Feature/2854 version management

This commit is contained in:
Frank Rotermund
2022-07-26 15:07:22 +00:00
parent e38ea287d3
commit 4a2a82fccb
57 changed files with 203 additions and 36 deletions
@@ -337,7 +337,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
{
[super viewDidAppear:animated];
[self checkAppVersion];
[self checkAppVersionDeprecated];
// Release the current selected item (if any) except if the second view controller is still visible.
if (self.splitViewController.isCollapsed)
@@ -2610,16 +2610,16 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
#pragma mark - Bwi Check App version
- (void)checkAppVersion {
- (void)checkAppVersionDeprecated {
ValidAppVersionsDefaultService *appVersionsService = [[ValidAppVersionsDefaultService alloc] init];
if( BwiBuildSettings.bwiCheckAppVersion && appVersionsService.isCurrentAppVersionDeprecated ) {
MXWeakify(self);
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[VectorL10n bwiOutdatedVersionWarningTitle]
message:[VectorL10n bwiOutdatedVersionWarningMessage]
message:[VectorL10n bwiDeprecatedVersionWarningMessage]
preferredStyle:UIAlertControllerStyleAlert];
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n bwiOutdatedVersionAppstoreButton]
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n bwiDeprecatedVersionAppstoreButton]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self logout];
@@ -2636,7 +2636,35 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
}]];
[self presentViewController:errorAlert animated:YES completion:nil];
}
}
- (void)checkAppVersionOutdated {
ValidAppVersionsDefaultService *appVersionsService = [[ValidAppVersionsDefaultService alloc] init];
if (BwiBuildSettings.bwiCheckAppVersion && appVersionsService.isCurrentAppVersionOutdated && !appVersionsService.wasOutdatedAlertShown) {
MXWeakify(self);
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[VectorL10n bwiOutdatedVersionWarningTitle]
message:[VectorL10n bwiOutdatedVersionWarningMessage:AppInfo.current.displayName]
preferredStyle:UIAlertControllerStyleAlert];
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n bwiOutdatedVersionAppstoreButton]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self gotoAppStore];
[appVersionsService setOutdatedAlertShown:true];
MXStrongifyAndReturnIfNil(self);
self->currentAlert = nil;
}]];
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n bwiOutdatedVersionLogoutButton]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[appVersionsService setOutdatedAlertShown:true];
}]];
[self presentViewController:errorAlert animated:YES completion:nil];
}
}