Bgerstle has uploaded a new change for review.

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

Change subject: move hockeyapp & debug menu config to info.plist
......................................................................

move hockeyapp & debug menu config to info.plist

- tested on:
  - [x] Debug:
    
https://rink.hockeyapp.net/manage/apps/152723/crash_reasons/36517884/multiple
  - [x] Alpha:
    
https://rink.hockeyapp.net/manage/apps/176472/app_versions/29/crash_reasons/36518556
  - [x] Beta:
    
https://rink.hockeyapp.net/manage/apps/152725/app_versions/33/crash_reasons/36518862
  - [x] Release (not showing debug menu, but HA id is correct)
  - [x] Release w/ override:
    
https://rink.hockeyapp.net/manage/apps/152731/app_versions/16/crash_reasons/36492385?type=crashes

Bug: T101269
Change-Id: I0af310e18f13eb92d7c9676973baacc01e76d83d
---
M Wikipedia.xcodeproj/project.pbxproj
M Wikipedia/Categories/BITHockeyManager+WMFExtensions.m
M Wikipedia/Categories/NSBundle+WMFInfoUtils.h
M Wikipedia/Categories/NSBundle+WMFInfoUtils.m
M Wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m
M Wikipedia/Wikipedia-Info.plist
M fastlane/Fastfile
M scripts/process_plist.sh
8 files changed, 53 insertions(+), 41 deletions(-)


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

diff --git a/Wikipedia.xcodeproj/project.pbxproj 
b/Wikipedia.xcodeproj/project.pbxproj
index a8d189e..1fc9ec6 100644
--- a/Wikipedia.xcodeproj/project.pbxproj
+++ b/Wikipedia.xcodeproj/project.pbxproj
@@ -3542,6 +3542,7 @@
                                        "-Werror=incompatible-pointer-types",
                                        "-Werror=incomplete-implementation",
                                );
+                               WMF_HOCKEYAPP_IDENTIFIER = 
35ef86a164e10f9c01c634c640ec2f0a;
                                WRAPPER_EXTENSION = app;
                        };
                        name = Alpha;
@@ -3644,6 +3645,7 @@
                                        "-Werror=incompatible-pointer-types",
                                        "-Werror=incomplete-implementation",
                                );
+                               WMF_HOCKEYAPP_IDENTIFIER = 
2295c3698bbd0b050f257772dd2bdbb2;
                                WRAPPER_EXTENSION = app;
                        };
                        name = Beta;
@@ -3836,6 +3838,7 @@
                                        "-Werror=incompatible-pointer-types",
                                        "-Werror=incomplete-implementation",
                                );
+                               WMF_HOCKEYAPP_IDENTIFIER = 
76947f174e31a9e33fe67d81ff31732e;
                                WRAPPER_EXTENSION = app;
                        };
                        name = Debug;
@@ -3871,6 +3874,7 @@
                                        "-Werror=incompatible-pointer-types",
                                        "-Werror=incomplete-implementation",
                                );
+                               WMF_HOCKEYAPP_IDENTIFIER = 
5d80da08a6761e5c6456736af7ebad88;
                                WRAPPER_EXTENSION = app;
                        };
                        name = Release;
diff --git a/Wikipedia/Categories/BITHockeyManager+WMFExtensions.m 
b/Wikipedia/Categories/BITHockeyManager+WMFExtensions.m
index 536b9bf..dfc4028 100644
--- a/Wikipedia/Categories/BITHockeyManager+WMFExtensions.m
+++ b/Wikipedia/Categories/BITHockeyManager+WMFExtensions.m
@@ -15,19 +15,6 @@
 static NSString* const kHockeyAppAlwaysSendStringsKey                = 
@"hockeyapp-alert-always-send";
 static NSString* const kHockeyAppDoNotSendStringsKey                 = 
@"hockeyapp-alert-do-not-send";
 
