Notify user after device has been unlinked

This commit is contained in:
Niels Andriesse 2019-11-21 08:22:36 +11:00
parent 592aa70862
commit 31e3a98d90
3 changed files with 11 additions and 0 deletions

View File

@ -75,6 +75,14 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
lokiLogoImageView.autoCenterInSuperview()
Analytics.shared.track("Landing Screen Viewed")
let userDefaults = UserDefaults.standard
if userDefaults.bool(forKey: "wasUnlinked") {
let alert = UIAlertController(title: NSLocalizedString("Device Unlinked", comment: ""), message: NSLocalizedString("Your device was unlinked successfully", comment: ""), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), accessibilityIdentifier: nil, style: .default, handler: nil))
present(alert, animated: true, completion: nil)
userDefaults.set(false, forKey: "wasUnlinked")
}
}
// MARK: - Events

View File

@ -2667,3 +2667,5 @@
"Please pick a name" = "Please pick a name";
"Couldn't Unlink Device" = "Couldn't Unlink Device";
"Please check your internet connection and try again" = "Please check your internet connection and try again";
"Device Unlinked" = "Device Unlinked";
"Your device was unlinked successfully" = "Your device was unlinked successfully";

View File

@ -1199,6 +1199,7 @@ NS_ASSUME_NONNULL_BEGIN
if (![deviceLinks contains:^BOOL(LKDeviceLink *deviceLink) {
return [deviceLink.master.hexEncodedPublicKey isEqual:senderHexEncodedPublicKey] && [deviceLink.slave.hexEncodedPublicKey isEqual:userHexEncodedPublicKey];
}]) {
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"wasUnlinked"];
[NSNotificationCenter.defaultCenter postNotification:NSNotification.dataNukeRequested];
}
});