[iOS] add UGC review notifications statistics

This commit is contained in:
Aleksey Belouosv 2018-11-29 16:27:10 +03:00 committed by Olesia Bolovintseva
parent 20149f7552
commit d81d37f3cb
11 changed files with 38 additions and 10 deletions

View file

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

View file

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

View file

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

View file

@ -1395,6 +1395,7 @@
470F5A7E2189C30800754295 /* InAppPurchase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPurchase.swift; sourceTree = "<group>"; };
4716EAB921A325310029B886 /* IPaidRouteStatistics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPaidRouteStatistics.swift; sourceTree = "<group>"; };
4716EAC021A6E0570029B886 /* BookmarksVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksVC.xib; sourceTree = "<group>"; };
4716EACA21B01C270029B886 /* MWMUGCReviewSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMUGCReviewSource.h; sourceTree = "<group>"; };
4719A642219CB61D009F9AA7 /* BillingPendingTransaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BillingPendingTransaction.swift; sourceTree = "<group>"; };
4719A644219CBD65009F9AA7 /* IPendingTransactionsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPendingTransactionsHandler.swift; sourceTree = "<group>"; };
4719A646219CBD7F009F9AA7 /* IBillingPendingTransaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBillingPendingTransaction.swift; sourceTree = "<group>"; };
@ -3963,6 +3964,7 @@
34E776301F15FAC2003040B3 /* MWMPlacePageManagerHelper.h */,
34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */,
F6E2FC9B1E097B9F0083EBEC /* MWMPlacePageProtocol.h */,
4716EACA21B01C270029B886 /* MWMUGCReviewSource.h */,
F6E2FC9C1E097B9F0083EBEC /* PlacePageLayout */,
);
path = PlacePage;

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,5 @@
typedef NS_ENUM(NSUInteger, MWMUGCReviewSource) {
MWMUGCReviewSourcePlacePage,
MWMUGCReviewSourcePlacePagePreview,
MWMUGCReviewSourceNotification
};

View file

@ -544,7 +544,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
auto c = static_cast<MWMUGCAddReviewCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
c.onRateTap = ^(MWMRatingSummaryViewValueType value) {
[delegate showUGCAddReview:value fromPreview:NO];
[delegate showUGCAddReview:value fromSource:MWMUGCReviewSourcePlacePage];
};
return c;
}

View file

@ -267,7 +267,7 @@ std::array<Class, 9> const kPreviewCells = {{[_MWMPPPTitle class],
smartDeal:NO
onAddReview:^{
[MWMPlacePageManagerHelper showUGCAddReview:MWMRatingSummaryViewValueTypeNoValue
fromPreview:YES];
fromSource:MWMUGCReviewSourcePlacePagePreview];
}];
}
return reviewCell;