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