Description
The handler for URL events does not get called anymore by the OS when building and using this plugin with Flutter 3.16.0.
I could trace down the origin of this to flutter/engine#44587 and flutter/engine#44689. I'm not an expert on macOS but my assumption is that macOS stops emitting get URL events via NSAppleEventManager
once an application implements the openURLs
method of the NSApplicationDelegate protocol and marks those events as handled there.
The second change in the Flutter engine seems to do that.
I have identified two possible fixes for this:
- Registering the
NSAppleEventManager
event handler later than when it is done right now, for example in theapplicationWillFinishLaunching()
lifecycle method ofNSApplicationDelegate
which is now exposed to Flutter plugins since Flutter 3.16.0 - Bypassing
NSAppleEventManager
altogether and instead using thehandleOpenURLs()
method of the newFlutterAppLifecycleDelegate
class.
Personally I prefer the latter since it seems to be the new intended way by Flutter to get notified about these type of events. Additionally this approach opens up the possibility to improve interoperability of this plugin with others that also rely on receiving URL events. This could be done by extending this plugin's API to allow to configure which URLs should and which should not be marked as consumed by this plugin.