Use AsyncView in EditUserProfileView

This commit is contained in:
Benoit Marty 2023-11-03 16:35:34 +01:00 committed by Benoit Marty
parent 6ad2c99576
commit aaa89afe34
7 changed files with 24 additions and 37 deletions

View file

@ -149,12 +149,11 @@ fun ConfigureRoomView(
onActionSelected = { state.eventSink(ConfigureRoomEvents.HandleAvatarAction(it)) }
)
val errorMessage = stringResource(R.string.screen_create_room_error_creating_room)
AsyncView(
async = state.createRoomAction,
progressText = stringResource(CommonStrings.common_creating_room),
onSuccess = { onRoomCreated(it) },
errorTransform = { errorMessage },
errorMessage = { stringResource(R.string.screen_create_room_error_creating_room) },
onRetry = { state.eventSink(ConfigureRoomEvents.CreateRoom(state.config)) },
onErrorDismiss = { state.eventSink(ConfigureRoomEvents.CancelCreateRoom) },
)

View file

@ -93,12 +93,11 @@ fun CreateRoomRootView(
}
}
val errorMessage = stringResource(R.string.screen_start_chat_error_starting_chat)
AsyncView(
async = state.startDmAction,
progressText = stringResource(CommonStrings.common_starting_chat),
onSuccess = { onOpenDM(it) },
errorTransform = { errorMessage },
errorMessage = { stringResource(R.string.screen_start_chat_error_starting_chat) },
onRetry = {
state.userListState.selectedUsers.firstOrNull()
?.let { state.eventSink(CreateRoomRootEvents.StartDM(it)) }