Soft logout: Implement the clear data button

#2540
This commit is contained in:
manuroe
2019-07-23 16:20:07 +02:00
parent bdcb548f42
commit 37949f342f
6 changed files with 83 additions and 1 deletions
@@ -39,6 +39,7 @@
// Observer that checks when the Authentification view controller has gone.
id authViewControllerObserver;
id authViewRemovedAccountObserver;
// The parameters to pass to the Authentification view controller.
NSDictionary *authViewControllerRegistrationParameters;
@@ -231,6 +232,11 @@
[[NSNotificationCenter defaultCenter] removeObserver:authViewControllerObserver];
authViewControllerObserver = nil;
}
if (authViewRemovedAccountObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:authViewRemovedAccountObserver];
authViewRemovedAccountObserver = nil;
}
if (kThemeServiceDidChangeThemeNotificationObserver)
{
@@ -664,6 +670,15 @@
[[NSNotificationCenter defaultCenter] removeObserver:authViewControllerObserver];
authViewControllerObserver = nil;
}];
authViewRemovedAccountObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKAccountManagerDidRemoveAccountNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
// The user has cleared data for their soft logged out account
_authViewController = nil;
[[NSNotificationCenter defaultCenter] removeObserver:authViewRemovedAccountObserver];
authViewRemovedAccountObserver = nil;
}];
// Forward parameters if any
if (authViewControllerRegistrationParameters)