forked from organicmaps/organicmaps
[ios] Booking stats.
This commit is contained in:
parent
0500c9368a
commit
fa325a0921
5 changed files with 66 additions and 14 deletions
|
@ -174,22 +174,11 @@ NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
|
|||
[self.placePageManager apiBack];
|
||||
break;
|
||||
case EButton::Booking:
|
||||
{
|
||||
UIViewController * vc = static_cast<UIViewController *>(MapsAppDelegate.theApp.mapViewController);
|
||||
NSString * urlString = [self.placePageManager.entity getCellValue:MWMPlacePageCellTypeBookingMore];
|
||||
NSAssert(urlString, @"Booking url can't be nil!");
|
||||
NSURL * url = [NSURL URLWithString:urlString];
|
||||
[vc openUrl:url];
|
||||
[self.placePageManager book];
|
||||
break;
|
||||
}
|
||||
case EButton::Call:
|
||||
{
|
||||
NSString * tel = [self.placePageManager.entity getCellValue:MWMPlacePageCellTypePhoneNumber];
|
||||
NSAssert(tel, @"Phone number can't be nil!");
|
||||
NSString * phoneNumber = [[@"telprompt:" stringByAppendingString:tel] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
|
||||
[self.placePageManager call];
|
||||
break;
|
||||
}
|
||||
case EButton::Bookmark:
|
||||
if (self.isBookmark)
|
||||
[self.placePageManager removeBookmark];
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#import "LocationManager.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "MWMPlacePage.h"
|
||||
#import "MWMPlacePageButtonCell.h"
|
||||
#import "MWMPlacePageEntity.h"
|
||||
#import "MWMPlacePageViewManager.h"
|
||||
#import "Statistics.h"
|
||||
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
|
||||
@interface MWMPlacePageButtonCell ()
|
||||
|
@ -55,8 +58,27 @@
|
|||
[self.placePage addPlace];
|
||||
break;
|
||||
case MWMPlacePageCellTypeBookingMore:
|
||||
{
|
||||
NSMutableDictionary * stat = [@{kStatProvider : kStatBooking} mutableCopy];
|
||||
LocationManager * lm = MapsAppDelegate.theApp.locationManager;
|
||||
if (lm.lastLocationIsValid)
|
||||
{
|
||||
CLLocation * loc = lm.lastLocation;
|
||||
stat[kStatLat] = @(loc.coordinate.latitude);
|
||||
stat[kStatLon] = @(loc.coordinate.longitude);
|
||||
}
|
||||
else
|
||||
{
|
||||
stat[kStatLat] = @0;
|
||||
stat[kStatLon] = @0;
|
||||
}
|
||||
MWMPlacePageEntity * en = self.placePage.manager.entity;
|
||||
auto const latLon = en.latlon;
|
||||
stat[kStatHotel] = @{kStatName : en.title, kStatLat : @(latLon.lat), kStatLon : @(latLon.lon)};
|
||||
[Statistics logEvent:kPlacePageHotelDetails withParameters:stat];
|
||||
[self.placePage bookingMore];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NSAssert(false, @"Incorrect cell type!");
|
||||
break;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
- (void)addPlace;
|
||||
- (void)addBookmark;
|
||||
- (void)removeBookmark;
|
||||
- (void)book;
|
||||
- (void)call;
|
||||
- (void)apiBack;
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation;
|
||||
- (void)viewWillTransitionToSize:(CGSize)size
|
||||
|
|
|
@ -246,6 +246,40 @@ extern NSString * const kBookmarksChangedNotification;
|
|||
anchorView:self.placePage.actionBar.shareAnchor];
|
||||
}
|
||||
|
||||
- (void)book
|
||||
{
|
||||
NSMutableDictionary * stat = [@{kStatProvider : kStatBooking} mutableCopy];
|
||||
LocationManager * lm = MapsAppDelegate.theApp.locationManager;
|
||||
if (lm.lastLocationIsValid)
|
||||
{
|
||||
CLLocation * loc = lm.lastLocation;
|
||||
stat[kStatLat] = @(loc.coordinate.latitude);
|
||||
stat[kStatLon] = @(loc.coordinate.longitude);
|
||||
}
|
||||
else
|
||||
{
|
||||
stat[kStatLat] = @0;
|
||||
stat[kStatLon] = @0;
|
||||
}
|
||||
MWMPlacePageEntity * en = self.entity;
|
||||
auto const latLon = en.latlon;
|
||||
stat[kStatHotel] = @{kStatName : en.title, kStatLat : @(latLon.lat), kStatLon : @(latLon.lon)};
|
||||
[Statistics logEvent:kPlacePageHotelBook withParameters:stat];
|
||||
UIViewController * vc = static_cast<UIViewController *>(MapsAppDelegate.theApp.mapViewController);
|
||||
NSString * urlString = [self.entity getCellValue:MWMPlacePageCellTypeBookingMore];
|
||||
NSAssert(urlString, @"Booking url can't be nil!");
|
||||
NSURL * url = [NSURL URLWithString:urlString];
|
||||
[vc openUrl:url];
|
||||
}
|
||||
|
||||
- (void)call
|
||||
{
|
||||
NSString * tel = [self.entity getCellValue:MWMPlacePageCellTypePhoneNumber];
|
||||
NSAssert(tel, @"Phone number can't be nil!");
|
||||
NSString * phoneNumber = [[@"telprompt:" stringByAppendingString:tel] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
|
||||
}
|
||||
|
||||
- (void)apiBack
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatPlacePage, kStatAPI)];
|
||||
|
|
|
@ -18,6 +18,7 @@ static NSString * const kStatBack = @"Back";
|
|||
static NSString * const kStatBannerDescription = @"Banner description";
|
||||
static NSString * const kStatBannerTitle = @"Banner title";
|
||||
static NSString * const kStatBicycle = @"Bicycle";
|
||||
static NSString * const kStatBooking = @"Booking.com";
|
||||
static NSString * const kStatBookmarks = @"Bookmarks";
|
||||
static NSString * const kStatBuildRoute = @"Build route";
|
||||
static NSString * const kStatButton = @"Button";
|
||||
|
@ -100,6 +101,7 @@ static NSString * const kStatGoogle = @"Google";
|
|||
static NSString * const kStatHelp = @"Help";
|
||||
static NSString * const kStatHidden = @"Hidden";
|
||||
static NSString * const kStatHistory = @"History";
|
||||
static NSString * const kStatHotel = @"Hotel";
|
||||
static NSString * const kStatImport = @"Import";
|
||||
static NSString * const kStatIn = @"In";
|
||||
static NSString * const kStatIsAuto = @"is_auto";
|
||||
|
@ -142,12 +144,15 @@ static NSString * const kStatOther = @"Other";
|
|||
static NSString * const kStatOut = @"Out";
|
||||
static NSString * const kStatPedestrian = @"Pedestrian";
|
||||
static NSString * const kStatPlacePage = @"Place page";
|
||||
static NSString * const kPlacePageHotelBook = @"Placepage_Hotel_book";
|
||||
static NSString * const kPlacePageHotelDetails = @"Placepage_Hotel_details";
|
||||
static NSString * const kStatPlacePageNonBuilding = @"placepage_nonbuilding";
|
||||
static NSString * const kStatPointToPoint = @"Point to point";
|
||||
static NSString * const kStatPortrait = @"Portrait";
|
||||
static NSString * const kStatProblem = @"Problem";
|
||||
static NSString * const kStatProfile = @"Profile";
|
||||
static NSString * const kStatProgress = @"Progress";
|
||||
static NSString * const kStatProvider = @"Provider";
|
||||
static NSString * const kStatPushReceived = @"Push received";
|
||||
static NSString * const kStatRate = @"Rate";
|
||||
static NSString * const kStatRecentTrack = @"Recent track";
|
||||
|
|
Loading…
Add table
Reference in a new issue