From 7ddc3224ad84e82d5b14952639557bb7d6c0432f Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Tue, 21 May 2024 15:38:06 +0400 Subject: [PATCH] [ios] update the PLacePage screen when the bookmark/track was edited in Edit Signed-off-by: Kiryl Kaveryn --- .../Components/PlacePageInfoViewController.swift | 6 ++++++ iphone/Maps/UI/PlacePage/PlacePageInteractor.swift | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift index 35d90dc27c..2022b96b62 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift @@ -48,6 +48,7 @@ class InfoItemViewController: UIViewController { } protocol PlacePageInfoViewControllerDelegate: AnyObject { + func viewWillAppear() func didPressCall() func didPressWebsite() func didPressWebsiteMenu() @@ -337,6 +338,11 @@ class PlacePageInfoViewController: UIViewController { } } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + delegate?.viewWillAppear() + } + // MARK: private private func createInfoItem(_ info: String, icon: UIImage?, diff --git a/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift b/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift index b29512eee6..ef309c1f89 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift @@ -14,6 +14,15 @@ class PlacePageInteractor { self.viewController = viewController self.mapViewController = mapViewController } + + private func updateBookmarkIfNeeded() { + guard let bookmarkId = placePageData.bookmarkData?.bookmarkId else { return } + if !BookmarksManager.shared().hasBookmark(bookmarkId) { + presenter?.closeAnimated() + } + FrameworkHelper.updatePlacePageData() + placePageData.updateBookmarkStatus() + } } extension PlacePageInteractor: PlacePageInteractorProtocol { @@ -25,6 +34,10 @@ extension PlacePageInteractor: PlacePageInteractorProtocol { // MARK: - PlacePageInfoViewControllerDelegate extension PlacePageInteractor: PlacePageInfoViewControllerDelegate { + func viewWillAppear() { + updateBookmarkIfNeeded() + } + func didPressCall() { MWMPlacePageManagerHelper.call(placePageData) }