Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/142724

Change subject: Update EventLogging edit funnel
......................................................................

Update EventLogging edit funnel

Change-Id: Ib629cd9f45f70d50ab3a8bc9fe13d6e2e21b731a
---
M wikipedia/EventLogging/EditFunnel.h
M wikipedia/EventLogging/EditFunnel.m
M wikipedia/View Controllers/Login/LoginViewController.m
M wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m
4 files changed, 43 insertions(+), 45 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia 
refs/changes/24/142724/1

diff --git a/wikipedia/EventLogging/EditFunnel.h 
b/wikipedia/EventLogging/EditFunnel.h
index 9b60592..92ccdb3 100644
--- a/wikipedia/EventLogging/EditFunnel.h
+++ b/wikipedia/EventLogging/EditFunnel.h
@@ -15,17 +15,19 @@
 -(id)init;
 -(void)logStart;
 -(void)logPreview;
+/**
+ * Parameter should be one of the string keys defined at
+ * 
https://meta.wikimedia.org/wiki/Schema_talk:MobileWikiAppEdit#Schema_missing_enum_for_editSummaryTapped
+ */
+-(void)logEditSummaryTap:(NSString *)editSummaryTapped;
 -(void)logSavedRevision:(int)revID;
--(void)logLoginAttempt;
--(void)logLoginSuccess;
--(void)logLoginFailure;
 -(void)logCaptchaShown;
 -(void)logCaptchaFailure;
 -(void)logAbuseFilterWarning:(NSString *)code;
 -(void)logAbuseFilterError:(NSString *)code;
 -(void)logAbuseFilterWarningIgnore:(NSString *)code;
 -(void)logAbuseFilterWarningBack:(NSString *)code;
--(void)logSaveAnonExplicit;
+-(void)logSaveAttempt; // @FIXME USE
 -(void)logError:(NSString *)code;
 
 @end
diff --git a/wikipedia/EventLogging/EditFunnel.m 
b/wikipedia/EventLogging/EditFunnel.m
index 359ac4e..3685716 100644
--- a/wikipedia/EventLogging/EditFunnel.m
+++ b/wikipedia/EventLogging/EditFunnel.m
@@ -15,7 +15,7 @@
 -(id)init
 {
     // https://meta.wikimedia.org/wiki/Schema:MobileWikiAppEdit
-    self = [super initWithSchema:@"MobileWikiAppEdit" version:8198182];
+    self = [super initWithSchema:@"MobileWikiAppEdit" version:9003125];
     if (self) {
         self.editSessionToken = [self singleUseUUID];
     }
@@ -26,9 +26,14 @@
 {
     NSMutableDictionary *dict = [eventData mutableCopy];
     dict[@"editSessionToken"] = self.editSessionToken;
-    NSString *userName = [SessionSingleton 
sharedInstance].keychainCredentials.userName;
-    dict[@"userName"] = userName ? userName : @"";
-    //dict[@"pageNS"] = @0; // @todo allow other types or ...? // Android 
doesn't send this?
+    NSString *userName = [SessionSingleton 
sharedInstance].keychainCredentials.userName; // @FIXME send user ID
+    if (!userName || [userName isEqualToString:@""]) {
+        dict[@"userID"] = @0; // not logged in
+    } else {
+        // @FIXME fetch the actual user ID
+        dict[@"userID"] = @(-1);
+    }
+    //dict[@"pageNS"] = @0; // @todo actually get the namespace...
     return [NSDictionary dictionaryWithDictionary: dict];
 }
 
@@ -44,26 +49,17 @@
     [self log:@{@"action": @"preview"}];
 }
 
