diff --git a/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsFragment.kt b/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsFragment.kt index 498292bd52..b707a7e6e4 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsFragment.kt @@ -20,7 +20,6 @@ import android.os.Bundle import android.view.View import androidx.appcompat.app.AlertDialog import androidx.core.view.isVisible -import com.airbnb.mvrx.Loading import com.airbnb.mvrx.args import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState @@ -82,7 +81,7 @@ class RoomSettingsFragment @Inject constructor( } private fun renderRoomSummary(state: RoomSettingsViewState) { - waiting_view.isVisible = state.currentRequest is Loading + waiting_view.isVisible = state.isLoading state.roomSummary()?.let { roomSettingsToolbarTitleView.text = it.displayName diff --git a/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewModel.kt b/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewModel.kt index fad8504e01..27386c141c 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewModel.kt @@ -71,13 +71,13 @@ class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState: private fun handleEnableEncryption() { setState { - copy(currentRequest = Loading()) + copy(isLoading = true) } room.enableEncryption(MXCRYPTO_ALGORITHM_MEGOLM, object : MatrixCallback { override fun onFailure(failure: Throwable) { setState { - copy(currentRequest = Uninitialized) + copy(isLoading = false) } _requestErrorLiveData.postLiveEvent(failure) @@ -85,7 +85,7 @@ class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState: override fun onSuccess(data: Unit) { setState { - copy(currentRequest = Uninitialized) + copy(isLoading = false) } } }) diff --git a/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewState.kt b/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewState.kt index b3be2e308e..d68ed6853e 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewState.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomprofile/settings/RoomSettingsViewState.kt @@ -25,7 +25,7 @@ import im.vector.riotx.features.roomprofile.RoomProfileArgs data class RoomSettingsViewState( val roomId: String, val roomSummary: Async = Uninitialized, - val currentRequest: Async = Uninitialized + val isLoading: Boolean = false ) : MvRxState { constructor(args: RoomProfileArgs) : this(roomId = args.roomId)