[ios] Fixed crash on cold start while opening om:// or https://omaps.app/ links

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2023-02-04 23:01:19 +01:00 committed by Alexander Borsuk
parent 75c956d296
commit 14f002d10a
2 changed files with 13 additions and 0 deletions

View file

@ -356,6 +356,14 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
*/
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// Cold start deep links should be handled when the map is initialized.
// Otherwise PP container view is nil, or there is no animation/selection of the point.
if (DeepLinkHandler.shared.isLaunchedByDeeplink)
(void)[DeepLinkHandler.shared handleDeepLink];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
if (!self.mapView.drapeEngineCreated)

View file

@ -16,6 +16,11 @@
}
func applicationDidOpenUrl(_ url: URL) -> Bool {
// On the cold start, isLaunchedByDeeplink is set and handleDeepLink() call is delayed
// until the map view will be fully initialized.
guard !isLaunchedByDeeplink else { return true }
// On the hot start, link can be processed immediately.
self.url = url
return handleDeepLink(url: url)
}