mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Use MutableSharedFlow for errors in NewMessage
This commit is contained in:
parent
4e43f6077d
commit
51b0510edc
@ -34,10 +34,10 @@ internal class NewMessageViewModel @Inject constructor(
|
|||||||
val state = _state.asStateFlow()
|
val state = _state.asStateFlow()
|
||||||
|
|
||||||
private val _success = MutableSharedFlow<Success>()
|
private val _success = MutableSharedFlow<Success>()
|
||||||
val success: Flow<Success> get() = _success.asSharedFlow()
|
val success get() = _success.asSharedFlow()
|
||||||
|
|
||||||
private val _qrErrors = Channel<String>()
|
private val _qrErrors = MutableSharedFlow<String>()
|
||||||
val qrErrors: Flow<String> = _qrErrors.receiveAsFlow()
|
val qrErrors = _qrErrors.asSharedFlow()
|
||||||
|
|
||||||
private var loadOnsJob: Job? = null
|
private var loadOnsJob: Job? = null
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ internal class NewMessageViewModel @Inject constructor(
|
|||||||
if (PublicKeyValidation.isValid(value, isPrefixRequired = false) && PublicKeyValidation.hasValidPrefix(value)) {
|
if (PublicKeyValidation.isValid(value, isPrefixRequired = false) && PublicKeyValidation.hasValidPrefix(value)) {
|
||||||
onPublicKey(value)
|
onPublicKey(value)
|
||||||
} else {
|
} 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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user