From 98b0bcc91c39e36ad8728091815088f8004f2d1c Mon Sep 17 00:00:00 2001 From: Konstantin Ivanov <54908981+konstantiniiv@users.noreply.github.com> Date: Thu, 22 May 2025 12:47:03 +0200 Subject: [PATCH] DROID-3659 Multiplayer | Invite loading screen, dismiss (#2433) --- .../multiplayer/RequestJoinSpaceFragment.kt | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/anytypeio/anytype/ui/multiplayer/RequestJoinSpaceFragment.kt b/app/src/main/java/com/anytypeio/anytype/ui/multiplayer/RequestJoinSpaceFragment.kt index 04fab586d1..74c49b3e1e 100644 --- a/app/src/main/java/com/anytypeio/anytype/ui/multiplayer/RequestJoinSpaceFragment.kt +++ b/app/src/main/java/com/anytypeio/anytype/ui/multiplayer/RequestJoinSpaceFragment.kt @@ -94,22 +94,24 @@ class RequestJoinSpaceFragment : BaseBottomSheetComposeFragment() { } } MaterialTheme(typography = typography) { - val showModal = vm.showEnableNotificationDialog.collectAsStateWithLifecycle().value - val isLoadingInvite = vm.showLoadingInviteProgress.collectAsStateWithLifecycle().value - when(val state = vm.state.collectAsStateWithLifecycle().value) { + val showModal = + vm.showEnableNotificationDialog.collectAsStateWithLifecycle().value + val isLoadingInvite = + vm.showLoadingInviteProgress.collectAsStateWithLifecycle().value + when (val state = vm.state.collectAsStateWithLifecycle().value) { is TypedViewState.Loading, is TypedViewState.Success -> { val isLoading: Boolean val spaceName: String val createdByName: String - val withoutApprove : Boolean + val withoutApprove: Boolean if (state is TypedViewState.Loading) { isLoading = true spaceName = stringResource(R.string.three_dots_text_placeholder) createdByName = stringResource(R.string.three_dots_text_placeholder) withoutApprove = false - } - else { - isLoading = vm.isRequestInProgress.collectAsStateWithLifecycle().value + } else { + isLoading = + vm.isRequestInProgress.collectAsStateWithLifecycle().value with(state as TypedViewState.Success) { spaceName = state.data.spaceName createdByName = state.data.creatorName @@ -121,7 +123,10 @@ class RequestJoinSpaceFragment : BaseBottomSheetComposeFragment() { .fillMaxWidth() .windowInsetsPadding(WindowInsets.navigationBars), onDismissRequest = { - if (!isLoadingInvite) { + if (isLoadingInvite) { + vm.onCancelLoadingInviteClicked() + dismiss() + } else { dismiss() } }, @@ -172,8 +177,9 @@ class RequestJoinSpaceFragment : BaseBottomSheetComposeFragment() { } } } + is TypedViewState.Error -> { - when(val err = state.error) { + when (val err = state.error) { is ErrorView.AlreadySpaceMember -> { Announcement( title = stringResource(id = R.string.multiplayer_already_space_member),