feat(video_calls): ios call declining notification for other devices fix

This commit is contained in:
misha
2026-10-22 17:44:46 +03:00
parent d8d7a211bd
commit 2779f79464
3 changed files with 80 additions and 2 deletions

View File

@@ -322,6 +322,21 @@ import flutter_foreground_task
return nil
}
private func extraMarksEndedPush(_ extra: [String: Any]) -> Bool {
let value = extra["endedPush"]
if let bool = value as? Bool {
return bool
}
if let number = value as? NSNumber {
return number.intValue != 0
}
if let text = value as? String {
let normalized = text.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
return normalized == "true" || normalized == "1"
}
return false
}
private func voipBool(_ value: Any?) -> Bool? {
if let bool = value as? Bool {
return bool
@@ -1106,6 +1121,22 @@ import flutter_foreground_task
resumeAudioAfterCallKitEnds = false
audioRestartGeneration += 1
callKitOwnsAudioSession = false
// Accept reports the CallKit payload on this channel, and that is what
// stops ringing on the other devices. The plugin decline event does not.
let extra = call.data.extra as? [String: Any] ?? [:]
if !extraMarksEndedPush(extra) {
recordVoipDiagnostic(
"callkit_decline_native",
data: [
"callKitId": call.data.uuid,
"conversationUuid": conversationUuid(fromCall: call) ?? "",
]
)
voipDiagnosticsChannel?.invokeMethod(
"declinedVoipCall",
arguments: call.data.toJSON()
)
}
action.fulfill()
}