Skip to content

Commit

Permalink
If adding an already added account, set SignInType manually
Browse files Browse the repository at this point in the history
  • Loading branch information
mchowning committed May 4, 2023
1 parent 995112f commit d13c31b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,15 @@ class SyncAccountManager @Inject constructor(
AccountConstants.SIGN_IN_TYPE_KEY to AccountConstants.SignInType.Tokens.value,
AccountConstants.LOGIN_IDENTITY to loginIdentity.value
)
accountManager.addAccountExplicitly(account, refreshToken.value, userData)
val accountAdded = accountManager.addAccountExplicitly(account, refreshToken.value, userData)
accountManager.setAuthToken(account, AccountConstants.TOKEN_TYPE, accessToken.value)

// When the account was already added, set the sign in type to Tokens because the account
// does not seem to get updated with this from the userData in the addAccountExplicitly call
if (!accountAdded) {
LogBuffer.i(LogBuffer.TAG_BACKGROUND_TASKS, "Account already added, setting sign in type to Tokens")
accountManager.setUserData(account, AccountConstants.SIGN_IN_TYPE_KEY, AccountConstants.SignInType.Tokens.value)
}
}

fun signOut() {
Expand Down

0 comments on commit d13c31b

Please sign in to comment.