flutter_call_kit icon indicating copy to clipboard operation
flutter_call_kit copied to clipboard

How to implement with swift support?

Open cherrydat opened this issue 6 years ago • 1 comments

i try to convert to swift code for get push voip and wakes up my app:

  // Handle incoming pushes
  func pushRegistry(_ registry: PKPushRegistry,
                    didReceiveIncomingPushWith payload: PKPushPayload,
                    for type: PKPushType, completion: @escaping () -> Void) {
     FlutterVoipPushNotificationPlugin.didReceiveIncomingPush(
        with: payload,
        forType: type.rawValue
     )
    let payloadDict = payload.dictionaryPayload["aps"] as! Dictionary<String, Any>
    let message = payloadDict["msg_data"] as! String
    print(message)
    let data = try! JSONSerialization.jsonObject(with: message.data(using: .utf8)!, options: []) as! [String:Any]
    let uuid = data["msg_id"] as! String
    let uID = data["u_id"] as! Int
    let callerName = data["msg_name"] as! String

    FlutterCallKitPlugin.reportNewIncomingCall(
        uuid,
        handle: String(uID),
        handleType: "generic",
        hasVideo: false,
        localizedCallerName: callerName,
        fromPushKit: true
    )
  }
  1. push voip woking ok, my app can wakes up and get push payload.
  2. but i get error: displayIncomingCall throws an error: parameter 'localizedName' cannot be nil'
  3. in reactnative has result but still don't know how to solver it in Flutter: here
  4. i test with swift code then my app show call scene. But still cannot process call, of course because this code working in swift not Flutter: provider.reportNewIncomingCall(with: UUID(), update: update, completion: { error in })

So how to implement it with swift support? Thank.

Sorry my bad english!

cherrydat avatar Jan 07 '20 08:01 cherrydat

FlutterCallKitPlugin.reportNewIncomingCall(UUID().uuidString, handle: "number", handleType: "generic", hasVideo: false, localizedCallerName: "callerName", fromPushKit: true)

dont forget to import flutter_call_kit

dnkoulouris avatar Apr 03 '20 22:04 dnkoulouris