mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 03:06:14 +00:00
ShareEvents -> ShareEvent
This commit is contained in:
+2
-2
@@ -8,6 +8,6 @@
|
||||
|
||||
package io.element.android.features.share.impl
|
||||
|
||||
sealed interface ShareEvents {
|
||||
data object ClearError : ShareEvents
|
||||
sealed interface ShareEvent {
|
||||
data object ClearError : ShareEvent
|
||||
}
|
||||
+2
-2
@@ -55,9 +55,9 @@ class SharePresenter(
|
||||
|
||||
@Composable
|
||||
override fun present(): ShareState {
|
||||
fun handleEvent(event: ShareEvents) {
|
||||
fun handleEvent(event: ShareEvent) {
|
||||
when (event) {
|
||||
ShareEvents.ClearError -> shareActionState.value = AsyncAction.Uninitialized
|
||||
ShareEvent.ClearError -> shareActionState.value = AsyncAction.Uninitialized
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -13,5 +13,5 @@ import io.element.android.libraries.matrix.api.core.RoomId
|
||||
|
||||
data class ShareState(
|
||||
val shareAction: AsyncAction<List<RoomId>>,
|
||||
val eventSink: (ShareEvents) -> Unit
|
||||
val eventSink: (ShareEvent) -> Unit
|
||||
)
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ open class ShareStatePreviewParam : PreviewParameterProvider<ShareState> {
|
||||
|
||||
fun aShareState(
|
||||
shareAction: AsyncAction<List<RoomId>> = AsyncAction.Uninitialized,
|
||||
eventSink: (ShareEvents) -> Unit = {}
|
||||
eventSink: (ShareEvent) -> Unit = {}
|
||||
) = ShareState(
|
||||
shareAction = shareAction,
|
||||
eventSink = eventSink
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ fun ShareView(
|
||||
onShareSuccess(it)
|
||||
},
|
||||
onErrorDismiss = {
|
||||
state.eventSink(ShareEvents.ClearError)
|
||||
state.eventSink(ShareEvent.ClearError)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class SharePresenterTest : RobolectricTest() {
|
||||
assertThat(awaitItem().shareAction.isLoading()).isTrue()
|
||||
val failure = awaitItem()
|
||||
assertThat(failure.shareAction.isFailure()).isTrue()
|
||||
failure.eventSink.invoke(ShareEvents.ClearError)
|
||||
failure.eventSink.invoke(ShareEvent.ClearError)
|
||||
assertThat(awaitItem().shareAction.isUninitialized()).isTrue()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user