+-(void)logEditSummaryTap:(NSString *)editSummaryTapped
+{
+    [self log:@{@"action": @"editSummaryTap",
+                @"editSummaryTapped": editSummaryTapped}];
+}
+
 -(void)logSavedRevision:(int)revID
 {
     NSNumber *revIDNumber = [NSNumber numberWithInt:revID];
     [self log:@{@"action": @"saved",
                 @"revID": (revIDNumber ? revIDNumber : @"")}];
-}
-
--(void)logLoginAttempt
-{
-    [self log:@{@"action": @"loginAttempt"}];
-}
-
--(void)logLoginSuccess
-{
-    [self log:@{@"action": @"loginSuccess"}];
-}
-
--(void)logLoginFailure
-{
-    [self log:@{@"action": @"loginFailure"}];
 }
 
 -(void)logCaptchaShown
@@ -100,9 +96,9 @@
                 @"abuseFilterCode": (code ? code : @"")}];
 }
 
-- (void)logSaveAnonExplicit
+-(void)logSaveAttempt // @FIXME WHAT CALLS THIS
 {
-    [self log:@{@"action": @"saveAnonExplicit"}];
+    [self log:@{@"action": @"saveAttempt"}];
 }
 
 - (void)logError:(NSString *)code
diff --git a/wikipedia/View Controllers/Login/LoginViewController.m 
b/wikipedia/View Controllers/Login/LoginViewController.m
index 1226d40..f9532a9 100644
--- a/wikipedia/View Controllers/Login/LoginViewController.m
+++ b/wikipedia/View Controllers/Login/LoginViewController.m
@@ -179,10 +179,6 @@
 
 -(void)save
 {
-    if (NAV.isEditorOnNavstack) {
-        [NAV.editor.funnel logLoginAttempt];
-    }
-
     id onboardingVC = [self 
searchModalsForViewControllerOfClass:[OnboardingViewController class]];
 
     [self loginWithUserName: self.usernameField.text
@@ -261,10 +257,6 @@
 
                           [self.funnel logSuccess];
                           
-                          if (NAV.isEditorOnNavstack) {
-                              [NAV.editor.funnel logLoginSuccess];
-                          }
-                          
                       } cancelledBlock: ^(NSError *error){
                           
                           [self showAlert:error.localizedDescription];
@@ -280,10 +272,6 @@
 
 
                           [self.funnel logError:error.localizedDescription];
-
-                          if (NAV.isEditorOnNavstack) {
-                              [NAV.editor.funnel logLoginFailure];
-                          }
                       }];
     
     LoginTokenOp *loginTokenOp =
diff --git a/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m 
b/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m
index 13171fb..42f4caa 100644
--- a/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m
+++ b/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m
@@ -294,6 +294,26 @@
 -(void)buttonTapped:(UIGestureRecognizer *)recognizer
 {
     MenuButton *tappedButton = (MenuButton *)recognizer.view;
+    
+    NSString *summaryKey;
+    switch (tappedButton.tag) {
+        case CANNED_SUMMARY_TYPOS:
+            summaryKey = @"typo";
+            break;
+        case CANNED_SUMMARY_GRAMMAR:
+            summaryKey = @"grammar";
+            break;
+        case CANNED_SUMMARY_LINKS:
+            summaryKey = @"links";
+            break;
+        case CANNED_SUMMARY_OTHER:
+            summaryKey = @"other";
+            break;
+        default:
+            NSLog(@"unrecognized button");
+    }
+    [self.funnel logEditSummaryTap:summaryKey];
+
     switch (tappedButton.tag) {
         case CANNED_SUMMARY_OTHER:
             [self showSummaryOverlay];
@@ -777,14 +797,6 @@
         ",
     warningHtml];
 }
-
-/*
-this save call was invoked when old sign-in/save-anon choice was presented and 
user selected save-anon.
-question: does logSaveAnonExplicit need to be called - maybe in save method if 
not logged in? check it it already is
-            [self.funnel logSaveAnonExplicit];
-
-            [self save];
-*/
 
 //    BOOL userIsloggedIn = [SessionSingleton 
sharedInstance].keychainCredentials.userName ? YES : NO;
 

-- 
To view, visit https://gerrit.wikimedia.org/r/142724
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib629cd9f45f70d50ab3a8bc9fe13d6e2e21b731a
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to