forked from organicmaps/organicmaps
[MAPSME-4855] [ios] Updated Placepage_Taxi_show statistics sending.
This commit is contained in:
parent
c8e6812d63
commit
7f03f8245a
3 changed files with 46 additions and 0 deletions
|
@ -229,6 +229,7 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
|
|||
{
|
||||
self.ownerViewController.visibleAreaBottomOffset = bound;
|
||||
[[MWMSideButtons buttons] setBottomBound:self.ownerViewController.view.height - bound];
|
||||
[self.layout checkCellsVisible];
|
||||
}
|
||||
|
||||
- (void)shouldDestroyLayout { self.layout = nil; }
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
- (void)processDownloaderEventWithStatus:(storage::NodeStatus)status progress:(CGFloat)progress;
|
||||
|
||||
- (void)checkCellsVisible;
|
||||
#pragma mark - iPad only
|
||||
|
||||
- (void)updateTopBound;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#import "MWMPlacePageRegularCell.h"
|
||||
#import "MWMiPadPlacePageLayoutImpl.h"
|
||||
#import "MWMiPhonePlacePageLayoutImpl.h"
|
||||
#import "MapViewController.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
#include "ugc/types.hpp"
|
||||
|
@ -61,6 +62,8 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
@property(nonatomic) MWMOpeningHoursLayoutHelper * openingHoursLayoutHelper;
|
||||
@property(nonatomic) NSArray<NSIndexPath *> * buttonsSectionIndexPaths;
|
||||
|
||||
@property(weak, nonatomic) MWMPlacePageTaxiCell * taxiCell;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageLayout
|
||||
|
@ -157,6 +160,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
|
||||
[self.placePageView.tableView reloadData];
|
||||
[self.layoutImpl onShow];
|
||||
[self checkCellsVisible];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[data fillOnlineBookingSections];
|
||||
|
@ -454,6 +458,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
case taxi::Provider::Yandex: type = MWMPlacePageTaxiProviderYandex; break;
|
||||
}
|
||||
[c configWithType:type delegate:delegate];
|
||||
self.taxiCell = c;
|
||||
return c;
|
||||
}
|
||||
case Sections::Buttons:
|
||||
|
@ -592,6 +597,45 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
}
|
||||
}
|
||||
|
||||
- (void)checkCellsVisible
|
||||
{
|
||||
auto data = self.data;
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
auto const checkCell = ^(UITableViewCell * cell, MWMVoidBlock onHit) {
|
||||
if (!cell)
|
||||
return;
|
||||
auto taxiBottom = CGPointMake(cell.width / 2, cell.height);
|
||||
auto mainView = [MapViewController controller].view;
|
||||
auto actionBar = self.actionBar;
|
||||
BOOL const isInMainView =
|
||||
[mainView pointInside:[cell convertPoint:taxiBottom toView:mainView] withEvent:nil];
|
||||
BOOL const isInActionBar =
|
||||
[actionBar pointInside:[cell convertPoint:taxiBottom toView:actionBar] withEvent:nil];
|
||||
if (isInMainView && !isInActionBar)
|
||||
onHit();
|
||||
};
|
||||
|
||||
checkCell(self.taxiCell, ^{
|
||||
self.taxiCell = nil;
|
||||
|
||||
auto const & taxiProviders = [data taxiProviders];
|
||||
if (taxiProviders.empty())
|
||||
{
|
||||
NSAssert(NO, @"Taxi is shown but providers are empty.");
|
||||
return;
|
||||
}
|
||||
NSString * provider = nil;
|
||||
switch (taxiProviders.front())
|
||||
{
|
||||
case taxi::Provider::Uber: provider = kStatUber; break;
|
||||
case taxi::Provider::Yandex: provider = kStatYandex; break;
|
||||
}
|
||||
[Statistics logEvent:kStatPlacepageTaxiShow withParameters:@{ @"provider" : provider }];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - MWMPlacePageCellUpdateProtocol
|
||||
|
||||
- (void)cellUpdated
|
||||
|
|
Loading…
Add table
Reference in a new issue