mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Improve handling of mandatory flag
- Fix mandatory flag is set but newer version is installed, then the mandatory dialog will still appear (if compareVersionType is set to HockeyComparisonResultDifferent) - Show mandatory alert if any newer version than the installed one is set to mandatory, and not only the latest one
This commit is contained in:
parent
810ecb84b8
commit
b9efccfbc6
@ -229,6 +229,9 @@ typedef enum {
|
|||||||
|
|
||||||
- (NSArray *)apps;
|
- (NSArray *)apps;
|
||||||
|
|
||||||
|
// check if there is any newer version mandatory
|
||||||
|
- (BOOL)hasNewerMandatoryVersion;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -539,7 +539,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
if (isAppStoreEnvironment_) return;
|
if (isAppStoreEnvironment_) return;
|
||||||
|
|
||||||
if (!updateAlertShowing_) {
|
if (!updateAlertShowing_) {
|
||||||
if ([self.app.mandatory boolValue] ) {
|
if ([self hasNewerMandatoryVersion]) {
|
||||||
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:BWHockeyLocalize(@"HockeyUpdateAvailable")
|
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:BWHockeyLocalize(@"HockeyUpdateAvailable")
|
||||||
message:[NSString stringWithFormat:BWHockeyLocalize(@"HockeyUpdateAlertMandatoryTextWithAppVersion"), [self.app nameAndVersionString]]
|
message:[NSString stringWithFormat:BWHockeyLocalize(@"HockeyUpdateAlertMandatoryTextWithAppVersion"), [self.app nameAndVersionString]]
|
||||||
delegate:self
|
delegate:self
|
||||||
@ -805,9 +805,8 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
- (void)checkForUpdate {
|
- (void)checkForUpdate {
|
||||||
if (!updateURL_) return;
|
if (!updateURL_) return;
|
||||||
if (self.requireAuthorization) return;
|
if (self.requireAuthorization) return;
|
||||||
if (self.isUpdateAvailable && [self.app.mandatory boolValue]) {
|
if (self.isUpdateAvailable && [self hasNewerMandatoryVersion]) {
|
||||||
[self showCheckForUpdateAlert_];
|
[self showCheckForUpdateAlert_];
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
[self checkForUpdateShowFeedback:NO];
|
[self checkForUpdateShowFeedback:NO];
|
||||||
}
|
}
|
||||||
@ -1054,7 +1053,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
[alert release];
|
[alert release];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.isUpdateAvailable && (self.alwaysShowUpdateReminder || newVersionDiffersFromCachedVersion || [self.app.mandatory boolValue])) {
|
if (self.isUpdateAvailable && (self.alwaysShowUpdateReminder || newVersionDiffersFromCachedVersion || [self hasNewerMandatoryVersion])) {
|
||||||
if (updateAvailable_ && !currentHockeyViewController_) {
|
if (updateAvailable_ && !currentHockeyViewController_) {
|
||||||
[self showCheckForUpdateAlert_];
|
[self showCheckForUpdateAlert_];
|
||||||
}
|
}
|
||||||
@ -1067,6 +1066,21 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)hasNewerMandatoryVersion {
|
||||||
|
BOOL result = NO;
|
||||||
|
|
||||||
|
for (BWApp *app in self.apps) {
|
||||||
|
if ([app.version isEqualToString:self.currentAppVersion]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([app.mandatory boolValue]) {
|
||||||
|
result = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
Loading…
x
Reference in New Issue
Block a user