diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2019-04-25 19:05:36 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2019-05-08 16:49:33 +0300 |
commit | beb9e881b46ecdd1d3bc059823e0f8e1daf9058a (patch) | |
tree | 2a1b247a53d35269ccb64f45f95937ac444a1023 /iphone | |
parent | 9fdc2d3947177a5fc0b400426877bb493f1c7277 (diff) |
[ios][booking] use single deep link when booking.com app is installed
Diffstat (limited to 'iphone')
-rw-r--r-- | iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index 0628d24c1b..bfe762de50 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -488,6 +488,20 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: [self.ownerViewController openFullPlaceDescriptionWithHtml:htmlString]; } +- (void)openPartnerWithStatisticLog:(NSString *)eventName proposedUrl:(NSURL *)proposedUrl +{ + auto data = self.data; + if (!data) + return; + + logSponsoredEvent(data, eventName); + + NSURL * url = data.isPartnerAppInstalled ? data.deepLink : proposedUrl; + NSAssert(url, @"Sponsored url can't be nil!"); + + [UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil]; +} + - (void)book { auto data = self.data; @@ -507,12 +521,8 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: NSAssert(false, @"Invalid book case!"); return; } - logSponsoredEvent(data, eventName); - NSURL * url = data.isPartnerAppInstalled ? data.deepLink : data.sponsoredURL; - NSAssert(url, @"Sponsored url can't be nil!"); - - [UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil]; + [self openPartnerWithStatisticLog:eventName proposedUrl:data.sponsoredURL]; } - (void)openDescriptionUrl @@ -520,10 +530,9 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: auto data = self.data; if (!data) return; - - logSponsoredEvent(data, kStatPlacePageHotelDetails); - [UIApplication.sharedApplication openURL:data.sponsoredDescriptionURL - options:@{} completionHandler:nil]; + + [self openPartnerWithStatisticLog:kStatPlacePageHotelDetails + proposedUrl:data.sponsoredDescriptionURL]; } - (void)openMoreUrl @@ -531,7 +540,7 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: auto data = self.data; if (!data) return; - + logSponsoredEvent(data, kStatPlacePageHotelMore); [UIApplication.sharedApplication openURL:data.sponsoredMoreURL options:@{} completionHandler:nil]; @@ -543,9 +552,8 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: if (!data) return; - logSponsoredEvent(data, kStatPlacePageHotelReviews); - [UIApplication.sharedApplication openURL:data.sponsoredReviewURL - options:@{} completionHandler:nil]; + [self openPartnerWithStatisticLog:kStatPlacePageHotelReviews + proposedUrl:data.sponsoredReviewURL]; } - (void)searchBookingHotels |