-
+
diff --git a/app/build.gradle b/app/build.gradle
index 306bb00..e8f98fe 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -52,6 +52,7 @@ dependencies {
implementation(project(":domain"))
implementation(project(":data"))
+ implementation(project(":features:catalog:presentation"))
implementation(project(":features:player:presentation"))
implementation(project(":core:design"))
implementation(project(":core:di"))
@@ -60,11 +61,8 @@ dependencies {
implementation libs.bundles.androidx
implementation libs.bundles.compose
- implementation libs.compose.accompanist.swipeToRefresh
-
implementation libs.polpetta
- implementation libs.arrow
implementation libs.timber
implementation libs.firebase.analytics
@@ -74,8 +72,6 @@ dependencies {
implementation libs.hilt.android
testImplementation project(":core:testing")
- testImplementation libs.mockk.core
- testImplementation libs.roboeletric
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.compose.test.uiJunit4
diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/SleepApp.kt b/app/src/main/java/dev/marcocattaneo/sleep/ui/SleepApp.kt
index 2766a15..2db0146 100644
--- a/app/src/main/java/dev/marcocattaneo/sleep/ui/SleepApp.kt
+++ b/app/src/main/java/dev/marcocattaneo/sleep/ui/SleepApp.kt
@@ -24,11 +24,11 @@ import androidx.compose.ui.platform.LocalConfiguration
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.compose.rememberNavController
import dev.marcocattaneo.core.design.theme.SleepTheme
-import dev.marcocattaneo.sleep.ui.screen.Routes
+import dev.marcocattaneo.sleep.catalog.presentation.Routes
import dev.marcocattaneo.sleep.player.presentation.screen.PlayerAction
import dev.marcocattaneo.sleep.player.presentation.screen.PlayerScreen
import dev.marcocattaneo.sleep.player.presentation.screen.PlayerViewModel
-import dev.marcocattaneo.sleep.ui.screen.home.registerCatalogScreen
+import dev.marcocattaneo.sleep.catalog.presentation.screen.registerCatalogScreen
@Composable
fun SleepApp() {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5d4b3b6..b25fa2a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -16,7 +16,4 @@
Sleepify
- Sleep tracks
- The sound of silence
- Welcome, to start the listening tap on the track below. If you want you can set an auto-stop after a set of minutes.
\ No newline at end of file
diff --git a/core/navigation/build.gradle b/core/navigation/build.gradle
index 36a98f5..5874e7b 100644
--- a/core/navigation/build.gradle
+++ b/core/navigation/build.gradle
@@ -1,5 +1,6 @@
plugins {
alias libs.plugins.sleep.android.library
+ alias libs.plugins.sleep.android.compose
alias libs.plugins.sleep.detekt
}
@@ -10,4 +11,7 @@ android {
dependencies {
implementation(platform(libs.bom.compose))
implementation libs.bundles.compose
+
+ api libs.compose.navigation
+ api libs.compose.navigationHilt
}
\ No newline at end of file
diff --git a/core/navigation/src/main/java/dev/marcocattaneo/navigation/NavigationComponent.kt b/core/navigation/src/main/java/dev/marcocattaneo/navigation/NavigationComponent.kt
index 07acfb4..893d497 100644
--- a/core/navigation/src/main/java/dev/marcocattaneo/navigation/NavigationComponent.kt
+++ b/core/navigation/src/main/java/dev/marcocattaneo/navigation/NavigationComponent.kt
@@ -22,6 +22,7 @@ import androidx.lifecycle.ViewModel
import androidx.navigation.*
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
+import dev.marcocattaneo.navigation.routing.ScreenRoute
/**
* Navigation Component used for the routing
@@ -30,7 +31,7 @@ import androidx.navigation.compose.composable
*/
@Composable
fun NavigationComponent(
- startRoute: dev.marcocattaneo.navigation.routing.ScreenRoute,
+ startRoute: ScreenRoute,
navHostController: NavHostController,
builder: NavGraphBuilder.() -> Unit
) {
@@ -47,7 +48,7 @@ fun NavigationComponent(
* @param content content associated to the route
*/
inline fun NavGraphBuilder.composable(
- route: dev.marcocattaneo.navigation.routing.ScreenRoute,
+ route: ScreenRoute,
crossinline content: @Composable (NavBackStackEntry, VM) -> Unit
) {
this.composable(
diff --git a/features/catalog/presentation/build.gradle b/features/catalog/presentation/build.gradle
new file mode 100644
index 0000000..90c7852
--- /dev/null
+++ b/features/catalog/presentation/build.gradle
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2022 Marco Cattaneo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ alias libs.plugins.sleep.android.library
+ alias libs.plugins.sleep.android.compose
+ alias libs.plugins.sleep.jacoco
+ alias libs.plugins.sleep.detekt
+}
+
+android {
+ namespace 'dev.marcocattaneo.sleep.catalog.presentation'
+}
+
+dependencies {
+ implementation platform(libs.bom.compose)
+
+ implementation project(":core:di")
+ implementation project(":core:design")
+ implementation project(":core:utils")
+ implementation(project(":core:navigation"))
+ implementation project(":data")
+ implementation project(":domain")
+ implementation project(":features:playlist:presentation")
+
+ implementation libs.bundles.androidx
+ implementation libs.bundles.compose
+ implementation libs.arrow
+ implementation libs.compose.constraintLayout
+ implementation libs.compose.accompanist.swipeToRefresh
+ implementation libs.kotlin.stdlib
+ implementation libs.polpetta
+ implementation libs.hilt.android
+
+ testImplementation project(":core:testing")
+
+ androidTestImplementation libs.androidx.junit
+ androidTestImplementation libs.compose.test.uiJunit4
+
+ debugImplementation libs.bundles.compose.debug
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/dev/marcocattaneo/sleep/AbsComposableTest.kt b/features/catalog/presentation/src/androidTest/kotlin/dev/marcocattaneo/sleep/catalog/presentation/AbsComposableTest.kt
similarity index 92%
rename from app/src/androidTest/java/dev/marcocattaneo/sleep/AbsComposableTest.kt
rename to features/catalog/presentation/src/androidTest/kotlin/dev/marcocattaneo/sleep/catalog/presentation/AbsComposableTest.kt
index be29112..9909b36 100644
--- a/app/src/androidTest/java/dev/marcocattaneo/sleep/AbsComposableTest.kt
+++ b/features/catalog/presentation/src/androidTest/kotlin/dev/marcocattaneo/sleep/catalog/presentation/AbsComposableTest.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2022 Marco Cattaneo
+ * Copyright 2023 Marco Cattaneo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep
+package dev.marcocattaneo.sleep.catalog.presentation
import androidx.compose.runtime.Composable
import androidx.compose.ui.test.junit4.ComposeContentTestRule
diff --git a/app/src/androidTest/java/dev/marcocattaneo/sleep/ui/composables/ComposableInfoBoxTest.kt b/features/catalog/presentation/src/androidTest/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/ComposableInfoBoxTest.kt
similarity index 86%
rename from app/src/androidTest/java/dev/marcocattaneo/sleep/ui/composables/ComposableInfoBoxTest.kt
rename to features/catalog/presentation/src/androidTest/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/ComposableInfoBoxTest.kt
index ec2a65d..1293a9c 100644
--- a/app/src/androidTest/java/dev/marcocattaneo/sleep/ui/composables/ComposableInfoBoxTest.kt
+++ b/features/catalog/presentation/src/androidTest/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/ComposableInfoBoxTest.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2022 Marco Cattaneo
+ * Copyright 2023 Marco Cattaneo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.ui.composables
+package dev.marcocattaneo.sleep.catalog.presentation.composables
import androidx.compose.material.Text
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.onNodeWithText
-import dev.marcocattaneo.sleep.AbsComposableTest
+import dev.marcocattaneo.sleep.catalog.presentation.AbsComposableTest
import org.junit.Test
internal class ComposableInfoBoxTest : AbsComposableTest() {
diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/Routes.kt b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/Routes.kt
similarity index 93%
rename from app/src/main/java/dev/marcocattaneo/sleep/ui/screen/Routes.kt
rename to features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/Routes.kt
index 0d162e4..a6626b7 100644
--- a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/Routes.kt
+++ b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/Routes.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.ui.screen
+package dev.marcocattaneo.sleep.catalog.presentation
import dev.marcocattaneo.navigation.routing.ScreenRoute
diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/composables/Illustration.kt b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/Illustration.kt
similarity index 94%
rename from app/src/main/java/dev/marcocattaneo/sleep/ui/composables/Illustration.kt
rename to features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/Illustration.kt
index 9faade7..7e44002 100644
--- a/app/src/main/java/dev/marcocattaneo/sleep/ui/composables/Illustration.kt
+++ b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/Illustration.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.ui.composables
+package dev.marcocattaneo.sleep.catalog.presentation.composables
import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/composables/InfoBox.kt b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/InfoBox.kt
similarity index 93%
rename from app/src/main/java/dev/marcocattaneo/sleep/ui/composables/InfoBox.kt
rename to features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/InfoBox.kt
index fec3459..8a061df 100644
--- a/app/src/main/java/dev/marcocattaneo/sleep/ui/composables/InfoBox.kt
+++ b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/composables/InfoBox.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2022 Marco Cattaneo
+ * Copyright 2023 Marco Cattaneo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.ui.composables
+package dev.marcocattaneo.sleep.catalog.presentation.composables
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeScreen.kt b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogScreen.kt
similarity index 89%
rename from app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeScreen.kt
rename to features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogScreen.kt
index c03e993..86745e6 100644
--- a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeScreen.kt
+++ b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogScreen.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 Marco Cattaneo
+ * Copyright 2023 Marco Cattaneo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.ui.screen.home
+package dev.marcocattaneo.sleep.catalog.presentation.screen
import android.annotation.SuppressLint
import androidx.compose.foundation.clickable
@@ -36,21 +36,25 @@ import dev.marcocattaneo.core.design.composables.*
import dev.marcocattaneo.core.design.theme.Dimen
import dev.marcocattaneo.core.design.theme.placeholder
import dev.marcocattaneo.navigation.composable
-import dev.marcocattaneo.sleep.R
+import dev.marcocattaneo.sleep.catalog.presentation.Routes
+import dev.marcocattaneo.sleep.catalog.presentation.composables.Illustration
+import dev.marcocattaneo.sleep.catalog.presentation.composables.InfoBox
import dev.marcocattaneo.sleep.domain.model.MediaFileEntity
-import dev.marcocattaneo.sleep.ui.composables.Illustration
-import dev.marcocattaneo.sleep.ui.composables.InfoBox
-import dev.marcocattaneo.sleep.ui.screen.Routes
+import dev.marcocattaneo.sleep.catalog.presentation.R
+/**
+ * Register the composable function into the NavGraphBuilder
+ * @param onClickMediaFile callback used when a media file is clicked
+ */
fun NavGraphBuilder.registerCatalogScreen(onClickMediaFile: (MediaFileEntity) -> Unit) {
- composable(
+ composable(
route = Routes.Dashboard
- ) { _, vm -> HomeScreen(vm, onClickMediaFile = onClickMediaFile) }
+ ) { _, vm -> CatalogScreen(vm, onClickMediaFile = onClickMediaFile) }
}
@Composable
-fun HomeScreen(
- homeViewModel: HomeViewModel,
+fun CatalogScreen(
+ homeViewModel: CatalogViewModel,
onClickMediaFile: (MediaFileEntity) -> Unit
) {
val uiState by homeViewModel.rememberState()
diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeStateStore.kt b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogStateStore.kt
similarity index 97%
rename from app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeStateStore.kt
rename to features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogStateStore.kt
index 2e67b2d..f520909 100644
--- a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeStateStore.kt
+++ b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogStateStore.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.ui.screen.home
+package dev.marcocattaneo.sleep.catalog.presentation.screen
import dagger.hilt.android.scopes.ViewModelScoped
import dev.marcocattaneo.sleep.core.di.scope.CoroutineContextScope
diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeViewModel.kt b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogViewModel.kt
similarity index 87%
rename from app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeViewModel.kt
rename to features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogViewModel.kt
index 46f0553..73d5059 100644
--- a/app/src/main/java/dev/marcocattaneo/sleep/ui/screen/home/HomeViewModel.kt
+++ b/features/catalog/presentation/src/main/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/CatalogViewModel.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 Marco Cattaneo
+ * Copyright 2023 Marco Cattaneo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.ui.screen.home
+package dev.marcocattaneo.sleep.catalog.presentation.screen
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import dev.marcocattaneo.sleep.core.utils.AbsStateStoreViewModel
-import dev.marcocattaneo.sleep.player.presentation.screen.PlaylistStateStore
+import dev.marcocattaneo.sleep.playlist.presentation.PlaylistStateStore
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel
-class HomeViewModel @Inject constructor(
+class CatalogViewModel @Inject constructor(
private val playlistStateStore: PlaylistStateStore,
homeStateStore: HomeStateStore
) : AbsStateStoreViewModel(
diff --git a/app/src/main/res/drawable/ic_baseline_play_circle_filled_24.xml b/features/catalog/presentation/src/main/res/drawable/ic_baseline_play_circle_filled_24.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_baseline_play_circle_filled_24.xml
rename to features/catalog/presentation/src/main/res/drawable/ic_baseline_play_circle_filled_24.xml
diff --git a/app/src/main/res/drawable/ui_undraw_late_at_night.xml b/features/catalog/presentation/src/main/res/drawable/ui_undraw_late_at_night.xml
similarity index 100%
rename from app/src/main/res/drawable/ui_undraw_late_at_night.xml
rename to features/catalog/presentation/src/main/res/drawable/ui_undraw_late_at_night.xml
diff --git a/features/catalog/presentation/src/main/res/values/strings.xml b/features/catalog/presentation/src/main/res/values/strings.xml
new file mode 100644
index 0000000..e0ed3f9
--- /dev/null
+++ b/features/catalog/presentation/src/main/res/values/strings.xml
@@ -0,0 +1,21 @@
+
+
+
+ Sleep tracks
+ The sound of silence
+ Welcome, to start the listening tap on the track below. If you want you can set an auto-stop after a set of minutes.
+
\ No newline at end of file
diff --git a/app/src/test/java/dev/marcocattaneo/sleep/ui/screen/home/HomeStateStoreTest.kt b/features/catalog/presentation/src/test/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/HomeStateStoreTest.kt
similarity index 98%
rename from app/src/test/java/dev/marcocattaneo/sleep/ui/screen/home/HomeStateStoreTest.kt
rename to features/catalog/presentation/src/test/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/HomeStateStoreTest.kt
index c0e74ee..ecc535a 100644
--- a/app/src/test/java/dev/marcocattaneo/sleep/ui/screen/home/HomeStateStoreTest.kt
+++ b/features/catalog/presentation/src/test/kotlin/dev/marcocattaneo/sleep/catalog/presentation/screen/HomeStateStoreTest.kt
@@ -1,4 +1,4 @@
-package dev.marcocattaneo.sleep.ui.screen.home
+package dev.marcocattaneo.sleep.catalog.presentation.screen
import app.cash.turbine.test
import arrow.core.Either
diff --git a/features/player/presentation/build.gradle b/features/player/presentation/build.gradle
index 739dc7d..18195ae 100644
--- a/features/player/presentation/build.gradle
+++ b/features/player/presentation/build.gradle
@@ -33,6 +33,7 @@ dependencies {
implementation project(":core:utils")
implementation project(":data")
implementation project(":domain")
+ implementation project(":features:playlist:presentation")
implementation libs.bundles.androidx
implementation libs.bundles.compose
@@ -40,6 +41,7 @@ dependencies {
implementation libs.compose.constraintLayout
implementation libs.kotlin.stdlib
implementation libs.polpetta
+ implementation libs.hilt.android
testImplementation project(":core:testing")
diff --git a/features/player/presentation/src/main/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStore.kt b/features/player/presentation/src/main/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStore.kt
index 9c05790..7315bb6 100644
--- a/features/player/presentation/src/main/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStore.kt
+++ b/features/player/presentation/src/main/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStore.kt
@@ -20,6 +20,8 @@ import dev.marcocattaneo.sleep.core.di.scope.CoroutineContextScope
import dev.marcocattaneo.sleep.domain.model.MediaFileEntity
import dev.marcocattaneo.sleep.domain.repository.MediaRepository
import dev.marcocattaneo.sleep.player.presentation.AudioPlayer
+import dev.marcocattaneo.sleep.playlist.presentation.PlaylistAction
+import dev.marcocattaneo.sleep.playlist.presentation.PlaylistStateStore
import dev.mcatta.polpetta.StateStore
import dev.mcatta.polpetta.operators.Action
import dev.mcatta.polpetta.operators.State
@@ -77,7 +79,8 @@ class PlayerStateStore @Inject constructor(
// Check if the stop timer is passed
if (this is PlayerState.Ready) {
- val mustStop = stopDate?.let { stopDate -> System.currentTimeMillis() > stopDate } ?: false
+ val mustStop =
+ stopDate?.let { stopDate -> System.currentTimeMillis() > stopDate } ?: false
if (mustStop) {
audioPlayer.stop()
PlayerState.Idle
@@ -121,7 +124,9 @@ class PlayerStateStore @Inject constructor(
copy(
stopTimer = newTimer,
- stopDate = newTimer?.let { System.currentTimeMillis().plus(it.inWholeMilliseconds) }
+ stopDate = newTimer?.let {
+ System.currentTimeMillis().plus(it.inWholeMilliseconds)
+ }
)
}
}
diff --git a/features/player/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStoreTest.kt b/features/player/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStoreTest.kt
index a42b3c2..17ab4d5 100644
--- a/features/player/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStoreTest.kt
+++ b/features/player/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlayerStateStoreTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2023 Marco Cattaneo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package dev.marcocattaneo.sleep.player.presentation.screen
import app.cash.turbine.test
@@ -24,7 +40,7 @@ internal class PlayerStateStoreTest {
lateinit var audioPlayer: AudioPlayer
@RelaxedMockK
- lateinit var playlistStateStore: PlaylistStateStore
+ lateinit var playlistStateStore: dev.marcocattaneo.sleep.playlist.presentation.PlaylistStateStore
@RelaxedMockK
lateinit var mediaRepository: MediaRepository
@@ -56,7 +72,7 @@ internal class PlayerStateStoreTest {
coVerify { audioPlayer.stop() }
coVerify { mediaRepository.urlFromId(any()) }
coVerify { audioPlayer.start(any(), any(), any()) }
- coVerify { playlistStateStore.dispatchAction(ofType()) }
+ coVerify { playlistStateStore.dispatchAction(ofType()) }
}
}
@@ -76,7 +92,7 @@ internal class PlayerStateStoreTest {
coVerify { audioPlayer.stop() }
coVerify { mediaRepository.urlFromId(any()) }
coVerify(exactly = 0) { audioPlayer.start(any(), any(), any()) }
- coVerify(exactly = 0) { playlistStateStore.dispatchAction(ofType()) }
+ coVerify(exactly = 0) { playlistStateStore.dispatchAction(ofType()) }
}
}
diff --git a/features/playlist/presentation/build.gradle b/features/playlist/presentation/build.gradle
new file mode 100644
index 0000000..cce9881
--- /dev/null
+++ b/features/playlist/presentation/build.gradle
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Marco Cattaneo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ alias libs.plugins.sleep.android.library
+ alias libs.plugins.sleep.jacoco
+ alias libs.plugins.sleep.detekt
+}
+
+android {
+ namespace 'dev.marcocattaneo.sleep.playlist.presentation'
+}
+
+dependencies {
+ implementation project(":core:di")
+ implementation project(":core:utils")
+ implementation project(":data")
+ implementation project(":domain")
+
+ implementation libs.bundles.androidx
+ implementation libs.kotlin.stdlib
+ implementation libs.polpetta
+ implementation libs.hilt.android
+
+ testImplementation project(":core:testing")
+}
\ No newline at end of file
diff --git a/features/player/presentation/src/main/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlaylistStateStore.kt b/features/playlist/presentation/src/main/kotlin/dev/marcocattaneo/sleep/playlist/presentation/PlaylistStateStore.kt
similarity index 96%
rename from features/player/presentation/src/main/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlaylistStateStore.kt
rename to features/playlist/presentation/src/main/kotlin/dev/marcocattaneo/sleep/playlist/presentation/PlaylistStateStore.kt
index 20f694c..248eafa 100644
--- a/features/player/presentation/src/main/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlaylistStateStore.kt
+++ b/features/playlist/presentation/src/main/kotlin/dev/marcocattaneo/sleep/playlist/presentation/PlaylistStateStore.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package dev.marcocattaneo.sleep.player.presentation.screen
+package dev.marcocattaneo.sleep.playlist.presentation
import dev.marcocattaneo.sleep.core.di.scope.CoroutineContextScope
import dev.mcatta.polpetta.StateStore
diff --git a/features/player/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlaylistStateStoreTest.kt b/features/playlist/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/PlaylistStateStoreTest.kt
similarity index 61%
rename from features/player/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlaylistStateStoreTest.kt
rename to features/playlist/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/PlaylistStateStoreTest.kt
index 61cdbbd..d5188e1 100644
--- a/features/player/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/screen/PlaylistStateStoreTest.kt
+++ b/features/playlist/presentation/src/test/kotlin/dev/marcocattaneo/sleep/player/presentation/PlaylistStateStoreTest.kt
@@ -1,6 +1,24 @@
-package dev.marcocattaneo.sleep.player.presentation.screen
+/*
+ * Copyright 2023 Marco Cattaneo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dev.marcocattaneo.sleep.player.presentation
import app.cash.turbine.test
+import dev.marcocattaneo.sleep.playlist.presentation.PlaylistAction
+import dev.marcocattaneo.sleep.playlist.presentation.PlaylistStateStore
import io.mockk.MockKAnnotations
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -19,7 +37,8 @@ internal class PlaylistStateStoreTest {
fun setup() {
MockKAnnotations.init(this)
testCoroutineScope = CoroutineScope(Dispatchers.Unconfined)
- playlistStateStore = PlaylistStateStore(testCoroutineScope)
+ playlistStateStore =
+ PlaylistStateStore(testCoroutineScope)
}
@Test
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 0b078ad..2352880 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -73,7 +73,7 @@ gradle-firebase = { module = "com.google.firebase:firebase-crashlytics-gradle",
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
[bundles]
-compose = ["compose-ui", "compose-material", "compose-preview", "compose-navigation", "compose-navigationHilt", "compose-activity"]
+compose = ["compose-ui", "compose-material", "compose-preview", "compose-activity"]
compose-debug = ["compose-test-uiManifest", "compose-tooling", "compose-preview"]
androidx = ["androidx-core", "androidx-material", "androidx-media", "androidx-appCompat"]
retrofit = ["retrofit-client", "retrofit-gson", "retrofit-logger"]
diff --git a/settings.gradle b/settings.gradle
index dbe3f85..360c1e6 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -40,6 +40,8 @@ include ':app'
include ':domain'
include ':data'
include ':features:player:presentation'
+include ':features:catalog:presentation'
+include ':features:playlist:presentation'
include ':core:di'
include ':core:design'
include ':core:testing'