mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Avoid tryEmit(), use emit()
This commit is contained in:
committed by
Benoit Marty
parent
a83952814f
commit
74048cca8f
+4
-2
@@ -24,6 +24,8 @@ interface NotificationTroubleshootTest {
|
||||
val state: StateFlow<NotificationTroubleshootTestState>
|
||||
fun isRelevant(data: TestFilterData): Boolean = true
|
||||
suspend fun run(coroutineScope: CoroutineScope)
|
||||
fun reset()
|
||||
suspend fun quickFix(coroutineScope: CoroutineScope) {}
|
||||
suspend fun reset()
|
||||
suspend fun quickFix(coroutineScope: CoroutineScope) {
|
||||
error("Quick fix not implemented, you need to override this method in your test")
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -41,12 +41,12 @@ class NotificationTroubleshootTestDelegate(
|
||||
|
||||
val state: StateFlow<NotificationTroubleshootTestState> = _state.asStateFlow()
|
||||
|
||||
fun updateState(
|
||||
suspend fun updateState(
|
||||
status: NotificationTroubleshootTestState.Status,
|
||||
name: String = defaultName,
|
||||
description: String = defaultDescription,
|
||||
) {
|
||||
_state.tryEmit(
|
||||
_state.emit(
|
||||
NotificationTroubleshootTestState(
|
||||
name = name,
|
||||
description = description,
|
||||
@@ -55,7 +55,7 @@ class NotificationTroubleshootTestDelegate(
|
||||
)
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
suspend fun reset() {
|
||||
updateState(NotificationTroubleshootTestState.Status.Idle(visibleWhenIdle))
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class NotificationTroubleshootTestDelegate(
|
||||
delay(fakeDelay)
|
||||
}
|
||||
|
||||
fun done(isSuccess: Boolean = true) {
|
||||
suspend fun done(isSuccess: Boolean = true) {
|
||||
updateState(
|
||||
if (isSuccess) {
|
||||
NotificationTroubleshootTestState.Status.Success
|
||||
|
||||
Reference in New Issue
Block a user