mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-31 07:30:40 +00:00
Add simulating an app store update being available
Will be automatically disabled when run from a build distributed by the App Store
This commit is contained in:
parent
166f2c7ccd
commit
7582f02a08
@ -159,7 +159,29 @@ typedef enum {
|
||||
@property (nonatomic, assign, getter=isUpdateUIEnabled) BOOL updateUIEnabled;
|
||||
|
||||
|
||||
// manually start an update check
|
||||
///-----------------------------------------------------------------------------
|
||||
/// @name Tests
|
||||
///-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Define the simulated new version avaialble from the App Store
|
||||
|
||||
Set the version string that should be used for a simulated new version being available
|
||||
in the App Store.
|
||||
|
||||
*Default*: _NIL_
|
||||
|
||||
@warning This property is autoamtically disabled if accidentally being invoked in an
|
||||
App Store build.
|
||||
@see updateSetting
|
||||
*/
|
||||
@property (nonatomic, strong) NSString *simulatedNewStoreVersion;
|
||||
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
/// @name Manual update checking
|
||||
///-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Check for an update
|
||||
|
||||
|
@ -92,6 +92,7 @@
|
||||
_appStoreURL = nil;
|
||||
_currentUUID = [[self executableUUID] copy];
|
||||
_countryCode = nil;
|
||||
_simulatedNewStoreVersion = nil;
|
||||
|
||||
_mainBundle = [NSBundle mainBundle];
|
||||
_currentLocale = [NSLocale currentLocale];
|
||||
@ -237,6 +238,7 @@
|
||||
#pragma mark - Private
|
||||
|
||||
- (BOOL)shouldCancelProcessing {
|
||||
if (self.simulatedNewStoreVersion) return NO;
|
||||
if (![self isAppStoreEnvironment]) return YES;
|
||||
if (![self isStoreUpdateManagerEnabled]) return YES;
|
||||
return NO;
|
||||
@ -260,6 +262,13 @@
|
||||
self.lastCheck = [NSDate date];
|
||||
|
||||
self.updateAvailable = [self hasNewVersion:json];
|
||||
|
||||
if (self.simulatedNewStoreVersion) {
|
||||
self.updateAvailable = YES;
|
||||
_lastCheckFailed = NO;
|
||||
_newStoreVersion = self.simulatedNewStoreVersion;
|
||||
}
|
||||
|
||||
BITHockeyLog(@"INFO: Update available: %i", self.updateAvailable);
|
||||
|
||||
if (_lastCheckFailed) {
|
||||
@ -405,6 +414,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setSimulatedNewStoreVersion:(NSString *)aSimulatedNewStoreVersion {
|
||||
if ([self isAppStoreEnvironment]) return;
|
||||
|
||||
if (_simulatedNewStoreVersion != aSimulatedNewStoreVersion) {
|
||||
_simulatedNewStoreVersion = [aSimulatedNewStoreVersion copy];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
@ -424,6 +441,8 @@
|
||||
|
||||
if (_appStoreURL) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:_appStoreURL]];
|
||||
} else {
|
||||
BITHockeyLog(@"WARNING: The app store page couldn't be opened, since we did not get a valid URL from the store API.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user