diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2019-04-19 16:43:05 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2019-04-19 16:52:10 +0300 |
commit | 6a1b2622bda31c9eadf91d3c136207528cdd4635 (patch) | |
tree | 958635a666b700f077b066e8c718f35a030958c9 /iphone | |
parent | 01ed2046098a9c608e2949c9246204990226a5c6 (diff) |
[booking] additional url params + ios statistics fix
Diffstat (limited to 'iphone')
8 files changed, 63 insertions, 15 deletions
diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index a49d0731f2..1ca5f95735 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -264,6 +264,7 @@ static NSString * const kStatPlacePageHotelBook = @"Placepage_Hotel_book"; static NSString * const kStatPlacePageHotelDetails = @"Placepage_Hotel_details"; static NSString * const kStatPlacePageHotelFacilities = @"PlacePage_Hotel_Facilities_open"; static NSString * const kStatPlacePageHotelGallery = @"PlacePage_Hotel_Gallery_open"; +static NSString * const kStatPlacePageHotelMore = @"PlacePage_Hotel_Description_land"; static NSString * const kStatPlacePageHotelReviews = @"PlacePage_Hotel_Reviews_land"; static NSString * const kStatPlacePageHotelSearch = @"Search.Booking.Com"; static NSString * const kStatPlacePageNonBuilding = @"placepage_nonbuilding"; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h b/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h index 306197e9e9..610967743b 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h @@ -11,7 +11,10 @@ typedef UIView * _Nullable (^MWMPlacePageButtonsDismissBlock)(NSInteger); - (void)editPlace; - (void)addPlace; - (void)addBusiness; -- (void)book:(BOOL)isDescription; +- (void)book; +- (void)openDescriptionUrl; +- (void)openMoreUrl; +- (void)openReviewUrl; - (void)editBookmark; - (void)orderTaxi:(MWMPlacePageTaxiProvider)provider; - (void)showAllFacilities; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index 9cf9107be4..1b34b26bd3 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -179,6 +179,8 @@ using NewSectionsAreReady = void (^)(NSRange const & range, MWMPlacePageData * d - (NSURL *)sponsoredURL; - (NSURL *)deepLink; - (NSURL *)sponsoredDescriptionURL; +- (NSURL *)sponsoredMoreURL; +- (NSURL *)sponsoredReviewURL; - (NSURL *)bookingSearchURL; - (NSString *)sponsoredId; - (NSString *)hotelDescription; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index 11e4c19626..1719d33971 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -562,6 +562,20 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; : nil; } +- (NSURL *)sponsoredMoreURL +{ + return m_info.IsSponsored() + ? [NSURL URLWithString:@(m_info.GetSponsoredMoreUrl().c_str())] + : nil; +} + +- (NSURL *)sponsoredReviewURL +{ + return m_info.IsSponsored() + ? [NSURL URLWithString:@(m_info.GetSponsoredReviewUrl().c_str())] + : nil; +} + - (NSURL *)bookingSearchURL { auto const & url = m_info.GetBookingSearchUrl(); diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index 28562bd149..028d300ed7 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -488,7 +488,7 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: [self.ownerViewController openFullPlaceDescriptionWithHtml:htmlString]; } -- (void)book:(BOOL)isDescription +- (void)book { auto data = self.data; if (!data) @@ -509,24 +509,52 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: } logSponsoredEvent(data, eventName); - if (!isDescription && data.isPartnerAppInstalled) - { - [UIApplication.sharedApplication openURL:data.deepLink options:@{} completionHandler:nil]; - return; - } - - NSURL * url = isDescription ? data.sponsoredDescriptionURL : data.sponsoredURL; + NSURL * url = data.isPartnerAppInstalled ? data.deepLink : data.sponsoredURL; NSAssert(url, @"Sponsored url can't be nil!"); [UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil]; } +- (void)openDescriptionUrl +{ + auto data = self.data; + if (!data) + return; + + logSponsoredEvent(data, kStatPlacePageHotelDetails); + [UIApplication.sharedApplication openURL:data.sponsoredDescriptionURL + options:@{} completionHandler:nil]; +} + +- (void)openMoreUrl +{ + auto data = self.data; + if (!data) + return; + + logSponsoredEvent(data, kStatPlacePageHotelMore); + [UIApplication.sharedApplication openURL:data.sponsoredMoreURL + options:@{} completionHandler:nil]; +} + +- (void)openReviewUrl +{ + auto data = self.data; + if (!data) + return; + + logSponsoredEvent(data, kStatPlacePageHotelReviews); + [UIApplication.sharedApplication openURL:data.sponsoredReviewURL + options:@{} completionHandler:nil]; +} + - (void)searchBookingHotels { auto data = self.data; if (!data) return; - logSponsoredEvent(data, kStatPlacePageHotelSearch); + + logSponsoredEvent(data, kStatPlacePageHotelBook); NSURL * url = data.bookingSearchURL; NSAssert(url, @"Search url can't be nil!"); [UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil]; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h b/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h index f790cc32cf..e7cf1434cb 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h @@ -16,7 +16,7 @@ - (void)removeBookmark; - (void)call; -- (void)book:(BOOL)isDecription; +- (void)book; - (void)searchBookingHotels; - (void)openPartner; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm index cab5bf4247..4ab8b3dc88 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm @@ -227,7 +227,7 @@ { case EButton::Download: [delegate downloadSelectedArea]; break; case EButton::Opentable: - case EButton::Booking: [delegate book:NO]; break; + case EButton::Booking: [delegate book]; break; case EButton::BookingSearch: [delegate searchBookingHotels]; break; case EButton::Call: [delegate call]; break; case EButton::Bookmark: diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm index 1559993b8e..01a611c6bc 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm @@ -413,7 +413,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = { case ButtonsRows::AddPlace: [delegate addPlace]; break; case ButtonsRows::EditPlace: [delegate editPlace]; break; case ButtonsRows::AddBusiness: [delegate addBusiness]; break; - case ButtonsRows::HotelDescription: [delegate book:NO]; break; + case ButtonsRows::HotelDescription: [delegate openDescriptionUrl]; break; case ButtonsRows::Other: NSAssert(false, @"Incorrect row"); } }]; @@ -483,7 +483,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = { [c configWithTitle:L(@"reviews_on_bookingcom") action:^{ - [delegate book:NO]; + [delegate openReviewUrl]; } isInsetButton:NO]; return c; @@ -510,7 +510,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = { [tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]); [c configWithTitle:L(@"more_on_bookingcom") action:^{ - [delegate book:NO]; + [delegate openMoreUrl]; ; } isInsetButton:NO]; |