Avoid tryEmit(), use emit()

This commit is contained in:
Benoit Marty 2024-03-26 15:29:12 +01:00 committed by Benoit Marty
parent a83952814f
commit 74048cca8f
11 changed files with 21 additions and 19 deletions

View file

@ -48,30 +48,30 @@ class FakeNotificationTroubleshootTest(
}
}
override fun reset() {
override suspend fun reset() {
updateState(
name = defaultName,
description = defaultDescription,
status = firstStatus,
)
resetAction()?.let {
_state.tryEmit(it)
_state.emit(it)
}
}
override suspend fun quickFix(coroutineScope: CoroutineScope) {
updateState(NotificationTroubleshootTestState.Status.InProgress)
quickFixAction()?.let {
_state.tryEmit(it)
_state.emit(it)
}
}
fun updateState(
suspend fun updateState(
status: NotificationTroubleshootTestState.Status,
name: String = defaultName,
description: String = defaultDescription,
) {
_state.tryEmit(
_state.emit(
NotificationTroubleshootTestState(
name = name,
description = description,