From 534b4d16c346ba58b3a00455caeb903c4197d98c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 19 Jan 2026 18:19:20 +0100 Subject: [PATCH] CrashDetectionEvents -> CrashDetectionEvent --- .../kotlin/io/element/android/appnav/root/RootView.kt | 4 ++-- .../{CrashDetectionEvents.kt => CrashDetectionEvent.kt} | 6 +++--- .../features/rageshake/api/crash/CrashDetectionState.kt | 2 +- .../features/rageshake/api/crash/CrashDetectionView.kt | 2 +- .../impl/crash/DefaultCrashDetectionPresenter.kt | 8 ++++---- .../impl/crash/ui/CrashDetectionPresenterTest.kt | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) rename features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/{CrashDetectionEvents.kt => CrashDetectionEvent.kt} (65%) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt b/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt index 23f0d7f44a..32c8e52084 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt @@ -15,7 +15,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.PreviewParameter -import io.element.android.features.rageshake.api.crash.CrashDetectionEvents +import io.element.android.features.rageshake.api.crash.CrashDetectionEvent import io.element.android.features.rageshake.api.crash.CrashDetectionView import io.element.android.features.rageshake.api.detection.RageshakeDetectionEvent import io.element.android.features.rageshake.api.detection.RageshakeDetectionView @@ -39,7 +39,7 @@ fun RootView( children() fun onOpenBugReport() { - state.crashDetectionState.eventSink(CrashDetectionEvents.ResetAppHasCrashed) + state.crashDetectionState.eventSink(CrashDetectionEvent.ResetAppHasCrashed) state.rageshakeDetectionState.eventSink(RageshakeDetectionEvent.Dismiss) onOpenBugReport.invoke() } diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvents.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvent.kt similarity index 65% rename from features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvents.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvent.kt index 89c49338d1..9a95910c13 100644 --- a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvents.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvent.kt @@ -8,7 +8,7 @@ package io.element.android.features.rageshake.api.crash -sealed interface CrashDetectionEvents { - data object ResetAllCrashData : CrashDetectionEvents - data object ResetAppHasCrashed : CrashDetectionEvents +sealed interface CrashDetectionEvent { + data object ResetAllCrashData : CrashDetectionEvent + data object ResetAppHasCrashed : CrashDetectionEvent } diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionState.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionState.kt index dd08cbf86c..9c29dc4e7b 100644 --- a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionState.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionState.kt @@ -11,5 +11,5 @@ package io.element.android.features.rageshake.api.crash data class CrashDetectionState( val appName: String, val crashDetected: Boolean, - val eventSink: (CrashDetectionEvents) -> Unit + val eventSink: (CrashDetectionEvent) -> Unit ) diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt index 57d28527ca..5db1d4f076 100644 --- a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt @@ -22,7 +22,7 @@ fun CrashDetectionView( onOpenBugReport: () -> Unit = { }, ) { fun onPopupDismissed() { - state.eventSink(CrashDetectionEvents.ResetAllCrashData) + state.eventSink(CrashDetectionEvent.ResetAllCrashData) } if (state.crashDetected) { diff --git a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt index 25afadec57..b75d36f21f 100644 --- a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt @@ -18,7 +18,7 @@ import androidx.compose.runtime.rememberCoroutineScope import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding import io.element.android.features.rageshake.api.RageshakeFeatureAvailability -import io.element.android.features.rageshake.api.crash.CrashDetectionEvents +import io.element.android.features.rageshake.api.crash.CrashDetectionEvent import io.element.android.features.rageshake.api.crash.CrashDetectionPresenter import io.element.android.features.rageshake.api.crash.CrashDetectionState import io.element.android.libraries.core.meta.BuildMeta @@ -48,10 +48,10 @@ class DefaultCrashDetectionPresenter( } }.collectAsState(false) - fun handleEvent(event: CrashDetectionEvents) { + fun handleEvent(event: CrashDetectionEvent) { when (event) { - CrashDetectionEvents.ResetAllCrashData -> localCoroutineScope.resetAll() - CrashDetectionEvents.ResetAppHasCrashed -> localCoroutineScope.resetAppHasCrashed() + CrashDetectionEvent.ResetAllCrashData -> localCoroutineScope.resetAll() + CrashDetectionEvent.ResetAppHasCrashed -> localCoroutineScope.resetAppHasCrashed() } } diff --git a/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/crash/ui/CrashDetectionPresenterTest.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/crash/ui/CrashDetectionPresenterTest.kt index dcaaa20a69..b2b496cf39 100644 --- a/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/crash/ui/CrashDetectionPresenterTest.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/crash/ui/CrashDetectionPresenterTest.kt @@ -12,7 +12,7 @@ import app.cash.molecule.RecompositionMode import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat -import io.element.android.features.rageshake.api.crash.CrashDetectionEvents +import io.element.android.features.rageshake.api.crash.CrashDetectionEvent import io.element.android.features.rageshake.impl.crash.A_CRASH_DATA import io.element.android.features.rageshake.impl.crash.DefaultCrashDetectionPresenter import io.element.android.features.rageshake.impl.crash.FakeCrashDataStore @@ -80,7 +80,7 @@ class CrashDetectionPresenterTest { skipItems(1) val initialState = awaitItem() assertThat(initialState.crashDetected).isTrue() - initialState.eventSink.invoke(CrashDetectionEvents.ResetAppHasCrashed) + initialState.eventSink.invoke(CrashDetectionEvent.ResetAppHasCrashed) assertThat(awaitItem().crashDetected).isFalse() } } @@ -96,7 +96,7 @@ class CrashDetectionPresenterTest { skipItems(1) val initialState = awaitItem() assertThat(initialState.crashDetected).isTrue() - initialState.eventSink.invoke(CrashDetectionEvents.ResetAllCrashData) + initialState.eventSink.invoke(CrashDetectionEvent.ResetAllCrashData) assertThat(awaitItem().crashDetected).isFalse() } }