Skip to content

Commit

Permalink
fix(auth): use areTokensValid instead of hasAuthenticated
Browse files Browse the repository at this point in the history
Comment from Qui:

`hasAuthenticated` indicates the user has authenticated at least once.
This is true even when the refresh token expires.
I'll add documentation later to make things clearer.
Change this to use the areTokensValid property.
This means the refresh token expiration is in the future and the user won't need to re-authenticate any time soon.
So when areTokensValid = true the login options don't need to be presented.
When false the user will want to re-authenticate to get a new refresh token.
  • Loading branch information
deepanchal committed Sep 4, 2023
1 parent 51eb431 commit b92e251
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RootAuthViewModel @Inject constructor(
): ViewModel() {
val authState = accountDataRepository.accountData
.map {
if (it.hasAuthenticated) {
if (it.areTokensValid) {
AuthState.Authenticated(it)
} else {
AuthState.NotAuthenticated
Expand Down

0 comments on commit b92e251

Please sign in to comment.