From 8a8aa375c096755fbe8d2b0adb01dade682c514a Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 2 Nov 2022 16:10:57 +0000 Subject: [PATCH] moving page reducer to the compose-core module --- .../src/main/kotlin/app/dapk/st/core/page}/PageReducer.kt | 2 +- .../app/dapk/st/messenger/gallery/ImageGalleryScreen.kt | 1 + .../dapk/st/messenger/gallery/state/ImageGalleryReducer.kt | 5 ++++- .../app/dapk/st/messenger/gallery/state/ImageGalleryState.kt | 2 +- .../st/messenger/gallery/state/ImageGalleryReducerTest.kt | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) rename {features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery => domains/android/compose-core/src/main/kotlin/app/dapk/st/core/page}/PageReducer.kt (97%) diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/PageReducer.kt b/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/page/PageReducer.kt similarity index 97% rename from features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/PageReducer.kt rename to domains/android/compose-core/src/main/kotlin/app/dapk/st/core/page/PageReducer.kt index b2b6c3d..4289061 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/PageReducer.kt +++ b/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/page/PageReducer.kt @@ -1,4 +1,4 @@ -package app.dapk.st.messenger.gallery +package app.dapk.st.core.page import app.dapk.st.design.components.SpiderPage import app.dapk.state.Action diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/ImageGalleryScreen.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/ImageGalleryScreen.kt index b86edba..971f1e3 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/ImageGalleryScreen.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/ImageGalleryScreen.kt @@ -21,6 +21,7 @@ import androidx.compose.ui.unit.sp import app.dapk.st.core.Lce import app.dapk.st.core.LifecycleEffect import app.dapk.st.core.components.CenteredLoading +import app.dapk.st.core.page.PageAction import app.dapk.st.design.components.GenericError import app.dapk.st.design.components.Spider import app.dapk.st.design.components.SpiderPage diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt index 5820b06..360467f 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt @@ -2,6 +2,9 @@ package app.dapk.st.messenger.gallery.state import app.dapk.st.core.JobBag import app.dapk.st.core.Lce +import app.dapk.st.core.page.PageAction +import app.dapk.st.core.page.PageContainer +import app.dapk.st.core.page.isDifferentPage import app.dapk.st.design.components.SpiderPage import app.dapk.st.messenger.gallery.* import app.dapk.state.* @@ -19,7 +22,7 @@ fun imageGalleryReducer( ) } -private fun createPageReducer(roomName: String): ReducerFactory> = createPageReducer( +private fun createPageReducer(roomName: String): ReducerFactory> = app.dapk.st.core.page.createPageReducer( initialPage = SpiderPage( route = ImageGalleryPage.Routes.folders, label = "Send to $roomName", diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryState.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryState.kt index b17ffcb..3e07c31 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryState.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryState.kt @@ -5,7 +5,7 @@ import app.dapk.st.core.State import app.dapk.st.design.components.Route import app.dapk.st.messenger.gallery.Folder import app.dapk.st.messenger.gallery.Media -import app.dapk.st.messenger.gallery.PageContainer +import app.dapk.st.core.page.PageContainer import app.dapk.state.Combined2 typealias ImageGalleryState = State, Unit>, Unit> diff --git a/features/messenger/src/test/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducerTest.kt b/features/messenger/src/test/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducerTest.kt index e6e8aac..f5fc127 100644 --- a/features/messenger/src/test/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducerTest.kt +++ b/features/messenger/src/test/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducerTest.kt @@ -4,7 +4,7 @@ import app.dapk.st.core.Lce import app.dapk.st.design.components.SpiderPage import app.dapk.st.messenger.gallery.FetchMediaFoldersUseCase import app.dapk.st.messenger.gallery.FetchMediaUseCase -import app.dapk.st.messenger.gallery.PageContainer +import app.dapk.st.core.page.PageContainer import app.dapk.state.Combined2 import fake.FakeJobBag import io.mockk.mockk