diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 48aab837c9..4a89478d7a 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -452,7 +452,8 @@ using namespace osm_auth_ios; { [LocalNotificationManager.sharedManager showReviewNotificationForPlace:@(notification.m_mapObject->GetReadableName().c_str()) - onTap: ^{ + onTap:^{ + [Statistics logEvent:kStatUGCReviewNotificationClicked]; place_page::Info info; if (GetFramework().MakePlacePageInfo(*notification.m_mapObject, info)) [[MapViewController sharedController].controlsManager showPlacePageReview:info]; diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index e4292bf19d..396e0965fd 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -231,6 +231,7 @@ static NSString * const kStatNoBackup = @"no_backup"; static NSString * const kStatNoConnection = @"no_connection"; static NSString * const kStatNoSpace = @"no_space"; static NSString * const kStatNone = @"none"; +static NSString * const kStatNotification = @"notification"; static NSString * const kStatNotToday = @"NotToday"; static NSString * const kStatOSM = @"OSM"; static NSString * const kStatOSMUserName = @"osm_username"; @@ -404,6 +405,8 @@ static NSString * const kStatUGCReviewAuthRequestSuccess = @"UGC_Auth_request_su static NSString * const kStatUGCReviewAuthShown = @"UGC_Auth_shown"; static NSString * const kStatUGCReviewCancel = @"UGC_Review_cancel"; static NSString * const kStatUGCReviewError = @"UGC_Review_error"; +static NSString * const kStatUGCReviewNotificationClicked = @"UGC_ReviewNotification_clicked"; +static NSString * const kStatUGCReviewNotificationShown = @"UGC_ReviewNotification_shown"; static NSString * const kStatUGCReviewStart = @"UGC_Review_start"; static NSString * const kStatUGCReviewSuccess = @"UGC_Review_success"; static NSString * const kStatUber = @"Uber"; diff --git a/iphone/Maps/Core/Notifications/LocalNotificationManager.mm b/iphone/Maps/Core/Notifications/LocalNotificationManager.mm index 71d1cb37df..c0064bd217 100644 --- a/iphone/Maps/Core/Notifications/LocalNotificationManager.mm +++ b/iphone/Maps/Core/Notifications/LocalNotificationManager.mm @@ -136,6 +136,7 @@ using namespace storage; #pragma mark - Location Notifications - (void)showReviewNotificationForPlace:(NSString *)place onTap:(MWMVoidBlock)onReviewNotification { + [Statistics logEvent:kStatUGCReviewNotificationShown]; self.onReviewNotification = onReviewNotification; UILocalNotification * notification = [[UILocalNotification alloc] init]; diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 6153cb92e7..5d0be170cc 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -1395,6 +1395,7 @@ 470F5A7E2189C30800754295 /* InAppPurchase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPurchase.swift; sourceTree = ""; }; 4716EAB921A325310029B886 /* IPaidRouteStatistics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPaidRouteStatistics.swift; sourceTree = ""; }; 4716EAC021A6E0570029B886 /* BookmarksVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksVC.xib; sourceTree = ""; }; + 4716EACA21B01C270029B886 /* MWMUGCReviewSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMUGCReviewSource.h; sourceTree = ""; }; 4719A642219CB61D009F9AA7 /* BillingPendingTransaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BillingPendingTransaction.swift; sourceTree = ""; }; 4719A644219CBD65009F9AA7 /* IPendingTransactionsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPendingTransactionsHandler.swift; sourceTree = ""; }; 4719A646219CBD7F009F9AA7 /* IBillingPendingTransaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBillingPendingTransaction.swift; sourceTree = ""; }; @@ -3963,6 +3964,7 @@ 34E776301F15FAC2003040B3 /* MWMPlacePageManagerHelper.h */, 34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */, F6E2FC9B1E097B9F0083EBEC /* MWMPlacePageProtocol.h */, + 4716EACA21B01C270029B886 /* MWMUGCReviewSource.h */, F6E2FC9C1E097B9F0083EBEC /* PlacePageLayout */, ); path = PlacePage; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h b/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h index 30325fbe0f..549d88e5ec 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageButtonsProtocol.h @@ -1,5 +1,6 @@ #import "MWMPlacePageTaxiProvider.h" #import "MWMRatingSummaryViewValueType.h" +#import "MWMUGCReviewSource.h" typedef UIView * _Nullable (^MWMPlacePageButtonsDismissBlock)(NSInteger); @@ -20,7 +21,7 @@ typedef UIView * _Nullable (^MWMPlacePageButtonsDismissBlock)(NSInteger); referenceViewWhenDismissingHandler: (nonnull MWMPlacePageButtonsDismissBlock)referenceViewWhenDismissingHandler; - (void)showGallery; -- (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromPreview:(BOOL)fromPreview; +- (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromSource:(MWMUGCReviewSource)source; - (void)searchSimilar; - (void)openLocalAdsURL; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index 85a745ecde..b2e41e1d9e 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -98,7 +98,8 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: - (void)showReview:(place_page::Info const &)info { [self show:info]; - [self showUGCAddReview:MWMRatingSummaryViewValueTypeNoValue fromPreview:YES]; + [self showUGCAddReview:MWMRatingSummaryViewValueTypeNoValue + fromSource:MWMUGCReviewSourceNotification]; } - (void)show:(place_page::Info const &)info @@ -595,7 +596,7 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: [[MapViewController sharedController].navigationController pushViewController:galleryVc animated:YES]; } -- (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromPreview:(BOOL)fromPreview +- (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromSource:(MWMUGCReviewSource)source { auto data = self.data; if (!data) @@ -609,13 +610,25 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: auto title = data.title; RegisterEventIfPossible(eye::MapObject::Event::Type::UgcEditorOpened, data.getRawData); + NSString * sourceString; + switch (source) { + case MWMUGCReviewSourcePlacePage: + sourceString = kStatPlacePage; + break; + case MWMUGCReviewSourcePlacePagePreview: + sourceString = kStatPlacePagePreview; + break; + case MWMUGCReviewSourceNotification: + sourceString = kStatNotification; + break; + } [Statistics logEvent:kStatUGCReviewStart withParameters:@{ kStatIsAuthenticated: @([MWMAuthorizationViewModel isAuthenticated]), kStatIsOnline: @(GetPlatform().ConnectionStatus() != Platform::EConnectionType::CONNECTION_NONE), kStatMode: kStatAdd, - kStatFrom: fromPreview ? kStatPlacePagePreview : kStatPlacePage + kStatFrom: sourceString }]; auto ugcReviewModel = [[MWMUGCReviewModel alloc] initWithReviewValue:value ratings:ratings title:title text:@""]; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h index ed41e80141..13d2339a18 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h @@ -1,9 +1,10 @@ #import "MWMRatingSummaryViewValueType.h" +#import "MWMUGCReviewSource.h" @interface MWMPlacePageManagerHelper : NSObject + (void)updateAvailableArea:(CGRect)frame; -+ (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromPreview:(BOOL)fromPreview; ++ (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromSource:(MWMUGCReviewSource)source; + (void)searchSimilar; @end diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm index f2fa1240c2..e2e440baaf 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm @@ -1,6 +1,7 @@ #import "MWMPlacePageManagerHelper.h" #import "MWMMapViewControlsManager.h" #import "MWMPlacePageManager.h" +#import "MWMUGCReviewSource.h" @interface MWMMapViewControlsManager () @@ -23,10 +24,10 @@ [[MWMMapViewControlsManager manager].placePageManager updateAvailableArea:frame]; } -+ (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromPreview:(BOOL)fromPreview ++ (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromSource:(MWMUGCReviewSource)source { [[MWMMapViewControlsManager manager].placePageManager showUGCAddReview:value - fromPreview:fromPreview]; + fromSource:source]; } + (void)searchSimilar diff --git a/iphone/Maps/UI/PlacePage/MWMUGCReviewSource.h b/iphone/Maps/UI/PlacePage/MWMUGCReviewSource.h new file mode 100644 index 0000000000..93084d0f0a --- /dev/null +++ b/iphone/Maps/UI/PlacePage/MWMUGCReviewSource.h @@ -0,0 +1,5 @@ +typedef NS_ENUM(NSUInteger, MWMUGCReviewSource) { + MWMUGCReviewSourcePlacePage, + MWMUGCReviewSourcePlacePagePreview, + MWMUGCReviewSourceNotification +}; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm index 4ff2d74550..554371ae16 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm @@ -544,7 +544,7 @@ map const kMetaInfoCells = { auto c = static_cast( [tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]); c.onRateTap = ^(MWMRatingSummaryViewValueType value) { - [delegate showUGCAddReview:value fromPreview:NO]; + [delegate showUGCAddReview:value fromSource:MWMUGCReviewSourcePlacePage]; }; return c; } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm index 35b1cfac49..36b7d51779 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm @@ -267,7 +267,7 @@ std::array const kPreviewCells = {{[_MWMPPPTitle class], smartDeal:NO onAddReview:^{ [MWMPlacePageManagerHelper showUGCAddReview:MWMRatingSummaryViewValueTypeNoValue - fromPreview:YES]; + fromSource:MWMUGCReviewSourcePlacePagePreview]; }]; } return reviewCell;