diff --git a/iphone/Maps/Categories/UIColor+MapsMeColor.h b/iphone/Maps/Categories/UIColor+MapsMeColor.h index 0b26febecd..9b9225062c 100644 --- a/iphone/Maps/Categories/UIColor+MapsMeColor.h +++ b/iphone/Maps/Categories/UIColor+MapsMeColor.h @@ -43,6 +43,7 @@ + (UIColor *)ratingYellow; + (UIColor *)ratingLightGreen; + (UIColor *)ratingGreen; ++ (UIColor *)thorBackground; + (UIColor *)colorWithName:(NSString *)colorName; diff --git a/iphone/Maps/Categories/UIColor+MapsMeColor.mm b/iphone/Maps/Categories/UIColor+MapsMeColor.mm index 5ca3fa01e8..1d7ba078df 100644 --- a/iphone/Maps/Categories/UIColor+MapsMeColor.mm +++ b/iphone/Maps/Categories/UIColor+MapsMeColor.mm @@ -338,6 +338,11 @@ UIColor * color(SEL cmd) return [UIColor colorWithRed:scaled(67) green:scaled(160) blue:scaled(71) alpha:alpha100]; } ++ (UIColor *)thorBackground +{ + return [UIColor colorWithRed:scaled(215) green:scaled(67) blue:scaled(19) alpha:alpha100]; +} + + (UIColor *)bannerBackground { return color(_cmd); diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index e505d11125..28e29123d8 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -30,6 +30,7 @@ static NSString * const kStatButton = @"Button"; static NSString * const kStatCallPhoneNumber = @"Call phone number"; static NSString * const kStatCancel = @"cancel"; static NSString * const kStatCategories = @"Categories"; +static NSString * const kStatCategory = @"category"; static NSString * const kStatChangeBookmarkColor = @"Change bookmark color"; static NSString * const kStatChangeBookmarkDescription = @"Change bookmark description"; static NSString * const kStatChangeBookmarkGroup = @"Change bookmark group"; @@ -157,6 +158,8 @@ static NSString * const kStatNightMode = @"NightMode"; static NSString * const kStatNo = @"No"; static NSString * const kStatNoConnection = @"no_connection"; static NSString * const kStatNoSpace = @"no_space"; +static NSString * const kStatObjectLat = @"object_lat"; +static NSString * const kStatObjectLon = @"object_lon"; static NSString * const kStatOSM = @"OSM"; static NSString * const kStatOSMUserName = @"osm_username"; static NSString * const kStatOff = @"Off"; @@ -185,6 +188,7 @@ static NSString * const kStatPlacePageNonBuilding = @"placepage_nonbuilding"; static NSString * const kStatPlacePageOwnershipButtonClick = @"Placepage_OwnershipButton_click"; static NSString * const kStatPlacePageRestaurantBook = @"Placepage_Restaurant_book"; static NSString * const kStatPlacePageTaxiClick = @"Placepage_Taxi_click"; +static NSString * const kStatPlacePageSponsoredActionButtonClick = @"Placepage_SponsoredActionButton_click"; static NSString * const kStatPlacepageSponsoredError = @"Placepage_SponsoredGallery_error"; static NSString * const kStatPlacepageSponsoredItemSelected = @"Placepage_SponsoredGallery_ProductItem_selected"; static NSString * const kStatPlacepageSponsoredLogoSelected = @"Placepage_SponsoredGallery_LogoItem_selected"; diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/Contents.json b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/Contents.json new file mode 100644 index 0000000000..22402347df --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_28px_logo_thor.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_28px_logo_thor@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_28px_logo_thor@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor.png b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor.png new file mode 100644 index 0000000000..45bed26312 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor.png differ diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor@2x.png b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor@2x.png new file mode 100644 index 0000000000..81b8cf006f Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor@3x.png b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor@3x.png new file mode 100644 index 0000000000..99091779b5 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/ic_28px_logo_thor.imageset/ic_28px_logo_thor@3x.png differ diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index 6351a4c39b..ffe77c4d75 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -172,6 +172,8 @@ using CianIsReady = void (^)(NSArray * items); - (place_page::OpeningHours)schedule; - (NSString *)address; +- (float)ratingRawValue; + // Booking - (void)fillOnlineBookingSections; - (MWMUGCRatingValueType *)bookingRating; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index 71e12f619c..e9a6bb6516 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -395,6 +395,11 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; }); } +- (float)ratingRawValue +{ + return m_info.GetRatingRawValue(); +} + - (void)fillOnlineBookingSections { if (!self.isBooking) diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index 804973274e..78f8cf0f44 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -45,6 +45,13 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName) stat[kStatRestaurant] = data.sponsoredId; stat[kStatRestaurantLocation] = makeLocationEventValue(latLon.lat, latLon.lon); } + else if (data.isThor) + { + stat[kStatProvider] = kStatThor; + stat[kStatCategory] = @(data.ratingRawValue); + stat[kStatObjectLat] = @(latLon.lat); + stat[kStatObjectLon] = @(latLon.lon); + } else { stat[kStatProvider] = kStatPlacePageHotelSearch; @@ -503,6 +510,17 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName) [self.ownerViewController openUrl:url]; } +- (void)openThor +{ + auto data = self.data; + if (!data) + return; + logSponsoredEvent(data, kStatPlacePageSponsoredActionButtonClick); + NSURL * url = data.sponsoredURL; + NSAssert(url, @"Thor url can't be nil!"); + [self.ownerViewController openUrl:url]; +} + - (void)call { auto data = self.data; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h b/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h index 1b3ab739ec..491a9087ae 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h @@ -19,6 +19,8 @@ - (void)book:(BOOL)isDecription; - (void)searchBookingHotels; +- (void)openThor; + - (void)apiBack; - (void)downloadSelectedArea; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h index d5dad454e7..548ce197d8 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h @@ -13,6 +13,7 @@ enum class EButton // Required button's order More, AddStop, RemoveStop, + Thor, Spacer }; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm index 8748c00fc0..6c9b3d5377 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm @@ -32,6 +32,8 @@ NSString * titleForButton(EButton type, BOOL isSelected) return L(@"placepage_add_stop"); case EButton::RemoveStop: return L(@"placepage_remove_stop"); + case EButton::Thor: + return L(@"sponsored_thor_gather"); case EButton::Spacer: return nil; } @@ -90,10 +92,10 @@ NSString * titleForButton(EButton type, BOOL isSelected) self.backgroundColor = [UIColor bookingBackground]; break; case EButton::BookingSearch: - [self.button setImage:[UIImage imageNamed:@"ic_booking_search"] forState:UIControlStateNormal]; - self.label.textColor = UIColor.whiteColor; - self.backgroundColor = [UIColor bookingBackground]; - break; + [self.button setImage:[UIImage imageNamed:@"ic_booking_search"] forState:UIControlStateNormal]; + self.label.textColor = UIColor.whiteColor; + self.backgroundColor = [UIColor bookingBackground]; + break; case EButton::Opentable: [self.button setImage:[UIImage imageNamed:@"ic_opentable"] forState:UIControlStateNormal]; self.label.textColor = UIColor.whiteColor; @@ -127,6 +129,12 @@ NSString * titleForButton(EButton type, BOOL isSelected) [self.button removeFromSuperview]; [self.label removeFromSuperview]; break; + case EButton::Thor: + [self.button setImage:[UIImage imageNamed:@"ic_28px_logo_thor"] forState:UIControlStateNormal]; + self.label.textColor = UIColor.whiteColor; + self.backgroundColor = UIColor.thorBackground; + break; + } } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h index 23861bcdd1..0599b10171 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h @@ -6,6 +6,7 @@ - (BOOL)isBookmark; - (BOOL)isOpentable; +- (BOOL)isThor; - (BOOL)isBooking; - (BOOL)isBookingSearch; - (BOOL)isApi; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm index 9349931636..9d90ffe4f8 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm @@ -51,7 +51,8 @@ extern NSString * const kAlohalyticsTapEventKey; BOOL const isBooking = [data isBooking]; BOOL const isOpentable = [data isOpentable]; BOOL const isBookingSearch = [data isBookingSearch]; - BOOL const isSponsored = isBooking || isOpentable || isBookingSearch; + BOOL const isThor = [data isThor]; + BOOL const isSponsored = isBooking || isOpentable || isBookingSearch || isThor; BOOL const isPhoneCallAvailable = [AppInfo sharedInfo].canMakeCalls && [data phoneNumber].length > 0; BOOL const isApi = [data isApi]; @@ -67,6 +68,8 @@ extern NSString * const kAlohalyticsTapEventKey; sponsoredButton = EButton::Booking; else if (isOpentable) sponsoredButton = EButton::Opentable; + else if (isThor) + sponsoredButton = EButton::Thor; BOOL thereAreExtraButtons = true; if (isRoutePoint) @@ -294,6 +297,7 @@ extern NSString * const kAlohalyticsTapEventKey; case EButton::More: [self showActionSheet]; break; case EButton::AddStop: [delegate addStop]; break; case EButton::RemoveStop: [delegate removeStop]; break; + case EButton::Thor: [delegate openThor]; break; case EButton::Spacer: break; } }