Skip to content

Commit

Permalink
Merge pull request #1955 from nextcloud/fix/noid/app-crash-when-app-t…
Browse files Browse the repository at this point in the history
…oken-is-revoked

fix: App crash when app token is revoked
  • Loading branch information
SystemKeeper authored Jan 23, 2025
2 parents c707966 + 9e7dac5 commit a170654
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions NextcloudTalk/NCSettingsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ - (void)tokenRevokedResponseReceived:(NSNotification *)notification
{
NSString *accountId = [notification.userInfo objectForKey:@"accountId"];
[self logoutAccountWithAccountId:accountId withCompletionBlock:^(NSError *error) {
[[NCUserInterfaceController sharedInstance] presentConversationsList];
[[NCUserInterfaceController sharedInstance] presentLoggedOutInvalidCredentialsAlert];
[[NCConnectionController sharedInstance] checkAppState];
if (!error) {
[[NCUserInterfaceController sharedInstance] presentConversationsList];
[[NCUserInterfaceController sharedInstance] presentLoggedOutInvalidCredentialsAlert];
[[NCConnectionController sharedInstance] checkAppState];
}
}];
}

Expand Down Expand Up @@ -417,6 +419,15 @@ - (void)getUserProfileForAccountId:(NSString *)accountId withCompletionBlock:(Up
- (void)logoutAccountWithAccountId:(NSString *)accountId withCompletionBlock:(LogoutCompletionBlock)block
{
TalkAccount *removingAccount = [[NCDatabaseManager sharedInstance] talkAccountForAccountId:accountId];

if (!removingAccount) {
if (block) {
NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:nil];
block(error);
}
return;
}

if (removingAccount.deviceIdentifier) {
[[NCAPIController sharedInstance] unsubscribeAccount:removingAccount fromNextcloudServerWithCompletionBlock:^(NSError *error) {
if (!error) {
Expand Down

0 comments on commit a170654

Please sign in to comment.