Only show migration popup to existing users

This commit is contained in:
Niels Andriesse 2019-08-01 16:47:45 +10:00
parent 92fb056688
commit 4954ff31aa
2 changed files with 2 additions and 3 deletions

View File

@ -216,6 +216,7 @@ final class OnboardingKeyPairViewController : OnboardingBaseViewController {
let onSuccess = { [weak self] in
guard let strongSelf = self else { return }
strongSelf.onboardingController.verificationDidComplete(fromView: strongSelf)
UserDefaults.standard.set(true, forKey: "didUpdateForMainnet")
}
if let userName = userName {
OWSProfileManager.shared().updateLocalProfileName(userName, avatarImage: nil, success: onSuccess, failure: onSuccess) // Try to save the user name but ignore the result

View File

@ -671,8 +671,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
NSString *buildNumberAsString = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
NSInteger buildNumber = buildNumberAsString.integerValue;
NSUserDefaults *userDefaults = NSUserDefaults.standardUserDefaults;
BOOL didUpdateForMainnet = [userDefaults boolForKey:@"didUpdateForMainnet"];
BOOL didUpdateForMainnet = [NSUserDefaults.standardUserDefaults boolForKey:@"didUpdateForMainnet"];
if ((buildNumber == 8 || buildNumber == 9) && !didUpdateForMainnet) {
NSString *title = NSLocalizedString(@"Update Required", @"");
NSString *message = NSLocalizedString(@"This version of Loki Messenger is no longer supported. Please press OK to reset your account and migrate to the latest version.", @"");
@ -686,7 +685,6 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
OWSNavigationController *navigationController = [[OWSNavigationController alloc] initWithRootViewController:rootViewController];
navigationController.navigationBarHidden = YES;
UIApplication.sharedApplication.keyWindow.rootViewController = navigationController;
[userDefaults setBool:YES forKey:@"didUpdateForMainnet"];
}]];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { /* Do nothing */ }]];
[self presentAlert:alert];