Hi there !
I believe there's an issue with the way anonymous accounts are handled, that would prevent from upgrading to a full account.
This is especially problematic when you want to backup your data to migrate to a new device, since no backup option is available (relevant issue #160).
Steps to reproduce
- On a fresh install, open the app. You are greeted by the login screen.
- Click Skip this for now. It states You can always upgrade to a regular account later on. ; click Login.
- On the main menu, click on the ⋮ button.
Expected result : A button to upgrade to a full account is shown
Actual result : No action is shown in the user section
I have never worked with Kotlin so I may very well be wrong here, but I believe the issue stems from the fact that despite the code being present in at.shockbytes.dante.ui.custom.profile.ProfileActionViewState
|
fun forAnonymousUser(): ProfileActionViewState { |
|
return Visible( |
|
showUpgrade = true, |
|
showChangeName = true, |
|
showChangeImage = true, |
|
showChangePassword = false |
|
) |
|
} |
The line AuthenticationSource.ANONYMOUS -> ProfileActionViewState.forAnonymousUser() is never reached in at.shockbytes.dante.ui.viewmodel.UserViewModel
|
private fun mapUserStateToUserEvent(userState: UserState) = when (userState) { |
|
is UserState.SignedInUser -> { |
|
UserViewState.LoggedIn(userState.user, resolveProfileActionViewState(userState.user)) |
|
} |
|
is UserState.Unauthenticated -> { |
|
UserViewState.UnauthenticatedUser |
|
} |
|
} |
|
|
|
private fun resolveProfileActionViewState(user: DanteUser): ProfileActionViewState { |
|
return when (user.authenticationSource) { |
|
AuthenticationSource.GOOGLE -> ProfileActionViewState.forGoogleUser() |
|
AuthenticationSource.MAIL -> ProfileActionViewState.forMailUser() |
|
AuthenticationSource.ANONYMOUS -> ProfileActionViewState.forAnonymousUser() |
|
else -> ProfileActionViewState.Hidden |
|
} |
|
} |
Because anonymous accounts seem to be treated as UserState.Unauthenticated. It is not exactly clear to me why that is the case though.
As a result, the relevant buttons are not shown in the menu :
|
is UserViewModel.UserViewState.UnauthenticatedUser -> { |
|
vb.btnMenuLogin.text = getString(R.string.login) |
|
|
|
vb.profileActionViewMenu.setState(ProfileActionViewState.Hidden) |
|
vb.profileHeaderMenu.reset() |
|
} |
Hi there !
I believe there's an issue with the way anonymous accounts are handled, that would prevent from upgrading to a full account.
This is especially problematic when you want to backup your data to migrate to a new device, since no backup option is available (relevant issue #160).
Steps to reproduce
Expected result : A button to upgrade to a full account is shown
Actual result : No action is shown in the user section
I have never worked with Kotlin so I may very well be wrong here, but I believe the issue stems from the fact that despite the code being present in
at.shockbytes.dante.ui.custom.profile.ProfileActionViewStateDante/app/src/main/java/at/shockbytes/dante/ui/custom/profile/ProfileActionViewState.kt
Lines 29 to 36 in 8b5b104
The line
AuthenticationSource.ANONYMOUS -> ProfileActionViewState.forAnonymousUser()is never reached inat.shockbytes.dante.ui.viewmodel.UserViewModelDante/app/src/main/java/at/shockbytes/dante/ui/viewmodel/UserViewModel.kt
Lines 109 to 125 in 8b5b104
Because anonymous accounts seem to be treated as
UserState.Unauthenticated. It is not exactly clear to me why that is the case though.As a result, the relevant buttons are not shown in the menu :
Dante/app/src/main/java/at/shockbytes/dante/ui/fragment/MenuFragment.kt
Lines 103 to 108 in 8b5b104