Convert to ViewEvents -> Cleanup after review
This commit is contained in:
parent
5b13be6332
commit
7e362be568
|
@ -23,9 +23,6 @@ import im.vector.riotx.core.platform.VectorViewEvents
|
|||
* Transient events for create direct room screen
|
||||
*/
|
||||
sealed class CreateDirectRoomViewEvents : VectorViewEvents {
|
||||
// data class Loading(val message: CharSequence? = null) : RoomDirectoryViewEvents()
|
||||
// data class Failure(val throwable: Throwable) : CreateDirectViewEvents()
|
||||
|
||||
data class SelectUserAction(
|
||||
val user: User,
|
||||
val isAdded: Boolean,
|
||||
|
|
|
@ -22,8 +22,5 @@ import im.vector.riotx.core.platform.VectorViewEvents
|
|||
* Transient events for the verification bottom sheet
|
||||
*/
|
||||
sealed class VerificationBottomSheetViewEvents : VectorViewEvents {
|
||||
// data class Loading(val message: CharSequence? = null) : RoomDirectoryViewEvents()
|
||||
// data class Failure(val throwable: Throwable) : CreateDirectViewEvents()
|
||||
|
||||
object Dismiss : VerificationBottomSheetViewEvents()
|
||||
}
|
||||
|
|
|
@ -22,8 +22,5 @@ import im.vector.riotx.core.platform.VectorViewEvents
|
|||
* Transient events for group list screen
|
||||
*/
|
||||
sealed class GroupListViewEvents : VectorViewEvents {
|
||||
// data class Loading(val message: CharSequence? = null) : RoomDirectoryViewEvents()
|
||||
// data class Failure(val throwable: Throwable) : GroupListViewEvents()
|
||||
|
||||
object OpenGroupSummary : GroupListViewEvents()
|
||||
}
|
||||
|
|
|
@ -22,6 +22,5 @@ import im.vector.riotx.core.platform.VectorViewEvents
|
|||
* Transient events for room directory screen
|
||||
*/
|
||||
sealed class RoomDirectoryViewEvents : VectorViewEvents {
|
||||
// data class Loading(val message: CharSequence? = null) : RoomDirectoryViewEvents()
|
||||
data class Failure(val throwable: Throwable) : RoomDirectoryViewEvents()
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@ import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo
|
|||
import im.vector.riotx.core.platform.VectorViewModelAction
|
||||
|
||||
sealed class DeviceListAction : VectorViewModelAction {
|
||||
// TODO Valere, this is not used?
|
||||
object Refresh : DeviceListAction()
|
||||
|
||||
data class SelectDevice(val device: CryptoDeviceInfo) : DeviceListAction()
|
||||
object DeselectDevice : DeviceListAction()
|
||||
|
||||
|
|
|
@ -22,8 +22,5 @@ import im.vector.riotx.core.platform.VectorViewEvents
|
|||
* Transient events for device list screen
|
||||
*/
|
||||
sealed class DeviceListBottomSheetViewEvents : VectorViewEvents {
|
||||
// data class Loading(val message: CharSequence? = null) : RoomDirectoryViewEvents()
|
||||
// data class Failure(val throwable: Throwable) : DeviceListBottomSheetViewEvents()
|
||||
|
||||
data class Verify(val userId: String, val txID: String) : DeviceListBottomSheetViewEvents()
|
||||
}
|
||||
|
|
|
@ -69,14 +69,12 @@ class DeviceListBottomSheetViewModel @AssistedInject constructor(@Assisted priva
|
|||
|
||||
override fun handle(action: DeviceListAction) {
|
||||
when (action) {
|
||||
is DeviceListAction.Refresh -> refreshSelectedId()
|
||||
is DeviceListAction.SelectDevice -> selectDevice(action)
|
||||
is DeviceListAction.DeselectDevice -> deselectDevice()
|
||||
is DeviceListAction.ManuallyVerify -> manuallyVerify(action)
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
// TODO Valere: not used?
|
||||
private fun refreshSelectedId() = withState { state ->
|
||||
if (state.selectedDevice != null) {
|
||||
state.cryptoDevices.invoke()?.firstOrNull { state.selectedDevice.deviceId == it.deviceId }?.let {
|
||||
|
|
|
@ -22,7 +22,6 @@ import im.vector.riotx.core.platform.VectorViewEvents
|
|||
* Transient events for cross signing settings screen
|
||||
*/
|
||||
sealed class CrossSigningSettingsViewEvents : VectorViewEvents {
|
||||
// data class Loading(val message: CharSequence? = null) : RoomDirectoryViewEvents()
|
||||
data class Failure(val throwable: Throwable) : CrossSigningSettingsViewEvents()
|
||||
|
||||
object RequestPassword : CrossSigningSettingsViewEvents()
|
||||
|
|
|
@ -33,7 +33,6 @@ sealed class DevicesViewEvents : VectorViewEvents {
|
|||
|
||||
data class ShowVerifyDevice(
|
||||
val userId: String,
|
||||
val deviceId: String,
|
||||
val transactionId: String?
|
||||
) : DevicesViewEvents()
|
||||
}
|
||||
|
|
|
@ -176,7 +176,6 @@ class DevicesViewModel @AssistedInject constructor(@Assisted initialState: Devic
|
|||
val txID = session.getVerificationService().requestKeyVerification(supportedVerificationMethods, session.myUserId, listOf(action.deviceId))
|
||||
_viewEvents.post(DevicesViewEvents.ShowVerifyDevice(
|
||||
session.myUserId,
|
||||
action.deviceId,
|
||||
txID.transactionId
|
||||
))
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ class VectorSettingsDevicesFragment @Inject constructor(
|
|||
is DevicesViewEvents.RequestPassword -> maybeShowDeleteDeviceWithPasswordDialog()
|
||||
is DevicesViewEvents.PromptRenameDevice -> displayDeviceRenameDialog(it.deviceInfo)
|
||||
is DevicesViewEvents.ShowVerifyDevice -> {
|
||||
// TODO Valere: We should pass the deviceId here
|
||||
VerificationBottomSheet.withArgs(
|
||||
roomId = null,
|
||||
otherUserId = it.userId,
|
||||
|
|
Loading…
Reference in New Issue