-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Problem
Deep linking on iOS relies on two application lifecycle events. After migrating to UIScene, these events are no longer called by UIKit. Instead, the UIScene lifecycle event is called.
- application:continueUserActivity:restorationHandler: → scene:continueUserActivity:
- application:openURL:options: → scene:openURLContexts:
In the engine, when these events are called, it forwards them to the FlutterViewController, which then uses a method channel from the FlutterEngine to send the information to the framework. It will then return with either a success or failure. (Source, Source)
https://docs.flutter.dev/cookbook/navigation/set-up-universal-links#test-the-universal-link
Prerequisites
Proposal
Flutter will need to add the UIScene lifecycle equivalents outlined above. Then when the FlutterSceneDelegate receives the event, instead of forwarding to the FlutterViewController, it will forward it directly to each FlutterEngine associated with it.
- (void)scene:(UIScene*)scene continueUserActivity:(NSUserActivity*)userActivity {
if (![self isFlutterDeepLinkingEnabled]) {
return NO;
}
for (FlutterEngine* engine in [_engines allObjects]) {
if (!engine) {
continue;
}
[engine sendDeepLinkToFramework:url ...];
}
}See prototype.