Properly display registration status in top bar when it's refreshing

This commit is contained in:
Sylvain Berfini 2023-09-27 09:56:47 +02:00
parent 1f5e3ba646
commit ee13e451d7
2 changed files with 4 additions and 4 deletions

View file

@ -472,12 +472,12 @@ class AccountSettingsViewModel(val account: Account) : GenericSettingsViewModel(
iconResource.value = when (account.state) { iconResource.value = when (account.state) {
RegistrationState.Ok -> R.drawable.led_registered RegistrationState.Ok -> R.drawable.led_registered
RegistrationState.Failed -> R.drawable.led_error RegistrationState.Failed -> R.drawable.led_error
RegistrationState.Progress -> R.drawable.led_registration_in_progress RegistrationState.Progress, RegistrationState.Refreshing -> R.drawable.led_registration_in_progress
else -> R.drawable.led_not_registered else -> R.drawable.led_not_registered
} }
iconContentDescription.value = when (account.state) { iconContentDescription.value = when (account.state) {
RegistrationState.Ok -> R.string.status_connected RegistrationState.Ok -> R.string.status_connected
RegistrationState.Progress -> R.string.status_in_progress RegistrationState.Progress, RegistrationState.Refreshing -> R.string.status_in_progress
RegistrationState.Failed -> R.string.status_error RegistrationState.Failed -> R.string.status_error
else -> R.string.status_not_connected else -> R.string.status_not_connected
} }

View file

@ -101,7 +101,7 @@ open class StatusViewModel : ViewModel() {
private fun getStatusIconText(state: RegistrationState): Int { private fun getStatusIconText(state: RegistrationState): Int {
return when (state) { return when (state) {
RegistrationState.Ok -> R.string.status_connected RegistrationState.Ok -> R.string.status_connected
RegistrationState.Progress -> R.string.status_in_progress RegistrationState.Progress, RegistrationState.Refreshing -> R.string.status_in_progress
RegistrationState.Failed -> R.string.status_error RegistrationState.Failed -> R.string.status_error
else -> R.string.status_not_connected else -> R.string.status_not_connected
} }
@ -110,7 +110,7 @@ open class StatusViewModel : ViewModel() {
private fun getStatusIconResource(state: RegistrationState): Int { private fun getStatusIconResource(state: RegistrationState): Int {
return when (state) { return when (state) {
RegistrationState.Ok -> R.drawable.led_registered RegistrationState.Ok -> R.drawable.led_registered
RegistrationState.Progress -> R.drawable.led_registration_in_progress RegistrationState.Progress, RegistrationState.Refreshing -> R.drawable.led_registration_in_progress
RegistrationState.Failed -> R.drawable.led_error RegistrationState.Failed -> R.drawable.led_error
else -> R.drawable.led_not_registered else -> R.drawable.led_not_registered
} }