From b7bc3df2a9bce970cc7c11628efb4993b36cfb37 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:00:38 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20button=20keeps=20spinning=20when=20user?= =?UTF-8?q?=20starts=20a=20conversation=20and=20back=20(WPB-5862)=20?= =?UTF-8?q?=F0=9F=8D=92=20(#3386)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yamil Medina --- .../ui/connection/ConnectionActionButtonViewModel.kt | 6 ++++-- .../ui/connection/ConnectionActionButtonViewModelTest.kt | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModel.kt index 1c6eec7bd56..3c24862f4b1 100644 --- a/app/src/main/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModel.kt @@ -202,9 +202,11 @@ class ConnectionActionButtonViewModelImpl @Inject constructor( if (result.coreFailure is CoreFailure.MissingKeyPackages) onMissingKeyPackages() } - is CreateConversationResult.Success -> onSuccess(result.conversation.id) + is CreateConversationResult.Success -> { + state = state.finishAction() + onSuccess(result.conversation.id) + } } - state.finishAction() } } diff --git a/app/src/test/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModelTest.kt b/app/src/test/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModelTest.kt index 1ca42505d07..58f1e3be4c8 100644 --- a/app/src/test/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModelTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/connection/ConnectionActionButtonViewModelTest.kt @@ -275,6 +275,7 @@ class ConnectionActionButtonViewModelTest { } verify { arrangement.onOpenConversation(any()) } verify { arrangement.onMissingKeyPackages wasNot Called } + assertEquals(false, viewModel.actionableState().isPerformingAction) } @Test @@ -294,6 +295,7 @@ class ConnectionActionButtonViewModelTest { } verify { arrangement.onOpenConversation wasNot Called } verify { arrangement.onMissingKeyPackages wasNot Called } + assertEquals(false, viewModel.actionableState().isPerformingAction) } @Test @@ -313,6 +315,7 @@ class ConnectionActionButtonViewModelTest { } verify { arrangement.onOpenConversation wasNot Called } verify { arrangement.onMissingKeyPackages() } + assertEquals(false, viewModel.actionableState().isPerformingAction) } companion object {