From 27c59a8d7b9eb17cd90c974b4d68fea6253e41f9 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 21 Jun 2024 11:45:50 +0930 Subject: [PATCH] Remove flowOn in LoadingViewModel --- .../onboarding/loading/LoadingViewModel.kt | 15 +++++++++------ .../org/thoughtcrime/securesms/ui/color/Colors.kt | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/LoadingViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/LoadingViewModel.kt index 3a837b76f1..9cfa86c693 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/LoadingViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loading/LoadingViewModel.kt @@ -49,22 +49,25 @@ internal class LoadingViewModel @Inject constructor( .onStart { emit(TextSecurePreferences.CONFIGURATION_SYNCED) } .filter { prefs.getConfigurationMessageSynced() } .timeout(TIMEOUT_TIME) - .flowOn(Dispatchers.Main) .collectLatest { onSuccess() } } catch (e: Exception) { - withContext(Dispatchers.Main) { onFail() } + onFail() } } } private suspend fun onSuccess() { - _states.value = State(ANIMATE_TO_DONE_TIME) - delay(IDLE_DONE_TIME) - _events.emit(Event.SUCCESS) + withContext(Dispatchers.Main) { + _states.value = State(ANIMATE_TO_DONE_TIME) + delay(IDLE_DONE_TIME) + _events.emit(Event.SUCCESS) + } } private suspend fun onFail() { - _events.emit(Event.TIMEOUT) + withContext(Dispatchers.Main) { + _events.emit(Event.TIMEOUT) + } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/color/Colors.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/color/Colors.kt index f2f96f8c15..1369661b9d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/color/Colors.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/color/Colors.kt @@ -40,7 +40,7 @@ interface Colors { val backgroundBubbleSent: Color get() = primary // buttonFill - val buttonFill: Color get() = text + val buttonFill: Color val buttonFillText: Color get() = background // primaryButtonFill