Skip to content

How to implement with swift support? #3

@cherrydat

Description

@cherrydat

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions