Show device unlinked message upon clearing secondary device

This commit is contained in:
nielsandriesse 2020-08-06 12:16:27 +10:00
parent 6984015aed
commit e648353453
2 changed files with 2 additions and 1 deletions

View file

@ -952,7 +952,7 @@ static NSTimeInterval launchStartedAt;
[self stopClosedGroupPoller]; [self stopClosedGroupPoller];
[self stopOpenGroupPollers]; [self stopOpenGroupPollers];
[LKPublicChatManager.shared stopPollers]; [LKPublicChatManager.shared stopPollers];
bool wasUnlinked = [NSUserDefaults.standardUserDefaults boolForKey:@"wasUnlinked"]; BOOL wasUnlinked = [NSUserDefaults.standardUserDefaults boolForKey:@"wasUnlinked"];
[SignalApp resetAppData:^{ [SignalApp resetAppData:^{
// Resetting the data clears the old user defaults. We need to restore the unlink default. // Resetting the data clears the old user defaults. We need to restore the unlink default.
[NSUserDefaults.standardUserDefaults setBool:wasUnlinked forKey:@"wasUnlinked"]; [NSUserDefaults.standardUserDefaults setBool:wasUnlinked forKey:@"wasUnlinked"];

View file

@ -175,6 +175,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
reload() reload()
// Clear all data if this is a secondary device // Clear all data if this is a secondary device
if UserDefaults.standard[.masterHexEncodedPublicKey] != nil { if UserDefaults.standard[.masterHexEncodedPublicKey] != nil {
UserDefaults.standard[.wasUnlinked] = true
NotificationCenter.default.post(name: .dataNukeRequested, object: nil, userInfo: nil) NotificationCenter.default.post(name: .dataNukeRequested, object: nil, userInfo: nil)
} }
} }