From 8573b97b1094dbce3804c94d0fdec3585fb3b652 Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Wed, 31 May 2023 17:27:09 +0200 Subject: [PATCH] [ios] Fixed non-working and repeated import of KML/KMZ files Signed-off-by: Alexander Borsuk --- iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.mm | 3 ++- iphone/Maps/Classes/MapViewController.mm | 2 +- iphone/Maps/Core/DeepLink/DeepLinkHandler.swift | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.mm b/iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.mm index efb143a56a..77b84912a0 100644 --- a/iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.mm +++ b/iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.mm @@ -24,7 +24,8 @@ } + (void)addBookmarksFile:(NSURL *)url { - GetFramework().AddBookmarksFile(url.relativePath.UTF8String, false /* isTemporaryFile */); + // iOS doesn't create temporary files on import at least in Safari and Files. + GetFramework().AddBookmarksFile(url.path.UTF8String, false /* isTemporaryFile */); } @end diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index bd258b3885..d5e13738f8 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -361,7 +361,7 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing"; // 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)[DeepLinkHandler.shared handleDeepLinkAndReset]; } - (void)viewDidLayoutSubviews { diff --git a/iphone/Maps/Core/DeepLink/DeepLinkHandler.swift b/iphone/Maps/Core/DeepLink/DeepLinkHandler.swift index 8b7b2d1a39..f8afa160a0 100644 --- a/iphone/Maps/Core/DeepLink/DeepLinkHandler.swift +++ b/iphone/Maps/Core/DeepLink/DeepLinkHandler.swift @@ -44,9 +44,11 @@ return (url.queryItems?.first(where: { $0.name == "backurl" })?.value ?? nil) } - func handleDeepLink() -> Bool { + func handleDeepLinkAndReset() -> Bool { if let url = self.url { - return handleDeepLink(url: url) + let result = handleDeepLink(url: url) + reset() + return result } LOG(.error, "handleDeepLink is called with nil URL") return false