mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-05 10:50:54 +00:00
Disable Authenticator and UpdateManager in TestFlight
This commit is contained in:
@@ -67,8 +67,8 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
|
||||
[self unregisterObservers];
|
||||
}
|
||||
|
||||
- (instancetype) initWithAppIdentifier:(NSString *)appIdentifier isAppStoreEnvironment:(BOOL)isAppStoreEnvironment {
|
||||
self = [super initWithAppIdentifier:appIdentifier isAppStoreEnvironment:isAppStoreEnvironment];
|
||||
- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier isTestFlightEnvironment:(BOOL)isTestFlightEnvironment isAppStoreEnvironment:(BOOL)isAppStoreEnvironment {
|
||||
self = [super initWithAppIdentifier:appIdentifier isTestFlightEnvironment:isTestFlightEnvironment isAppStoreEnvironment:isAppStoreEnvironment];
|
||||
if( self ) {
|
||||
_webpageURL = [NSURL URLWithString:@"https://rink.hockeyapp.net/"];
|
||||
|
||||
@@ -82,8 +82,8 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
|
||||
|
||||
#pragma mark - BITHockeyBaseManager overrides
|
||||
- (void)startManager {
|
||||
//disabled in the appStore
|
||||
if([self isAppStoreEnvironment]) return;
|
||||
//disabled in TestFlight and the AppStore
|
||||
if([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return;
|
||||
|
||||
_isSetup = YES;
|
||||
}
|
||||
@@ -109,8 +109,8 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
|
||||
}
|
||||
|
||||
- (void)authenticateInstallation {
|
||||
//disabled in the appStore
|
||||
if([self isAppStoreEnvironment]) return;
|
||||
//disabled in TestFlight and the AppStore
|
||||
if([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return;
|
||||
|
||||
// make sure this is called after startManager so all modules are fully setup
|
||||
if (!_isSetup) {
|
||||
|
||||
@@ -51,8 +51,6 @@
|
||||
UINavigationController *_navController;
|
||||
|
||||
NSDateFormatter *_rfc3339Formatter;
|
||||
|
||||
BOOL _isAppStoreEnvironment;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,10 +75,11 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier isAppStoreEnvironment:(BOOL)isAppStoreEnvironment {
|
||||
- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier isTestFlightEnvironment:(BOOL)isTestFlightEnvironment isAppStoreEnvironment:(BOOL)isAppStoreEnvironment {
|
||||
if ((self = [self init])) {
|
||||
_appIdentifier = appIdentifier;
|
||||
_isAppStoreEnvironment = isAppStoreEnvironment;
|
||||
_testFlightEnvironment = isTestFlightEnvironment;
|
||||
_appStoreEnvironment = isAppStoreEnvironment;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -92,10 +91,6 @@
|
||||
BITHockeyLog(@"ERROR: %@", [error localizedDescription]);
|
||||
}
|
||||
|
||||
- (BOOL)isAppStoreEnvironment {
|
||||
return _isAppStoreEnvironment;
|
||||
}
|
||||
|
||||
- (NSString *)encodedAppIdentifier {
|
||||
return bit_encodeAppIdentifier(_appIdentifier);
|
||||
}
|
||||
|
||||
@@ -36,13 +36,14 @@
|
||||
|
||||
@property (nonatomic, strong) NSString *appIdentifier;
|
||||
|
||||
- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier isAppStoreEnvironment:(BOOL)isAppStoreEnvironment;
|
||||
@property (nonatomic, assign, readonly, getter=isTestFlightEnvironment) BOOL testFlightEnvironment;
|
||||
|
||||
@property (nonatomic, assign, readonly, getter=isAppStoreEnvironment) BOOL appStoreEnvironment;
|
||||
|
||||
- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier isTestFlightEnvironment:(BOOL)isTestFlightEnvironment isAppStoreEnvironment:(BOOL)isAppStoreEnvironment;
|
||||
|
||||
- (void)startManager;
|
||||
|
||||
/** the value this object was initialized with */
|
||||
- (BOOL)isAppStoreEnvironment;
|
||||
|
||||
/** Check if the device is running an iOS version previous to iOS 7 */
|
||||
- (BOOL)isPreiOS7Environment;
|
||||
|
||||
|
||||
@@ -664,32 +664,32 @@ bitstadium_info_t bitstadium_library_info __attribute__((section("__TEXT,__bit_h
|
||||
if (_validAppIdentifier) {
|
||||
#if HOCKEYSDK_FEATURE_CRASH_REPORTER
|
||||
BITHockeyLog(@"INFO: Setup CrashManager");
|
||||
_crashManager = [[BITCrashManager alloc] initWithAppIdentifier:_appIdentifier isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_crashManager = [[BITCrashManager alloc] initWithAppIdentifier:_appIdentifier isTestFlightEnvironment:_testFlightEnvironment isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_crashManager.hockeyAppClient = [self hockeyAppClient];
|
||||
_crashManager.delegate = _delegate;
|
||||
#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */
|
||||
|
||||
#if HOCKEYSDK_FEATURE_UPDATES
|
||||
BITHockeyLog(@"INFO: Setup UpdateManager");
|
||||
_updateManager = [[BITUpdateManager alloc] initWithAppIdentifier:_appIdentifier isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_updateManager = [[BITUpdateManager alloc] initWithAppIdentifier:_appIdentifier isTestFlightEnvironment:_testFlightEnvironment isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_updateManager.delegate = _delegate;
|
||||
#endif /* HOCKEYSDK_FEATURE_UPDATES */
|
||||
|
||||
#if HOCKEYSDK_FEATURE_STORE_UPDATES
|
||||
BITHockeyLog(@"INFO: Setup StoreUpdateManager");
|
||||
_storeUpdateManager = [[BITStoreUpdateManager alloc] initWithAppIdentifier:_appIdentifier isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_storeUpdateManager = [[BITStoreUpdateManager alloc] initWithAppIdentifier:_appIdentifier isTestFlightEnvironment:_testFlightEnvironment isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_storeUpdateManager.delegate = _delegate;
|
||||
#endif /* HOCKEYSDK_FEATURE_STORE_UPDATES */
|
||||
|
||||
#if HOCKEYSDK_FEATURE_FEEDBACK
|
||||
BITHockeyLog(@"INFO: Setup FeedbackManager");
|
||||
_feedbackManager = [[BITFeedbackManager alloc] initWithAppIdentifier:_appIdentifier isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_feedbackManager = [[BITFeedbackManager alloc] initWithAppIdentifier:_appIdentifier isTestFlightEnvironment:_testFlightEnvironment isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_feedbackManager.delegate = _delegate;
|
||||
#endif /* HOCKEYSDK_FEATURE_FEEDBACK */
|
||||
|
||||
#if HOCKEYSDK_FEATURE_AUTHENTICATOR
|
||||
BITHockeyLog(@"INFO: Setup Authenticator");
|
||||
_authenticator = [[BITAuthenticator alloc] initWithAppIdentifier:_appIdentifier isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_authenticator = [[BITAuthenticator alloc] initWithAppIdentifier:_appIdentifier isTestFlightEnvironment:_testFlightEnvironment isAppStoreEnvironment:_appStoreEnvironment];
|
||||
_authenticator.hockeyAppClient = [self hockeyAppClient];
|
||||
_authenticator.delegate = _delegate;
|
||||
#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR */
|
||||
|
||||
@@ -227,7 +227,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
#pragma mark - Expiry
|
||||
|
||||
- (BOOL)expiryDateReached {
|
||||
if ([self isAppStoreEnvironment]) return NO;
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return NO;
|
||||
|
||||
if (_expiryDate) {
|
||||
NSDate *currentDate = [NSDate date];
|
||||
@@ -314,7 +314,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
|
||||
- (void)stopUsage {
|
||||
if ([self isAppStoreEnvironment]) return;
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return;
|
||||
if ([self expiryDateReached]) return;
|
||||
|
||||
double timeDifference = [[NSDate date] timeIntervalSinceReferenceDate] - [_usageStartTimestamp timeIntervalSinceReferenceDate];
|
||||
@@ -324,7 +324,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
|
||||
- (void) storeUsageTimeForCurrentVersion:(NSNumber *)usageTime {
|
||||
if ([self isAppStoreEnvironment]) return;
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return;
|
||||
|
||||
NSMutableData *data = [[NSMutableData alloc] init];
|
||||
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
|
||||
@@ -518,7 +518,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
#pragma mark - BetaUpdateUI
|
||||
|
||||
- (BITUpdateViewController *)hockeyViewController:(BOOL)modal {
|
||||
if ([self isAppStoreEnvironment]) {
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) {
|
||||
NSLog(@"[HockeySDK] This should not be called from an app store build!");
|
||||
// return an empty view controller instead
|
||||
BITHockeyBaseViewController *blankViewController = [[BITHockeyBaseViewController alloc] initWithModalStyle:modal];
|
||||
@@ -528,7 +528,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
|
||||
- (void)showUpdateView {
|
||||
if ([self isAppStoreEnvironment]) {
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) {
|
||||
NSLog(@"[HockeySDK] This should not be called from an app store build!");
|
||||
return;
|
||||
}
|
||||
@@ -550,7 +550,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
|
||||
|
||||
- (void)showCheckForUpdateAlert {
|
||||
if ([self isAppStoreEnvironment]) return;
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return;
|
||||
if ([self isUpdateManagerDisabled]) return;
|
||||
|
||||
if (!_updateAlertShowing) {
|
||||
@@ -825,7 +825,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
|
||||
- (void)checkForUpdate {
|
||||
if (![self isAppStoreEnvironment] && ![self isUpdateManagerDisabled]) {
|
||||
if (![self isTestFlightEnvironment] && ![self isAppStoreEnvironment] && ![self isUpdateManagerDisabled]) {
|
||||
if ([self expiryDateReached]) return;
|
||||
if (![self installationIdentified]) return;
|
||||
|
||||
@@ -838,7 +838,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
|
||||
- (void)checkForUpdateShowFeedback:(BOOL)feedback {
|
||||
if ([self isAppStoreEnvironment]) return;
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return;
|
||||
if (self.isCheckInProgress) return;
|
||||
|
||||
_showFeedback = feedback;
|
||||
@@ -916,7 +916,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
|
||||
- (BOOL)initiateAppDownload {
|
||||
if ([self isAppStoreEnvironment]) return NO;
|
||||
if ([self isTestFlightEnvironment] || [self isAppStoreEnvironment]) return NO;
|
||||
|
||||
if (!self.isUpdateAvailable) {
|
||||
BITHockeyLog(@"WARNING: No update available. Aborting.");
|
||||
@@ -985,7 +985,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
|
||||
// begin the startup process
|
||||
- (void)startManager {
|
||||
if (![self isAppStoreEnvironment]) {
|
||||
if (![self isTestFlightEnvironment] && ![self isAppStoreEnvironment]) {
|
||||
if ([self isUpdateManagerDisabled]) return;
|
||||
|
||||
BITHockeyLog(@"INFO: Starting UpdateManager");
|
||||
@@ -1040,7 +1040,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
|
||||
self.companyName = (([[json valueForKey:@"company"] isKindOfClass:[NSString class]]) ? [json valueForKey:@"company"] : nil);
|
||||
|
||||
if (![self isAppStoreEnvironment]) {
|
||||
if (![self isTestFlightEnvironment] && ![self isAppStoreEnvironment]) {
|
||||
NSArray *feedArray = (NSArray *)[json valueForKey:@"versions"];
|
||||
|
||||
// remember that we just checked the server
|
||||
|
||||
@@ -58,7 +58,7 @@ static void *kInstallationIdentification = &kInstallationIdentification;
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
|
||||
_sut = [[BITAuthenticator alloc] initWithAppIdentifier:nil isAppStoreEnvironment:NO];
|
||||
_sut = [[BITAuthenticator alloc] initWithAppIdentifier:nil isTestFlightEnvironment:NO isAppStoreEnvironment:NO];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
@@ -87,7 +87,7 @@ static void *kInstallationIdentification = &kInstallationIdentification;
|
||||
#pragma mark - Persistence Tests
|
||||
- (void) testThatLastAuthenticatedVersionIsPersisted {
|
||||
_sut.lastAuthenticatedVersion = @"1.2.1";
|
||||
_sut = [[BITAuthenticator alloc] initWithAppIdentifier:nil isAppStoreEnvironment:YES];
|
||||
_sut = [[BITAuthenticator alloc] initWithAppIdentifier:nil isTestFlightEnvironment:NO isAppStoreEnvironment:YES];
|
||||
assertThat(_sut.lastAuthenticatedVersion, equalTo(@"1.2.1"));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
[super setUp];
|
||||
|
||||
_startManagerInitialized = NO;
|
||||
_sut = [[BITCrashManager alloc] initWithAppIdentifier:nil isAppStoreEnvironment:NO];
|
||||
_sut = [[BITCrashManager alloc] initWithAppIdentifier:nil isTestFlightEnvironment:NO isAppStoreEnvironment:NO];
|
||||
|
||||
_hockeyAppClient = [[BITHockeyAppClient alloc] initWithBaseURL:[NSURL URLWithString: BITHOCKEYSDK_URL]];
|
||||
_hockeyAppClient.baseURL = [NSURL URLWithString:BITHOCKEYSDK_URL];
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
BITHockeyManager *hm = [BITHockeyManager sharedHockeyManager];
|
||||
hm.delegate = nil;
|
||||
_sut = [[BITFeedbackManager alloc] initWithAppIdentifier:nil isAppStoreEnvironment:NO];
|
||||
_sut = [[BITFeedbackManager alloc] initWithAppIdentifier:nil isTestFlightEnvironment:NO isAppStoreEnvironment:NO];
|
||||
_sut.delegate = nil;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
[super setUp];
|
||||
|
||||
// Set-up code here.
|
||||
_storeUpdateManager = [[BITStoreUpdateManager alloc] initWithAppIdentifier:nil isAppStoreEnvironment:YES];
|
||||
_storeUpdateManager = [[BITStoreUpdateManager alloc] initWithAppIdentifier:nil isTestFlightEnvironment:NO isAppStoreEnvironment:YES];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
|
||||
Reference in New Issue
Block a user