[ios] Thor.

This commit is contained in:
VladiMihaylenko 2017-10-16 19:18:40 +03:00 committed by Roman Kuznetsov
parent dc7d383777
commit 59954ede7d
15 changed files with 79 additions and 5 deletions

View file

@ -43,6 +43,7 @@
+ (UIColor *)ratingYellow;
+ (UIColor *)ratingLightGreen;
+ (UIColor *)ratingGreen;
+ (UIColor *)thorBackground;
+ (UIColor *)colorWithName:(NSString *)colorName;

View file

@ -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);

View file

@ -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";

View file

@ -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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

View file

@ -172,6 +172,8 @@ using CianIsReady = void (^)(NSArray<MWMCianItemModel *> * items);
- (place_page::OpeningHours)schedule;
- (NSString *)address;
- (float)ratingRawValue;
// Booking
- (void)fillOnlineBookingSections;
- (MWMUGCRatingValueType *)bookingRating;

View file

@ -395,6 +395,11 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
});
}
- (float)ratingRawValue
{
return m_info.GetRatingRawValue();
}
- (void)fillOnlineBookingSections
{
if (!self.isBooking)

View file

@ -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;

View file

@ -19,6 +19,8 @@
- (void)book:(BOOL)isDecription;
- (void)searchBookingHotels;
- (void)openThor;
- (void)apiBack;
- (void)downloadSelectedArea;

View file

@ -13,6 +13,7 @@ enum class EButton // Required button's order
More,
AddStop,
RemoveStop,
Thor,
Spacer
};

View file

@ -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;
}
}

View file

@ -6,6 +6,7 @@
- (BOOL)isBookmark;
- (BOOL)isOpentable;
- (BOOL)isThor;
- (BOOL)isBooking;
- (BOOL)isBookingSearch;
- (BOOL)isApi;

View file

@ -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;
}
}