-static NSString* WMFCurrentHockeyReportingID() {
-    static NSDictionary* hockeyAPIKeysByBundleID;
-    if (!hockeyAPIKeysByBundleID) {
-        hockeyAPIKeysByBundleID = @{
-            @"org.wikimedia.wikipedia.tfbeta": 
@"2295c3698bbd0b050f257772dd2bdbb2",
-            @"org.wikimedia.wikipedia.tfalpha": 
@"38c83eea9df95b47d210c8ad137e815a",
-            @"org.wikimedia.wikipedia": @"5d80da08a6761e5c6456736af7ebad88",
-            @"org.wikimedia.wikipedia.developer": 
@"76947f174e31a9e33fe67d81ff31732e"
-        };
-    }
-    return hockeyAPIKeysByBundleID[[[NSBundle mainBundle] 
wmf_bundleIdentifier]];
-}
-
 @implementation BITHockeyManager (WMFExtensions)
 
 + (NSString*)crashSendText {
@@ -43,7 +30,7 @@
 }
 
 - (void)wmf_setupAndStart {
-    [[BITHockeyManager sharedHockeyManager] 
configureWithIdentifier:WMFCurrentHockeyReportingID()];
+    [[BITHockeyManager sharedHockeyManager] configureWithIdentifier:[[NSBundle 
mainBundle] wmf_hockeyappIdentifier]];
     [[BITHockeyManager sharedHockeyManager] startManager];
     [BITHockeyManager sharedHockeyManager].updateManager.updateSetting = 
BITUpdateCheckManually;
     [[BITHockeyManager sharedHockeyManager].authenticator 
authenticateInstallation];
diff --git a/Wikipedia/Categories/NSBundle+WMFInfoUtils.h 
b/Wikipedia/Categories/NSBundle+WMFInfoUtils.h
index 59bc583..5d4f488 100644
--- a/Wikipedia/Categories/NSBundle+WMFInfoUtils.h
+++ b/Wikipedia/Categories/NSBundle+WMFInfoUtils.h
@@ -10,6 +10,10 @@
 
 @interface NSBundle (WMFInfoUtils)
 
+///
+/// @name App Version Information
+///
+
 /// @return The value for Info.plist key `CFBundleIdentifier`, i.e. the app's 
bundle identifier.
 - (NSString*)wmf_bundleIdentifier;
 
@@ -31,4 +35,13 @@
 /// @return Either `wmf_releaseVersion` or `wmf_debugVersion` depending on the 
bundle identifier.
 - (NSString*)wmf_versionForCurrentBundleIdentifier;
 
+///
+/// @name App Configuration
+///
+
+- (BOOL)wmf_showDebugMenu;
+
+/// @return HockeyApp ID for crash reports
+- (NSString*)wmf_hockeyappIdentifier;
+
 @end
diff --git a/Wikipedia/Categories/NSBundle+WMFInfoUtils.m 
b/Wikipedia/Categories/NSBundle+WMFInfoUtils.m
index 4b8ea66..ba54e7a 100644
--- a/Wikipedia/Categories/NSBundle+WMFInfoUtils.m
+++ b/Wikipedia/Categories/NSBundle+WMFInfoUtils.m
@@ -10,6 +10,8 @@
 
 @implementation NSBundle (WMFInfoUtils)
 
+#pragma mark - Version Info
+
 - (NSString*)wmf_bundleIdentifier {
     return [self objectForInfoDictionaryKey:@"CFBundleIdentifier"];
 }
@@ -38,4 +40,14 @@
     return [self wmf_isAppStoreBundleIdentifier] ? [self wmf_releaseVersion] : 
[self wmf_debugVersion];
 }
 
+#pragma mark - Config
+
+- (NSString*)wmf_hockeyappIdentifier {
+    return [self objectForInfoDictionaryKey:@"WMFHockeyAppIdentifier"];
+}
+
+- (BOOL)wmf_showDebugMenu {
+    return [[self objectForInfoDictionaryKey:@"WMFShowDebugMenu"] boolValue];
+}
+
 @end
diff --git a/Wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m b/Wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m
index 472e819..e1f5e17 100644
--- a/Wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m
+++ b/Wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m
@@ -22,8 +22,9 @@
 #import "UIViewController+ModalPop.h"
 #import "LoginViewController.h"
 #import "PaddedLabel.h"
-#import "UIFont+WMFStyle.h"
 #import <HockeySDK/HockeySDK.h>
+#import "UIFont+WMFStyle.h"
+#import "NSBundle+WMFInfoUtils.h"
 
 #pragma mark - Defines
 
@@ -38,14 +39,6 @@
 #define URL_PRIVACY_POLICY 
@"https://m.wikimediafoundation.org/wiki/Privacy_Policy";
 #define URL_TERMS @"https://m.wikimediafoundation.org/wiki/Terms_of_Use";
 #define URL_RATE_APP @"itms-apps://itunes.apple.com/app/id324715238"
-
-#ifndef WMF_SHOW_DEBUG_MENU
-    #if DEBUG
-        #define WMF_SHOW_DEBUG_MENU 1
-    #else
-        #define WMF_SHOW_DEBUG_MENU 0
-    #endif
-#endif
 
 typedef NS_ENUM (NSUInteger, SecondaryMenuRowIndex) {
     SECONDARY_MENU_ROW_INDEX_LOGIN,
@@ -69,6 +62,10 @@
     SECONDARY_MENU_ROW_INDEX_HEADING_BLANK,
     SECONDARY_MENU_ROW_INDEX_HEADING_BLANK_2
 };
+
+static uint const WMFDebugSectionCount                                    = 2;
+static SecondaryMenuRowIndex const WMFDebugSections[WMFDebugSectionCount] = { 
SECONDARY_MENU_ROW_INDEX_DEBUG_CRASH,
+                                                                              
SECONDARY_MENU_ROW_INDEX_HEADING_DEBUG };
 
 #pragma mark - Private
 
@@ -497,7 +494,6 @@
             @"icon": @"",
             @"type": @(ROW_TYPE_SELECTION),
         }.mutableCopy
-#if WMF_SHOW_DEBUG_MENU
         ,
         @{
             @"title": MWLocalizedString(@"main-menu-heading-debug", nil),
@@ -514,15 +510,6 @@
             @"type": @(ROW_TYPE_SELECTION),
             @"accessibilityTraits": @(UIAccessibilityTraitLink),
         }.mutableCopy
-#else
-        ,
-        @{
-            @"title": @"",
-            @"tag": @(SECONDARY_MENU_ROW_INDEX_HEADING_BLANK_2),
-            @"icon": @"",
-            @"type": @(ROW_TYPE_HEADING),
-        }.mutableCopy
-#endif
     ].mutableCopy;
 
     self.rowData = rowData;
@@ -532,12 +519,11 @@
         [self deleteRowWithTag:SECONDARY_MENU_ROW_INDEX_PAGE_HISTORY];
     }
 
-#if WMF_SHOW_DEBUG_MENU
-    if (![[BITHockeyManager sharedHockeyManager] crashManager]) {
-        NSLog(@"Crash reporting is disabled, removing crash button");
-        [self deleteRowWithTag:SECONDARY_MENU_ROW_INDEX_DEBUG_CRASH];
+    if (![[NSBundle mainBundle] wmf_showDebugMenu]) {
+        for (int i = 0; i < WMFDebugSectionCount; i++) {
+            [self deleteRowWithTag:WMFDebugSections[i]];
+        }
     }
-#endif
 
     NSString* userName = [SessionSingleton 
sharedInstance].keychainCredentials.userName;
     if (!userName) {
@@ -694,12 +680,10 @@
                                         block:nil];
             }
             break;
-#if WMF_SHOW_DEBUG_MENU
             case SECONDARY_MENU_ROW_INDEX_DEBUG_CRASH: {
                 [[[BITHockeyManager sharedHockeyManager] crashManager] 
generateTestCrash];
                 break;
             }
-#endif
             default:
                 break;
         }
diff --git a/Wikipedia/Wikipedia-Info.plist b/Wikipedia/Wikipedia-Info.plist
index a10c617..a64bcc4 100644
--- a/Wikipedia/Wikipedia-Info.plist
+++ b/Wikipedia/Wikipedia-Info.plist
@@ -55,5 +55,9 @@
        </array>
        <key>UIViewControllerBasedStatusBarAppearance</key>
        <true/>
+       <key>WMFHockeyAppIdentifier</key>
+       <string>${WMF_HOCKEYAPP_IDENTIFIER}</string>
+       <key>WMFShowDebugMenu</key>
+       <false/>
 </dict>
 </plist>
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index b58b73a..0fdc125 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -99,7 +99,9 @@
       filename: 'build/adhoc.mobileprovision'
     )
     # force iTunes file sharing to be enabled (normally disabled for release 
builds)
-    ENV['WMF_FORCE_ITUNES_FILE_SHARING']='1'
+    ENV['WMF_FORCE_ITUNES_FILE_SHARING'] = '1'
+    # force debug menu to be shown
+    ENV['WMF_FORCE_DEBUG_MENU'] = '1'
     ipa(
       configuration: "Wikipedia",
       scheme: "Wikipedia",
diff --git a/scripts/process_plist.sh b/scripts/process_plist.sh
index f536d1b..9d13a5f 100755
--- a/scripts/process_plist.sh
+++ b/scripts/process_plist.sh
@@ -14,3 +14,9 @@
   echo "Enabling iTunes File Sharing for ${CONFIGURATION} build."
   defaults write "${INFO_PLIST}" UIFileSharingEnabled true
 fi
+
+if [[ "${CONFIGURATION}" != "Release" || $WMF_FORCE_DEBUG_MENU == "1" ]]; then
+  echo "Showing debug menu for ${CONFIGURATION} build."
+  defaults write "${INFO_PLIST}" WMFShowDebugMenu true
+fi
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0af310e18f13eb92d7c9676973baacc01e76d83d
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Bgerstle <bgers...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to