From 7705382f6bba376322ea6554c152b8bb4742e2ff Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Fri, 23 Mar 2012 21:20:37 +0100 Subject: [PATCH] Remove autoSubmitting UDID with crash reports and add # DONT_SEND_UDID macro for disabling usage of UDID By default DONT_SEND_UDID is set to 0, so UDID data will be send for beta usage. The developers should set it to 1 in their project settings for AppStore configurations --- Classes/BWGlobal.h | 8 ++++++-- Classes/BWHockeyManager.m | 13 +++++-------- Classes/BWQuincyManager.h | 5 ----- Classes/BWQuincyManager.m | 18 ++---------------- Classes/CNSHockeyManager.h | 7 ------- Classes/CNSHockeyManager.m | 8 -------- 6 files changed, 13 insertions(+), 46 deletions(-) diff --git a/Classes/BWGlobal.h b/Classes/BWGlobal.h index 32e4df543c..2cede6c2c1 100644 --- a/Classes/BWGlobal.h +++ b/Classes/BWGlobal.h @@ -25,8 +25,12 @@ #import "BWHockeyManager.h" #import "BWApp.h" -#define HOCKEYKIT_VERSION_MAJOR 2 -#define HOCKEYKIT_VERSION_MINOR 0 +#define SDK_NAME @"HockeySDK" +#define SDK_VERSION @"2.2.6-develop" + +#ifndef DONT_SEND_UDID +#define DONT_SEND_UDID 0 +#endif // uncomment this line to enable NSLog-debugging output //#define kHockeyDebugEnabled diff --git a/Classes/BWHockeyManager.m b/Classes/BWHockeyManager.m index f9ef4c53e1..6159d99e52 100644 --- a/Classes/BWHockeyManager.m +++ b/Classes/BWHockeyManager.m @@ -40,9 +40,6 @@ #define BETA_UPDATE_TIMESTAMP @"timestamp" #define BETA_UPDATE_APPSIZE @"appsize" -#define SDK_NAME @"HockeySDK" -#define SDK_VERSION @"2.2.4" - @interface BWHockeyManager () - (NSString *)getDevicePlatform_; - (id)parseJSONResultString:(NSString *)jsonString; @@ -241,12 +238,12 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain"; } - (NSString *)deviceIdentifier { - if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) { +#if DONT_SEND_UDID == 0 + if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)]; - } - else { - return @"invalid"; - } +#endif + + return @"invalid"; } - (NSString *)authenticationToken { diff --git a/Classes/BWQuincyManager.h b/Classes/BWQuincyManager.h index e4accd4068..f1b71fdd78 100644 --- a/Classes/BWQuincyManager.h +++ b/Classes/BWQuincyManager.h @@ -153,7 +153,6 @@ typedef enum CrashReportStatus { BOOL _showAlwaysButton; BOOL _feedbackActivated; BOOL _autoSubmitCrashReport; - BOOL _autoSubmitDeviceUDID; BOOL _didCrashInLastSession; @@ -215,10 +214,6 @@ typedef enum CrashReportStatus { // if NO, the user will be asked if the crash report can be submitted (default) @property (nonatomic, assign, getter=isAutoSubmitCrashReport) BOOL autoSubmitCrashReport; -// if YES, the device UDID will be submitted as the user id, without the need to define it in the crashReportUserID delegate (meant for beta versions!) -// if NO, the crashReportUserID delegate defines what to be sent as user id (default) -@property (nonatomic, assign, getter=isAutoSubmitDeviceUDID) BOOL autoSubmitDeviceUDID; - // will return if the last session crashed, to e.g. make sure a "rate my app" alert will not show up @property (nonatomic, readonly) BOOL didCrashInLastSession; diff --git a/Classes/BWQuincyManager.m b/Classes/BWQuincyManager.m index 3b427d507b..b941853350 100644 --- a/Classes/BWQuincyManager.m +++ b/Classes/BWQuincyManager.m @@ -30,14 +30,12 @@ #import #import #import +#import "BWGlobal.h" #import "BWQuincyManager.h" #include #include //needed for PRIx64 macro -#define SDK_NAME @"HockeySDK" -#define SDK_VERSION @"2.2.6-develop" - NSBundle *quincyBundle(void) { static NSBundle* bundle = nil; if (!bundle) { @@ -87,7 +85,6 @@ NSString *BWQuincyLocalize(NSString *stringToken) { @synthesize showAlwaysButton = _showAlwaysButton; @synthesize feedbackActivated = _feedbackActivated; @synthesize autoSubmitCrashReport = _autoSubmitCrashReport; -@synthesize autoSubmitDeviceUDID = _autoSubmitDeviceUDID; @synthesize languageStyle = _languageStyle; @synthesize didCrashInLastSession = _didCrashInLastSession; @synthesize loggingEnabled = _loggingEnabled; @@ -136,7 +133,6 @@ NSString *BWQuincyLocalize(NSString *stringToken) { self.feedbackActivated = NO; self.showAlwaysButton = NO; self.autoSubmitCrashReport = NO; - self.autoSubmitDeviceUDID = NO; NSString *testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kQuincyKitAnalyzerStarted]; if (testValue) { @@ -462,14 +458,6 @@ NSString *BWQuincyLocalize(NSString *stringToken) { return platform; } -- (NSString *)deviceIdentifier { - if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) { - return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)]; - } - else { - return @"invalid"; - } -} - (void)_performSendingCrashReports { NSMutableDictionary *approvedCrashReports = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryForKey: kApprovedCrashReports]]; @@ -481,9 +469,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { NSString *contact = @""; NSString *description = @""; - if (self.autoSubmitDeviceUDID && [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) { - userid = [self deviceIdentifier]; - } else if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportUserID)]) { + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportUserID)]) { userid = [self.delegate crashReportUserID] ?: @""; } diff --git a/Classes/CNSHockeyManager.h b/Classes/CNSHockeyManager.h index ffb73d4b08..1481ca8c84 100644 --- a/Classes/CNSHockeyManager.h +++ b/Classes/CNSHockeyManager.h @@ -123,13 +123,6 @@ // Default: NO @property (nonatomic, assign, getter=isAutoSubmitCrashReport) BOOL autoSubmitCrashReport; -// Submit the device's UDID in the field UserID if crashReportUserID is not -// implemented (see CNSHockeyManagerDelegate); DO NOT USE THIS FOR LIVE -// VERSION OF YOUR APP AS THIS VIOLATES THE USERS PRIVACY! -// -// Default: NO -@property (nonatomic, assign, getter=isAutoSubmitDeviceUDID) BOOL autoSubmitDeviceUDID; - // Send user data to HockeyApp when checking for a new version; works only // for beta apps and should not be activated for live apps. User data includes // the device type, OS version, app version and device UDID. diff --git a/Classes/CNSHockeyManager.m b/Classes/CNSHockeyManager.m index b69a2d7692..35425d9834 100644 --- a/Classes/CNSHockeyManager.m +++ b/Classes/CNSHockeyManager.m @@ -206,14 +206,6 @@ [[BWQuincyManager sharedQuincyManager] setAutoSubmitCrashReport:autoSubmitCrashReport]; } -- (BOOL)isAutoSubmitDeviceUDID { - return [[BWQuincyManager sharedQuincyManager] isAutoSubmitDeviceUDID]; -} - -- (void)setAutoSubmitDeviceUDID:(BOOL)autoSubmitDeviceUDID { - [[BWQuincyManager sharedQuincyManager] setAutoSubmitDeviceUDID:autoSubmitDeviceUDID]; -} - - (BOOL)didCrashInLastSession { return [[BWQuincyManager sharedQuincyManager] didCrashInLastSession]; }