From 031356be6363c59343987ad9bd571a1aeacdb759 Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Sun, 12 May 2024 16:17:42 +0400 Subject: [PATCH] [ios] implement the website:menu to the PlacePage Signed-off-by: Kiryl Kaveryn --- .../PlacePageData/Common/PlacePageInfoData.h | 1 + .../PlacePageData/Common/PlacePageInfoData.mm | 2 +- .../Components/PlacePageInfoViewController.swift | 16 +++++++++++++++- .../Maps/UI/PlacePage/PlacePageInteractor.swift | 6 +++++- .../PlacePageManager/MWMPlacePageManager.mm | 4 ++++ .../PlacePageManager/MWMPlacePageManagerHelper.h | 1 + .../MWMPlacePageManagerHelper.mm | 5 +++++ 7 files changed, 32 insertions(+), 3 deletions(-) diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h index b110605b94..93ea1ae20f 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h @@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly, nullable) NSString *capacity; @property(nonatomic, readonly, nullable) NSString *wheelchair; @property(nonatomic, readonly, nullable) NSString *driveThrough; +@property(nonatomic, readonly, nullable) NSString *websiteMenu; @end diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm index b71d94be6d..0495fa5889 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm @@ -83,7 +83,7 @@ using namespace osm; if (value == "yes") _driveThrough = NSLocalizedString(@"drive_through", nil); break; - + case MetadataID::FMD_WEBSITE_MENU: _websiteMenu = ToNSString(value); break; default: break; } diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift index 82c090cdcc..35d90dc27c 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift @@ -50,6 +50,7 @@ class InfoItemViewController: UIViewController { protocol PlacePageInfoViewControllerDelegate: AnyObject { func didPressCall() func didPressWebsite() + func didPressWebsiteMenu() func didPressKayak() func didPressWikipedia() func didPressWikimediaCommons() @@ -78,6 +79,7 @@ class PlacePageInfoViewController: UIViewController { private var rawOpeningHoursView: InfoItemViewController? private var phoneView: InfoItemViewController? private var websiteView: InfoItemViewController? + private var websiteMenuView: InfoItemViewController? private var kayakView: InfoItemViewController? private var wikipediaView: InfoItemViewController? private var wikimediaCommonsView: InfoItemViewController? @@ -158,7 +160,19 @@ class PlacePageInfoViewController: UIViewController { self?.delegate?.didCopy(website) }) } - + + if let websiteMenu = placePageInfoData.websiteMenu { + websiteView = createInfoItem(L("website_menu"), + icon: UIImage(named: "ic_placepage_website_menu"), + style: .link, + tapHandler: { [weak self] in + self?.delegate?.didPressWebsiteMenu() + }, + longPressHandler: { [weak self] in + self?.delegate?.didCopy(websiteMenu) + }) + } + if let wikipedia = placePageInfoData.wikipedia { wikipediaView = createInfoItem(L("read_in_wikipedia"), icon: UIImage(named: "ic_placepage_wiki"), diff --git a/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift b/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift index 8a0f9c7f85..b29512eee6 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageInteractor.swift @@ -32,7 +32,11 @@ extension PlacePageInteractor: PlacePageInfoViewControllerDelegate { func didPressWebsite() { MWMPlacePageManagerHelper.openWebsite(placePageData) } - + + func didPressWebsiteMenu() { + MWMPlacePageManagerHelper.openWebsiteMenu(placePageData) + } + func didPressKayak() { let kUDDidShowKayakInformationDialog = "kUDDidShowKayakInformationDialog" diff --git a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm index f5bd1edf54..779c5e90d4 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm @@ -232,6 +232,10 @@ using namespace storage; [self.ownerViewController openUrl:data.infoData.website]; } +- (void)openWebsiteMenu:(PlacePageData *)data { + [self.ownerViewController openUrl:data.infoData.websiteMenu]; +} + - (void)openKayak:(PlacePageData *)data { [self.ownerViewController openUrl:data.infoData.kayak]; } diff --git a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.h b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.h index 5bca1ace42..b2e3964b0e 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.h +++ b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.h @@ -8,6 +8,7 @@ + (void)addBusiness; + (void)addPlace:(CLLocationCoordinate2D)coordinate; + (void)openWebsite:(PlacePageData *)data; ++ (void)openWebsiteMenu:(PlacePageData *)data; + (void)openKayak:(PlacePageData *)data; + (void)openWikipedia:(PlacePageData *)data; + (void)openWikimediaCommons:(PlacePageData *)data; diff --git a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.mm b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.mm index 8d7470ec3e..ae1124836c 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManagerHelper.mm @@ -15,6 +15,7 @@ - (void)addBusiness; - (void)addPlace:(CLLocationCoordinate2D)coordinate; - (void)openWebsite:(PlacePageData *)data; +- (void)openWebsiteMenu:(PlacePageData *)data; - (void)openKayak:(PlacePageData *)data; - (void)openWikipedia:(PlacePageData *)data; - (void)openWikimediaCommons:(PlacePageData *)data; @@ -72,6 +73,10 @@ [[MWMMapViewControlsManager manager].placePageManager openWebsite:data]; } ++ (void)openWebsiteMenu:(PlacePageData *)data { + [[MWMMapViewControlsManager manager].placePageManager openWebsiteMenu:data]; +} + + (void)openKayak:(PlacePageData *)data { [[MWMMapViewControlsManager manager].placePageManager openKayak:data]; }