From 14d625765c6a1fef4b11b5c997f2f786d723cf8f Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 29 Sep 2022 16:25:33 +0100 Subject: [PATCH] avoiding try emit --- .../main/kotlin/app/dapk/st/messenger/MessengerViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerViewModel.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerViewModel.kt index aead223..94a59f1 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerViewModel.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerViewModel.kt @@ -126,7 +126,9 @@ internal class MessengerViewModel( } fun startAttachment() { - _events.tryEmit(MessengerEvent.SelectImageAttachment) + viewModelScope.launch { + _events.emit(MessengerEvent.SelectImageAttachment) + } } }