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

FEAT: extras included in handle object, added normal handle mode #403

Merged
merged 4 commits into from
Jan 5, 2024

Conversation

efraespada
Copy link
Contributor

@efraespada efraespada commented Nov 25, 2023

Handling calls from recent history only with nameCaller and handle fields makes hard to start a new call depending on the data model (how contacts or chats are structured: email, id..).

I've included all the extra fields in the handle object:

 override func application(_ application: UIApplication,
                              continue userActivity: NSUserActivity,
                              restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {

        guard let handleObj = userActivity.handle else {
            return false
        }
        
        guard let isVideo = userActivity.isVideo else {
            return false
        }
                    
        let nameCaller = handleObj.getDecryptHandle()["nameCaller"] as? String ?? ""
        let handle = handleObj.getDecryptHandle()["handle"] as? String ?? ""
        let chatId = handleObj.getDecryptHandle()["chatId"] as? String ?? ""

        let data = flutter_callkit_incoming.Data(id: UUID().uuidString, nameCaller: nameCaller, handle: handle, type: isVideo ? 1 : 0)        
        data.appName = "Your App Name"
        data.iconName = "AppIcon"
        data.extra = ["id": data.uuid,
                      "chatId": chatId,
                      "fromHistory": "true"]
        
        SwiftFlutterCallkitIncomingPlugin.sharedInstance?.startCall(data, fromPushKit: true)
        
        return super.application(application, continue: userActivity, restorationHandler: restorationHandler)
}

I've also added a normal handle mode for scenarios where a normal number/email is needed instead of the base64 encrypted value.

@efraespada efraespada changed the title FEAT: extras included in handle object FEAT: extras included in handle object, added normal handle mode Nov 26, 2023
@hiennguyen92 hiennguyen92 changed the base branch from master to dev January 5, 2024 04:12
@hiennguyen92 hiennguyen92 merged commit 197bda9 into hiennguyen92:dev Jan 5, 2024
@hiennguyen92 hiennguyen92 mentioned this pull request Jan 5, 2024
Merged
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 this pull request may close these issues.

2 participants