From 51b0510edc0642f6e390043ab20298c4a5ee6ba6 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 18 Jun 2024 12:20:05 +0930 Subject: [PATCH] Use MutableSharedFlow for errors in NewMessage --- .../conversation/newmessage/NewMessageViewModel.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt index a7e370fdbf..f61cc7d1a1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt @@ -34,10 +34,10 @@ internal class NewMessageViewModel @Inject constructor( val state = _state.asStateFlow() private val _success = MutableSharedFlow() - val success: Flow get() = _success.asSharedFlow() + val success get() = _success.asSharedFlow() - private val _qrErrors = Channel() - val qrErrors: Flow = _qrErrors.receiveAsFlow() + private val _qrErrors = MutableSharedFlow() + val qrErrors = _qrErrors.asSharedFlow() private var loadOnsJob: Job? = null @@ -62,7 +62,7 @@ internal class NewMessageViewModel @Inject constructor( if (PublicKeyValidation.isValid(value, isPrefixRequired = false) && PublicKeyValidation.hasValidPrefix(value)) { onPublicKey(value) } else { - _qrErrors.trySend(application.getString(R.string.this_qr_code_does_not_contain_an_account_id)) + _qrErrors.tryEmit(application.getString(R.string.this_qr_code_does_not_contain_an_account_id)) } }