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

iOS app link handling issue while app is in running state (when app is launched with a link) #34

Open
arreshashikant opened this issue Jul 24, 2023 · 2 comments

Comments

@arreshashikant
Copy link

arreshashikant commented Jul 24, 2023

Steps to reproduce:
singular_flutter_sdk: ^1.0.15

  1. Launch iOS app from terminated state with a link (singularLinksHandler is invoked, No issues)
  2. Now, click on the link from any other app (app is in running state). The callback singularLinksHandler is NOT invoked

This is because of the following code in iOS

if ([SingularAppDelegate shared].launchOptions != nil) {
        config.launchOptions = [SingularAppDelegate shared].launchOptions;
    } else if ([SingularAppDelegate shared].userActivity != nil) {
        config.userActivity = [SingularAppDelegate shared].userActivity;
    } else if ([SingularAppDelegate shared].openURL != nil) {
        config.openUrl = [SingularAppDelegate shared].openURL;
    } else {
        NSLog(@"everything is null");
    }
@arreshashikant
Copy link
Author

Quick fix I found:

    override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        
        if let singularAppDelegate = SingularAppDelegate.shared() {
            if let singularAppDelegate = SingularAppDelegate.shared() {
                singularAppDelegate.launchOptions = nil
            }
            singularAppDelegate.continueUserActivity(userActivity, restorationHandler:nil)
        }
        return super.application(application, continue: userActivity, restorationHandler: restorationHandler)
    }

@lucasuracosta
Copy link

I had the exact same issue. @arreshashikant solution fixed it though 😁

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

No branches or pull requests

2 participants