llfbandit / app_links

Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
https://pub.dev/packages/app_links
Apache License 2.0
214 stars 78 forks source link

Event is fired several times #161

Open florianramaj opened 1 week ago

florianramaj commented 1 week ago

With the latest (maybe also with older versions) the event is fired several times (usually twice instead of once). This behavior no longer occurs with version 6.1.3.

Occurs with Android and Iphone

llfbandit commented 1 week ago

Disable default Flutter deep linking? https://github.com/llfbandit/app_links/blob/master/doc/README_ios.md#ios

RtgrV commented 6 days ago

I'm currently observing similar behavior on Flutter 3.22 when listening on the AppLinks().uriLinkStream. If I understood correctly, Flutter 3.22 shouldn't need explicit configuration / disablement as shown in the README you @llfbandit linked?

A simple debounce on the stream fixes my issue, but this isn't an ideal fix.

llfbandit commented 5 days ago

Please fill a reproducer.

RtgrV commented 5 days ago

After conducting further investigation, I have determined that the issue is with our App. We are using a plugin called FlutterDownloader, which requires the use of setPluginRegistrantCallback in didFinishLaunchingWithOptions. When the callback is executed and it is not in the registry, it needs to register itself again.

When registering, we mistakenly called GeneratedPluginRegistrant.register(with: flutterPluginRegistry), which is incorrect. According to the plugins documentation, we should have called FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!).

Our mistake caused the SwiftAppLinksPlugin to call the addApplicationDelegate twice, resulting in the deeplink being sent to our App twice.

I apologize for the confusion, and I hope that my message can be useful to others in the future.