From cd7ab74eed9beb139147468943fb043e5ccc06d1 Mon Sep 17 00:00:00 2001 From: sravan Date: Tue, 28 Jul 2026 23:03:01 +0530 Subject: [PATCH] fix(ios): NativeCallPlugin Swift compile errors - didReceiveIncomingPush: normalise payload.dictionaryPayload ([AnyHashable:Any]) to [String:Any] before storing/using (the reported build error at :121). - CXProviderConfiguration(localizedName:) instead of the no-arg init (available on all deployment targets, avoids an availability edge). - Make two 'calls[uuid] ?? [:]' bindings explicitly [String:Any] to avoid empty- literal inference ambiguity. Co-Authored-By: Claude Opus 4.8 --- .../NativeCallPlugin/NativeCallPlugin.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mobile/plugins/native-call/ios/Sources/NativeCallPlugin/NativeCallPlugin.swift b/mobile/plugins/native-call/ios/Sources/NativeCallPlugin/NativeCallPlugin.swift index 2231772..0ad7111 100644 --- a/mobile/plugins/native-call/ios/Sources/NativeCallPlugin/NativeCallPlugin.swift +++ b/mobile/plugins/native-call/ios/Sources/NativeCallPlugin/NativeCallPlugin.swift @@ -38,7 +38,7 @@ public class NativeCallPlugin: CAPPlugin, CAPBridgedPlugin, PKPushRegistryDelega private var calls: [UUID: [String: Any]] = [:] override public func load() { - let config = CXProviderConfiguration() + let config = CXProviderConfiguration(localizedName: "Biz Connect") config.supportsVideo = true config.maximumCallGroups = 1 config.maximumCallsPerCallGroup = 1 @@ -114,7 +114,9 @@ public class NativeCallPlugin: CAPPlugin, CAPBridgedPlugin, PKPushRegistryDelega // Incoming VoIP push. iOS 13+: we MUST report a call to CallKit before completion() or the app is killed. public func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { - let dict = payload.dictionaryPayload + // payload.dictionaryPayload is [AnyHashable: Any]; normalise to [String: Any] for CallKit + notifyListeners. + var dict: [String: Any] = [:] + for (k, v) in payload.dictionaryPayload { if let ks = k as? String { dict[ks] = v } } let uuid = UUID(uuidString: (dict["callUUID"] as? String) ?? "") ?? UUID() let callerName = (dict["callerName"] as? String) ?? (dict["groupName"] as? String) ?? "Incoming call" let hasVideo = (dict["hasVideo"] as? Bool) ?? false @@ -140,14 +142,14 @@ public class NativeCallPlugin: CAPPlugin, CAPBridgedPlugin, PKPushRegistryDelega } public func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { - var data = calls[action.callUUID] ?? [:] + var data: [String: Any] = calls[action.callUUID] ?? [:] data["callUUID"] = action.callUUID.uuidString notifyListeners("answerCall", data: data) action.fulfill() } public func provider(_ provider: CXProvider, perform action: CXEndCallAction) { - var data = calls[action.callUUID] ?? [:] + var data: [String: Any] = calls[action.callUUID] ?? [:] data["callUUID"] = action.callUUID.uuidString notifyListeners("endCall", data: data) calls.removeValue(forKey: action.callUUID) @@ -169,10 +171,10 @@ public class NativeCallPlugin: CAPPlugin, CAPBridgedPlugin, PKPushRegistryDelega public func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) { try? audioSession.setCategory(.playAndRecord, mode: .voiceChat, options: [.allowBluetooth, .allowBluetoothA2DP]) try? audioSession.setActive(true) - notifyListeners("audioActivated", data: [:]) + notifyListeners("audioActivated", data: ["ok": true]) } public func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) { - notifyListeners("audioDeactivated", data: [:]) + notifyListeners("audioDeactivated", data: ["ok": true]) } }