From 916eda47900d121e6570816b4fdd86fb52aa4ae8 Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Mon, 26 Aug 2024 12:11:05 +0200 Subject: [PATCH] fix: the eternal spin of the conneciton button --- .../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 18aef539992..47cefa4ed89 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 @@ -206,9 +206,11 @@ class ConnectionActionButtonViewModelImpl @Inject constructor( onFailure(result.coreFailure) } - 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 5e445ce6379..5dc267d6f2e 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 @@ -256,6 +256,7 @@ class ConnectionActionButtonViewModelTest { } verify { arrangement.onOpenConversation(any()) } verify { arrangement.onStartConversationError wasNot Called } + assertEquals(false, viewModel.actionableState().isPerformingAction) } @Test @@ -275,6 +276,7 @@ class ConnectionActionButtonViewModelTest { } verify { arrangement.onOpenConversation wasNot Called } verify { arrangement.onStartConversationError(eq(failure)) } + assertEquals(false, viewModel.actionableState().isPerformingAction) } @Test @@ -295,6 +297,7 @@ class ConnectionActionButtonViewModelTest { } verify { arrangement.onOpenConversation wasNot Called } verify { arrangement.onStartConversationError(eq(errorResult)) } + assertEquals(false, viewModel.actionableState().isPerformingAction) } companion object {