Only show migration popup to existing users

pull/35/head
Niels Andriesse 6 years ago
parent 92fb056688
commit 4954ff31aa

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

@ -671,8 +671,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
NSString *buildNumberAsString = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]; NSString *buildNumberAsString = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
NSInteger buildNumber = buildNumberAsString.integerValue; NSInteger buildNumber = buildNumberAsString.integerValue;
NSUserDefaults *userDefaults = NSUserDefaults.standardUserDefaults; BOOL didUpdateForMainnet = [NSUserDefaults.standardUserDefaults boolForKey:@"didUpdateForMainnet"];
BOOL didUpdateForMainnet = [userDefaults boolForKey:@"didUpdateForMainnet"];
if ((buildNumber == 8 || buildNumber == 9) && !didUpdateForMainnet) { if ((buildNumber == 8 || buildNumber == 9) && !didUpdateForMainnet) {
NSString *title = NSLocalizedString(@"Update Required", @""); 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.", @""); 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]; OWSNavigationController *navigationController = [[OWSNavigationController alloc] initWithRootViewController:rootViewController];
navigationController.navigationBarHidden = YES; navigationController.navigationBarHidden = YES;
UIApplication.sharedApplication.keyWindow.rootViewController = navigationController; UIApplication.sharedApplication.keyWindow.rootViewController = navigationController;
[userDefaults setBool:YES forKey:@"didUpdateForMainnet"];
}]]; }]];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { /* Do nothing */ }]]; [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { /* Do nothing */ }]];
[self presentAlert:alert]; [self presentAlert:alert];

Loading…
Cancel
Save