Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement with swift support? #3

Open
cherrydat opened this issue Jan 7, 2020 · 1 comment
Open

How to implement with swift support? #3

cherrydat opened this issue Jan 7, 2020 · 1 comment

Comments

@cherrydat
Copy link

cherrydat commented Jan 7, 2020

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!

@dnkoulouris
Copy link

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

dont forget to import flutter_call_kit

LucaJeevanjee pushed a commit to LucaJeevanjee/flutter_call_kit that referenced this issue May 25, 2021
Merge pull request peerwaya#16 from DanbiEduCorp/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants