Dr0ptp4kt has submitted this change and it was merged. Change subject: Add debug menu for crashing app, wire up HockeyApp ......................................................................
Add debug menu for crashing app, wire up HockeyApp For now, only sends crashes if the app is deployed with one of the following bundle IDs: org.wikimedia.wikipedia.alphahockey org.wikimedia.wikipedia.tfbeta This patch sets the default bundle ID to: org.wikimedia.wikipedia.developer Thus, to cut channel builds for other channels, update the bundle ID. This is done to keep the developer builds separate from the stable channel. Well, and the other channels. Note: pod install updated AFNetworking minor release as well. Based largely on: https://github.com/btgerst/apps-ios-wikipedia/tree/debug-crash-reporting Change-Id: Ide0ca5bdfbb67dd8ce3d5f9846b438999bd5434a --- M Podfile M Podfile.lock M Wikipedia.xcodeproj/project.pbxproj M wikipedia/AppDelegate.m M wikipedia/View Controllers/About/AboutViewController.plist M wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m M wikipedia/Wikipedia-Info.plist M wikipedia/en.lproj/Localizable.strings M wikipedia/mw-utils/WikipediaAppUtils.h M wikipedia/mw-utils/WikipediaAppUtils.m M wikipedia/qqq.lproj/Localizable.strings 11 files changed, 127 insertions(+), 18 deletions(-) Approvals: Dr0ptp4kt: Verified; Looks good to me, approved Mhurd: Checked; Looks good to me, but someone else must approve diff --git a/Podfile b/Podfile index 2e24612..fa37926 100644 --- a/Podfile +++ b/Podfile @@ -5,6 +5,7 @@ pod 'hpple', '< 0.3' pod 'blockskit/Core', '< 2.3' pod 'Masonry', '< 0.7' +pod 'HockeySDK', '3.6.2' target 'WikipediaUnitTests', :exclusive => false do pod 'OCMockito', '< 1.5' diff --git a/Podfile.lock b/Podfile.lock index c19da5e..11f1f25 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,26 +1,27 @@ PODS: - - AFNetworking (2.5.0): - - AFNetworking/NSURLConnection (= 2.5.0) - - AFNetworking/NSURLSession (= 2.5.0) - - AFNetworking/Reachability (= 2.5.0) - - AFNetworking/Security (= 2.5.0) - - AFNetworking/Serialization (= 2.5.0) - - AFNetworking/UIKit (= 2.5.0) - - AFNetworking/NSURLConnection (2.5.0): + - AFNetworking (2.5.1): + - AFNetworking/NSURLConnection (= 2.5.1) + - AFNetworking/NSURLSession (= 2.5.1) + - AFNetworking/Reachability (= 2.5.1) + - AFNetworking/Security (= 2.5.1) + - AFNetworking/Serialization (= 2.5.1) + - AFNetworking/UIKit (= 2.5.1) + - AFNetworking/NSURLConnection (2.5.1): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/NSURLSession (2.5.0): + - AFNetworking/NSURLSession (2.5.1): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/Reachability (2.5.0) - - AFNetworking/Security (2.5.0) - - AFNetworking/Serialization (2.5.0) - - AFNetworking/UIKit (2.5.0): + - AFNetworking/Reachability (2.5.1) + - AFNetworking/Security (2.5.1) + - AFNetworking/Serialization (2.5.1) + - AFNetworking/UIKit (2.5.1): - AFNetworking/NSURLConnection - AFNetworking/NSURLSession - BlocksKit/Core (2.2.5) + - HockeySDK (3.6.2) - hpple (0.2.0) - Masonry (0.6.1) - OCHamcrest (4.1.1) @@ -30,14 +31,16 @@ DEPENDENCIES: - AFNetworking (< 2.6) - blockskit/Core (< 2.3) + - HockeySDK (= 3.6.2) - hpple (< 0.3) - Masonry (< 0.7) - OCHamcrest (< 4.2) - OCMockito (< 1.5) SPEC CHECKSUMS: - AFNetworking: 0f54cb5d16ce38c1b76948faffb8d5fb705021c7 + AFNetworking: 8bee59492a6ff15d69130efa4d0dc67e0094a52a BlocksKit: 4439e7f30a9f90743462ca63545a15c1f4304cef + HockeySDK: bfd1f5ac75938b07499c4ac12932244b72a2e70b hpple: f4eb7c21a8db83ec264e5d614ec7509e10e5adec Masonry: 2cb49fd14d203d2db5ca6bb017135b235dde9980 OCHamcrest: af1c7c5ea345de69ea6c9c2958f65f3044e5c420 diff --git a/Wikipedia.xcodeproj/project.pbxproj b/Wikipedia.xcodeproj/project.pbxproj index fb4a150..c8a526a 100644 --- a/Wikipedia.xcodeproj/project.pbxproj +++ b/Wikipedia.xcodeproj/project.pbxproj @@ -2726,7 +2726,6 @@ runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; }; D4C16A621970946900CD91AD /* update-storyboard-strings */ = { isa = PBXShellScriptBuildPhase; @@ -3384,6 +3383,10 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "\"$(PROJECT_DIR)/vendor/Frameworks\"", + "$(inherited)", + ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "wikipedia/Wikipedia-Prefix.pch"; HEADER_SEARCH_PATHS = ( @@ -3419,6 +3422,10 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "\"$(PROJECT_DIR)/vendor/Frameworks\"", + "$(inherited)", + ); GCC_OPTIMIZATION_LEVEL = 3; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "wikipedia/Wikipedia-Prefix.pch"; diff --git a/wikipedia/AppDelegate.m b/wikipedia/AppDelegate.m index 478f194..87be348 100644 --- a/wikipedia/AppDelegate.m +++ b/wikipedia/AppDelegate.m @@ -5,10 +5,18 @@ #import "URLCache.h" #import "NSDate-Utilities.h" #import "WikipediaAppUtils.h" +#import <HockeySDK/HockeySDK.h> @implementation AppDelegate - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { + NSString* currentBundle = [WikipediaAppUtils wmf_appBundleIdentifierForCrashReporting]; + if (currentBundle) { + [[BITHockeyManager sharedHockeyManager] configureWithIdentifier:currentBundle]; + [[BITHockeyManager sharedHockeyManager] startManager]; + [[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation]; + } + [WikipediaAppUtils copyAssetsFolderToAppDataDocuments]; [self registerStandardUserDefaults]; [self systemWideStyleOverrides]; diff --git a/wikipedia/View Controllers/About/AboutViewController.plist b/wikipedia/View Controllers/About/AboutViewController.plist index cff3415..bc40b7f 100644 --- a/wikipedia/View Controllers/About/AboutViewController.plist +++ b/wikipedia/View Controllers/About/AboutViewController.plist @@ -137,6 +137,14 @@ <key>License Text</key> <string>pod install</string> </dict> + <dict> + <key>Name</key> + <string>HockeySDK</string> + <key>Source URL</key> + <string>https://github.com/bitstadium/HockeySDK-iOS.git</string> + <key>License Text</key> + <string>pod install</string> + </dict> </array> <key>contributors</key> <array> diff --git a/wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m b/wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m index 1b6b35f..6aba0e9 100644 --- a/wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m +++ b/wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m @@ -23,6 +23,7 @@ #import "LoginViewController.h" #import "PaddedLabel.h" #import "UIFont+WMFStyle.h" +#import <HockeySDK/HockeySDK.h> #pragma mark - Defines @@ -37,6 +38,14 @@ #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, @@ -53,8 +62,10 @@ SECONDARY_MENU_ROW_INDEX_PRIVACY_POLICY, SECONDARY_MENU_ROW_INDEX_TERMS, SECONDARY_MENU_ROW_INDEX_RATE_APP, + SECONDARY_MENU_ROW_INDEX_DEBUG_CRASH, SECONDARY_MENU_ROW_INDEX_HEADING_ZERO, SECONDARY_MENU_ROW_INDEX_HEADING_LEGAL, + SECONDARY_MENU_ROW_INDEX_HEADING_DEBUG, SECONDARY_MENU_ROW_INDEX_HEADING_BLANK, SECONDARY_MENU_ROW_INDEX_HEADING_BLANK_2 }; @@ -481,6 +492,24 @@ @"icon": @"", @"type": @(ROW_TYPE_SELECTION), }.mutableCopy +#if WMF_SHOW_DEBUG_MENU + , + @{ + @"title": MWLocalizedString(@"main-menu-heading-debug", nil), + @"tag": @(SECONDARY_MENU_ROW_INDEX_HEADING_DEBUG), + @"icon": @"", + @"type": @(ROW_TYPE_HEADING), + @"accessibilityTraits": @(UIAccessibilityTraitLink) + } + , + @{ + @"title": MWLocalizedString(@"main-menu-debug-crash", nil), + @"tag": @(SECONDARY_MENU_ROW_INDEX_DEBUG_CRASH), + @"icon": @"", + @"type": @(ROW_TYPE_SELECTION), + @"accessibilityTraits": @(UIAccessibilityTraitLink), + }.mutableCopy +#else , @{ @"title": @"", @@ -488,6 +517,7 @@ @"icon": @"", @"type": @(ROW_TYPE_HEADING), }.mutableCopy +#endif ].mutableCopy; self.rowData = rowData; @@ -640,6 +670,12 @@ 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 29e4b68..09bcb8c 100644 --- a/wikipedia/Wikipedia-Info.plist +++ b/wikipedia/Wikipedia-Info.plist @@ -9,7 +9,7 @@ <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIdentifier</key> - <string>org.wikimedia.wikipedia</string> + <string>org.wikimedia.wikipedia.developer</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> diff --git a/wikipedia/en.lproj/Localizable.strings b/wikipedia/en.lproj/Localizable.strings index 2bd166a..123540c 100644 --- a/wikipedia/en.lproj/Localizable.strings +++ b/wikipedia/en.lproj/Localizable.strings @@ -126,6 +126,8 @@ "main-menu-show-today" = "Today"; "main-menu-nearby" = "Nearby"; "main-menu-more" = "More..."; +"main-menu-heading-debug" = "Debug"; +"main-menu-debug-crash"= "Crash"; "saved-pages-title" = "Saved pages"; "saved-pages-clear-confirmation-heading" = "Delete all saved items?"; @@ -280,4 +282,4 @@ "update-progress-label" = "Upgrading local data"; -"image-gallery-unknown-owner" = "Uploader unknown."; \ No newline at end of file +"image-gallery-unknown-owner" = "Uploader unknown."; diff --git a/wikipedia/mw-utils/WikipediaAppUtils.h b/wikipedia/mw-utils/WikipediaAppUtils.h index 600e87f..be4f6ce 100644 --- a/wikipedia/mw-utils/WikipediaAppUtils.h +++ b/wikipedia/mw-utils/WikipediaAppUtils.h @@ -4,6 +4,17 @@ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> +// TODO: use developer constants? +//extern NSString * const WMFHockeyAppDeveloperXcodeCFBundleIdentifier; +//extern NSString * const WMFHockeyAppDeveloperXcodeAppId; +extern NSString* const WMFHockeyAppAlphaHockeyCFBundleIdentifier; +extern NSString* const WMFHockeyAppAlphaHockeyAppId; +extern NSString* const WMFHockeyAppBetaTestFlightCFBundleIdentifier; +extern NSString* const WMFHockeyAppBetaTestFlightAppId; +//extern NSString * const WMFHockeyAppStableCFBundleIdentifier; +//extern NSString * const WMFHockeyAppStableAppId; +// TODO: use stable channel constants + #define MWLocalizedString(key, throwaway) [WikipediaAppUtils localizedStringForKey : key] /** @@ -60,4 +71,6 @@ + (void)copyAssetsFolderToAppDataDocuments; ++ (NSString*)wmf_appBundleIdentifierForCrashReporting; + @end diff --git a/wikipedia/mw-utils/WikipediaAppUtils.m b/wikipedia/mw-utils/WikipediaAppUtils.m index 58f8589..6d9cd67 100644 --- a/wikipedia/mw-utils/WikipediaAppUtils.m +++ b/wikipedia/mw-utils/WikipediaAppUtils.m @@ -4,6 +4,17 @@ #import "WikipediaAppUtils.h" #import "AssetsFile.h" +// TODO: use developer constants? +//NSString * const WMFHockeyAppDeveloperXcodeCFBundleIdentifier = @"org.wikimedia.wikipedia.developer"; +//NSString * const WMFHockeyAppDeveloperXcodeAppId = @"76947f174e31a9e33fe67d81ff31732e"; +NSString* const WMFHockeyAppAlphaHockeyCFBundleIdentifier = @"org.wikimedia.wikipedia.alphahockey"; +NSString* const WMFHockeyAppAlphaHockeyAppId = @"11136dadf17c6d8b76f903e92eea83b1"; +NSString* const WMFHockeyAppBetaTestFlightCFBundleIdentifier = @"org.wikimedia.wikipedia.tfbeta"; +NSString* const WMFHockeyAppBetaTestFlightAppId = @"2295c3698bbd0b050f257772dd2bdbb2"; +//NSString * const WMFHockeyAppStableCFBundleIdentifier = @"org.wikimedia.wikipedia"; +//NSString * const WMFHockeyAppStableAppId = @"5d80da08a6761e5c6456736af7ebad88"; +// TODO: use stable channel constants + NSUInteger MegabytesToBytes(NSUInteger m){ static NSUInteger const MEGABYTE = 1 << 20; return m * MEGABYTE; @@ -229,4 +240,21 @@ } } ++ (NSString*)wmf_appBundleIdentifierForCrashReporting { + NSString* bundleId = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; + // We're not handling developer or stable channel at this time. + // If you want to generate a crash yourself: + // change the bundle ID to one of the constants below, then push + // the build to your device with Xcode, then disconnect your device + // from the computer, then run the app. + + if ([bundleId isEqualToString:WMFHockeyAppAlphaHockeyCFBundleIdentifier]) { + return WMFHockeyAppAlphaHockeyAppId; + } else if ([bundleId isEqualToString:WMFHockeyAppBetaTestFlightCFBundleIdentifier]) { + return WMFHockeyAppBetaTestFlightAppId; + } else { + return nil; + } +} + @end diff --git a/wikipedia/qqq.lproj/Localizable.strings b/wikipedia/qqq.lproj/Localizable.strings index c4129a3..229fb44 100644 --- a/wikipedia/qqq.lproj/Localizable.strings +++ b/wikipedia/qqq.lproj/Localizable.strings @@ -124,6 +124,8 @@ "main-menu-show-today" = "Button text for showing mobile version of main page\n{{Identical|Today}}"; "main-menu-nearby" = "Button for showing nearby articles.\n{{Identical|Nearby}}"; "main-menu-more" = "Button for showing additional settings and menu items.\n{{Identical|More}}"; +"main-menu-heading-debug" = "Header text for the debug section of the menu. The debug menu is conditionall shown if in Xcode debug mode."; +"main-menu-debug-crash"= "Title for button that forces the application to crash."; "saved-pages-title" = "Header text for Saved Pages interface.\n{{Identical|Saved page}}"; "saved-pages-clear-confirmation-heading" = "Heading text of delete all confirmation dialog"; "saved-pages-clear-confirmation-sub-heading" = "Sub-heading text of delete all confirmation dialog"; @@ -252,4 +254,5 @@ "nearby-location-general-error" = "General location determination error message"; "nearby-wifi" = "Alert text telling user how to improve location accuracy"; "update-progress-label" = "Label shown during automatic upgrade of local data to new internal format. May be on screen very briefly or for a few seconds."; -"image-gallery-unknown-owner" = "Fallback text for when an item in the image gallery doesn't have a specified owner."; \ No newline at end of file +"image-gallery-unknown-owner" = "Fallback text for when an item in the image gallery doesn't have a specified owner."; + -- To view, visit https://gerrit.wikimedia.org/r/194321 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ide0ca5bdfbb67dd8ce3d5f9846b438999bd5434a Gerrit-PatchSet: 7 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Dr0ptp4kt <[email protected]> Gerrit-Reviewer: Bgerstle <[email protected]> Gerrit-Reviewer: Dr0ptp4kt <[email protected]> Gerrit-Reviewer: Fjalapeno <[email protected]> Gerrit-Reviewer: Mhurd <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
