mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Merge pull request #1895 from vector-im/fix_account_deactivation_completion
Fix account deactivation completion
This commit is contained in:
commit
1fe6e98b94
4 changed files with 19 additions and 7 deletions
|
@ -117,9 +117,12 @@ extern NSString *const kAppDelegateNetworkStatusDidChangeNotification;
|
|||
Log out all the accounts without confirmation.
|
||||
Show the authentication screen on successful logout.
|
||||
|
||||
@param sendLogoutRequest Indicate whether send logout request to home server.
|
||||
@param completion the block to execute at the end of the operation.
|
||||
*/
|
||||
- (void)logoutWithCompletion:(void (^)(BOOL isLoggedOut))completion;
|
||||
- (void)logoutSendingRequestServer:(BOOL)sendLogoutServerRequest
|
||||
completion:(void (^)(BOOL isLoggedOut))completion;
|
||||
|
||||
|
||||
#pragma mark - Matrix Accounts handling
|
||||
|
||||
|
|
|
@ -2677,7 +2677,7 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
|
|||
[topVC startActivityIndicator];
|
||||
}
|
||||
|
||||
[self logoutWithCompletion:^(BOOL isLoggedOut) {
|
||||
[self logoutSendingRequestServer:YES completion:^(BOOL isLoggedOut) {
|
||||
if (completion)
|
||||
{
|
||||
completion (YES);
|
||||
|
@ -2685,7 +2685,8 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
|
|||
}];
|
||||
}
|
||||
|
||||
- (void)logoutWithCompletion:(void (^)(BOOL isLoggedOut))completion
|
||||
- (void)logoutSendingRequestServer:(BOOL)sendLogoutServerRequest
|
||||
completion:(void (^)(BOOL isLoggedOut))completion
|
||||
{
|
||||
self.pushRegistry = nil;
|
||||
isPushRegistered = NO;
|
||||
|
|
|
@ -203,7 +203,7 @@ static CGFloat const kTextFontSize = 15.0;
|
|||
- (void)enableUserActions:(BOOL)enableUserActions
|
||||
{
|
||||
self.navigationItem.rightBarButtonItem.enabled = enableUserActions;
|
||||
self.forgetMessageButton.enabled = enableUserActions;
|
||||
self.forgetMessageButton.userInteractionEnabled = enableUserActions;
|
||||
self.deactivateAcccountButton.enabled = enableUserActions;
|
||||
}
|
||||
|
||||
|
@ -272,8 +272,15 @@ static CGFloat const kTextFontSize = 15.0;
|
|||
[self.mainSession deactivateAccountWithAuthParameters:authParameters eraseAccount:eraseAllMessages success:^{
|
||||
NSLog(@"[SettingsViewController] Deactivate account with success");
|
||||
|
||||
[weakSelf stopActivityIndicator];
|
||||
[weakSelf enableUserActions:YES];
|
||||
typeof(weakSelf) strongSelf = weakSelf;
|
||||
|
||||
if (strongSelf)
|
||||
{
|
||||
[strongSelf stopActivityIndicator];
|
||||
[strongSelf enableUserActions:YES];
|
||||
[strongSelf.delegate deactivateAccountViewControllerDidDeactivateWithSuccess:strongSelf];
|
||||
}
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
NSLog(@"[SettingsViewController] Failed to deactivate account");
|
||||
|
|
|
@ -4103,7 +4103,8 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
|||
{
|
||||
NSLog(@"[SettingsViewController] Deactivate account with success");
|
||||
|
||||
[[AppDelegate theDelegate] logoutWithCompletion:^(BOOL isLoggedOut) {
|
||||
|
||||
[[AppDelegate theDelegate] logoutSendingRequestServer:NO completion:^(BOOL isLoggedOut) {
|
||||
NSLog(@"[SettingsViewController] Complete clear user data after account deactivation");
|
||||
}];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue