diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b6a66e82..c561c599d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,32 +14,37 @@ jobs: env: TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }} TMDB_API_URL: ${{ secrets.TMDB_API_URL }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Generate build number + shell: bash + run: echo "BUILD_NUMBER=$(( $GITHUB_RUN_NUMBER + 6000 + (($GITHUB_RUN_NUMBER - 980) * 3) ))" >> $GITHUB_ENV + + - uses: actions/checkout@v2 + - name: Set Up JDK uses: actions/setup-java@v1 with: java-version: 11 - - uses: actions/checkout@v2 - - name: Add App Secrets run: | - echo -e "\TMDB_API_KEY=$TMDB_API_KEY" >> ./local.properties - echo -e "\TMDB_API_URL=$TMDB_API_URL" >> ./local.properties + echo -e "\TMDB_API_KEY=$TMDB_API_KEY" >> ./local.properties + echo -e "\TMDB_API_URL=$TMDB_API_URL" >> ./local.properties - - name: Build all artifacts - id: buildAllApks - uses: eskatos/gradle-command-action@v1.3.3 + - uses: burrunan/gradle-cache-action@v1 + name: Build and check + env: + ORG_GRADLE_PROJECT_TVMANIAC_VERSIONCODE: ${{ env.BUILD_NUMBER }} with: - gradle-version: current - wrapper-cache-enabled: true - dependencies-cache-enabled: true - configuration-cache-enabled: true - arguments: assembleDebug - - - name: Unit Tests - run: ./gradlew testDebugUnitTest + gradle-dependencies-cache-key: | + gradle/libs.versions.toml + arguments: | + bundle + detekt + testDebugUnitTest + assembleDebug - name: Create release uses: softprops/action-gh-release@v1 diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 000000000..4bec4ea8a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,117 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 000000000..a55e7a179 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app-common/annotations/build.gradle.kts b/app-common/annotations/build.gradle.kts index 2f796c9bc..9ce9f2836 100644 --- a/app-common/annotations/build.gradle.kts +++ b/app-common/annotations/build.gradle.kts @@ -9,6 +9,7 @@ plugins { android { compileSdk = libs.versions.android.compile.get().toInt() + namespace = "com.thomaskioko.tvmaniac.annotations" defaultConfig { minSdk = libs.versions.android.min.get().toInt() diff --git a/app-common/annotations/src/main/AndroidManifest.xml b/app-common/annotations/src/main/AndroidManifest.xml deleted file mode 100644 index 8a619eeca..000000000 --- a/app-common/annotations/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/app-common/compose/build.gradle.kts b/app-common/compose/build.gradle.kts index be4dba22b..a0f9db8cc 100644 --- a/app-common/compose/build.gradle.kts +++ b/app-common/compose/build.gradle.kts @@ -2,5 +2,6 @@ plugins { `android-compose-plugin` } -dependencies { +android { + namespace = "com.thomaskioko.tvmaniac.compose" } diff --git a/app-common/compose/src/main/AndroidManifest.xml b/app-common/compose/src/main/AndroidManifest.xml deleted file mode 100644 index 2a786c2b7..000000000 --- a/app-common/compose/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/components/Buttons.kt b/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/components/Buttons.kt new file mode 100644 index 000000000..34e0510e5 --- /dev/null +++ b/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/components/Buttons.kt @@ -0,0 +1,52 @@ +package com.thomaskioko.tvmaniac.compose.components + +import androidx.compose.foundation.Image +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.ContentAlpha +import androidx.compose.material.ExtendedFloatingActionButton +import androidx.compose.material.FloatingActionButtonDefaults +import androidx.compose.material.LocalContentAlpha +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.graphics.RectangleShape +import androidx.compose.ui.graphics.painter.Painter +import androidx.compose.ui.unit.dp + +@Composable +fun ExtendedFab( + painter: Painter, + text: String, + onClick: () -> Unit = {} +) { + ExtendedFloatingActionButton( + icon = { + Image( + painter = painter, + contentDescription = null, + colorFilter = ColorFilter.tint(MaterialTheme.colors.secondary.copy(alpha = 0.8F)), + ) + }, + text = { + CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { + Text( + text = text, + style = MaterialTheme.typography.body2, + ) + } + }, + shape = RectangleShape, + backgroundColor = Color.Transparent, + elevation = FloatingActionButtonDefaults.elevation(0.dp), + onClick = { onClick() }, + modifier = Modifier + .padding(2.dp) + .border(1.dp, Color(0xFF414141), RoundedCornerShape(8.dp)) + ) +} diff --git a/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/components/RatingComponent.kt b/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/components/RatingComponent.kt deleted file mode 100644 index 7482365d9..000000000 --- a/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/components/RatingComponent.kt +++ /dev/null @@ -1,128 +0,0 @@ -package com.thomaskioko.tvmaniac.compose.components - -import androidx.compose.foundation.Canvas -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.BoxWithConstraints -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.aspectRatio -import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.wrapContentSize -import androidx.compose.foundation.shape.GenericShape -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.geometry.Size -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.Path -import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import kotlin.math.cos -import kotlin.math.sin - -@Composable -fun RatingBar( - rating: Float, - modifier: Modifier = Modifier, - color: Color = Color.Yellow -) { - Row(modifier = modifier.wrapContentSize()) { - (1..5).forEach { step -> - val stepRating = when { - rating > step -> 1f - step.rem(rating) < 1 -> rating - (step - 1f) - else -> 0f - } - RatingStar(stepRating, color) - } - } -} - -@Composable -private fun RatingStar( - rating: Float, - ratingColor: Color = Color.Yellow, - backgroundColor: Color = Color.Gray -) { - BoxWithConstraints( - modifier = Modifier - .fillMaxHeight() - .aspectRatio(1f) - .clip(starShape) - ) { - Canvas(modifier = Modifier.size(maxHeight)) { - drawRect( - brush = SolidColor(backgroundColor), - size = Size( - height = size.height * 1.4f, - width = size.width * 1.4f - ), - topLeft = Offset( - x = -(size.width * 0.1f), - y = -(size.height * 0.1f) - ) - ) - if (rating > 0) { - drawRect( - brush = SolidColor(ratingColor), - size = Size( - height = size.height * 1.1f, - width = size.width * rating - ) - ) - } - } - } -} - -private val starShape = GenericShape { size, _ -> - addPath(starPath(size.height)) -} - -private val starPath = { size: Float -> - Path().apply { - val outerRadius: Float = size / 1.8f - val innerRadius: Double = outerRadius / 2.5 - var rot: Double = Math.PI / 2 * 3 - val cx: Float = size / 2 - val cy: Float = size / 20 * 11 - var x: Float = cx - var y: Float = cy - val step = Math.PI / 5 - - moveTo(cx, cy - outerRadius) - repeat(5) { - x = (cx + cos(rot) * outerRadius).toFloat() - y = (cy + sin(rot) * outerRadius).toFloat() - lineTo(x, y) - rot += step - - x = (cx + cos(rot) * innerRadius).toFloat() - y = (cy + sin(rot) * innerRadius).toFloat() - lineTo(x, y) - rot += step - } - close() - } -} - -@Preview -@Composable -fun RatingBarPreview() { - Column( - Modifier - .fillMaxSize() - .background(Color.White) - ) { - RatingBar( - rating = 3.8f, - modifier = Modifier.height(20.dp), - - ) - } -} diff --git a/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/util/DynamicTheming.kt b/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/util/DynamicTheming.kt index fc934e80a..b59fbd1c9 100644 --- a/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/util/DynamicTheming.kt +++ b/app-common/compose/src/main/kotlin/com/thomaskioko/tvmaniac/compose/util/DynamicTheming.kt @@ -24,6 +24,9 @@ import coil.size.Scale import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +private const val COVER_IMAGE_SIZE = 128 +private const val MAC_COLOR_COUNT = 8 + @Composable fun rememberDominantColorState( context: Context = LocalContext.current, @@ -139,7 +142,7 @@ private suspend fun calculateSwatchesInImage( val r = ImageRequest.Builder(context) .data(imageUrl) // We scale the image to cover 128px x 128px (i.e. min dimension == 128px) - .size(128).scale(Scale.FILL) + .size(COVER_IMAGE_SIZE).scale(Scale.FILL) // Disable hardware bitmaps, since Palette uses Bitmap.getPixels() .allowHardware(false) .build() @@ -158,7 +161,7 @@ private suspend fun calculateSwatchesInImage( // Clear any built-in filters. We want the unfiltered dominant color .clearFilters() // We reduce the maximum color count down to 8 - .maximumColorCount(8) + .maximumColorCount(MAC_COLOR_COUNT) .generate() palette.swatches diff --git a/app-common/navigation/build.gradle.kts b/app-common/navigation/build.gradle.kts index c5324982a..9aa5d6055 100644 --- a/app-common/navigation/build.gradle.kts +++ b/app-common/navigation/build.gradle.kts @@ -11,6 +11,7 @@ plugins { android { compileSdk = libs.versions.android.compile.get().toInt() + namespace = "com.thomaskioko.tvmaniac.navigation" defaultConfig { minSdk = libs.versions.android.min.get().toInt() diff --git a/app-common/navigation/src/main/AndroidManifest.xml b/app-common/navigation/src/main/AndroidManifest.xml deleted file mode 100644 index 7944662c1..000000000 --- a/app-common/navigation/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/app-common/resources/build.gradle.kts b/app-common/resources/build.gradle.kts index 934de3fdb..8ea2fea35 100644 --- a/app-common/resources/build.gradle.kts +++ b/app-common/resources/build.gradle.kts @@ -6,6 +6,7 @@ plugins { android { compileSdk = libs.versions.android.compile.get().toInt() + namespace = "com.thomaskioko.tvmaniac.resources" defaultConfig { minSdk = libs.versions.android.min.get().toInt() diff --git a/app-common/resources/src/main/AndroidManifest.xml b/app-common/resources/src/main/AndroidManifest.xml deleted file mode 100644 index 3ef1bb555..000000000 --- a/app-common/resources/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/app-features/discover/build.gradle.kts b/app-features/discover/build.gradle.kts index 6c1fbf195..d69d01373 100644 --- a/app-features/discover/build.gradle.kts +++ b/app-features/discover/build.gradle.kts @@ -4,8 +4,12 @@ plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.details" +} + dependencies { - implementation(projects.shared.domain.show.api) + implementation(projects.shared.domain.discover.api) implementation(projects.shared.domain.showCommon.api) implementation(libs.androidx.paging.runtime) } diff --git a/app-features/discover/src/main/AndroidManifest.xml b/app-features/discover/src/main/AndroidManifest.xml deleted file mode 100644 index 3a44a37d8..000000000 --- a/app-features/discover/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverScreen.kt b/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverScreen.kt index 5813acc03..5d1297065 100644 --- a/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverScreen.kt +++ b/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverScreen.kt @@ -57,9 +57,9 @@ import com.thomaskioko.tvmaniac.compose.util.verticalGradientScrim import com.thomaskioko.tvmaniac.discover.api.DiscoverShowEffect import com.thomaskioko.tvmaniac.discover.api.DiscoverShowResult import com.thomaskioko.tvmaniac.discover.api.DiscoverShowState -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory import com.thomaskioko.tvmaniac.resources.R -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import dev.chrisbanes.snapper.ExperimentalSnapperApi import dev.chrisbanes.snapper.rememberSnapperFlingBehavior import kotlin.math.absoluteValue @@ -70,8 +70,6 @@ import kotlin.math.absoluteValue * 3:1 which is the minimum for user-interface components. */ private const val MinContrastOfPrimaryVsSurface = 3f - -@OptIn(ExperimentalSnapperApi::class, kotlinx.coroutines.InternalCoroutinesApi::class) @Composable fun DiscoverScreen( viewModel: DiscoverViewModel, @@ -100,7 +98,6 @@ fun DiscoverScreen( ) } -@OptIn(ExperimentalSnapperApi::class) @Composable private fun DiscoverShows( scaffoldState: ScaffoldState, diff --git a/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverViewModel.kt b/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverViewModel.kt index 072cfdbf1..207c44306 100644 --- a/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverViewModel.kt +++ b/app-features/discover/src/main/java/com/thomaskioko/tvmaniac/DiscoverViewModel.kt @@ -2,14 +2,14 @@ package com.thomaskioko.tvmaniac import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.thomaskioko.tvmaniac.core.util.CoroutineScopeOwner import com.thomaskioko.tvmaniac.discover.api.DiscoverShowAction import com.thomaskioko.tvmaniac.discover.api.DiscoverShowAction.Error import com.thomaskioko.tvmaniac.discover.api.DiscoverShowEffect import com.thomaskioko.tvmaniac.discover.api.DiscoverShowResult import com.thomaskioko.tvmaniac.discover.api.DiscoverShowState -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveDiscoverShowsInteractor -import com.thomaskioko.tvmaniac.shared.core.CoroutineScopeOwner -import com.thomaskioko.tvmaniac.shared.core.store.Store +import com.thomaskioko.tvmaniac.discover.api.ObserveDiscoverShowsInteractor +import com.thomaskioko.tvmaniac.shared.core.ui.Store import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow diff --git a/app-features/following/build.gradle.kts b/app-features/following/build.gradle.kts index 99250059e..02a9144bd 100644 --- a/app-features/following/build.gradle.kts +++ b/app-features/following/build.gradle.kts @@ -2,9 +2,12 @@ plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.following" +} + dependencies { implementation(projects.appCommon.compose) - implementation(projects.shared.interactors) - implementation(projects.shared.domain.show.api) + implementation(projects.shared.domain.showDetails.api) implementation(projects.shared.domain.showCommon.api) } diff --git a/app-features/following/src/main/AndroidManifest.xml b/app-features/following/src/main/AndroidManifest.xml deleted file mode 100644 index f4e97f653..000000000 --- a/app-features/following/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/WatchlistContract.kt b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingContract.kt similarity index 64% rename from shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/WatchlistContract.kt rename to app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingContract.kt index f6831e9b8..454255cda 100644 --- a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/WatchlistContract.kt +++ b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingContract.kt @@ -1,9 +1,9 @@ -package com.thomaskioko.tvmaniac.interactors +package com.thomaskioko.tvmaniac.following -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.Effect -import com.thomaskioko.tvmaniac.shared.core.store.State -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.Effect +import com.thomaskioko.tvmaniac.shared.core.ui.State +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow data class WatchlistState( val isLoading: Boolean, diff --git a/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingListScreen.kt b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingListScreen.kt index fb921f537..d9a03cb6c 100644 --- a/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingListScreen.kt +++ b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingListScreen.kt @@ -26,8 +26,6 @@ import com.thomaskioko.tvmaniac.compose.components.LazyGridItems import com.thomaskioko.tvmaniac.compose.components.NetworkImageComposable import com.thomaskioko.tvmaniac.compose.components.SwipeDismissSnackbar import com.thomaskioko.tvmaniac.compose.rememberFlowWithLifecycle -import com.thomaskioko.tvmaniac.interactors.WatchlistEffect -import com.thomaskioko.tvmaniac.interactors.WatchlistState import com.thomaskioko.tvmaniac.resources.R import kotlinx.coroutines.InternalCoroutinesApi diff --git a/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingViewModel.kt b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingViewModel.kt index fe19fedec..999dd5a77 100644 --- a/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingViewModel.kt +++ b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/FollowingViewModel.kt @@ -2,12 +2,8 @@ package com.thomaskioko.tvmaniac.following import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.thomaskioko.tvmaniac.interactors.ObserveFollowingInteractor -import com.thomaskioko.tvmaniac.interactors.WatchlistAction -import com.thomaskioko.tvmaniac.interactors.WatchlistEffect -import com.thomaskioko.tvmaniac.interactors.WatchlistState -import com.thomaskioko.tvmaniac.shared.core.CoroutineScopeOwner -import com.thomaskioko.tvmaniac.shared.core.store.Store +import com.thomaskioko.tvmaniac.core.util.CoroutineScopeOwner +import com.thomaskioko.tvmaniac.shared.core.ui.Store import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow diff --git a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ObserveFollowingInteractor.kt b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/ObserveFollowingInteractor.kt similarity index 80% rename from shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ObserveFollowingInteractor.kt rename to app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/ObserveFollowingInteractor.kt index 52ffdf538..2a64327c6 100644 --- a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ObserveFollowingInteractor.kt +++ b/app-features/following/src/main/kotlin/com/thomaskioko/tvmaniac/following/ObserveFollowingInteractor.kt @@ -1,9 +1,9 @@ -package com.thomaskioko.tvmaniac.interactors +package com.thomaskioko.tvmaniac.following +import com.thomaskioko.tvmaniac.core.util.FlowInteractor import com.thomaskioko.tvmaniac.datasource.cache.Show -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map diff --git a/app-features/home/build.gradle.kts b/app-features/home/build.gradle.kts index a7e0d5bb6..495b13421 100644 --- a/app-features/home/build.gradle.kts +++ b/app-features/home/build.gradle.kts @@ -2,6 +2,10 @@ plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.home" +} + dependencies { implementation(projects.appCommon.compose) } diff --git a/app-features/home/src/main/AndroidManifest.xml b/app-features/home/src/main/AndroidManifest.xml deleted file mode 100644 index 3ca75fbfe..000000000 --- a/app-features/home/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/app-features/search/build.gradle.kts b/app-features/search/build.gradle.kts index f75d39453..9f97ca7ca 100644 --- a/app-features/search/build.gradle.kts +++ b/app-features/search/build.gradle.kts @@ -4,6 +4,10 @@ plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.search" +} + dependencies { implementation(libs.androidx.paging.runtime) } diff --git a/app-features/search/src/main/AndroidManifest.xml b/app-features/search/src/main/AndroidManifest.xml deleted file mode 100644 index d03c92001..000000000 --- a/app-features/search/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/app-features/seasons/build.gradle.kts b/app-features/seasons/build.gradle.kts index c4d781da9..1fd436b56 100644 --- a/app-features/seasons/build.gradle.kts +++ b/app-features/seasons/build.gradle.kts @@ -2,8 +2,12 @@ plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.seasons" +} + dependencies { - implementation(projects.shared.domain.show.api) + implementation(projects.shared.domain.showDetails.api) implementation(projects.shared.domain.seasons.api) implementation(projects.shared.domain.showCommon.api) implementation(projects.shared.domain.seasonEpisodes.api) diff --git a/app-features/seasons/src/main/AndroidManifest.xml b/app-features/seasons/src/main/AndroidManifest.xml deleted file mode 100644 index b3840c28a..000000000 --- a/app-features/seasons/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsScreen.kt b/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsScreen.kt index 3a7776c59..bee440ec0 100644 --- a/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsScreen.kt +++ b/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsScreen.kt @@ -45,7 +45,7 @@ import com.thomaskioko.tvmaniac.compose.util.iconButtonBackgroundScrim import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonsViewState import com.thomaskioko.tvmaniac.seasonepisodes.api.model.Episode import com.thomaskioko.tvmaniac.seasonepisodes.api.model.SeasonWithEpisodes -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import dev.chrisbanes.snapper.ExperimentalSnapperApi import dev.chrisbanes.snapper.rememberSnapperFlingBehavior diff --git a/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsViewModel.kt b/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsViewModel.kt index b205fe1b6..bb38561a8 100644 --- a/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsViewModel.kt +++ b/app-features/seasons/src/main/java/com/thomaskioko/tvmaniac/seasons/SeasonsViewModel.kt @@ -3,7 +3,8 @@ package com.thomaskioko.tvmaniac.seasons import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveShowInteractor +import com.thomaskioko.tvmaniac.core.util.CoroutineScopeOwner +import com.thomaskioko.tvmaniac.details.api.interactor.ObserveShowInteractor import com.thomaskioko.tvmaniac.seasonepisodes.api.ObserveSeasonWithEpisodesInteractor import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonsAction import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonsAction.Error @@ -11,8 +12,7 @@ import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonsAction.LoadSeasons import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonsAction.LoadShowDetails import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonsEffect import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonsViewState -import com.thomaskioko.tvmaniac.shared.core.CoroutineScopeOwner -import com.thomaskioko.tvmaniac.shared.core.store.Store +import com.thomaskioko.tvmaniac.shared.core.ui.Store import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow diff --git a/app-features/settings/build.gradle.kts b/app-features/settings/build.gradle.kts index 2c020b699..0f878bd36 100644 --- a/app-features/settings/build.gradle.kts +++ b/app-features/settings/build.gradle.kts @@ -2,5 +2,9 @@ plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.settings" +} + dependencies { } diff --git a/app-features/settings/src/main/AndroidManifest.xml b/app-features/settings/src/main/AndroidManifest.xml deleted file mode 100644 index fb1d03fe3..000000000 --- a/app-features/settings/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsContract.kt b/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsContract.kt index eef760f75..a31405c6d 100644 --- a/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsContract.kt +++ b/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsContract.kt @@ -1,8 +1,8 @@ package com.thomaskioko.tvmaniac.settings -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.Effect -import com.thomaskioko.tvmaniac.shared.core.store.State +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.Effect +import com.thomaskioko.tvmaniac.shared.core.ui.State data class SettingsState( val theme: Theme, diff --git a/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsViewModel.kt b/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsViewModel.kt index 0898dd418..dfba379cc 100644 --- a/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsViewModel.kt +++ b/app-features/settings/src/main/kotlin/com/thomaskioko/tvmaniac/settings/SettingsViewModel.kt @@ -7,7 +7,7 @@ import com.thomaskioko.tvmaniac.settings.SettingsActions.LoadTheme import com.thomaskioko.tvmaniac.settings.SettingsActions.ThemeClicked import com.thomaskioko.tvmaniac.settings.SettingsActions.ThemeSelected import com.thomaskioko.tvmaniac.settings.api.TvManiacPreferences -import com.thomaskioko.tvmaniac.shared.core.store.Store +import com.thomaskioko.tvmaniac.shared.core.ui.Store import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.InternalCoroutinesApi diff --git a/app-features/show-details/build.gradle.kts b/app-features/show-details/build.gradle.kts index 34508eebe..60e8029e4 100644 --- a/app-features/show-details/build.gradle.kts +++ b/app-features/show-details/build.gradle.kts @@ -4,7 +4,11 @@ plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.showdetails" +} + dependencies { - implementation(projects.shared.domain.show.api) + implementation(projects.shared.domain.showDetails.api) implementation(projects.shared.domain.similar.api) } diff --git a/app-features/show-details/src/main/AndroidManifest.xml b/app-features/show-details/src/main/AndroidManifest.xml deleted file mode 100644 index d9b12eb2e..000000000 --- a/app-features/show-details/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/PreviewMockData.kt b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/PreviewMockData.kt index 788366906..440f762ca 100644 --- a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/PreviewMockData.kt +++ b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/PreviewMockData.kt @@ -1,10 +1,10 @@ package com.thomaskioko.showdetails -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailViewState +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailViewState import com.thomaskioko.tvmaniac.genre.api.GenreUIModel import com.thomaskioko.tvmaniac.lastairepisodes.api.LastAirEpisode import com.thomaskioko.tvmaniac.seasons.api.model.SeasonUiModel -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow val detailUiState = ShowDetailViewState( isLoading = false, @@ -63,7 +63,8 @@ fun getEpisodeList() = listOf( LastAirEpisode( id = 2534997, name = "Glorious Purpose", - overview = "After stealing the Tesseract in Avengers: Endgame, Loki lands before the Time Variance Authority.", + overview = "After stealing the Tesseract in Avengers: Endgame, Loki lands before the Time" + + " Variance Authority.", posterPath = "https://image.tmdb.org/t/p/original/gxh0k3aADsYkt9tgkfm2kGn2qQj.jpg", voteCount = 42, voteAverage = 6.429, @@ -75,7 +76,8 @@ fun getEpisodeList() = listOf( LastAirEpisode( id = 2927202, name = "The Variant", - overview = "Mobius puts Loki to work, but not everyone at TVA is thrilled about the God of Mischief's presence.", + overview = "Mobius puts Loki to work, but not everyone at TVA is thrilled about the God of " + + "Mischief's presence.", posterPath = "https://image.tmdb.org/t/p/original/gqpcfkdmSsm6xiX2EsLkwUvA8g8.jpg", voteCount = 23, voteAverage = 7.6, diff --git a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailNavigationFactory.kt b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailNavigationFactory.kt index 90b6c7a4b..90b9eb4fa 100644 --- a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailNavigationFactory.kt +++ b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailNavigationFactory.kt @@ -28,7 +28,7 @@ class ShowDetailNavigationFactory @Inject constructor() : ComposeNavigationFacto navController.navigate("${NavigationScreen.SeasonsNavScreen.route}/$showId/$seasonName") }, onEpisodeClicked = { episodeNumber, seasonNumber -> - // TODO:: Navigate to episode detail screen + // Navigate to episode detail screen } ) } diff --git a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailScreen.kt b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailScreen.kt index 15ed2c949..1c9911c85 100644 --- a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailScreen.kt +++ b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailScreen.kt @@ -2,9 +2,7 @@ package com.thomaskioko.showdetails import android.content.res.Configuration import androidx.compose.animation.AnimatedVisibility -import androidx.compose.foundation.Image import androidx.compose.foundation.background -import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -21,11 +19,8 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.ButtonDefaults import androidx.compose.material.ContentAlpha -import androidx.compose.material.ExtendedFloatingActionButton -import androidx.compose.material.FloatingActionButtonDefaults import androidx.compose.material.LocalContentAlpha import androidx.compose.material.MaterialTheme import androidx.compose.material.ScrollableTabRow @@ -48,14 +43,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clipToBounds import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.ColorFilter -import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.buildAnnotatedString -import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview @@ -66,6 +58,7 @@ import com.thomaskioko.tvmaniac.compose.components.ChoiceChipContent import com.thomaskioko.tvmaniac.compose.components.CollapsableAppBar import com.thomaskioko.tvmaniac.compose.components.ColumnSpacer import com.thomaskioko.tvmaniac.compose.components.ExpandingText +import com.thomaskioko.tvmaniac.compose.components.ExtendedFab import com.thomaskioko.tvmaniac.compose.components.KenBurnsViewImage import com.thomaskioko.tvmaniac.compose.components.LoadingItem import com.thomaskioko.tvmaniac.compose.components.RowSpacer @@ -73,20 +66,18 @@ import com.thomaskioko.tvmaniac.compose.rememberFlowWithLifecycle import com.thomaskioko.tvmaniac.compose.theme.TvManiacTheme import com.thomaskioko.tvmaniac.compose.theme.backgroundGradient import com.thomaskioko.tvmaniac.compose.util.copy -import com.thomaskioko.tvmaniac.discover.api.interactor.UpdateShowParams -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailAction -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailAction.UpdateFavorite -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailEffect -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailViewState +import com.thomaskioko.tvmaniac.details.api.interactor.UpdateShowParams +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailAction +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailAction.UpdateFavorite +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailEffect +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailViewState import com.thomaskioko.tvmaniac.genre.api.GenreUIModel import com.thomaskioko.tvmaniac.resources.R import com.thomaskioko.tvmaniac.seasons.api.model.SeasonUiModel -import com.thomaskioko.tvmaniac.showcommon.api.TvShow -import kotlinx.coroutines.InternalCoroutinesApi +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow private val HeaderHeight = 550.dp -@OptIn(InternalCoroutinesApi::class) @Composable fun ShowDetailScreen( viewModel: ShowDetailsViewModel, @@ -267,7 +258,7 @@ private fun HeaderImage(backdropImageUrl: String) { @Composable private fun Body( - tvShow: com.thomaskioko.tvmaniac.showcommon.api.TvShow, + tvShow: TvShow, genreUIS: List, onUpdateFavoriteClicked: (UpdateShowParams) -> Unit ) { @@ -430,34 +421,14 @@ fun ShowDetailButtons( horizontalArrangement = Arrangement.Center, ) { - ExtendedFloatingActionButton( - icon = { - Image( - painter = painterResource(id = R.drawable.ic_trailer_24), - contentDescription = null, - colorFilter = ColorFilter.tint(MaterialTheme.colors.secondary.copy(alpha = 0.8F)), - ) - }, - text = { - CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { - Text( - text = stringResource(id = R.string.btn_trailer), - style = MaterialTheme.typography.body2, - ) - } - }, - shape = RectangleShape, - backgroundColor = Color.Transparent, - elevation = FloatingActionButtonDefaults.elevation(0.dp), - onClick = {}, - modifier = Modifier - .padding(2.dp) - .border(1.dp, Color(0xFF414141), RoundedCornerShape(8.dp)) + ExtendedFab( + painter = painterResource(id = R.drawable.ic_trailer_24), + text = stringResource(id = R.string.btn_trailer) ) RowSpacer(value = 8) - val message = if (tvShow.following) + val buttonText = if (tvShow.following) stringResource(id = R.string.unfollow) else stringResource(id = R.string.following) @@ -465,34 +436,9 @@ fun ShowDetailButtons( painterResource(id = R.drawable.ic_baseline_check_box_24) else painterResource(id = R.drawable.ic_baseline_add_box_24) - ExtendedFloatingActionButton( - icon = { - Image( - painter = imageVector, - contentDescription = null, - colorFilter = ColorFilter.tint(MaterialTheme.colors.secondary.copy(alpha = 0.8F)), - ) - }, - text = { - CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { - Text( - text = message, - style = MaterialTheme.typography.body2, - textAlign = TextAlign.Center, - overflow = TextOverflow.Ellipsis, - maxLines = 1 - ) - } - }, - shape = RectangleShape, - backgroundColor = Color.Transparent, - elevation = FloatingActionButtonDefaults.elevation(0.dp), - onClick = { - onWatchlistClick(UpdateShowParams(tvShow.id, !tvShow.following)) - }, - modifier = Modifier - .padding(2.dp) - .border(1.dp, Color(0xFF414141), RoundedCornerShape(8.dp)) + ExtendedFab( + painter = imageVector, + text = buttonText ) } } diff --git a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailsViewModel.kt b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailsViewModel.kt index 797c5b815..df8d39b78 100644 --- a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailsViewModel.kt +++ b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/ShowDetailsViewModel.kt @@ -3,18 +3,18 @@ package com.thomaskioko.showdetails import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveShowInteractor -import com.thomaskioko.tvmaniac.discover.api.interactor.UpdateFollowingInteractor -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailAction -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailAction.UpdateFavorite -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailEffect -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailEffect.ShowDetailsError -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailViewState +import com.thomaskioko.tvmaniac.core.util.CoroutineScopeOwner +import com.thomaskioko.tvmaniac.details.api.interactor.ObserveShowInteractor +import com.thomaskioko.tvmaniac.details.api.interactor.UpdateFollowingInteractor +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailAction +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailAction.UpdateFavorite +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailEffect +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailEffect.ShowDetailsError +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailViewState import com.thomaskioko.tvmaniac.genre.api.GetGenresInteractor import com.thomaskioko.tvmaniac.lastairepisodes.api.ObserveAirEpisodesInteractor import com.thomaskioko.tvmaniac.seasons.api.interactor.ObserveSeasonsInteractor -import com.thomaskioko.tvmaniac.shared.core.CoroutineScopeOwner -import com.thomaskioko.tvmaniac.shared.core.store.Store +import com.thomaskioko.tvmaniac.shared.core.ui.Store import com.thomaskioko.tvmaniac.similar.api.ObserveSimilarShowsInteractor import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineScope @@ -74,7 +74,7 @@ class ShowDetailsViewModel @Inject constructor( } is ShowDetailAction.LoadEpisodes -> fetchEpisodes() is ShowDetailAction.BookmarkEpisode -> { - // TODO:: Update episode watchlist + // TODO Update episode watchlist } } } diff --git a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/SimilarShowsScreen.kt b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/SimilarShowsScreen.kt index 5d514ae69..3a5293a7f 100644 --- a/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/SimilarShowsScreen.kt +++ b/app-features/show-details/src/main/kotlin/com/thomaskioko/showdetails/SimilarShowsScreen.kt @@ -19,7 +19,7 @@ import com.thomaskioko.tvmaniac.compose.components.ColumnSpacer import com.thomaskioko.tvmaniac.compose.components.TvShowCard import com.thomaskioko.tvmaniac.compose.theme.TvManiacTheme import com.thomaskioko.tvmaniac.resources.R -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import dev.chrisbanes.snapper.ExperimentalSnapperApi import dev.chrisbanes.snapper.rememberSnapperFlingBehavior diff --git a/app-features/shows-grid/build.gradle.kts b/app-features/shows-grid/build.gradle.kts index b223bbd00..7bed6bd3f 100644 --- a/app-features/shows-grid/build.gradle.kts +++ b/app-features/shows-grid/build.gradle.kts @@ -1,12 +1,16 @@ @file:Suppress("UnstableApiUsage") +import util.libs plugins { `android-feature-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.show_grid" +} + dependencies { - implementation(projects.shared.domain.show.api) + implementation(projects.shared.domain.showDetails.api) implementation(projects.shared.domain.showCommon.api) - implementation(projects.shared.interactors) implementation(libs.multiplatform.paging.core) } diff --git a/app-features/shows-grid/src/main/AndroidManifest.xml b/app-features/shows-grid/src/main/AndroidManifest.xml deleted file mode 100644 index 233750b31..000000000 --- a/app-features/shows-grid/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowGridViewModel.kt b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowGridViewModel.kt index 7553cdcdb..cb9bb6922 100644 --- a/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowGridViewModel.kt +++ b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowGridViewModel.kt @@ -3,12 +3,9 @@ package com.thomaskioko.tvmaniac.show_grid import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.thomaskioko.tvmaniac.interactors.ObserveShowsByCategoryInteractor -import com.thomaskioko.tvmaniac.interactors.ShowsGridAction -import com.thomaskioko.tvmaniac.interactors.ShowsGridEffect -import com.thomaskioko.tvmaniac.interactors.ShowsGridState -import com.thomaskioko.tvmaniac.shared.core.CoroutineScopeOwner -import com.thomaskioko.tvmaniac.shared.core.store.Store +import com.thomaskioko.tvmaniac.core.util.CoroutineScopeOwner +import com.thomaskioko.tvmaniac.shared.core.ui.Store +import com.thomaskioko.tvmaniac.show_grid.domain.ObserveShowsByCategoryInteractor import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow diff --git a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ShowsGridContract.kt b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowsGridContract.kt similarity index 72% rename from shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ShowsGridContract.kt rename to app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowsGridContract.kt index e1b09e90a..57879adc5 100644 --- a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ShowsGridContract.kt +++ b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowsGridContract.kt @@ -1,10 +1,10 @@ -package com.thomaskioko.tvmaniac.interactors +package com.thomaskioko.tvmaniac.show_grid import com.kuuurt.paging.multiplatform.PagingData -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.Effect -import com.thomaskioko.tvmaniac.shared.core.store.State -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.Effect +import com.thomaskioko.tvmaniac.shared.core.ui.State +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf diff --git a/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowsGridScreen.kt b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowsGridScreen.kt index 47bc7cad2..7ce628803 100644 --- a/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowsGridScreen.kt +++ b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/ShowsGridScreen.kt @@ -25,9 +25,8 @@ import com.thomaskioko.tvmaniac.compose.components.BackAppBar import com.thomaskioko.tvmaniac.compose.components.LazyPagedGridItems import com.thomaskioko.tvmaniac.compose.components.NetworkImageComposable import com.thomaskioko.tvmaniac.compose.rememberFlowWithLifecycle -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory -import com.thomaskioko.tvmaniac.interactors.ShowsGridState import com.thomaskioko.tvmaniac.resources.R +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory import kotlinx.coroutines.CoroutineScope @OptIn(ExperimentalFoundationApi::class) diff --git a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ObserveShowsByCategoryInteractor.kt b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/domain/ObserveShowsByCategoryInteractor.kt similarity index 80% rename from shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ObserveShowsByCategoryInteractor.kt rename to app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/domain/ObserveShowsByCategoryInteractor.kt index c79eb3eb2..2c80535b9 100644 --- a/shared/interactors/src/commonMain/kotlin/com/thomaskioko/tvmaniac/interactors/ObserveShowsByCategoryInteractor.kt +++ b/app-features/shows-grid/src/main/kotlin/com/thomaskioko/tvmaniac/show_grid/domain/ObserveShowsByCategoryInteractor.kt @@ -1,12 +1,12 @@ -package com.thomaskioko.tvmaniac.interactors +package com.thomaskioko.tvmaniac.show_grid.domain import com.kuuurt.paging.multiplatform.PagingData import com.kuuurt.paging.multiplatform.map +import com.thomaskioko.tvmaniac.core.util.FlowInteractor import com.thomaskioko.tvmaniac.datasource.cache.Show -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flow diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 69820d061..593a892c9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -2,13 +2,18 @@ plugins { `android-app-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac" +} + dependencies { - implementation(projects.shared.core) + implementation(projects.shared.core.ui) + implementation(projects.shared.core.util) implementation(projects.shared.database) implementation(projects.shared.remote) - implementation(projects.shared.domain.show.api) + implementation(projects.shared.domain.showDetails.api) implementation(projects.shared.domain.showCommon.api) - implementation(projects.shared.domain.show.implementation) + implementation(projects.shared.domain.showDetails.implementation) implementation(projects.shared.domain.seasons.api) implementation(projects.shared.domain.seasons.implementation) implementation(projects.shared.domain.episodes.api) @@ -21,7 +26,8 @@ dependencies { implementation(projects.shared.domain.similar.implementation) implementation(projects.shared.domain.seasonEpisodes.api) implementation(projects.shared.domain.seasonEpisodes.implementation) - implementation(projects.shared.interactors) + implementation(projects.shared.domain.discover.api) + implementation(projects.shared.domain.discover.implementation) implementation(projects.appCommon.annotations) implementation(projects.appCommon.compose) implementation(projects.appCommon.resources) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 92503a9e7..99dc38734 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/DatabaseModule.kt b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/DatabaseModule.kt index 6d7346581..bae893542 100644 --- a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/DatabaseModule.kt +++ b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/DatabaseModule.kt @@ -4,11 +4,13 @@ import android.content.Context import com.thomaskioko.tvmaniac.core.db.DriverFactory import com.thomaskioko.tvmaniac.core.db.TvManiacDatabaseFactory import com.thomaskioko.tvmaniac.datasource.cache.TvManiacDatabase +import com.thomaskioko.tvmaniac.details.api.cache.ShowCategoryCache +import com.thomaskioko.tvmaniac.details.implementation.cache.ShowCategoryCacheImpl +import com.thomaskioko.tvmaniac.details.implementation.cache.TvShowCacheImpl import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache -import com.thomaskioko.tvmaniac.discover.api.cache.ShowCategoryCache -import com.thomaskioko.tvmaniac.discover.implementation.cache.CategoryCacheImpl -import com.thomaskioko.tvmaniac.discover.implementation.cache.ShowCategoryCacheImpl -import com.thomaskioko.tvmaniac.discover.implementation.cache.TvShowCacheImpl +import com.thomaskioko.tvmaniac.discover.api.cache.DiscoverCategoryCache +import com.thomaskioko.tvmaniac.discover.implementation.CategoryCacheImpl +import com.thomaskioko.tvmaniac.discover.implementation.DiscoverCategoryCacheImpl import com.thomaskioko.tvmaniac.episodes.api.EpisodesCache import com.thomaskioko.tvmaniac.episodes.implementation.EpisodesCacheImpl import com.thomaskioko.tvmaniac.genre.api.GenreCache @@ -19,7 +21,7 @@ import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonWithEpisodesCache import com.thomaskioko.tvmaniac.seasonepisodes.implementation.SeasonWithEpisodesCacheImpl import com.thomaskioko.tvmaniac.seasons.api.SeasonsCache import com.thomaskioko.tvmaniac.seasons.implementation.SeasonsCacheImpl -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache import com.thomaskioko.tvmaniac.similar.api.SimilarShowCache import com.thomaskioko.tvmaniac.similar.implementation.SimilarShowCacheImpl import dagger.Module @@ -98,4 +100,10 @@ object DatabaseModule { fun provideSeasonWithEpisodesCache(database: TvManiacDatabase): SeasonWithEpisodesCache { return SeasonWithEpisodesCacheImpl(database) } + + @Singleton + @Provides + fun provideSeasonWithDiscoverCategoryCache(database: TvManiacDatabase): DiscoverCategoryCache { + return DiscoverCategoryCacheImpl(database) + } } diff --git a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/InteractorsModule.kt b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/InteractorsModule.kt index 31d30d8d5..940aebb76 100644 --- a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/InteractorsModule.kt +++ b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/InteractorsModule.kt @@ -1,22 +1,23 @@ package com.thomaskioko.tvmaniac.injection import com.thomaskioko.tvmaniac.core.annotations.DefaultDispatcher -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveDiscoverShowsInteractor -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveShowInteractor -import com.thomaskioko.tvmaniac.discover.api.interactor.UpdateFollowingInteractor -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.details.api.interactor.ObserveShowInteractor +import com.thomaskioko.tvmaniac.details.api.interactor.UpdateFollowingInteractor +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.discover.api.ObserveDiscoverShowsInteractor +import com.thomaskioko.tvmaniac.discover.api.repository.DiscoverRepository import com.thomaskioko.tvmaniac.episodes.api.EpisodeRepository import com.thomaskioko.tvmaniac.episodes.api.ObserveEpisodesInteractor +import com.thomaskioko.tvmaniac.following.ObserveFollowingInteractor import com.thomaskioko.tvmaniac.genre.api.GenreRepository import com.thomaskioko.tvmaniac.genre.api.GetGenresInteractor -import com.thomaskioko.tvmaniac.interactors.ObserveFollowingInteractor -import com.thomaskioko.tvmaniac.interactors.ObserveShowsByCategoryInteractor import com.thomaskioko.tvmaniac.lastairepisodes.api.LastAirEpisodeRepository import com.thomaskioko.tvmaniac.lastairepisodes.api.ObserveAirEpisodesInteractor import com.thomaskioko.tvmaniac.seasonepisodes.api.ObserveSeasonWithEpisodesInteractor import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonWithEpisodesRepository import com.thomaskioko.tvmaniac.seasons.api.SeasonsRepository import com.thomaskioko.tvmaniac.seasons.api.interactor.ObserveSeasonsInteractor +import com.thomaskioko.tvmaniac.show_grid.domain.ObserveShowsByCategoryInteractor import com.thomaskioko.tvmaniac.similar.api.ObserveSimilarShowsInteractor import com.thomaskioko.tvmaniac.similar.api.SimilarShowsRepository import dagger.Module @@ -45,7 +46,7 @@ object InteractorsModule { @Singleton @Provides fun provideObserveShowsByCategoryInteractor( - repository: TvShowsRepository + repository: DiscoverRepository ): ObserveDiscoverShowsInteractor = ObserveDiscoverShowsInteractor(repository) @Singleton diff --git a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/NetworkModule.kt b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/NetworkModule.kt index be51edcc4..8682bd403 100644 --- a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/NetworkModule.kt +++ b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/NetworkModule.kt @@ -1,11 +1,11 @@ package com.thomaskioko.tvmaniac.injection import android.content.Context +import com.thomaskioko.tvmaniac.core.util.AppContext +import com.thomaskioko.tvmaniac.core.util.network.ObserveConnectionState import com.thomaskioko.tvmaniac.remote.KtorClientFactory import com.thomaskioko.tvmaniac.remote.api.TvShowsService import com.thomaskioko.tvmaniac.remote.api.TvShowsServiceImpl -import com.thomaskioko.tvmaniac.shared.core.AppContext -import com.thomaskioko.tvmaniac.shared.core.util.network.ObserveConnectionState import dagger.Module import dagger.Provides import dagger.hilt.InstallIn diff --git a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/RepositoriesModule.kt b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/RepositoriesModule.kt index 52aceece6..5f95cf1c8 100644 --- a/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/RepositoriesModule.kt +++ b/app/src/main/kotlin/com/thomaskioko/tvmaniac/injection/RepositoriesModule.kt @@ -2,10 +2,13 @@ package com.thomaskioko.tvmaniac.injection import com.thomaskioko.tvmaniac.core.annotations.DefaultDispatcher import com.thomaskioko.tvmaniac.core.annotations.IoCoroutineScope +import com.thomaskioko.tvmaniac.details.api.cache.ShowCategoryCache +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.details.implementation.repository.TvShowsRepositoryImpl import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache -import com.thomaskioko.tvmaniac.discover.api.cache.ShowCategoryCache -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.discover.implementation.repository.TvShowsRepositoryImpl +import com.thomaskioko.tvmaniac.discover.api.cache.DiscoverCategoryCache +import com.thomaskioko.tvmaniac.discover.api.repository.DiscoverRepository +import com.thomaskioko.tvmaniac.discover.implementation.DiscoverRepositoryImpl import com.thomaskioko.tvmaniac.episodes.api.EpisodeRepository import com.thomaskioko.tvmaniac.episodes.api.EpisodesCache import com.thomaskioko.tvmaniac.episodes.implementation.EpisodeRepositoryImpl @@ -22,7 +25,7 @@ import com.thomaskioko.tvmaniac.seasonepisodes.implementation.SeasonWithEpisodes import com.thomaskioko.tvmaniac.seasons.api.SeasonsCache import com.thomaskioko.tvmaniac.seasons.api.SeasonsRepository import com.thomaskioko.tvmaniac.seasons.implementation.SeasonsRepositoryImpl -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache import com.thomaskioko.tvmaniac.similar.api.SimilarShowCache import com.thomaskioko.tvmaniac.similar.api.SimilarShowsRepository import com.thomaskioko.tvmaniac.similar.implementation.SimilarShowsRepositoryImpl @@ -43,7 +46,6 @@ object RepositoriesModule { fun provideTvShowsRepository( tvShowsService: TvShowsService, tvShowCache: TvShowCache, - categoryCache: CategoryCache, showCategoryCache: ShowCategoryCache, epAirCacheLast: LastEpisodeAirCache, @IoCoroutineScope coroutineScope: CoroutineScope, @@ -52,13 +54,29 @@ object RepositoriesModule { TvShowsRepositoryImpl( apiService = tvShowsService, tvShowCache = tvShowCache, - categoryCache = categoryCache, showCategoryCache = showCategoryCache, epAirCacheLast = epAirCacheLast, coroutineScope = coroutineScope, dispatcher = ioDispatcher ) + @Singleton + @Provides + fun provideDiscoverRepository( + tvShowsService: TvShowsService, + tvShowCache: TvShowCache, + categoryCache: CategoryCache, + discoverCategoryCache: DiscoverCategoryCache, + @DefaultDispatcher ioDispatcher: CoroutineDispatcher + ): DiscoverRepository = + DiscoverRepositoryImpl( + apiService = tvShowsService, + tvShowCache = tvShowCache, + categoryCache = categoryCache, + discoverCategoryCache = discoverCategoryCache, + dispatcher = ioDispatcher + ) + @Singleton @Provides fun provideGenreRepository( diff --git a/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt b/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt index b5edd11be..ed5baf0da 100644 --- a/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt +++ b/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt @@ -26,12 +26,12 @@ import com.thomaskioko.tvmaniac.compose.components.ConnectionStatus import com.thomaskioko.tvmaniac.compose.theme.DarkColors import com.thomaskioko.tvmaniac.compose.theme.LightColors import com.thomaskioko.tvmaniac.compose.theme.TvManiacTheme +import com.thomaskioko.tvmaniac.core.util.network.ConnectionState +import com.thomaskioko.tvmaniac.core.util.network.ObserveConnectionState import com.thomaskioko.tvmaniac.home.HomeScreen import com.thomaskioko.tvmaniac.navigation.ComposeNavigationFactory import com.thomaskioko.tvmaniac.settings.api.TvManiacPreferences import com.thomaskioko.tvmaniac.settings.domain.shouldUseDarkColors -import com.thomaskioko.tvmaniac.shared.core.util.network.ConnectionState -import com.thomaskioko.tvmaniac.shared.core.util.network.ObserveConnectionState import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay diff --git a/build.gradle.kts b/build.gradle.kts index 86b4b06e9..64964187d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,6 +11,7 @@ allprojects { repositories.applyDefault() plugins.apply("checks.dependency-updates") + plugins.apply("checks.detekt") } tasks.register("clean", Delete::class) { @@ -24,11 +25,9 @@ tasks.withType().configureEach { subprojects { tasks.withType().configureEach { with(kotlinOptions) { - jvmTarget = JavaVersion.VERSION_1_8.toString() - languageVersion = "1.5" - apiVersion = "1.5" freeCompilerArgs = freeCompilerArgs + listOf( "-Xopt-in=kotlin.RequiresOptIn", + "-Xopt-in=kotlin.OptIn", "-Xopt-in=kotlin.time.ExperimentalTime", "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", ) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index f2431cf1d..0736c9d34 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -19,4 +19,5 @@ dependencies { implementation(libs.plugin.dependency.check) implementation(libs.plugin.hilt) implementation(libs.plugin.buildkonfig) + implementation(libs.plugin.detekt) } diff --git a/buildSrc/src/main/kotlin/android-feature-plugin.gradle.kts b/buildSrc/src/main/kotlin/android-feature-plugin.gradle.kts index be8333edf..092735a8a 100644 --- a/buildSrc/src/main/kotlin/android-feature-plugin.gradle.kts +++ b/buildSrc/src/main/kotlin/android-feature-plugin.gradle.kts @@ -49,7 +49,8 @@ tasks.withType().configureEach { } dependencies { - implementation(project(":shared:core")) + implementation(project(":shared:core:ui")) + implementation(project(":shared:core:util")) implementation(project(":app-common:annotations")) implementation(project(":app-common:compose")) implementation(project(":app-common:navigation")) diff --git a/buildSrc/src/main/kotlin/com/thomaskioko/tvmaniac/checks/detekt.gradle.kts b/buildSrc/src/main/kotlin/com/thomaskioko/tvmaniac/checks/detekt.gradle.kts new file mode 100644 index 000000000..c691a6ae6 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/thomaskioko/tvmaniac/checks/detekt.gradle.kts @@ -0,0 +1,21 @@ +package checks + +import io.gitlab.arturbosch.detekt.DetektPlugin +import io.gitlab.arturbosch.detekt.extensions.DetektExtension + +apply() + +configure { + + parallel = true + source = project.files("src/main/kotlin") + config = files("${rootProject.projectDir}/tooling/config/detekt.yml") + + reports { + html.required.set(true) + html.outputLocation.set(rootProject.file("build/reports/detekt/report.html")) + + xml.required.set(true) + xml.outputLocation.set(rootProject.file("build/reports/detekt/report.xml")) + } +} diff --git a/buildSrc/src/main/kotlin/kmm-domain-plugin.gradle.kts b/buildSrc/src/main/kotlin/kmm-domain-plugin.gradle.kts index 24df0ff41..e746d31de 100644 --- a/buildSrc/src/main/kotlin/kmm-domain-plugin.gradle.kts +++ b/buildSrc/src/main/kotlin/kmm-domain-plugin.gradle.kts @@ -30,7 +30,6 @@ kotlin { android { compileSdk = libs.versions.android.compile.get().toInt() - sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") defaultConfig { minSdk = libs.versions.android.min.get().toInt() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2234bf70f..94e4bd7ab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ android-compile = "31" android-target = "31" android-min = "23" -android-gradle = "7.1.0" +android-gradle = "7.1.2" date-time = "0.3.1" accompanist = "0.22.0-rc" @@ -24,7 +24,7 @@ androidx-paging = "3.1.0" coil = "1.4.0" coroutines-native = "1.6.0-native-mt" -coroutines = "1.6.0" +coroutines-core = "1.6.0" desugar = "1.1.5" hilt = "2.40.5" hiltNavigation = "1.0.0-rc01" @@ -48,6 +48,7 @@ testing-mockito-kotlin = "2.2.0" plugin-buildkonfig = "0.7.0" plugin-gradle-versions = "0.39.0" +plugin-detekt = "1.19.0" shared-module-version = "0.3.1" @@ -120,6 +121,7 @@ plugin-dependency-check = { module = "com.github.ben-manes:gradle-versions-plugi plugin-hilt = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" } plugin-buildkonfig = { module = "com.codingfeline.buildkonfig:buildkonfig-gradle-plugin", version.ref = "plugin-buildkonfig" } plugin-squareup-sqldelight = { module = "com.squareup.sqldelight:gradle-plugin", version.ref = "sqldelight" } +plugin-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "plugin-detekt" } testing-androidx-core = { module = "androidx.arch.core:core-testing", version.ref = "testing-arch-core" } testing-androidx-junit = { module = "androidx.test.ext:junit", version.ref = "testing-junitext" } @@ -134,7 +136,7 @@ testing-kotest-runner = { module = "io.kotest:kotest-runner-junit5", version.ref testing-mockk-core = { module = "io.mockk:mockk", version.ref = "testing-mockk" } testing-mockk-common = { module = "io.mockk:mockk-common", version.ref = "testing-mockk" } -testing-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } +testing-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines-core" } testing-junit = { module = "junit:junit", version.ref = "testing-junit" } testing-turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } diff --git a/settings.gradle.kts b/settings.gradle.kts index de6c03ad5..8545be027 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,20 +25,20 @@ include( ":app-features:shows-grid", ":app-features:settings", ":app-features:seasons", - ":shared", - ":shared:core", - ":shared:core-test", + ":shared:shared", + ":shared:core:ui", + ":shared:core:util", + ":shared:core:test", ":shared:database", ":shared:remote", - ":shared:domain:show:api", - ":shared:domain:show:implementation", + ":shared:domain:show-details:api", + ":shared:domain:show-details:implementation", ":shared:domain:seasons:api", ":shared:domain:seasons:implementation", ":shared:domain:episodes:api", ":shared:domain:episodes:implementation", ":shared:domain:genre:api", ":shared:domain:genre:implementation", - ":shared:interactors", ":shared:domain:last-air-episodes:api", ":shared:domain:last-air-episodes:implementation", ":shared:domain:similar:api", @@ -46,4 +46,6 @@ include( ":shared:domain:season-episodes:api", ":shared:domain:season-episodes:implementation", ":shared:domain:show-common:api", + ":shared:domain:discover:api", + ":shared:domain:discover:implementation" ) diff --git a/shared/core-test/src/androidMain/AndroidManifest.xml b/shared/core-test/src/androidMain/AndroidManifest.xml deleted file mode 100644 index d27dd593f..000000000 --- a/shared/core-test/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt b/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt deleted file mode 100644 index c0083b629..000000000 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.thomaskioko.tvmaniac.shared.core.di - -import org.koin.core.module.Module -import org.koin.dsl.module - -actual fun corePlatformModule(): Module = module { } diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt b/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt deleted file mode 100644 index 86631e56a..000000000 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.thomaskioko.tvmaniac.shared.core - -expect class AppContext diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt b/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt deleted file mode 100644 index 63612d822..000000000 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.thomaskioko.tvmaniac.shared.core.di - -import org.koin.core.module.Module - -expect fun corePlatformModule(): Module diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt b/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt deleted file mode 100644 index eb9069ca9..000000000 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.thomaskioko.tvmaniac.shared.core - -actual typealias AppContext = Any diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt b/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt deleted file mode 100644 index 1f31e6c60..000000000 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/di/Module.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.thomaskioko.tvmaniac.shared.core.di - -import com.thomaskioko.tvmaniac.shared.core.MainDispatcher -import org.koin.core.module.Module -import org.koin.dsl.module - -actual fun corePlatformModule(): Module = module { - single { MainDispatcher() } -} diff --git a/shared/core-test/build.gradle.kts b/shared/core/test/build.gradle.kts similarity index 57% rename from shared/core-test/build.gradle.kts rename to shared/core/test/build.gradle.kts index 05e00ad35..5af50f0b4 100644 --- a/shared/core-test/build.gradle.kts +++ b/shared/core/test/build.gradle.kts @@ -1,7 +1,13 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.core.test" +} + dependencies { commonMainImplementation(libs.kotlin.coroutines.core) } diff --git a/shared/core-test/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt b/shared/core/test/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt similarity index 100% rename from shared/core-test/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt rename to shared/core/test/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt diff --git a/shared/core-test/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt b/shared/core/test/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt similarity index 100% rename from shared/core-test/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt rename to shared/core/test/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt diff --git a/shared/core-test/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt b/shared/core/test/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt similarity index 100% rename from shared/core-test/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt rename to shared/core/test/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/test/CoroutineTestUtil.kt diff --git a/shared/core/ui/build.gradle.kts b/shared/core/ui/build.gradle.kts new file mode 100644 index 000000000..19eef11aa --- /dev/null +++ b/shared/core/ui/build.gradle.kts @@ -0,0 +1,19 @@ +import util.libs + +plugins { + `kmm-domain-plugin` +} + +android { + namespace = "com.thomaskioko.tvmaniac.shared.core.ui" +} + +dependencies { + + commonMainImplementation(projects.shared.core.util) + commonMainImplementation(libs.kotlin.coroutines.core) + commonMainImplementation(libs.koin.core) + + iosMainImplementation(libs.kotlin.coroutines.core) + iosMainImplementation(libs.koin.core) +} diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt b/shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt similarity index 79% rename from shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt rename to shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt index 2b1304e63..51f8d8cc6 100644 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt +++ b/shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt @@ -1,7 +1,6 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.shared.core.ui -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.ViewState +import com.thomaskioko.tvmaniac.core.util.CoroutineScopeOwner import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt b/shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt similarity index 78% rename from shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt rename to shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt index 5f91bda34..a52219864 100644 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt +++ b/shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.shared.core.ui import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers diff --git a/shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt b/shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt new file mode 100644 index 000000000..0a6160d55 --- /dev/null +++ b/shared/core/ui/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt @@ -0,0 +1,6 @@ +package com.thomaskioko.tvmaniac.shared.core.ui.di + +import org.koin.core.module.Module +import org.koin.dsl.module + +actual fun coreUiPlatformModule(): Module = module { } diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt similarity index 65% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt rename to shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt index 7a5aac9a2..80b1bceeb 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt +++ b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt @@ -1,7 +1,5 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.shared.core.ui -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.ViewState import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.StateFlow diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt similarity index 70% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt rename to shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt index 5ef9e5d3b..c06ddb530 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt +++ b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.shared.core.ui import kotlinx.coroutines.CoroutineDispatcher diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/store/NanoRedux.kt b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/NanoRedux.kt similarity index 85% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/store/NanoRedux.kt rename to shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/NanoRedux.kt index 27dcbf8f9..1cf020edb 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/store/NanoRedux.kt +++ b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/NanoRedux.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.store +package com.thomaskioko.tvmaniac.shared.core.ui import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow diff --git a/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt new file mode 100644 index 000000000..540e76d6b --- /dev/null +++ b/shared/core/ui/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt @@ -0,0 +1,5 @@ +package com.thomaskioko.tvmaniac.shared.core.ui.di + +import org.koin.core.module.Module + +expect fun coreUiPlatformModule(): Module diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt b/shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt similarity index 85% rename from shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt rename to shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt index d44225398..a1a1337a3 100644 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/BaseViewModel.kt +++ b/shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/BaseViewModel.kt @@ -1,7 +1,5 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.shared.core.ui -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.ViewState import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancelChildren diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt b/shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt similarity index 78% rename from shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt rename to shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt index 5f91bda34..a52219864 100644 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/MainDispatcher.kt +++ b/shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/MainDispatcher.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.shared.core.ui import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers diff --git a/shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt b/shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt new file mode 100644 index 000000000..ce18f23f1 --- /dev/null +++ b/shared/core/ui/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/ui/di/Module.kt @@ -0,0 +1,9 @@ +package com.thomaskioko.tvmaniac.shared.core.ui.di + +import com.thomaskioko.tvmaniac.shared.core.ui.MainDispatcher +import org.koin.core.module.Module +import org.koin.dsl.module + +actual fun coreUiPlatformModule(): Module = module { + single { MainDispatcher() } +} diff --git a/shared/core/build.gradle.kts b/shared/core/util/build.gradle.kts similarity index 73% rename from shared/core/build.gradle.kts rename to shared/core/util/build.gradle.kts index 66c80d03d..45de343c8 100644 --- a/shared/core/build.gradle.kts +++ b/shared/core/util/build.gradle.kts @@ -1,14 +1,21 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + namespace = "com.thomaskioko.tvmaniac.core.util" +} + dependencies { - commonMainImplementation(libs.kotlin.coroutines.core) + commonMainImplementation(libs.kermit) commonMainImplementation(libs.koin.core) commonMainImplementation(libs.ktor.core) - commonMainImplementation(libs.kermit) commonMainImplementation(libs.kotlin.datetime) + commonMainImplementation(libs.kotlin.coroutines.core) iosMainImplementation(libs.kotlin.coroutines.core) iosMainImplementation(libs.koin.core) diff --git a/shared/core/src/androidMain/AndroidManifest.xml b/shared/core/util/src/androidMain/AndroidManifest.xml similarity index 79% rename from shared/core/src/androidMain/AndroidManifest.xml rename to shared/core/util/src/androidMain/AndroidManifest.xml index 50d6a2dcb..b0aafad16 100644 --- a/shared/core/src/androidMain/AndroidManifest.xml +++ b/shared/core/util/src/androidMain/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.thomaskioko.tvmaniac.core.util"> \ No newline at end of file diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt similarity index 62% rename from shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt rename to shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt index c1d311cfa..2952f73a0 100644 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/AppContext.kt +++ b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.core.util import android.app.Application diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt similarity index 99% rename from shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt rename to shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt index 1abc93f78..20070ee7b 100644 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt +++ b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.core.util import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineDispatcher diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt similarity index 93% rename from shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt rename to shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt index d311d2379..23b435e9f 100644 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt +++ b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util import co.touchlab.kermit.Logger import java.text.SimpleDateFormat diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt similarity index 89% rename from shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt rename to shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt index 957f8821d..af294a579 100644 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt +++ b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util const val POSTER_PATH = "https://image.tmdb.org/t/p/original%s" const val DEFAULT_IMAGE_URL = diff --git a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt similarity index 83% rename from shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt rename to shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt index f658dac92..8f2de9beb 100644 --- a/shared/core/src/androidMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt +++ b/shared/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt @@ -1,13 +1,11 @@ -package com.thomaskioko.tvmaniac.shared.core.util.network +package com.thomaskioko.tvmaniac.core.util.network import android.content.Context import android.net.ConnectivityManager import android.net.Network import android.net.NetworkCapabilities import android.net.NetworkRequest -import com.thomaskioko.tvmaniac.shared.core.AppContext -import com.thomaskioko.tvmaniac.shared.core.util.network.ConnectionState.ConnectionAvailable -import com.thomaskioko.tvmaniac.shared.core.util.network.ConnectionState.NoConnection +import com.thomaskioko.tvmaniac.core.util.AppContext import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow @@ -52,11 +50,11 @@ actual class ObserveConnectionState actual constructor(private val context: AppC fun NetworkCallback(callback: (ConnectionState) -> Unit): ConnectivityManager.NetworkCallback { return object : ConnectivityManager.NetworkCallback() { override fun onAvailable(network: Network) { - callback(ConnectionAvailable) + callback(ConnectionState.ConnectionAvailable) } override fun onLost(network: Network) { - callback(NoConnection) + callback(ConnectionState.NoConnection) } } } @@ -67,5 +65,5 @@ private fun ConnectivityManager.getCurrentConnectivityState(): ConnectionState { ?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) } ?: false - return if (connected) ConnectionAvailable else NoConnection + return if (connected) ConnectionState.ConnectionAvailable else ConnectionState.NoConnection } diff --git a/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt new file mode 100644 index 000000000..6ecf8cfda --- /dev/null +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt @@ -0,0 +1,3 @@ +package com.thomaskioko.tvmaniac.core.util + +expect class AppContext diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/CommonFlow.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/CommonFlow.kt similarity index 93% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/CommonFlow.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/CommonFlow.kt index f2856c95f..d7ccee174 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/CommonFlow.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/CommonFlow.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util import io.ktor.utils.io.core.Closeable import kotlinx.coroutines.CoroutineScope diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt similarity index 88% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt index 55affbe90..f0094b689 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.core.util import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt similarity index 85% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt index 300e79fb3..5ed6831ed 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util const val DATE_PATTERN = "EEE, MMM d, yyyy" diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/ExceptionHandler.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/ExceptionHandler.kt similarity index 95% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/ExceptionHandler.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/ExceptionHandler.kt index 3411e632a..edc131bb1 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/ExceptionHandler.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/ExceptionHandler.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util import co.touchlab.kermit.Logger import io.ktor.client.features.ResponseException diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/FlowInteractor.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/FlowInteractor.kt similarity index 96% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/FlowInteractor.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/FlowInteractor.kt index 7044ed785..6de7ac3b4 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/FlowInteractor.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/FlowInteractor.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.core.util import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Job @@ -29,7 +29,8 @@ abstract class FlowInteractor { args: Arg, config: FlowUseCaseConfig.Builder.() -> Unit ) { - val flowUseCaseConfig = FlowUseCaseConfig.Builder().run { + val flowUseCaseConfig = com.thomaskioko.tvmaniac.core.util.FlowInteractor.FlowUseCaseConfig.Builder() + .run { config(this) return@run build() } diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt similarity index 62% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt index d6c15842d..3ab58ea27 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util expect object StringUtil { fun formatPosterPath(imageUrl: String?): String diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/NetworkBoundResource.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/NetworkBoundResource.kt similarity index 93% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/NetworkBoundResource.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/NetworkBoundResource.kt index 5ff51f61a..73623f473 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/NetworkBoundResource.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/NetworkBoundResource.kt @@ -1,5 +1,6 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util.network +import com.thomaskioko.tvmaniac.core.util.resolveError import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt similarity index 78% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt index e25836465..a733be6c7 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt @@ -1,6 +1,6 @@ -package com.thomaskioko.tvmaniac.shared.core.util.network +package com.thomaskioko.tvmaniac.core.util.network -import com.thomaskioko.tvmaniac.shared.core.AppContext +import com.thomaskioko.tvmaniac.core.util.AppContext import kotlinx.coroutines.flow.Flow expect class ObserveConnectionState actual constructor(context: AppContext) { diff --git a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/Resource.kt b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/Resource.kt similarity index 93% rename from shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/Resource.kt rename to shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/Resource.kt index 93399b69e..19fd6d07f 100644 --- a/shared/core/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/Resource.kt +++ b/shared/core/util/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/Resource.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util.network /** * A generic class that describes data with a status diff --git a/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt new file mode 100644 index 000000000..947cd65ce --- /dev/null +++ b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/AppContext.kt @@ -0,0 +1,3 @@ +package com.thomaskioko.tvmaniac.core.util + +actual typealias AppContext = Any diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt similarity index 86% rename from shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt rename to shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt index 0124f843d..a1d4eb48e 100644 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/CoroutineScopeOwner.kt +++ b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/CoroutineScopeOwner.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core +package com.thomaskioko.tvmaniac.core.util import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt similarity index 94% rename from shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt rename to shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt index e26b7f4ab..725aa0fdc 100644 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/DateUtil.kt +++ b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/DateUtil.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util import platform.Foundation.NSDateFormatter import platform.Foundation.NSLocale diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt similarity index 88% rename from shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt rename to shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt index 795281efd..795960ac4 100644 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/StringUtil.kt +++ b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/StringUtil.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.shared.core.util +package com.thomaskioko.tvmaniac.core.util const val POSTER_PATH = "https://image.tmdb.org/t/p/original" const val DEFAULT_IMAGE_URL = diff --git a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt similarity index 74% rename from shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt rename to shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt index 3be145992..4147e8dd2 100644 --- a/shared/core/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/core/util/network/ObserveConnectionState.kt +++ b/shared/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/core/util/network/ObserveConnectionState.kt @@ -1,6 +1,6 @@ -package com.thomaskioko.tvmaniac.shared.core.util.network +package com.thomaskioko.tvmaniac.core.util.network -import com.thomaskioko.tvmaniac.shared.core.AppContext +import com.thomaskioko.tvmaniac.core.util.AppContext import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf @@ -9,4 +9,4 @@ actual class ObserveConnectionState actual constructor(context: AppContext) { // TODO:: ADD Connection State implementation. return flowOf(ConnectionState.ConnectionAvailable) } -} +} \ No newline at end of file diff --git a/shared/database/build.gradle.kts b/shared/database/build.gradle.kts index 6af51545d..abb027dbd 100644 --- a/shared/database/build.gradle.kts +++ b/shared/database/build.gradle.kts @@ -1,8 +1,14 @@ +import util.libs + plugins { `kmm-domain-plugin` id("com.squareup.sqldelight") } +android { + namespace = "com.thomaskioko.tvmaniac.core.db" +} + dependencies { commonMainImplementation(libs.koin.core) commonMainImplementation(libs.squareup.sqldelight.runtime) diff --git a/shared/database/src/androidMain/AndroidManifest.xml b/shared/database/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 8fbf795c9..000000000 --- a/shared/database/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/discover/api/build.gradle.kts b/shared/domain/discover/api/build.gradle.kts new file mode 100644 index 000000000..10a5d40bd --- /dev/null +++ b/shared/domain/discover/api/build.gradle.kts @@ -0,0 +1,36 @@ +import util.libs + +plugins { + `kmm-domain-plugin` +} + +android { + namespace = "com.thomaskioko.tvmaniac.discover.api" +} + +dependencies { + commonMainApi(projects.shared.core.ui) + commonMainApi(projects.shared.core.util) + commonMainApi(projects.shared.domain.genre.api) + commonMainApi(projects.shared.domain.seasons.api) + commonMainApi(projects.shared.domain.lastAirEpisodes.api) + commonMainImplementation(projects.shared.domain.similar.api) + commonMainImplementation(projects.shared.domain.showCommon.api) + + commonMainApi(libs.koin.core) + commonMainApi(libs.kermit) + + commonMainImplementation(libs.multiplatform.paging.core) + commonMainImplementation(libs.kotlin.coroutines.core) + + iosMainImplementation(libs.kotlin.coroutines.core) + + val coroutineCore = libs.kotlin.coroutines.core.get() + + @Suppress("UnstableApiUsage") + iosMainImplementation("${coroutineCore.module.group}:${coroutineCore.module.name}:${coroutineCore.versionConstraint.displayName}") { + version { + strictly(libs.versions.coroutines.native.get()) + } + } +} diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowContract.kt b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowContract.kt similarity index 80% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowContract.kt rename to shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowContract.kt index e0c6b0c45..eb4ac7e96 100644 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowContract.kt +++ b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowContract.kt @@ -1,10 +1,10 @@ package com.thomaskioko.tvmaniac.discover.api -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.Effect -import com.thomaskioko.tvmaniac.shared.core.store.State -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.Effect +import com.thomaskioko.tvmaniac.shared.core.ui.State +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow data class DiscoverShowState( val isLoading: Boolean, @@ -45,7 +45,7 @@ data class DiscoverShowResult( data class DiscoverShowsData( val isLoading: Boolean, val category: ShowCategory, - val tvShows: List, + val tvShows: List, val errorMessage: String? = null ) { diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/ObserveDiscoverShowsInteractor.kt b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/ObserveDiscoverShowsInteractor.kt similarity index 64% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/ObserveDiscoverShowsInteractor.kt rename to shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/ObserveDiscoverShowsInteractor.kt index 0dc573c6f..5761bd053 100644 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/ObserveDiscoverShowsInteractor.kt +++ b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/ObserveDiscoverShowsInteractor.kt @@ -1,16 +1,15 @@ -package com.thomaskioko.tvmaniac.discover.api.interactor +package com.thomaskioko.tvmaniac.discover.api +import com.thomaskioko.tvmaniac.core.util.FlowInteractor +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.Status import com.thomaskioko.tvmaniac.datasource.cache.Show -import com.thomaskioko.tvmaniac.discover.api.DiscoverShowResult -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory.POPULAR -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory.TOP_RATED -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory.TRENDING -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor -import com.thomaskioko.tvmaniac.shared.core.util.Resource -import com.thomaskioko.tvmaniac.shared.core.util.Status -import com.thomaskioko.tvmaniac.showcommon.api.toTvShowList +import com.thomaskioko.tvmaniac.discover.api.repository.DiscoverRepository +import com.thomaskioko.tvmaniac.showcommon.api.mapper.toTvShowList +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory.POPULAR +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory.TOP_RATED +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory.TRENDING import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map @@ -18,7 +17,7 @@ import kotlinx.coroutines.flow.map private const val FEATURED_LIST_SIZE = 5 class ObserveDiscoverShowsInteractor constructor( - private val repository: TvShowsRepository, + private val repository: DiscoverRepository, ) : FlowInteractor() { override fun run(params: Unit): Flow = combine( diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/CategoryCache.kt b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/CategoryCache.kt similarity index 100% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/CategoryCache.kt rename to shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/CategoryCache.kt diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/ShowCategoryCache.kt b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/DiscoverCategoryCache.kt similarity index 78% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/ShowCategoryCache.kt rename to shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/DiscoverCategoryCache.kt index bbd4b19a1..48733aacf 100644 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/ShowCategoryCache.kt +++ b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/cache/DiscoverCategoryCache.kt @@ -4,11 +4,9 @@ import com.thomaskioko.tvmaniac.datasource.cache.SelectShows import com.thomaskioko.tvmaniac.datasource.cache.Show_category import kotlinx.coroutines.flow.Flow -interface ShowCategoryCache { +interface DiscoverCategoryCache { fun insert(category: Show_category) - fun getShowsByCategoryID(id: Int): List - fun observeShowsByCategoryID(id: Int): Flow> } diff --git a/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/repository/DiscoverRepository.kt b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/repository/DiscoverRepository.kt new file mode 100644 index 000000000..79f279b79 --- /dev/null +++ b/shared/domain/discover/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/repository/DiscoverRepository.kt @@ -0,0 +1,12 @@ +package com.thomaskioko.tvmaniac.discover.api.repository + +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.datasource.cache.Show +import kotlinx.coroutines.flow.Flow + +interface DiscoverRepository { + + fun observeShowsByCategoryID( + categoryId: Int + ): Flow>> +} diff --git a/shared/domain/show/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowsViewModel.kt b/shared/domain/discover/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowsViewModel.kt similarity index 89% rename from shared/domain/show/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowsViewModel.kt rename to shared/domain/discover/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowsViewModel.kt index d991f2da3..744efb830 100644 --- a/shared/domain/show/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowsViewModel.kt +++ b/shared/domain/discover/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/DiscoverShowsViewModel.kt @@ -1,10 +1,9 @@ package com.thomaskioko.tvmaniac.discover.api import com.thomaskioko.tvmaniac.discover.api.DiscoverShowResult.DiscoverShowsData -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveDiscoverShowsInteractor -import com.thomaskioko.tvmaniac.shared.core.BaseViewModel -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.ViewState +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.BaseViewModel +import com.thomaskioko.tvmaniac.shared.core.ui.ViewState import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.catch diff --git a/shared/domain/discover/implementation/build.gradle.kts b/shared/domain/discover/implementation/build.gradle.kts new file mode 100644 index 000000000..0035db9a9 --- /dev/null +++ b/shared/domain/discover/implementation/build.gradle.kts @@ -0,0 +1,38 @@ +import util.libs + +plugins { + `kmm-domain-plugin` +} + +android { + namespace = "com.thomaskioko.tvmaniac.discover.implementation" +} + +dependencies { + commonMainImplementation(projects.shared.remote) + commonMainImplementation(projects.shared.domain.discover.api) + commonMainImplementation(projects.shared.domain.showCommon.api) + + commonMainImplementation(libs.koin.core) + commonMainImplementation(libs.kotlin.datetime) + commonMainImplementation(libs.multiplatform.paging.core) + commonMainImplementation(libs.squareup.sqldelight.extensions) + + testImplementation(libs.testing.mockk.core) + + commonTestImplementation(kotlin("test")) + commonTestImplementation(projects.shared.core.test) + commonTestImplementation(libs.testing.turbine) + commonTestImplementation(libs.testing.kotest.assertions) + commonTestImplementation(libs.testing.coroutines.test) + commonTestImplementation(libs.testing.mockk.common) + + val coroutineCore = libs.kotlin.coroutines.core.get() + + @Suppress("UnstableApiUsage") + iosMainImplementation("${coroutineCore.module.group}:${coroutineCore.module.name}:${coroutineCore.versionConstraint.displayName}") { + version { + strictly(libs.versions.coroutines.native.get()) + } + } +} diff --git a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/CategoryCacheImpl.kt b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/CategoryCacheImpl.kt similarity index 91% rename from shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/CategoryCacheImpl.kt rename to shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/CategoryCacheImpl.kt index 21b234d9e..fc081189f 100644 --- a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/CategoryCacheImpl.kt +++ b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/CategoryCacheImpl.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.discover.implementation.cache +package com.thomaskioko.tvmaniac.discover.implementation import com.thomaskioko.tvmaniac.datasource.cache.Category import com.thomaskioko.tvmaniac.datasource.cache.TvManiacDatabase diff --git a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/ShowCategoryCacheImpl.kt b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/DiscoverCategoryCacheImpl.kt similarity index 70% rename from shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/ShowCategoryCacheImpl.kt rename to shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/DiscoverCategoryCacheImpl.kt index 1d09941ce..ac6f5be47 100644 --- a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/ShowCategoryCacheImpl.kt +++ b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/DiscoverCategoryCacheImpl.kt @@ -1,16 +1,16 @@ -package com.thomaskioko.tvmaniac.discover.implementation.cache +package com.thomaskioko.tvmaniac.discover.implementation import com.squareup.sqldelight.runtime.coroutines.asFlow import com.squareup.sqldelight.runtime.coroutines.mapToList import com.thomaskioko.tvmaniac.datasource.cache.SelectShows import com.thomaskioko.tvmaniac.datasource.cache.Show_category import com.thomaskioko.tvmaniac.datasource.cache.TvManiacDatabase -import com.thomaskioko.tvmaniac.discover.api.cache.ShowCategoryCache +import com.thomaskioko.tvmaniac.discover.api.cache.DiscoverCategoryCache import kotlinx.coroutines.flow.Flow -class ShowCategoryCacheImpl( +class DiscoverCategoryCacheImpl( private val database: TvManiacDatabase -) : ShowCategoryCache { +) : DiscoverCategoryCache { private val showCategoryQuery get() = database.showCategoryQueries @@ -21,12 +21,6 @@ class ShowCategoryCacheImpl( ) } - override fun getShowsByCategoryID(id: Int): List { - return showCategoryQuery.selectShows( - category_id = id.toLong() - ).executeAsList() - } - override fun observeShowsByCategoryID(id: Int): Flow> { return showCategoryQuery.selectShows(category_id = id.toLong()) .asFlow() diff --git a/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/DiscoverRepositoryImpl.kt b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/DiscoverRepositoryImpl.kt new file mode 100644 index 000000000..20b8a0661 --- /dev/null +++ b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/DiscoverRepositoryImpl.kt @@ -0,0 +1,80 @@ +package com.thomaskioko.tvmaniac.discover.implementation + +import co.touchlab.kermit.Logger +import com.thomaskioko.tvmaniac.core.util.getErrorMessage +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.networkBoundResource +import com.thomaskioko.tvmaniac.datasource.cache.Category +import com.thomaskioko.tvmaniac.datasource.cache.Show +import com.thomaskioko.tvmaniac.datasource.cache.Show_category +import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache +import com.thomaskioko.tvmaniac.discover.api.cache.DiscoverCategoryCache +import com.thomaskioko.tvmaniac.discover.api.repository.DiscoverRepository +import com.thomaskioko.tvmaniac.remote.api.TvShowsService +import com.thomaskioko.tvmaniac.remote.api.model.TvShowsResponse +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map + +private const val DEFAULT_API_PAGE = 1 + +class DiscoverRepositoryImpl( + private val apiService: TvShowsService, + private val tvShowCache: TvShowCache, + private val discoverCategoryCache: DiscoverCategoryCache, + private val categoryCache: CategoryCache, + private val dispatcher: CoroutineDispatcher, +) : DiscoverRepository { + + override fun observeShowsByCategoryID(categoryId: Int): Flow>> { + val networkBoundResource = networkBoundResource( + query = { + discoverCategoryCache.observeShowsByCategoryID(categoryId) + .map { it.toShowList() } + }, + shouldFetch = { it.isNullOrEmpty() }, + fetch = { fetchShowsApiRequest(categoryId) }, + saveFetchResult = { cacheResult(it, categoryId) }, + onFetchFailed = { + Logger.withTag("observeShowsByCategoryID").e { it.getErrorMessage() } + }, + coroutineDispatcher = dispatcher + ) + return networkBoundResource + } + + private suspend fun fetchShowsApiRequest(categoryId: Int): TvShowsResponse = when (categoryId) { + ShowCategory.TRENDING.type -> apiService.getTrendingShows(DEFAULT_API_PAGE) + ShowCategory.POPULAR.type -> apiService.getPopularShows(DEFAULT_API_PAGE) + ShowCategory.TOP_RATED.type -> apiService.getTopRatedShows(DEFAULT_API_PAGE) + else -> apiService.getTrendingShows(DEFAULT_API_PAGE) + } + + private fun cacheResult( + it: TvShowsResponse, + categoryId: Int + ) { + val result = it.results.map { show -> show.toShow() } + tvShowCache.insert(result) + + result.forEach { show -> + // Insert Category + categoryCache.insert( + Category( + id = categoryId.toLong(), + name = ShowCategory[categoryId].title + ) + ) + + // Insert ShowCategory + discoverCategoryCache.insert( + Show_category( + category_id = categoryId.toLong(), + show_id = show.id + ) + ) + } + } +} diff --git a/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/TvShowsCacheMapper.kt b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/TvShowsCacheMapper.kt new file mode 100644 index 000000000..2787c1e92 --- /dev/null +++ b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/TvShowsCacheMapper.kt @@ -0,0 +1,63 @@ +package com.thomaskioko.tvmaniac.discover.implementation + +import com.thomaskioko.tvmaniac.core.util.StringUtil +import com.thomaskioko.tvmaniac.datasource.cache.SelectShows +import com.thomaskioko.tvmaniac.datasource.cache.Show +import com.thomaskioko.tvmaniac.remote.api.model.ShowResponse +import kotlinx.datetime.toLocalDate + +fun List.toShowList(): List { + return map { it.toShow() } +} + +fun SelectShows.toShow(): Show { + return Show( + id = id, + title = title, + description = description, + language = language, + poster_image_url = poster_image_url, + backdrop_image_url = backdrop_image_url, + votes = votes, + vote_average = vote_average, + genre_ids = genre_ids, + year = year, + status = status, + following = following, + popularity = popularity, + number_of_episodes = number_of_episodes, + number_of_seasons = number_of_seasons + ) +} + +fun ShowResponse.toShow(): Show { + return Show( + id = id.toLong(), + title = name, + description = overview, + language = originalLanguage, + poster_image_url = StringUtil.formatPosterPath(posterPath), + backdrop_image_url = backdropPath.toImageUrl(posterPath), + votes = voteCount.toLong(), + vote_average = voteAverage, + genre_ids = genreIds, + year = formatDate(firstAirDate), + status = "", + popularity = popularity, + following = false, + number_of_seasons = numberOfSeasons?.toLong(), + number_of_episodes = numberOfEpisodes?.toLong() + ) +} + +// TODO:: Move to common module +private fun formatDate(dateString: String): String { + return if (dateString.isNotBlank() && !dateString.contains("N/A")) + dateString.toLocalDate().year.toString() + else + dateString +} + +private fun String?.toImageUrl(posterPath: String?) = + if (this.isNullOrEmpty()) StringUtil.formatPosterPath(posterPath) + else StringUtil.formatPosterPath(this) diff --git a/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/di/DomainModule.kt b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/di/DomainModule.kt new file mode 100644 index 000000000..bb02d5a30 --- /dev/null +++ b/shared/domain/discover/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/di/DomainModule.kt @@ -0,0 +1,22 @@ +package com.thomaskioko.tvmaniac.discover.implementation.di + +import com.thomaskioko.tvmaniac.discover.api.ObserveDiscoverShowsInteractor +import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache +import com.thomaskioko.tvmaniac.discover.api.cache.DiscoverCategoryCache +import com.thomaskioko.tvmaniac.discover.api.repository.DiscoverRepository +import com.thomaskioko.tvmaniac.discover.implementation.CategoryCacheImpl +import com.thomaskioko.tvmaniac.discover.implementation.DiscoverCategoryCacheImpl +import com.thomaskioko.tvmaniac.discover.implementation.DiscoverRepositoryImpl +import org.koin.core.module.Module +import org.koin.dsl.module + +val discoverDomainModule: Module = module { + single { + DiscoverRepositoryImpl(get(), get(), get(), get(), get()) + } + + factory { ObserveDiscoverShowsInteractor(get()) } + + single { CategoryCacheImpl(get()) } + single { DiscoverCategoryCacheImpl(get()) } +} diff --git a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt b/shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt similarity index 96% rename from shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt rename to shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt index 8ab60dca9..f27f62f0e 100644 --- a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt +++ b/shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt @@ -1,11 +1,12 @@ package com.thomaskioko.tvmaniac +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.Show import com.thomaskioko.tvmaniac.discover.api.DiscoverShowResult -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory import com.thomaskioko.tvmaniac.remote.api.model.ShowResponse import com.thomaskioko.tvmaniac.remote.api.model.TvShowsResponse -import com.thomaskioko.tvmaniac.shared.core.util.Resource +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import kotlinx.coroutines.flow.flowOf object MockData { @@ -66,7 +67,7 @@ object MockData { private fun getDiscoverShowsData(category: ShowCategory) = DiscoverShowResult.DiscoverShowsData( category = category, tvShows = listOf( - com.thomaskioko.tvmaniac.showcommon.api.TvShow( + TvShow( id = 84958, title = "Loki", overview = "After stealing the Tesseract during the events of “Avengers: Endgame,” " + diff --git a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt b/shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt similarity index 87% rename from shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt rename to shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt index b4f9aa031..f8a8c5ce5 100644 --- a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt +++ b/shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt @@ -1,8 +1,8 @@ package com.thomaskioko.tvmaniac.datasource.mapper import com.thomaskioko.tvmaniac.MockData.getTvResponse -import com.thomaskioko.tvmaniac.discover.implementation.mapper.toShow -import com.thomaskioko.tvmaniac.shared.core.util.StringUtil.formatPosterPath +import com.thomaskioko.tvmaniac.core.util.StringUtil.formatPosterPath +import com.thomaskioko.tvmaniac.discover.implementation.toShow import io.kotest.matchers.shouldBe import kotlin.test.Test diff --git a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/interactor/ObserveDiscoverShowsInteractorTest.kt b/shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/interactor/ObserveDiscoverShowsInteractorTest.kt similarity index 76% rename from shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/interactor/ObserveDiscoverShowsInteractorTest.kt rename to shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/interactor/ObserveDiscoverShowsInteractorTest.kt index d4b4e9105..32a154926 100644 --- a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/interactor/ObserveDiscoverShowsInteractorTest.kt +++ b/shared/domain/discover/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/interactor/ObserveDiscoverShowsInteractorTest.kt @@ -4,9 +4,9 @@ import app.cash.turbine.test import com.thomaskioko.tvmaniac.MockData.getDiscoverShowResult import com.thomaskioko.tvmaniac.MockData.getShowsCache import com.thomaskioko.tvmaniac.core.test.runBlockingTest -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveDiscoverShowsInteractor -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.shared.core.invoke +import com.thomaskioko.tvmaniac.core.util.invoke +import com.thomaskioko.tvmaniac.discover.api.ObserveDiscoverShowsInteractor +import com.thomaskioko.tvmaniac.discover.api.repository.DiscoverRepository import io.kotest.matchers.shouldBe import io.mockk.coEvery import io.mockk.mockk @@ -14,7 +14,7 @@ import kotlin.test.Test internal class ObserveDiscoverShowsInteractorTest { - private val repository: TvShowsRepository = mockk() + private val repository: DiscoverRepository = mockk() private val interactor = ObserveDiscoverShowsInteractor(repository) @Test diff --git a/shared/domain/episodes/api/build.gradle.kts b/shared/domain/episodes/api/build.gradle.kts index 78a7413aa..b3a1be174 100644 --- a/shared/domain/episodes/api/build.gradle.kts +++ b/shared/domain/episodes/api/build.gradle.kts @@ -1,9 +1,15 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.episodes.api" +} + dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.database) commonMainApi(projects.shared.domain.seasons.api) commonMainApi(libs.kotlin.coroutines.core) diff --git a/shared/domain/episodes/api/src/androidMain/AndroidManifest.xml b/shared/domain/episodes/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 021c99ac9..000000000 --- a/shared/domain/episodes/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/EpisodeRepository.kt b/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/EpisodeRepository.kt index f04b89c81..023349ace 100644 --- a/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/EpisodeRepository.kt +++ b/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/EpisodeRepository.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.episodes.api +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.EpisodesBySeasonId -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.Flow interface EpisodeRepository { diff --git a/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/ObserveEpisodesInteractor.kt b/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/ObserveEpisodesInteractor.kt index 7b4e0e995..9bbae32fb 100644 --- a/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/ObserveEpisodesInteractor.kt +++ b/shared/domain/episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/api/ObserveEpisodesInteractor.kt @@ -1,8 +1,8 @@ package com.thomaskioko.tvmaniac.episodes.api +import com.thomaskioko.tvmaniac.core.util.FlowInteractor import com.thomaskioko.tvmaniac.episodes.api.mapper.toEpisodeEntityList import com.thomaskioko.tvmaniac.episodes.api.model.EpisodeUiModel -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map diff --git a/shared/domain/episodes/implementation/build.gradle.kts b/shared/domain/episodes/implementation/build.gradle.kts index dc2f5ae4a..ecd517f94 100644 --- a/shared/domain/episodes/implementation/build.gradle.kts +++ b/shared/domain/episodes/implementation/build.gradle.kts @@ -1,7 +1,13 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.episodes.implementation" +} + dependencies { commonMainImplementation(projects.shared.remote) commonMainImplementation(projects.shared.domain.episodes.api) @@ -12,7 +18,7 @@ dependencies { testImplementation(libs.testing.mockk.core) commonTestImplementation(kotlin("test")) - commonTestImplementation(projects.shared.coreTest) + commonTestImplementation(projects.shared.core.test) commonTestImplementation(libs.testing.turbine) commonTestImplementation(libs.testing.kotest.assertions) commonTestImplementation(libs.testing.mockk.common) diff --git a/shared/domain/episodes/implementation/src/androidMain/AndroidManifest.xml b/shared/domain/episodes/implementation/src/androidMain/AndroidManifest.xml deleted file mode 100644 index bb4fb0b3b..000000000 --- a/shared/domain/episodes/implementation/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapper.kt b/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapper.kt index 33ecc534d..307e77447 100644 --- a/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapper.kt +++ b/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapper.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.episodes.implementation +import com.thomaskioko.tvmaniac.core.util.StringUtil.formatPosterPath import com.thomaskioko.tvmaniac.remote.api.model.SeasonResponse -import com.thomaskioko.tvmaniac.shared.core.util.StringUtil.formatPosterPath import com.thomaskioko.tvmaniac.datasource.cache.Episode as EpisodeCache fun SeasonResponse.toEpisodeCacheList(): List { diff --git a/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeRepositoryImpl.kt b/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeRepositoryImpl.kt index 71ef63324..7741856ca 100644 --- a/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeRepositoryImpl.kt +++ b/shared/domain/episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeRepositoryImpl.kt @@ -1,13 +1,13 @@ package com.thomaskioko.tvmaniac.episodes.implementation import co.touchlab.kermit.Logger +import com.thomaskioko.tvmaniac.core.util.getErrorMessage +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.networkBoundResource import com.thomaskioko.tvmaniac.datasource.cache.EpisodesBySeasonId import com.thomaskioko.tvmaniac.episodes.api.EpisodeRepository import com.thomaskioko.tvmaniac.episodes.api.EpisodesCache import com.thomaskioko.tvmaniac.remote.api.TvShowsService -import com.thomaskioko.tvmaniac.shared.core.util.Resource -import com.thomaskioko.tvmaniac.shared.core.util.getErrorMessage -import com.thomaskioko.tvmaniac.shared.core.util.networkBoundResource import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow diff --git a/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapperTest.kt b/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapperTest.kt index d50e107e4..818f32c84 100644 --- a/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapperTest.kt +++ b/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/EpisodeMapperTest.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.episodes.implementation +import com.thomaskioko.tvmaniac.core.util.StringUtil.formatPosterPath import com.thomaskioko.tvmaniac.episodes.implementation.MockData.getShowSeasonsResponse -import com.thomaskioko.tvmaniac.shared.core.util.StringUtil.formatPosterPath import io.kotest.matchers.shouldBe import kotlin.test.Test diff --git a/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/MockData.kt b/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/MockData.kt index d4cbae425..c571a6821 100644 --- a/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/MockData.kt +++ b/shared/domain/episodes/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/episodes/implementation/MockData.kt @@ -1,10 +1,10 @@ package com.thomaskioko.tvmaniac.episodes.implementation +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.EpisodesBySeasonId import com.thomaskioko.tvmaniac.episodes.api.model.EpisodeUiModel import com.thomaskioko.tvmaniac.remote.api.model.EpisodesResponse import com.thomaskioko.tvmaniac.remote.api.model.SeasonResponse -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.flowOf object MockData { diff --git a/shared/domain/genre/api/build.gradle.kts b/shared/domain/genre/api/build.gradle.kts index 8b8158046..7972a6be0 100644 --- a/shared/domain/genre/api/build.gradle.kts +++ b/shared/domain/genre/api/build.gradle.kts @@ -1,9 +1,15 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.genre.api" +} + dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.database) commonMainApi(libs.kotlin.coroutines.core) } diff --git a/shared/domain/genre/api/src/androidMain/AndroidManifest.xml b/shared/domain/genre/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 441bd8d43..000000000 --- a/shared/domain/genre/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GenreRepository.kt b/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GenreRepository.kt index 7069d0ca1..99acf999d 100644 --- a/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GenreRepository.kt +++ b/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GenreRepository.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.genre.api +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.Genre -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.Flow interface GenreRepository { diff --git a/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GetGenresInteractor.kt b/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GetGenresInteractor.kt index ff9ca8e3b..b7393b2be 100644 --- a/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GetGenresInteractor.kt +++ b/shared/domain/genre/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/api/GetGenresInteractor.kt @@ -1,6 +1,6 @@ package com.thomaskioko.tvmaniac.genre.api -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor +import com.thomaskioko.tvmaniac.core.util.FlowInteractor import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map diff --git a/shared/domain/genre/implementation/build.gradle.kts b/shared/domain/genre/implementation/build.gradle.kts index 02331c194..da491186f 100644 --- a/shared/domain/genre/implementation/build.gradle.kts +++ b/shared/domain/genre/implementation/build.gradle.kts @@ -1,14 +1,20 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.genre.implementation" +} + dependencies { - commonMainImplementation(project(":shared:remote")) - commonMainImplementation(project(":shared:domain:genre:api")) + commonMainImplementation(projects.shared.remote) + commonMainImplementation(projects.shared.domain.genre.api) commonMainImplementation(libs.kermit) commonMainImplementation(libs.koin.core) commonMainImplementation(libs.squareup.sqldelight.extensions) commonTestImplementation(kotlin("test")) - commonTestImplementation(project(":shared:core-test")) + commonTestImplementation(projects.shared.core.test) } diff --git a/shared/domain/genre/implementation/src/androidMain/AndroidManifest.xml b/shared/domain/genre/implementation/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 3ee45daff..000000000 --- a/shared/domain/genre/implementation/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/genre/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/implementation/GenreRepositoryImpl.kt b/shared/domain/genre/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/implementation/GenreRepositoryImpl.kt index 6ae040056..9d6140b38 100644 --- a/shared/domain/genre/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/implementation/GenreRepositoryImpl.kt +++ b/shared/domain/genre/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/genre/implementation/GenreRepositoryImpl.kt @@ -1,14 +1,14 @@ package com.thomaskioko.tvmaniac.genre.implementation import co.touchlab.kermit.Logger +import com.thomaskioko.tvmaniac.core.util.getErrorMessage +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.networkBoundResource import com.thomaskioko.tvmaniac.datasource.cache.Genre import com.thomaskioko.tvmaniac.genre.api.GenreCache import com.thomaskioko.tvmaniac.genre.api.GenreRepository import com.thomaskioko.tvmaniac.remote.api.TvShowsService import com.thomaskioko.tvmaniac.remote.api.model.GenresResponse -import com.thomaskioko.tvmaniac.shared.core.util.Resource -import com.thomaskioko.tvmaniac.shared.core.util.getErrorMessage -import com.thomaskioko.tvmaniac.shared.core.util.networkBoundResource import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow diff --git a/shared/domain/last-air-episodes/api/build.gradle.kts b/shared/domain/last-air-episodes/api/build.gradle.kts index 8b8158046..a70d32ce7 100644 --- a/shared/domain/last-air-episodes/api/build.gradle.kts +++ b/shared/domain/last-air-episodes/api/build.gradle.kts @@ -1,9 +1,15 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.lastairepisodes.api" +} + dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.database) commonMainApi(libs.kotlin.coroutines.core) } diff --git a/shared/domain/last-air-episodes/api/src/androidMain/AndroidManifest.xml b/shared/domain/last-air-episodes/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 9f5b6f640..000000000 --- a/shared/domain/last-air-episodes/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/last-air-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/lastairepisodes/api/ObserveAirEpisodesInteractor.kt b/shared/domain/last-air-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/lastairepisodes/api/ObserveAirEpisodesInteractor.kt index 4a091d43a..fc1ad2a9b 100644 --- a/shared/domain/last-air-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/lastairepisodes/api/ObserveAirEpisodesInteractor.kt +++ b/shared/domain/last-air-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/lastairepisodes/api/ObserveAirEpisodesInteractor.kt @@ -1,6 +1,6 @@ package com.thomaskioko.tvmaniac.lastairepisodes.api -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor +import com.thomaskioko.tvmaniac.core.util.FlowInteractor import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map diff --git a/shared/domain/last-air-episodes/implementation/build.gradle.kts b/shared/domain/last-air-episodes/implementation/build.gradle.kts index f88e4ee93..88137ce76 100644 --- a/shared/domain/last-air-episodes/implementation/build.gradle.kts +++ b/shared/domain/last-air-episodes/implementation/build.gradle.kts @@ -1,10 +1,16 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.lastairepisodes.implementation" +} + dependencies { - commonMainImplementation(project(":shared:remote")) - commonMainImplementation(project(":shared:domain:last-air-episodes:api")) + commonMainImplementation(projects.shared.remote) + commonMainImplementation(projects.shared.domain.lastAirEpisodes.api) commonMainImplementation(libs.kermit) commonMainImplementation(libs.koin.core) commonMainImplementation(libs.squareup.sqldelight.extensions) @@ -12,7 +18,7 @@ dependencies { testImplementation(libs.testing.mockk.core) commonTestImplementation(kotlin("test")) - commonTestImplementation(project(":shared:core-test")) + commonTestImplementation(projects.shared.core.test) commonTestImplementation(libs.testing.turbine) commonTestImplementation(libs.testing.kotest.assertions) commonTestImplementation(libs.testing.mockk.common) diff --git a/shared/domain/last-air-episodes/implementation/src/androidMain/AndroidManifest.xml b/shared/domain/last-air-episodes/implementation/src/androidMain/AndroidManifest.xml deleted file mode 100644 index dfd378fa9..000000000 --- a/shared/domain/last-air-episodes/implementation/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/season-episodes/api/build.gradle.kts b/shared/domain/season-episodes/api/build.gradle.kts index 9a96cd467..a7c4aceaf 100644 --- a/shared/domain/season-episodes/api/build.gradle.kts +++ b/shared/domain/season-episodes/api/build.gradle.kts @@ -1,9 +1,16 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.seasonepisodes.api" +} + dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.ui) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.database) commonMainApi(libs.kotlin.coroutines.core) commonMainApi(libs.kermit) diff --git a/shared/domain/season-episodes/api/src/androidMain/AndroidManifest.xml b/shared/domain/season-episodes/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index b04dcdd8c..000000000 --- a/shared/domain/season-episodes/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/ObserveSeasonWithEpisodesInteractor.kt b/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/ObserveSeasonWithEpisodesInteractor.kt index 4a4985e0f..8d6d036fa 100644 --- a/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/ObserveSeasonWithEpisodesInteractor.kt +++ b/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/ObserveSeasonWithEpisodesInteractor.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.seasonepisodes.api +import com.thomaskioko.tvmaniac.core.util.FlowInteractor import com.thomaskioko.tvmaniac.seasonepisodes.api.model.SeasonWithEpisodes -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOn diff --git a/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonWithEpisodesRepository.kt b/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonWithEpisodesRepository.kt index 68f71c964..633849527 100644 --- a/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonWithEpisodesRepository.kt +++ b/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonWithEpisodesRepository.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.seasonepisodes.api +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.SelectSeasonWithEpisodes -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.Flow interface SeasonWithEpisodesRepository { diff --git a/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonsContract.kt b/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonsContract.kt index a2b98b01f..149f7960d 100644 --- a/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonsContract.kt +++ b/shared/domain/season-episodes/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/api/SeasonsContract.kt @@ -1,10 +1,10 @@ package com.thomaskioko.tvmaniac.seasonepisodes.api import com.thomaskioko.tvmaniac.seasonepisodes.api.model.SeasonWithEpisodes -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.Effect -import com.thomaskioko.tvmaniac.shared.core.store.State -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.Effect +import com.thomaskioko.tvmaniac.shared.core.ui.State +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow sealed class SeasonsAction : Action { object LoadSeasons : SeasonsAction() diff --git a/shared/domain/season-episodes/implementation/build.gradle.kts b/shared/domain/season-episodes/implementation/build.gradle.kts index 288a7de0c..e561ec563 100644 --- a/shared/domain/season-episodes/implementation/build.gradle.kts +++ b/shared/domain/season-episodes/implementation/build.gradle.kts @@ -1,18 +1,24 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.seasonepisodes.implementation" +} + dependencies { - commonMainImplementation(project(":shared:remote")) - commonMainImplementation(project(":shared:domain:episodes:api")) - commonMainImplementation(project(":shared:domain:season-episodes:api")) + commonMainImplementation(projects.shared.remote) + commonMainImplementation(projects.shared.domain.episodes.api) + commonMainImplementation(projects.shared.domain.seasonEpisodes.api) commonMainImplementation(libs.koin.core) commonMainImplementation(libs.squareup.sqldelight.extensions) testImplementation(libs.testing.mockk.core) commonTestImplementation(kotlin("test")) - commonTestImplementation(project(":shared:core-test")) + commonTestImplementation(projects.shared.core.test) commonTestImplementation(libs.testing.turbine) commonTestImplementation(libs.testing.mockk.common) commonTestImplementation(libs.testing.kotest.assertions) diff --git a/shared/domain/season-episodes/implementation/src/androidMain/AndroidManifest.xml b/shared/domain/season-episodes/implementation/src/androidMain/AndroidManifest.xml deleted file mode 100644 index cb321e486..000000000 --- a/shared/domain/season-episodes/implementation/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/Mapper.kt b/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/Mapper.kt index 9dd374953..01c9e3d16 100644 --- a/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/Mapper.kt +++ b/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/Mapper.kt @@ -1,8 +1,8 @@ package com.thomaskioko.tvmaniac.seasonepisodes.implementation +import com.thomaskioko.tvmaniac.core.util.StringUtil import com.thomaskioko.tvmaniac.datasource.cache.Episode import com.thomaskioko.tvmaniac.remote.api.model.SeasonResponse -import com.thomaskioko.tvmaniac.shared.core.util.StringUtil fun SeasonResponse.toEpisodeCacheList(): List { return episodes.map { episodeResponse -> diff --git a/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/SeasonWithEpisodesRepositoryImpl.kt b/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/SeasonWithEpisodesRepositoryImpl.kt index bcc48e688..b21beebf8 100644 --- a/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/SeasonWithEpisodesRepositoryImpl.kt +++ b/shared/domain/season-episodes/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasonepisodes/implementation/SeasonWithEpisodesRepositoryImpl.kt @@ -1,6 +1,8 @@ package com.thomaskioko.tvmaniac.seasonepisodes.implementation import co.touchlab.kermit.Logger +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.networkBoundResource import com.thomaskioko.tvmaniac.datasource.cache.Season_with_episodes import com.thomaskioko.tvmaniac.datasource.cache.SelectSeasonWithEpisodes import com.thomaskioko.tvmaniac.episodes.api.EpisodesCache @@ -9,8 +11,6 @@ import com.thomaskioko.tvmaniac.remote.api.model.SeasonResponse import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonWithEpisodesCache import com.thomaskioko.tvmaniac.seasonepisodes.api.SeasonWithEpisodesRepository import com.thomaskioko.tvmaniac.seasons.api.SeasonsCache -import com.thomaskioko.tvmaniac.shared.core.util.Resource -import com.thomaskioko.tvmaniac.shared.core.util.networkBoundResource import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow diff --git a/shared/domain/seasons/api/build.gradle.kts b/shared/domain/seasons/api/build.gradle.kts index 8b8158046..26a206252 100644 --- a/shared/domain/seasons/api/build.gradle.kts +++ b/shared/domain/seasons/api/build.gradle.kts @@ -1,9 +1,14 @@ +import util.libs + plugins { `kmm-domain-plugin` } dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.database) commonMainApi(libs.kotlin.coroutines.core) } +android { + namespace = "com.thomaskioko.tvmaniac.seasons.api" +} diff --git a/shared/domain/seasons/api/src/androidMain/AndroidManifest.xml b/shared/domain/seasons/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index b6ff333b6..000000000 --- a/shared/domain/seasons/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/SeasonsRepository.kt b/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/SeasonsRepository.kt index 76631020e..1b69aa140 100644 --- a/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/SeasonsRepository.kt +++ b/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/SeasonsRepository.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.seasons.api +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.SelectSeasonsByShowId -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.Flow interface SeasonsRepository { diff --git a/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/interactor/ObserveSeasonsInteractor.kt b/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/interactor/ObserveSeasonsInteractor.kt index b19b185fe..19a32a5d8 100644 --- a/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/interactor/ObserveSeasonsInteractor.kt +++ b/shared/domain/seasons/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/api/interactor/ObserveSeasonsInteractor.kt @@ -1,9 +1,9 @@ package com.thomaskioko.tvmaniac.seasons.api.interactor +import com.thomaskioko.tvmaniac.core.util.FlowInteractor import com.thomaskioko.tvmaniac.datasource.cache.SelectSeasonsByShowId import com.thomaskioko.tvmaniac.seasons.api.SeasonsRepository import com.thomaskioko.tvmaniac.seasons.api.model.SeasonUiModel -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map diff --git a/shared/domain/seasons/implementation/build.gradle.kts b/shared/domain/seasons/implementation/build.gradle.kts index a09f7b731..217bbbfd9 100644 --- a/shared/domain/seasons/implementation/build.gradle.kts +++ b/shared/domain/seasons/implementation/build.gradle.kts @@ -1,12 +1,18 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.implementation" +} + dependencies { - commonMainImplementation(project(":shared:remote")) - commonMainImplementation(project(":shared:domain:seasons:api")) - commonMainImplementation(project(":shared:domain:show:api")) - commonMainImplementation(project(":shared:domain:show-common:api")) + commonMainImplementation(projects.shared.remote) + commonMainImplementation(projects.shared.domain.seasons.api) + commonMainImplementation(projects.shared.domain.showDetails.implementation) + commonMainImplementation(projects.shared.domain.showCommon.api) commonMainImplementation(libs.kermit) commonMainImplementation(libs.koin.core) @@ -15,7 +21,7 @@ dependencies { testImplementation(libs.testing.mockk.core) commonTestImplementation(kotlin("test")) - commonTestImplementation(project(":shared:core-test")) + commonTestImplementation(projects.shared.core.test) commonTestImplementation(libs.testing.turbine) commonTestImplementation(libs.testing.mockk.common) commonTestImplementation(libs.testing.kotest.assertions) diff --git a/shared/domain/seasons/implementation/src/androidMain/AndroidManifest.xml b/shared/domain/seasons/implementation/src/androidMain/AndroidManifest.xml deleted file mode 100644 index ede55ed81..000000000 --- a/shared/domain/seasons/implementation/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/seasons/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryImpl.kt b/shared/domain/seasons/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryImpl.kt index e42906797..9a17034ff 100644 --- a/shared/domain/seasons/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryImpl.kt +++ b/shared/domain/seasons/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryImpl.kt @@ -1,14 +1,14 @@ package com.thomaskioko.tvmaniac.seasons.implementation import co.touchlab.kermit.Logger +import com.thomaskioko.tvmaniac.core.util.getErrorMessage +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.networkBoundResource import com.thomaskioko.tvmaniac.datasource.cache.SelectSeasonsByShowId import com.thomaskioko.tvmaniac.remote.api.TvShowsService import com.thomaskioko.tvmaniac.seasons.api.SeasonsCache import com.thomaskioko.tvmaniac.seasons.api.SeasonsRepository import com.thomaskioko.tvmaniac.seasons.implementation.mapper.toSeasonCacheList -import com.thomaskioko.tvmaniac.shared.core.util.Resource -import com.thomaskioko.tvmaniac.shared.core.util.getErrorMessage -import com.thomaskioko.tvmaniac.shared.core.util.networkBoundResource import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow diff --git a/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/MockData.kt b/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/MockData.kt index 062f93cf1..367cb5789 100644 --- a/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/MockData.kt +++ b/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/MockData.kt @@ -1,12 +1,12 @@ package com.thomaskioko.tvmaniac.seasons.implementation +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.SelectSeasonsByShowId import com.thomaskioko.tvmaniac.datasource.cache.Show import com.thomaskioko.tvmaniac.remote.api.model.GenreResponse import com.thomaskioko.tvmaniac.remote.api.model.SeasonsResponse import com.thomaskioko.tvmaniac.remote.api.model.ShowDetailResponse import com.thomaskioko.tvmaniac.seasons.api.model.SeasonUiModel -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.flowOf internal object MockData { diff --git a/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryTest.kt b/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryTest.kt index 06089174f..0ed6bd00c 100644 --- a/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryTest.kt +++ b/shared/domain/seasons/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/seasons/implementation/SeasonsRepositoryTest.kt @@ -7,7 +7,7 @@ import com.thomaskioko.tvmaniac.seasons.api.SeasonsCache import com.thomaskioko.tvmaniac.seasons.implementation.MockData.getShow import com.thomaskioko.tvmaniac.seasons.implementation.MockData.getShowDetailResponse import com.thomaskioko.tvmaniac.seasons.implementation.mapper.toSeasonCacheList -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache import io.mockk.coEvery import io.mockk.coVerify import io.mockk.every diff --git a/shared/domain/show-common/api/build.gradle.kts b/shared/domain/show-common/api/build.gradle.kts index 7d3dae7f4..ac516da27 100644 --- a/shared/domain/show-common/api/build.gradle.kts +++ b/shared/domain/show-common/api/build.gradle.kts @@ -4,6 +4,10 @@ plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.show_common.api" +} + dependencies { commonMainApi(projects.shared.database) diff --git a/shared/domain/show-common/api/src/androidMain/AndroidManifest.xml b/shared/domain/show-common/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index ba5f8159e..000000000 --- a/shared/domain/show-common/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/TvShowCache.kt b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/cache/TvShowCache.kt similarity index 91% rename from shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/TvShowCache.kt rename to shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/cache/TvShowCache.kt index 49a9e077f..d7f71b930 100644 --- a/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/TvShowCache.kt +++ b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/cache/TvShowCache.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.showcommon.api +package com.thomaskioko.tvmaniac.showcommon.api.cache import com.thomaskioko.tvmaniac.datasource.cache.AirEpisodesByShowId import com.thomaskioko.tvmaniac.datasource.cache.Show diff --git a/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/ShowMapper.kt b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/mapper/ShowMapper.kt similarity index 82% rename from shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/ShowMapper.kt rename to shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/mapper/ShowMapper.kt index 522f150a2..915df8a75 100644 --- a/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/ShowMapper.kt +++ b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/mapper/ShowMapper.kt @@ -1,6 +1,7 @@ -package com.thomaskioko.tvmaniac.showcommon.api +package com.thomaskioko.tvmaniac.showcommon.api.mapper import com.thomaskioko.tvmaniac.datasource.cache.Show +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow fun List.toTvShowList(): List { return map { it.toTvShow() } diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/model/ShowCategory.kt b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/model/ShowCategory.kt similarity index 89% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/model/ShowCategory.kt rename to shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/model/ShowCategory.kt index b4803fc02..fa39e0dcf 100644 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/model/ShowCategory.kt +++ b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/model/ShowCategory.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.discover.api.model +package com.thomaskioko.tvmaniac.showcommon.api.model enum class ShowCategory( val type: Int, diff --git a/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/TvShow.kt b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/model/TvShow.kt similarity index 91% rename from shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/TvShow.kt rename to shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/model/TvShow.kt index 9eab424ad..26e5ae4b0 100644 --- a/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/TvShow.kt +++ b/shared/domain/show-common/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/showcommon/api/model/TvShow.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.showcommon.api +package com.thomaskioko.tvmaniac.showcommon.api.model data class TvShow( val id: Long = 0, diff --git a/shared/domain/show/api/build.gradle.kts b/shared/domain/show-details/api/build.gradle.kts similarity index 85% rename from shared/domain/show/api/build.gradle.kts rename to shared/domain/show-details/api/build.gradle.kts index b2444181e..aa62ae9e8 100644 --- a/shared/domain/show/api/build.gradle.kts +++ b/shared/domain/show-details/api/build.gradle.kts @@ -4,8 +4,13 @@ plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.details.api" +} + dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.ui) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.domain.genre.api) commonMainApi(projects.shared.domain.seasons.api) commonMainApi(projects.shared.domain.lastAirEpisodes.api) diff --git a/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/cache/ShowCategoryCache.kt b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/cache/ShowCategoryCache.kt new file mode 100644 index 000000000..e62c69af0 --- /dev/null +++ b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/cache/ShowCategoryCache.kt @@ -0,0 +1,8 @@ +package com.thomaskioko.tvmaniac.details.api.cache + +import com.thomaskioko.tvmaniac.datasource.cache.SelectShows + +interface ShowCategoryCache { + + fun getShowsByCategoryID(id: Int): List +} diff --git a/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/interactor/ObserveShowInteractor.kt b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/interactor/ObserveShowInteractor.kt new file mode 100644 index 000000000..77fb41ec0 --- /dev/null +++ b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/interactor/ObserveShowInteractor.kt @@ -0,0 +1,16 @@ +package com.thomaskioko.tvmaniac.details.api.interactor + +import com.thomaskioko.tvmaniac.core.util.FlowInteractor +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.showcommon.api.mapper.toTvShow +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map + +class ObserveShowInteractor constructor( + private val repository: TvShowsRepository, +) : FlowInteractor() { + + override fun run(params: Long): Flow = repository.observeShow(params) + .map { it.data?.toTvShow() ?: TvShow.EMPTY_SHOW } +} diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/UpdateFollowingInteractor.kt b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/interactor/UpdateFollowingInteractor.kt similarity index 73% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/UpdateFollowingInteractor.kt rename to shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/interactor/UpdateFollowingInteractor.kt index a98564a9c..1e8b5227b 100644 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/UpdateFollowingInteractor.kt +++ b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/interactor/UpdateFollowingInteractor.kt @@ -1,7 +1,7 @@ -package com.thomaskioko.tvmaniac.discover.api.interactor +package com.thomaskioko.tvmaniac.details.api.interactor -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor +import com.thomaskioko.tvmaniac.core.util.FlowInteractor +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/presentation/ShowDetailsContract.kt b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/presentation/ShowDetailsContract.kt similarity index 71% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/presentation/ShowDetailsContract.kt rename to shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/presentation/ShowDetailsContract.kt index 205da8109..52ae5758e 100644 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/presentation/ShowDetailsContract.kt +++ b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/presentation/ShowDetailsContract.kt @@ -1,13 +1,13 @@ -package com.thomaskioko.tvmaniac.discover.api.presentation +package com.thomaskioko.tvmaniac.details.api.presentation -import com.thomaskioko.tvmaniac.discover.api.interactor.UpdateShowParams -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.details.api.interactor.UpdateShowParams import com.thomaskioko.tvmaniac.genre.api.GenreUIModel import com.thomaskioko.tvmaniac.lastairepisodes.api.LastAirEpisode import com.thomaskioko.tvmaniac.seasons.api.model.SeasonUiModel -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.Effect -import com.thomaskioko.tvmaniac.shared.core.store.State +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.Effect +import com.thomaskioko.tvmaniac.shared.core.ui.State +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow sealed class ShowDetailAction : Action { object LoadGenres : ShowDetailAction() @@ -47,8 +47,8 @@ sealed class ShowDetailEffect : Effect { data class ShowDetailViewState( val isLoading: Boolean = false, val errorMessage: String = "", - val tvShow: com.thomaskioko.tvmaniac.showcommon.api.TvShow = com.thomaskioko.tvmaniac.showcommon.api.TvShow.EMPTY_SHOW, - val similarShowList: List = emptyList(), + val tvShow: TvShow = TvShow.EMPTY_SHOW, + val similarShowList: List = emptyList(), val tvSeasonUiModels: List = emptyList(), val genreUIList: List = emptyList(), val lastAirEpList: List = emptyList(), diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/repository/TvShowsRepository.kt b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/repository/TvShowsRepository.kt similarity index 62% rename from shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/repository/TvShowsRepository.kt rename to shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/repository/TvShowsRepository.kt index b7ceb2d66..714c6fa49 100644 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/repository/TvShowsRepository.kt +++ b/shared/domain/show-details/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/api/repository/TvShowsRepository.kt @@ -1,9 +1,9 @@ -package com.thomaskioko.tvmaniac.discover.api.repository +package com.thomaskioko.tvmaniac.details.api.repository import com.kuuurt.paging.multiplatform.PagingData +import com.thomaskioko.tvmaniac.core.util.CommonFlow +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.Show -import com.thomaskioko.tvmaniac.shared.core.util.CommonFlow -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.Flow interface TvShowsRepository { @@ -14,10 +14,6 @@ interface TvShowsRepository { fun observeFollowing(): Flow> - fun observeShowsByCategoryID( - categoryId: Int - ): Flow>> - fun observePagedShowsByCategoryID( categoryId: Int ): CommonFlow> diff --git a/shared/domain/show/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/ShowDetailsViewModel.kt b/shared/domain/show-details/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/details/api/ShowDetailsViewModel.kt similarity index 84% rename from shared/domain/show/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/ShowDetailsViewModel.kt rename to shared/domain/show-details/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/details/api/ShowDetailsViewModel.kt index a6b8729cd..3bdf73874 100644 --- a/shared/domain/show/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/discover/api/ShowDetailsViewModel.kt +++ b/shared/domain/show-details/api/src/iosMain/kotlin/com/thomaskioko/tvmaniac/details/api/ShowDetailsViewModel.kt @@ -1,17 +1,18 @@ -package com.thomaskioko.tvmaniac.discover.api +package com.thomaskioko.tvmaniac.details.api -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveShowInteractor -import com.thomaskioko.tvmaniac.discover.api.interactor.UpdateFollowingInteractor -import com.thomaskioko.tvmaniac.discover.api.presentation.ShowDetailAction +import com.thomaskioko.tvmaniac.details.api.interactor.ObserveShowInteractor +import com.thomaskioko.tvmaniac.details.api.interactor.UpdateFollowingInteractor +import com.thomaskioko.tvmaniac.details.api.presentation.ShowDetailAction import com.thomaskioko.tvmaniac.genre.api.GenreUIModel import com.thomaskioko.tvmaniac.genre.api.GetGenresInteractor import com.thomaskioko.tvmaniac.lastairepisodes.api.LastAirEpisode import com.thomaskioko.tvmaniac.lastairepisodes.api.ObserveAirEpisodesInteractor import com.thomaskioko.tvmaniac.seasons.api.interactor.ObserveSeasonsInteractor import com.thomaskioko.tvmaniac.seasons.api.model.SeasonUiModel -import com.thomaskioko.tvmaniac.shared.core.BaseViewModel -import com.thomaskioko.tvmaniac.shared.core.store.Action -import com.thomaskioko.tvmaniac.shared.core.store.ViewState +import com.thomaskioko.tvmaniac.shared.core.ui.Action +import com.thomaskioko.tvmaniac.shared.core.ui.BaseViewModel +import com.thomaskioko.tvmaniac.shared.core.ui.ViewState +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import com.thomaskioko.tvmaniac.similar.api.ObserveSimilarShowsInteractor import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -94,8 +95,8 @@ class ShowDetailsViewModel : BaseViewModel(), KoinComponent { data class ShowDetailUiViewState( val isLoading: Boolean = true, val errorMessage: String = "", - val tvShow: com.thomaskioko.tvmaniac.showcommon.api.TvShow = com.thomaskioko.tvmaniac.showcommon.api.TvShow.EMPTY_SHOW, - val similarShowList: List = emptyList(), + val tvShow: TvShow = TvShow.EMPTY_SHOW, + val similarShowList: List = emptyList(), val seasonList: List = emptyList(), val genreList: List = emptyList(), val episodeList: List = emptyList(), diff --git a/shared/domain/show-details/implementation/build.gradle.kts b/shared/domain/show-details/implementation/build.gradle.kts new file mode 100644 index 000000000..bdf84e17a --- /dev/null +++ b/shared/domain/show-details/implementation/build.gradle.kts @@ -0,0 +1,40 @@ +import util.libs + +plugins { + `kmm-domain-plugin` +} + +android { + namespace = "com.thomaskioko.tvmaniac.details.implementation" +} + +dependencies { + commonMainImplementation(projects.shared.remote) + commonMainImplementation(projects.shared.domain.showDetails.api) + commonMainImplementation(projects.shared.domain.episodes.api) + commonMainImplementation(projects.shared.domain.lastAirEpisodes.api) + commonMainImplementation(projects.shared.domain.showCommon.api) + + commonMainImplementation(libs.koin.core) + commonMainImplementation(libs.kotlin.datetime) + commonMainImplementation(libs.multiplatform.paging.core) + commonMainImplementation(libs.squareup.sqldelight.extensions) + + testImplementation(libs.testing.mockk.core) + + commonTestImplementation(kotlin("test")) + commonTestImplementation(projects.shared.core.test) + commonTestImplementation(libs.testing.turbine) + commonTestImplementation(libs.testing.kotest.assertions) + commonTestImplementation(libs.testing.coroutines.test) + commonTestImplementation(libs.testing.mockk.common) + + val coroutineCore = libs.kotlin.coroutines.core.get() + + @Suppress("UnstableApiUsage") + iosMainImplementation("${coroutineCore.module.group}:${coroutineCore.module.name}:${coroutineCore.versionConstraint.displayName}") { + version { + strictly(libs.versions.coroutines.native.get()) + } + } +} diff --git a/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/cache/ShowCategoryCacheImpl.kt b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/cache/ShowCategoryCacheImpl.kt new file mode 100644 index 000000000..6b946e616 --- /dev/null +++ b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/cache/ShowCategoryCacheImpl.kt @@ -0,0 +1,18 @@ +package com.thomaskioko.tvmaniac.details.implementation.cache + +import com.thomaskioko.tvmaniac.datasource.cache.SelectShows +import com.thomaskioko.tvmaniac.datasource.cache.TvManiacDatabase +import com.thomaskioko.tvmaniac.details.api.cache.ShowCategoryCache + +class ShowCategoryCacheImpl( + private val database: TvManiacDatabase +) : ShowCategoryCache { + + private val showCategoryQuery get() = database.showCategoryQueries + + override fun getShowsByCategoryID(id: Int): List { + return showCategoryQuery.selectShows( + category_id = id.toLong() + ).executeAsList() + } +} diff --git a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/TvShowCacheImpl.kt b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/cache/TvShowCacheImpl.kt similarity index 94% rename from shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/TvShowCacheImpl.kt rename to shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/cache/TvShowCacheImpl.kt index 1bfdc83d5..55c38f3b1 100644 --- a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/cache/TvShowCacheImpl.kt +++ b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/cache/TvShowCacheImpl.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.discover.implementation.cache +package com.thomaskioko.tvmaniac.details.implementation.cache import com.squareup.sqldelight.runtime.coroutines.asFlow import com.squareup.sqldelight.runtime.coroutines.mapToList @@ -6,7 +6,7 @@ import com.squareup.sqldelight.runtime.coroutines.mapToOne import com.thomaskioko.tvmaniac.datasource.cache.AirEpisodesByShowId import com.thomaskioko.tvmaniac.datasource.cache.Show import com.thomaskioko.tvmaniac.datasource.cache.TvManiacDatabase -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache import kotlinx.coroutines.flow.Flow class TvShowCacheImpl( diff --git a/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/di/DomainModule.kt b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/di/DomainModule.kt new file mode 100644 index 000000000..8c484e753 --- /dev/null +++ b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/di/DomainModule.kt @@ -0,0 +1,24 @@ +package com.thomaskioko.tvmaniac.details.implementation.di + +import com.thomaskioko.tvmaniac.details.api.cache.ShowCategoryCache +import com.thomaskioko.tvmaniac.details.api.interactor.ObserveShowInteractor +import com.thomaskioko.tvmaniac.details.api.interactor.UpdateFollowingInteractor +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.details.implementation.cache.ShowCategoryCacheImpl +import com.thomaskioko.tvmaniac.details.implementation.cache.TvShowCacheImpl +import com.thomaskioko.tvmaniac.details.implementation.repository.TvShowsRepositoryImpl +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache +import org.koin.core.module.Module +import org.koin.dsl.module + +val detailDomainModule: Module = module { + single { + TvShowsRepositoryImpl(get(), get(), get(), get(), get(), get()) + } + + factory { ObserveShowInteractor(get()) } + factory { UpdateFollowingInteractor(get()) } + + single { TvShowCacheImpl(get()) } + single { ShowCategoryCacheImpl(get()) } +} diff --git a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/mapper/TvShowsCacheMapper.kt b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/mapper/TvShowsCacheMapper.kt similarity index 93% rename from shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/mapper/TvShowsCacheMapper.kt rename to shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/mapper/TvShowsCacheMapper.kt index a1b2044e2..8f4ea38c6 100644 --- a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/mapper/TvShowsCacheMapper.kt +++ b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/mapper/TvShowsCacheMapper.kt @@ -1,11 +1,11 @@ -package com.thomaskioko.tvmaniac.discover.implementation.mapper +package com.thomaskioko.tvmaniac.details.implementation.mapper +import com.thomaskioko.tvmaniac.core.util.DateUtil.formatDateString import com.thomaskioko.tvmaniac.datasource.cache.Last_episode import com.thomaskioko.tvmaniac.datasource.cache.SelectShows import com.thomaskioko.tvmaniac.datasource.cache.Show import com.thomaskioko.tvmaniac.remote.api.model.LastEpisodeToAir import com.thomaskioko.tvmaniac.remote.api.model.NextEpisodeToAir -import com.thomaskioko.tvmaniac.shared.core.util.DateUtil.formatDateString fun List.toShowList(): List { return map { it.toShow() } diff --git a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/mapper/TvShowsResponseMapper.kt b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/mapper/TvShowsResponseMapper.kt similarity index 93% rename from shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/mapper/TvShowsResponseMapper.kt rename to shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/mapper/TvShowsResponseMapper.kt index 06e16334c..109c43b17 100644 --- a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/mapper/TvShowsResponseMapper.kt +++ b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/mapper/TvShowsResponseMapper.kt @@ -1,10 +1,10 @@ -package com.thomaskioko.tvmaniac.discover.implementation.mapper +package com.thomaskioko.tvmaniac.details.implementation.mapper +import com.thomaskioko.tvmaniac.core.util.StringUtil.formatPosterPath import com.thomaskioko.tvmaniac.datasource.cache.Show import com.thomaskioko.tvmaniac.remote.api.model.GenreResponse import com.thomaskioko.tvmaniac.remote.api.model.ShowDetailResponse import com.thomaskioko.tvmaniac.remote.api.model.ShowResponse -import com.thomaskioko.tvmaniac.shared.core.util.StringUtil.formatPosterPath import kotlinx.datetime.toLocalDate fun ShowResponse.toShow(): Show { diff --git a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/repository/TvShowsRepositoryImpl.kt b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/repository/TvShowsRepositoryImpl.kt similarity index 52% rename from shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/repository/TvShowsRepositoryImpl.kt rename to shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/repository/TvShowsRepositoryImpl.kt index 0602d02a8..b613b1850 100644 --- a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/repository/TvShowsRepositoryImpl.kt +++ b/shared/domain/show-details/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/details/implementation/repository/TvShowsRepositoryImpl.kt @@ -1,4 +1,4 @@ -package com.thomaskioko.tvmaniac.discover.implementation.repository +package com.thomaskioko.tvmaniac.details.implementation.repository import co.touchlab.kermit.Logger import com.kuuurt.paging.multiplatform.Pager @@ -6,34 +6,28 @@ import com.kuuurt.paging.multiplatform.PagingConfig import com.kuuurt.paging.multiplatform.PagingData import com.kuuurt.paging.multiplatform.PagingResult import com.kuuurt.paging.multiplatform.helpers.cachedIn -import com.thomaskioko.tvmaniac.datasource.cache.Category +import com.thomaskioko.tvmaniac.core.util.CommonFlow +import com.thomaskioko.tvmaniac.core.util.asCommonFlow +import com.thomaskioko.tvmaniac.core.util.getErrorMessage +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.networkBoundResource import com.thomaskioko.tvmaniac.datasource.cache.Show -import com.thomaskioko.tvmaniac.datasource.cache.Show_category -import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache -import com.thomaskioko.tvmaniac.discover.api.cache.ShowCategoryCache -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory.POPULAR -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory.TOP_RATED -import com.thomaskioko.tvmaniac.discover.api.model.ShowCategory.TRENDING -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.discover.implementation.mapper.toAirEp -import com.thomaskioko.tvmaniac.discover.implementation.mapper.toShow -import com.thomaskioko.tvmaniac.discover.implementation.mapper.toShowList +import com.thomaskioko.tvmaniac.details.api.cache.ShowCategoryCache +import com.thomaskioko.tvmaniac.details.api.repository.TvShowsRepository +import com.thomaskioko.tvmaniac.details.implementation.mapper.toAirEp +import com.thomaskioko.tvmaniac.details.implementation.mapper.toShow +import com.thomaskioko.tvmaniac.details.implementation.mapper.toShowList import com.thomaskioko.tvmaniac.lastairepisodes.api.LastEpisodeAirCache import com.thomaskioko.tvmaniac.remote.api.TvShowsService import com.thomaskioko.tvmaniac.remote.api.model.ShowDetailResponse -import com.thomaskioko.tvmaniac.remote.api.model.TvShowsResponse -import com.thomaskioko.tvmaniac.shared.core.util.CommonFlow -import com.thomaskioko.tvmaniac.shared.core.util.Resource -import com.thomaskioko.tvmaniac.shared.core.util.asCommonFlow -import com.thomaskioko.tvmaniac.shared.core.util.getErrorMessage -import com.thomaskioko.tvmaniac.shared.core.util.networkBoundResource -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory.POPULAR +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory.TOP_RATED +import com.thomaskioko.tvmaniac.showcommon.api.model.ShowCategory.TRENDING import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged -import kotlinx.coroutines.flow.map private const val DEFAULT_API_PAGE = 1 @@ -41,7 +35,6 @@ class TvShowsRepositoryImpl( private val apiService: TvShowsService, private val tvShowCache: TvShowCache, private val epAirCacheLast: LastEpisodeAirCache, - private val categoryCache: CategoryCache, private val showCategoryCache: ShowCategoryCache, private val coroutineScope: CoroutineScope, private val dispatcher: CoroutineDispatcher, @@ -62,21 +55,6 @@ class TvShowsRepositoryImpl( override fun observeFollowing(): Flow> = tvShowCache.observeFollowing() - override fun observeShowsByCategoryID(categoryId: Int): Flow>> = - networkBoundResource( - query = { - showCategoryCache.observeShowsByCategoryID(categoryId) - .map { it.toShowList() } - }, - shouldFetch = { it.isNullOrEmpty() }, - fetch = { fetchShowsApiRequest(categoryId) }, - saveFetchResult = { cacheResult(it, categoryId) }, - onFetchFailed = { - // Logger.withTag("observeShowsByCategoryID").e { it.getErrorMessage() } - }, - coroutineDispatcher = dispatcher - ) - override fun observePagedShowsByCategoryID( categoryId: Int ): CommonFlow> { @@ -115,41 +93,6 @@ class TvShowsRepositoryImpl( .asCommonFlow() } - private suspend fun fetchShowsApiRequest(categoryId: Int): TvShowsResponse = when (categoryId) { - TRENDING.type -> apiService.getTrendingShows(DEFAULT_API_PAGE) - POPULAR.type -> apiService.getPopularShows(DEFAULT_API_PAGE) - TOP_RATED.type -> apiService.getTopRatedShows(DEFAULT_API_PAGE) - else -> apiService.getTrendingShows(DEFAULT_API_PAGE) - } - - private fun cacheResult( - it: TvShowsResponse, - categoryId: Int - ) { - val result = it.results.map { show -> - show.toShow() - } - tvShowCache.insert(result) - - result.forEach { show -> - // Insert Category - categoryCache.insert( - Category( - id = categoryId.toLong(), - name = ShowCategory[categoryId].title - ) - ) - - // Insert ShowCategory - showCategoryCache.insert( - Show_category( - category_id = categoryId.toLong(), - show_id = show.id - ) - ) - } - } - private fun mapAndInsert(tvShowId: Long, response: ShowDetailResponse) { tvShowCache.insert(response.toShow()) diff --git a/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt b/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt new file mode 100644 index 000000000..1187a9af4 --- /dev/null +++ b/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/MockData.kt @@ -0,0 +1,76 @@ +package com.thomaskioko.tvmaniac + +import com.thomaskioko.tvmaniac.datasource.cache.Show +import com.thomaskioko.tvmaniac.remote.api.model.ShowResponse +import com.thomaskioko.tvmaniac.remote.api.model.TvShowsResponse + +object MockData { + + fun getTvResponse() = TvShowsResponse( + page = 1, + results = listOf( + ShowResponse( + backdropPath = "/wr7nrzDrpGCEgYnw15jyAB59PtZ.jpg", + firstAirDate = "2021-06-09", + genreIds = listOf(18, 10765), + id = 84958, + name = "Loki", + originCountry = listOf("US"), + originalLanguage = "en", + originalName = "Loki", + overview = "After stealing the Tesseract during the events of “Avengers: Endgame,” " + + "an alternate version of Loki is brought to the mysterious Time Variance " + + "Authority, a bureaucratic organization that exists outside of time and " + + "space and monitors the timeline. They give Loki a choice: face being " + + "erased from existence due to being a “time variant”or help fix " + + "the timeline and stop a greater threat.", + popularity = 6005.364, + posterPath = "/kEl2t3OhXc3Zb9FBh1AuYzRTgZp.jpg", + voteAverage = 8.1, + voteCount = 4958, + ), + ShowResponse( + backdropPath = "/9nBVkNBe4x9HKDAzxjxlIqecxCW.jpg", + firstAirDate = "2021-06-25", + genreIds = listOf(35, 18), + id = 126280, + name = "Sex/Life", + originCountry = listOf("US"), + originalLanguage = "en", + originalName = "Loki", + overview = "A woman's daring sexual past collides with her married-with-kids " + + "present when the bad-boy ex she can't stop fantasizing about crashes " + + "back into her life.", + popularity = 2275.168, + posterPath = "/2ST6l4WP7ZfqAetuttBqx8F3AAH.jpg", + voteAverage = 7.3, + voteCount = 212, + ) + ), + totalPages = 100, + totalResults = 5 + ) + + fun getShow() = Show( + id = 84958, + title = "Loki", + description = "After stealing the Tesseract during the events of “Avengers: Endgame,” " + + "an alternate version of Loki is brought to the mysterious Time Variance " + + "Authority, a bureaucratic organization that exists outside of time and " + + "space and monitors the timeline. They give Loki a choice: face being " + + "erased from existence due to being a “time variant”or help fix " + + "the timeline and stop a greater threat.", + poster_image_url = "/kEl2t3OhXc3Zb9FBh1AuYzRTgZp.jpg", + backdrop_image_url = "/kEl2t3OhXc3Zb9FBh1AuYzRTgZp.jpg", + language = "en", + votes = 4958, + vote_average = 8.1, + genre_ids = listOf(18, 10765), + year = "2019", + status = "Ended", + popularity = 24.4848, + following = true, + number_of_episodes = 30, + number_of_seasons = 2 + ) +} diff --git a/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt b/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt new file mode 100644 index 000000000..89a8028e0 --- /dev/null +++ b/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/mapper/TvShowResponseMapperTest.kt @@ -0,0 +1,30 @@ +package com.thomaskioko.tvmaniac.datasource.mapper + +import com.thomaskioko.tvmaniac.MockData.getTvResponse +import com.thomaskioko.tvmaniac.core.util.StringUtil.formatPosterPath +import com.thomaskioko.tvmaniac.details.implementation.mapper.toShow +import io.kotest.matchers.shouldBe +import kotlin.test.Test + +internal class TvShowResponseMapperTest { + + @Test + fun givenApiResponse_VerifyResponse_isMappedToEntityList() { + + val response = getTvResponse() + val mappedData = response.results + .map { it.toShow() } + + val showResponse = response.results.first() + val mappedShow = mappedData.first() + + mappedData.size shouldBe response.results.size + mappedShow.id shouldBe showResponse.id + mappedShow.title shouldBe showResponse.name + mappedShow.description shouldBe showResponse.overview + mappedShow.poster_image_url shouldBe formatPosterPath(showResponse.posterPath) + mappedShow.votes shouldBe showResponse.voteCount + mappedShow.vote_average shouldBe showResponse.voteAverage + mappedShow.genre_ids shouldBe showResponse.genreIds + } +} diff --git a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/repository/TvShowRepositoryTest.kt b/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/repository/TvShowRepositoryTest.kt similarity index 74% rename from shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/repository/TvShowRepositoryTest.kt rename to shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/repository/TvShowRepositoryTest.kt index f94216cc0..edfb22a30 100644 --- a/shared/domain/show/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/repository/TvShowRepositoryTest.kt +++ b/shared/domain/show-details/implementation/src/commonTest/kotlin/com/thomaskioko/tvmaniac/datasource/repository/TvShowRepositoryTest.kt @@ -4,17 +4,12 @@ import com.thomaskioko.tvmaniac.MockData.getShow import com.thomaskioko.tvmaniac.core.test.runBlockingTest import com.thomaskioko.tvmaniac.core.test.testCoroutineDispatcher import com.thomaskioko.tvmaniac.core.test.testCoroutineScope -import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache -import com.thomaskioko.tvmaniac.discover.api.cache.ShowCategoryCache -import com.thomaskioko.tvmaniac.discover.implementation.repository.TvShowsRepositoryImpl +import com.thomaskioko.tvmaniac.details.api.cache.ShowCategoryCache +import com.thomaskioko.tvmaniac.details.implementation.repository.TvShowsRepositoryImpl import com.thomaskioko.tvmaniac.lastairepisodes.api.LastEpisodeAirCache import com.thomaskioko.tvmaniac.remote.api.TvShowsService -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache -import io.mockk.coVerify -import io.mockk.every -import io.mockk.mockk -import io.mockk.spyk -import io.mockk.unmockkAll +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache +import io.mockk.* import kotlinx.coroutines.flow.flowOf import kotlin.test.AfterTest import kotlin.test.Ignore @@ -23,16 +18,14 @@ import kotlin.test.Test internal class TvShowRepositoryTest { private var apiService = mockk() - private var tvShowCache = spyk() + private var tvShowCache = spyk() private var showCategoryCache = spyk() - private var categoryCache = spyk() private var lastEpisodeAirCache = spyk() private val repository: TvShowsRepositoryImpl = TvShowsRepositoryImpl( apiService, tvShowCache, lastEpisodeAirCache, - categoryCache, showCategoryCache, testCoroutineScope, testCoroutineDispatcher diff --git a/shared/domain/show/api/src/androidMain/AndroidManifest.xml b/shared/domain/show/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 7c813dc6f..000000000 --- a/shared/domain/show/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/ObserveShowInteractor.kt b/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/ObserveShowInteractor.kt deleted file mode 100644 index b08afe648..000000000 --- a/shared/domain/show/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/api/interactor/ObserveShowInteractor.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.thomaskioko.tvmaniac.discover.api.interactor - -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor -import com.thomaskioko.tvmaniac.showcommon.api.toTvShow -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.map - -class ObserveShowInteractor constructor( - private val repository: TvShowsRepository, -) : FlowInteractor() { - - override fun run(params: Long): Flow = repository.observeShow(params) - .map { it.data?.toTvShow() ?: com.thomaskioko.tvmaniac.showcommon.api.TvShow.EMPTY_SHOW } -} diff --git a/shared/domain/show/implementation/build.gradle.kts b/shared/domain/show/implementation/build.gradle.kts deleted file mode 100644 index 6958eab76..000000000 --- a/shared/domain/show/implementation/build.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -plugins { - `kmm-domain-plugin` -} - -dependencies { - commonMainImplementation(project(":shared:remote")) - commonMainImplementation(project(":shared:domain:show:api")) - commonMainImplementation(project(":shared:domain:episodes:api")) - commonMainImplementation(project(":shared:domain:last-air-episodes:api")) - commonMainImplementation(project(":shared:domain:show-common:api")) - - commonMainImplementation(libs.koin.core) - commonMainImplementation(libs.kotlin.datetime) - commonMainImplementation(libs.multiplatform.paging.core) - commonMainImplementation(libs.squareup.sqldelight.extensions) - - testImplementation(libs.testing.mockk.core) - - commonTestImplementation(kotlin("test")) - commonTestImplementation(project(":shared:core-test")) - commonTestImplementation(libs.testing.turbine) - commonTestImplementation(libs.testing.kotest.assertions) - commonTestImplementation(libs.testing.coroutines.test) - commonTestImplementation(libs.testing.mockk.common) -} diff --git a/shared/domain/show/implementation/src/androidMain/AndroidManifest.xml b/shared/domain/show/implementation/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 7291fc275..000000000 --- a/shared/domain/show/implementation/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/di/DomainModule.kt b/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/di/DomainModule.kt deleted file mode 100644 index b45118659..000000000 --- a/shared/domain/show/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/discover/implementation/di/DomainModule.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.thomaskioko.tvmaniac.discover.implementation.di - -import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache -import com.thomaskioko.tvmaniac.discover.api.cache.ShowCategoryCache -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveDiscoverShowsInteractor -import com.thomaskioko.tvmaniac.discover.api.interactor.ObserveShowInteractor -import com.thomaskioko.tvmaniac.discover.api.interactor.UpdateFollowingInteractor -import com.thomaskioko.tvmaniac.discover.api.repository.TvShowsRepository -import com.thomaskioko.tvmaniac.discover.implementation.cache.CategoryCacheImpl -import com.thomaskioko.tvmaniac.discover.implementation.cache.ShowCategoryCacheImpl -import com.thomaskioko.tvmaniac.discover.implementation.cache.TvShowCacheImpl -import com.thomaskioko.tvmaniac.discover.implementation.repository.TvShowsRepositoryImpl -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache -import org.koin.core.module.Module -import org.koin.dsl.module - -val discoverDomainModule: Module = module { - single { - TvShowsRepositoryImpl(get(), get(), get(), get(), get(), get(), get()) - } - - factory { ObserveDiscoverShowsInteractor(get()) } - factory { ObserveShowInteractor(get()) } - factory { UpdateFollowingInteractor(get()) } - - single { TvShowCacheImpl(get()) } - single { ShowCategoryCacheImpl(get()) } - single { CategoryCacheImpl(get()) } -} diff --git a/shared/domain/similar/api/build.gradle.kts b/shared/domain/similar/api/build.gradle.kts index 7780884f5..932c06894 100644 --- a/shared/domain/similar/api/build.gradle.kts +++ b/shared/domain/similar/api/build.gradle.kts @@ -1,9 +1,15 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.similar.api" +} + dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.database) commonMainApi(projects.shared.domain.showCommon.api) commonMainApi(libs.kotlin.coroutines.core) diff --git a/shared/domain/similar/api/src/androidMain/AndroidManifest.xml b/shared/domain/similar/api/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 4205def8d..000000000 --- a/shared/domain/similar/api/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ObserveSimilarShowsInteractor.kt b/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ObserveSimilarShowsInteractor.kt index 63c71dfcc..553a0dd6c 100644 --- a/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ObserveSimilarShowsInteractor.kt +++ b/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ObserveSimilarShowsInteractor.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.similar.api -import com.thomaskioko.tvmaniac.shared.core.FlowInteractor -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.core.util.FlowInteractor +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map diff --git a/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ShowMapper.kt b/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ShowMapper.kt index c033a4ff2..ce26e87c6 100644 --- a/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ShowMapper.kt +++ b/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/ShowMapper.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.similar.api import com.thomaskioko.tvmaniac.datasource.cache.SelectSimilarShows -import com.thomaskioko.tvmaniac.showcommon.api.TvShow +import com.thomaskioko.tvmaniac.showcommon.api.model.TvShow fun List.toTvShowList(): List { return map { it.toTvShow() } diff --git a/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/SimilarShowsRepository.kt b/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/SimilarShowsRepository.kt index a8017fe35..9e7291c9f 100644 --- a/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/SimilarShowsRepository.kt +++ b/shared/domain/similar/api/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/api/SimilarShowsRepository.kt @@ -1,7 +1,7 @@ package com.thomaskioko.tvmaniac.similar.api +import com.thomaskioko.tvmaniac.core.util.network.Resource import com.thomaskioko.tvmaniac.datasource.cache.SelectSimilarShows -import com.thomaskioko.tvmaniac.shared.core.util.Resource import kotlinx.coroutines.flow.Flow interface SimilarShowsRepository { diff --git a/shared/domain/similar/implementation/build.gradle.kts b/shared/domain/similar/implementation/build.gradle.kts index a608c3220..d97f34146 100644 --- a/shared/domain/similar/implementation/build.gradle.kts +++ b/shared/domain/similar/implementation/build.gradle.kts @@ -1,11 +1,17 @@ +import util.libs + plugins { `kmm-domain-plugin` } +android { + namespace = "com.thomaskioko.tvmaniac.similar.implementation" +} + dependencies { - commonMainImplementation(project(":shared:remote")) - commonMainImplementation(project(":shared:domain:similar:api")) + commonMainImplementation(projects.shared.remote) + commonMainImplementation(projects.shared.domain.similar.api) commonMainImplementation(libs.kermit) commonMainImplementation(libs.koin.core) commonMainImplementation(libs.squareup.sqldelight.extensions) @@ -13,9 +19,18 @@ dependencies { testImplementation(libs.testing.mockk.core) commonTestImplementation(kotlin("test")) - commonTestImplementation(project(":shared:core-test")) + commonTestImplementation(projects.shared.core.test) commonTestImplementation(libs.testing.turbine) commonTestImplementation(libs.testing.kotest.assertions) commonTestImplementation(libs.testing.mockk.common) commonTestImplementation(libs.testing.coroutines.test) + + val coroutineCore = libs.kotlin.coroutines.core.get() + + @Suppress("UnstableApiUsage") + iosMainImplementation("${coroutineCore.module.group}:${coroutineCore.module.name}:${coroutineCore.versionConstraint.displayName}") { + version { + strictly(libs.versions.coroutines.native.get()) + } + } } diff --git a/shared/domain/similar/implementation/src/androidMain/AndroidManifest.xml b/shared/domain/similar/implementation/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 3d542a932..000000000 --- a/shared/domain/similar/implementation/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/ResponseMapper.kt b/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/ResponseMapper.kt index 208c62505..2a06d808b 100644 --- a/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/ResponseMapper.kt +++ b/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/ResponseMapper.kt @@ -1,9 +1,9 @@ package com.thomaskioko.tvmaniac.similar.implementation +import com.thomaskioko.tvmaniac.core.util.DateUtil.formatDateString +import com.thomaskioko.tvmaniac.core.util.StringUtil import com.thomaskioko.tvmaniac.datasource.cache.Show import com.thomaskioko.tvmaniac.remote.api.model.ShowResponse -import com.thomaskioko.tvmaniac.shared.core.util.DateUtil.formatDateString -import com.thomaskioko.tvmaniac.shared.core.util.StringUtil fun ShowResponse.toShow(): Show { return Show( diff --git a/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/SimilarShowsRepositoryImpl.kt b/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/SimilarShowsRepositoryImpl.kt index a26b22211..ea29bc73c 100644 --- a/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/SimilarShowsRepositoryImpl.kt +++ b/shared/domain/similar/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/similar/implementation/SimilarShowsRepositoryImpl.kt @@ -1,13 +1,13 @@ package com.thomaskioko.tvmaniac.similar.implementation import co.touchlab.kermit.Logger +import com.thomaskioko.tvmaniac.core.util.getErrorMessage +import com.thomaskioko.tvmaniac.core.util.network.Resource +import com.thomaskioko.tvmaniac.core.util.network.networkBoundResource import com.thomaskioko.tvmaniac.datasource.cache.SelectSimilarShows import com.thomaskioko.tvmaniac.remote.api.TvShowsService import com.thomaskioko.tvmaniac.remote.api.model.TvShowsResponse -import com.thomaskioko.tvmaniac.shared.core.util.Resource -import com.thomaskioko.tvmaniac.shared.core.util.getErrorMessage -import com.thomaskioko.tvmaniac.shared.core.util.networkBoundResource -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache import com.thomaskioko.tvmaniac.similar.api.SimilarShowCache import com.thomaskioko.tvmaniac.similar.api.SimilarShowsRepository import kotlinx.coroutines.CoroutineDispatcher diff --git a/shared/interactors/build.gradle.kts b/shared/interactors/build.gradle.kts deleted file mode 100644 index def602b6a..000000000 --- a/shared/interactors/build.gradle.kts +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - `kmm-domain-plugin` -} - -dependencies { - - commonMainImplementation(projects.shared.core) - commonMainImplementation(projects.shared.database) - commonMainImplementation(projects.shared.remote) - commonMainImplementation(projects.shared.domain.show.api) - commonMainImplementation(projects.shared.domain.showCommon.api) - - commonMainImplementation(libs.kermit) - commonMainImplementation(libs.multiplatform.paging.core) - commonMainImplementation(libs.kotlin.coroutines.core) -} diff --git a/shared/interactors/src/androidMain/AndroidManifest.xml b/shared/interactors/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 25ee6867e..000000000 --- a/shared/interactors/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/remote/build.gradle.kts b/shared/remote/build.gradle.kts index 563a21a94..9a65cef8d 100644 --- a/shared/remote/build.gradle.kts +++ b/shared/remote/build.gradle.kts @@ -1,13 +1,19 @@ + import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING +import util.libs import java.io.FileInputStream import java.util.Properties plugins { `kmm-domain-plugin` - kotlin("plugin.serialization") + kotlin("plugin.serialization") version ("1.6.10") id("com.codingfeline.buildkonfig") } +android { + namespace = "com.thomaskioko.tvmaniac.remote" +} + dependencies { commonMainImplementation(libs.ktor.core) commonMainImplementation(libs.ktor.logging) @@ -21,7 +27,7 @@ dependencies { iosMainImplementation(libs.ktor.ios) commonTestImplementation(kotlin("test")) - commonTestImplementation(projects.shared.coreTest) + commonTestImplementation(projects.shared.core.test) commonTestImplementation(libs.testing.ktor.mock) commonTestImplementation(libs.testing.turbine) diff --git a/shared/remote/src/androidMain/AndroidManifest.xml b/shared/remote/src/androidMain/AndroidManifest.xml deleted file mode 100644 index b394e735f..000000000 --- a/shared/remote/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/shared/build.gradle.kts similarity index 80% rename from shared/build.gradle.kts rename to shared/shared/build.gradle.kts index ff1f31958..a9a7127d7 100644 --- a/shared/build.gradle.kts +++ b/shared/shared/build.gradle.kts @@ -2,6 +2,7 @@ import Kmm_domain_plugin_gradle.Utils.getIosTarget import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode import org.jetbrains.kotlin.gradle.plugin.mpp.Framework import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget +import util.libs plugins { `kmm-domain-plugin` @@ -11,6 +12,10 @@ plugins { version = libs.versions.shared.module.version.get() +android { + namespace = "com.thomaskioko.tvmaniac.shared" +} + kotlin { val iosTarget = getIosTarget() @@ -28,10 +33,11 @@ kotlin { isStatic = false linkerOpts.add("-lsqlite3") - export(projects.shared.core) + export(projects.shared.core.ui) + export(projects.shared.core.util) export(projects.shared.database) export(projects.shared.remote) - export(projects.shared.domain.show.api) + export(projects.shared.domain.showDetails.api) export(projects.shared.domain.seasons.api) export(projects.shared.domain.episodes.api) export(projects.shared.domain.genre.api) @@ -39,6 +45,7 @@ kotlin { export(projects.shared.domain.similar.api) export(projects.shared.domain.seasonEpisodes.api) export(projects.shared.domain.showCommon.api) + export(projects.shared.domain.discover.api) embedBitcode(BitcodeEmbeddingMode.BITCODE) transitiveExport = true @@ -47,10 +54,11 @@ kotlin { } dependencies { - commonMainApi(projects.shared.core) + commonMainApi(projects.shared.core.ui) + commonMainApi(projects.shared.core.util) commonMainApi(projects.shared.database) commonMainApi(projects.shared.remote) - commonMainApi(projects.shared.domain.show.api) + commonMainApi(projects.shared.domain.showDetails.api) commonMainApi(projects.shared.domain.seasons.api) commonMainApi(projects.shared.domain.episodes.api) commonMainApi(projects.shared.domain.genre.api) @@ -58,14 +66,16 @@ dependencies { commonMainApi(projects.shared.domain.similar.api) commonMainApi(projects.shared.domain.seasonEpisodes.api) commonMainApi(projects.shared.domain.showCommon.api) + commonMainApi(projects.shared.domain.discover.api) commonMainImplementation(projects.shared.domain.episodes.implementation) - commonMainImplementation(projects.shared.domain.show.implementation) + commonMainImplementation(projects.shared.domain.showDetails.implementation) commonMainImplementation(projects.shared.domain.seasons.implementation) commonMainImplementation(projects.shared.domain.genre.implementation) commonMainImplementation(projects.shared.domain.lastAirEpisodes.implementation) commonMainImplementation(projects.shared.domain.similar.implementation) commonMainImplementation(projects.shared.domain.seasonEpisodes.implementation) + commonMainImplementation(projects.shared.domain.discover.implementation) commonMainImplementation(libs.koin.core) commonMainImplementation(libs.kotlin.coroutines.core) diff --git a/shared/src/commonMain/kotlin/com/thomaskioko/tvmaniac/di/Koin.kt b/shared/shared/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/di/Koin.kt similarity index 69% rename from shared/src/commonMain/kotlin/com/thomaskioko/tvmaniac/di/Koin.kt rename to shared/shared/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/di/Koin.kt index 64043158a..e7ff38906 100644 --- a/shared/src/commonMain/kotlin/com/thomaskioko/tvmaniac/di/Koin.kt +++ b/shared/shared/src/commonMain/kotlin/com/thomaskioko/tvmaniac/shared/di/Koin.kt @@ -1,11 +1,10 @@ -package com.thomaskioko.tvmaniac.di +package com.thomaskioko.tvmaniac.shared.di import com.thomaskioko.tvmaniac.core.db.di.dbPlatformModule -import com.thomaskioko.tvmaniac.discover.api.cache.CategoryCache -import com.thomaskioko.tvmaniac.discover.api.cache.ShowCategoryCache -import com.thomaskioko.tvmaniac.discover.implementation.cache.CategoryCacheImpl -import com.thomaskioko.tvmaniac.discover.implementation.cache.ShowCategoryCacheImpl -import com.thomaskioko.tvmaniac.discover.implementation.cache.TvShowCacheImpl +import com.thomaskioko.tvmaniac.details.api.cache.ShowCategoryCache +import com.thomaskioko.tvmaniac.details.implementation.cache.ShowCategoryCacheImpl +import com.thomaskioko.tvmaniac.details.implementation.cache.TvShowCacheImpl +import com.thomaskioko.tvmaniac.details.implementation.di.detailDomainModule import com.thomaskioko.tvmaniac.discover.implementation.di.discoverDomainModule import com.thomaskioko.tvmaniac.episodes.implementation.di.episodeDomainModule import com.thomaskioko.tvmaniac.genre.implementation.di.genreModule @@ -14,8 +13,8 @@ import com.thomaskioko.tvmaniac.remote.di.remotePlatformModule import com.thomaskioko.tvmaniac.remote.di.serviceModule import com.thomaskioko.tvmaniac.seasonepisodes.implementation.seasonEpisodesDomainModule import com.thomaskioko.tvmaniac.seasons.implementation.di.seasonsDomainModule -import com.thomaskioko.tvmaniac.shared.core.di.corePlatformModule -import com.thomaskioko.tvmaniac.showcommon.api.TvShowCache +import com.thomaskioko.tvmaniac.shared.core.ui.di.coreUiPlatformModule +import com.thomaskioko.tvmaniac.showcommon.api.cache.TvShowCache import com.thomaskioko.tvmaniac.similar.implementation.di.similarDomainModule import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.MainScope @@ -30,23 +29,23 @@ fun initKoin(appDeclaration: KoinAppDeclaration = {}) = startKoin { serviceModule, cacheModule, dispatcherModule, - discoverDomainModule, + detailDomainModule, seasonsDomainModule, episodeDomainModule, genreModule, lastAirEpisodeDomainModule, similarDomainModule, seasonEpisodesDomainModule, - corePlatformModule(), + discoverDomainModule, + coreUiPlatformModule(), dbPlatformModule(), remotePlatformModule() ) } val cacheModule: Module = module { - single { TvShowCacheImpl(get()) } + single { TvShowCacheImpl(get()) } single { ShowCategoryCacheImpl(get()) } - single { CategoryCacheImpl(get()) } } val dispatcherModule = module { diff --git a/shared/src/iosMain/kotlin/com/thomaskioko/tvmaniac/KoiniOS.kt b/shared/shared/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/di/KoiniOS.kt similarity index 53% rename from shared/src/iosMain/kotlin/com/thomaskioko/tvmaniac/KoiniOS.kt rename to shared/shared/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/di/KoiniOS.kt index 533e38e23..c991a388b 100644 --- a/shared/src/iosMain/kotlin/com/thomaskioko/tvmaniac/KoiniOS.kt +++ b/shared/shared/src/iosMain/kotlin/com/thomaskioko/tvmaniac/shared/di/KoiniOS.kt @@ -1,6 +1,5 @@ -package com.thomaskioko.tvmaniac +package com.thomaskioko.tvmaniac.shared.di -import com.thomaskioko.tvmaniac.di.initKoin import org.koin.core.KoinApplication fun initKoinIos(): KoinApplication = initKoin {} diff --git a/shared/src/androidMain/AndroidManifest.xml b/shared/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 897d53077..000000000 --- a/shared/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/tooling/config/detekt.yml b/tooling/config/detekt.yml new file mode 100644 index 000000000..583a5143b --- /dev/null +++ b/tooling/config/detekt.yml @@ -0,0 +1,727 @@ +build: + maxIssues: 0 + excludeCorrectable: false + weights: + + +config: + validation: true + warningsAsErrors: false + # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' + excludes: '' + +processors: + active: true + exclude: [''] + +console-reports: + active: true + exclude: [''] + +output-reports: + active: true + exclude: [''] + +comments: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + AbsentOrWrongFileLicense: + active: false + licenseTemplateFile: 'license.template' + licenseTemplateIsRegex: false + CommentOverPrivateFunction: + active: false + CommentOverPrivateProperty: + active: false + DeprecatedBlockTag: + active: false + EndOfSentenceFormat: + active: false + endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' + UndocumentedPublicClass: + active: false + searchInNestedClass: true + searchInInnerClass: true + searchInInnerObject: true + searchInInnerInterface: true + UndocumentedPublicFunction: + active: false + UndocumentedPublicProperty: + active: false + +complexity: + active: true + ComplexCondition: + active: true + threshold: 4 + ComplexInterface: + active: false + threshold: 10 + includeStaticDeclarations: false + includePrivateDeclarations: false + ComplexMethod: + active: true + threshold: 15 + ignoreSingleWhenExpression: false + ignoreSimpleWhenEntries: false + ignoreNestingFunctions: false + nestingFunctions: ['run', 'let', 'apply', 'with', 'also', 'use', 'forEach', 'isNotNull', 'ifNull'] + LabeledExpression: + active: false + ignoredLabels: [] + LargeClass: + active: true + threshold: 600 + LongMethod: + active: true + threshold: 60 + ignoreAnnotated: ['Composable'] + LongParameterList: + active: true + functionThreshold: 8 + constructorThreshold: 8 + ignoreDefaultParameters: true + ignoreDataClasses: true + ignoreAnnotated: ['Composable'] + MethodOverloading: + active: false + threshold: 6 + NamedArguments: + active: false + threshold: 3 + NestedBlockDepth: + active: true + threshold: 4 + ReplaceSafeCallChainWithRun: + active: false + StringLiteralDuplication: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + threshold: 3 + ignoreAnnotation: true + excludeStringsWithLessThan5Characters: true + ignoreStringsRegex: '$^' + TooManyFunctions: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + thresholdInFiles: 13 + thresholdInClasses: 13 + thresholdInInterfaces: 13 + thresholdInObjects: 13 + thresholdInEnums: 11 + ignoreDeprecated: false + ignorePrivate: false + ignoreOverridden: false + +coroutines: + active: true + GlobalCoroutineUsage: + active: false + RedundantSuspendModifier: + active: false + SleepInsteadOfDelay: + active: false + SuspendFunWithFlowReturnType: + active: false + +empty-blocks: + active: true + EmptyCatchBlock: + active: true + allowedExceptionNameRegex: '_|(ignore|expected).*' + EmptyClassBlock: + active: true + EmptyDefaultConstructor: + active: true + EmptyDoWhileBlock: + active: true + EmptyElseBlock: + active: true + EmptyFinallyBlock: + active: true + EmptyForBlock: + active: true + EmptyFunctionBlock: + active: true + ignoreOverridden: false + EmptyIfBlock: + active: true + EmptyInitBlock: + active: true + EmptyKtFile: + active: true + EmptySecondaryConstructor: + active: true + EmptyTryBlock: + active: true + EmptyWhenBlock: + active: true + EmptyWhileBlock: + active: true + +exceptions: + active: true + ExceptionRaisedInUnexpectedLocation: + active: true + methodNames: [toString, hashCode, equals, finalize] + InstanceOfCheckForException: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + NotImplementedDeclaration: + active: false + ObjectExtendsThrowable: + active: false + PrintStackTrace: + active: true + RethrowCaughtException: + active: true + ReturnFromFinally: + active: true + ignoreLabeled: false + SwallowedException: + active: true + ignoredExceptionTypes: + - InterruptedException + - NumberFormatException + - ParseException + - MalformedURLException + allowedExceptionNameRegex: '_|(ignore|expected).*' + ThrowingExceptionFromFinally: + active: true + ThrowingExceptionInMain: + active: false + ThrowingExceptionsWithoutMessageOrCause: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptions: + - IllegalArgumentException + - IllegalStateException + - IOException + ThrowingNewInstanceOfSameException: + active: true + TooGenericExceptionCaught: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptionNames: + - ArrayIndexOutOfBoundsException + - Error + - Exception + - IllegalMonitorStateException + - NullPointerException + - IndexOutOfBoundsException + - RuntimeException + - Throwable + allowedExceptionNameRegex: '_|(ignore|expected).*' + TooGenericExceptionThrown: + active: true + exceptionNames: + - Error + - Exception + - Throwable + - RuntimeException + +formatting: + active: true + android: false + autoCorrect: true + AnnotationOnSeparateLine: + active: false + autoCorrect: true + AnnotationSpacing: + active: false + autoCorrect: true + ArgumentListWrapping: + active: false + autoCorrect: true + indentSize: 4 + maxLineLength: 120 + ChainWrapping: + active: true + autoCorrect: true + CommentSpacing: + active: true + autoCorrect: true + EnumEntryNameCase: + active: false + autoCorrect: true + Filename: + active: true + FinalNewline: + active: true + autoCorrect: true + insertFinalNewLine: true + ImportOrdering: + active: false + autoCorrect: true + layout: '*,java.**,javax.**,kotlin.**,^' + Indentation: + active: false + autoCorrect: true + indentSize: 4 + continuationIndentSize: 4 + MaximumLineLength: + active: true + maxLineLength: 120 + ignoreBackTickedIdentifier: false + ModifierOrdering: + active: true + autoCorrect: true + MultiLineIfElse: + active: true + autoCorrect: true + NoBlankLineBeforeRbrace: + active: true + autoCorrect: true + NoConsecutiveBlankLines: + active: true + autoCorrect: true + NoEmptyClassBody: + active: true + autoCorrect: true + NoEmptyFirstLineInMethodBlock: + active: false + autoCorrect: true + NoLineBreakAfterElse: + active: true + autoCorrect: true + NoLineBreakBeforeAssignment: + active: true + autoCorrect: true + NoMultipleSpaces: + active: true + autoCorrect: true + NoSemicolons: + active: true + autoCorrect: true + NoTrailingSpaces: + active: true + autoCorrect: true + NoUnitReturn: + active: true + autoCorrect: true + NoUnusedImports: + active: true + autoCorrect: true + NoWildcardImports: + active: true + PackageName: + active: true + autoCorrect: true + ParameterListWrapping: + active: true + autoCorrect: true + indentSize: 4 + maxLineLength: 120 + SpacingAroundAngleBrackets: + active: false + autoCorrect: true + SpacingAroundColon: + active: true + autoCorrect: true + SpacingAroundComma: + active: true + autoCorrect: true + SpacingAroundCurly: + active: true + autoCorrect: true + SpacingAroundDot: + active: true + autoCorrect: true + SpacingAroundDoubleColon: + active: false + autoCorrect: true + SpacingAroundKeyword: + active: true + autoCorrect: true + SpacingAroundOperators: + active: true + autoCorrect: true + SpacingAroundParens: + active: true + autoCorrect: true + SpacingAroundRangeOperator: + active: true + autoCorrect: true + SpacingAroundUnaryOperator: + active: false + autoCorrect: true + SpacingBetweenDeclarationsWithAnnotations: + active: false + autoCorrect: true + SpacingBetweenDeclarationsWithComments: + active: false + autoCorrect: true + StringTemplate: + active: true + autoCorrect: true + +naming: + active: true + ClassNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + classPattern: '[A-Z][a-zA-Z0-9]*' + ConstructorParameterNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + parameterPattern: '[a-z][A-Za-z0-9]*' + privateParameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + EnumNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' + ForbiddenClassName: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + forbiddenName: [] + FunctionMaxLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + maximumFunctionNameLength: 30 + FunctionMinLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + minimumFunctionNameLength: 3 + FunctionNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)' + excludeClassPattern: '$^' + ignoreOverridden: true + ignoreAnnotated: ['Composable'] + FunctionParameterNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + parameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + InvalidPackageDeclaration: + active: false + excludes: ['*.kts'] + rootPackage: '' + MatchingDeclarationName: + active: true + mustBeFirst: true + MemberNameEqualsClassName: + active: true + ignoreOverridden: true + NoNameShadowing: + active: false + NonBooleanPropertyPrefixedWithIs: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + ObjectPropertyNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + constantPattern: '[A-Za-z][_A-Za-z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' + PackageNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9_]*)*' + TopLevelPropertyNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + constantPattern: '[A-Z][_A-Z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' + VariableMaxLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + maximumVariableNameLength: 64 + VariableMinLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + minimumVariableNameLength: 1 + VariableNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + variablePattern: '[a-z][A-Za-z0-9]*' + privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + +performance: + active: true + ArrayPrimitive: + active: true + ForEachOnRange: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + SpreadOperator: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + UnnecessaryTemporaryInstantiation: + active: true + +potential-bugs: + active: true + CastToNullableType: + active: false + Deprecation: + active: false + DontDowncastCollectionTypes: + active: false + DoubleMutabilityForCollection: + active: false + DuplicateCaseInWhenExpression: + active: true + EqualsAlwaysReturnsTrueOrFalse: + active: true + EqualsWithHashCodeExist: + active: true + ExitOutsideMain: + active: false + ExplicitGarbageCollectionCall: + active: true + HasPlatformType: + active: false + IgnoredReturnValue: + active: false + restrictToAnnotatedMethods: true + returnValueAnnotations: ['*.CheckReturnValue', '*.CheckResult'] + ImplicitDefaultLocale: + active: true + ImplicitUnitReturnType: + active: false + allowExplicitReturnType: true + InvalidRange: + active: true + IteratorHasNextCallsNextMethod: + active: true + IteratorNotThrowingNoSuchElementException: + active: true + LateinitUsage: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludeAnnotatedProperties: [] + ignoreOnClassesPattern: '' + MapGetWithNotNullAssertionOperator: + active: false + MissingWhenCase: + active: true + allowElseExpression: true + NullableToStringCall: + active: false + RedundantElseInWhen: + active: true + UnconditionalJumpStatementInLoop: + active: false + UnnecessaryNotNullOperator: + active: true + UnnecessarySafeCall: + active: true + UnreachableCatchBlock: + active: false + UnreachableCode: + active: true + UnsafeCallOnNullableType: + active: true + UnsafeCast: + active: true + UnusedUnaryOperator: + active: false + UselessPostfixExpression: + active: false + WrongEqualsTypeParameter: + active: true + +style: + active: true + ClassOrdering: + active: false + CollapsibleIfStatements: + active: false + DataClassContainsFunctions: + active: false + conversionFunctionPrefix: 'to' + DataClassShouldBeImmutable: + active: false + DestructuringDeclarationWithTooManyEntries: + active: false + maxDestructuringEntries: 3 + EqualsNullCall: + active: true + EqualsOnSignatureLine: + active: false + ExplicitCollectionElementAccessMethod: + active: false + ExplicitItLambdaParameter: + active: false + ExpressionBodySyntax: + active: false + includeLineWrapping: false + ForbiddenComment: + active: true + values: ['TODO:', 'FIXME:', 'STOPSHIP:'] + allowedPatterns: 'TODO::' + ForbiddenImport: + active: false + imports: [] + forbiddenPatterns: '' + ForbiddenMethodCall: + active: false + methods: ['kotlin.io.println', 'kotlin.io.print'] + ForbiddenPublicDataClass: + active: true + excludes: ['**'] + ignorePackages: ['*.internal', '*.internal.*'] + ForbiddenVoid: + active: false + ignoreOverridden: false + ignoreUsageInGenerics: false + FunctionOnlyReturningConstant: + active: true + ignoreOverridableFunction: true + ignoreActualFunction: true + excludedFunctions: 'describeContents' + excludeAnnotatedFunction: ['dagger.Provides'] + LibraryCodeMustSpecifyReturnType: + active: true + excludes: ['**'] + LibraryEntitiesShouldNotBePublic: + active: true + excludes: ['**'] + LoopWithTooManyJumpStatements: + active: true + maxJumpCount: 1 + MagicNumber: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', + '**/jsTest/**', '**/iosTest/**', '**/*PreviewMockData.kt', + '**/*Colors.kt'] + ignoreNumbers: ['-1', '0', '1', '2', '10'] + ignoreHashCodeFunction: true + ignorePropertyDeclaration: false + ignoreLocalVariableDeclaration: false + ignoreConstantDeclaration: true + ignoreCompanionObjectPropertyDeclaration: true + ignoreAnnotation: false + ignoreNamedArgument: true + ignoreEnums: false + ignoreRanges: false + ignoreExtensionFunctions: true + ignoreAnnotated: ['Preview', 'Composable'] + + MandatoryBracesIfStatements: + active: false + MandatoryBracesLoops: + active: false + MaxLineLength: + active: true + maxLineLength: 120 + excludePackageStatements: true + excludeImportStatements: true + excludeCommentStatements: false + MayBeConst: + active: true + ModifierOrder: + active: true + MultilineLambdaItParameter: + active: false + NestedClassesVisibility: + active: true + NewLineAtEndOfFile: + active: true + NoTabs: + active: false + ObjectLiteralToLambda: + active: false + OptionalAbstractKeyword: + active: true + OptionalUnit: + active: false + OptionalWhenBraces: + active: false + PreferToOverPairSyntax: + active: false + ProtectedMemberInFinalClass: + active: true + RedundantExplicitType: + active: false + RedundantHigherOrderMapUsage: + active: false + RedundantVisibilityModifierRule: + active: false + ReturnCount: + active: true + max: 2 + excludedFunctions: 'equals' + excludeLabeled: false + excludeReturnFromLambda: true + excludeGuardClauses: false + SafeCast: + active: true + SerialVersionUIDInSerializableClass: + active: true + SpacingBetweenPackageAndImports: + active: false + ThrowsCount: + active: true + max: 2 + TrailingWhitespace: + active: false + UnderscoresInNumericLiterals: + active: false + acceptableDecimalLength: 5 + UnnecessaryAbstractClass: + active: true + excludeAnnotatedClasses: ['dagger.Module'] + UnnecessaryAnnotationUseSiteTarget: + active: false + UnnecessaryApply: + active: true + UnnecessaryFilter: + active: false + UnnecessaryInheritance: + active: true + UnnecessaryLet: + active: false + UnnecessaryParentheses: + active: false + UntilInsteadOfRangeTo: + active: false + UnusedImports: + active: false + UnusedPrivateClass: + active: true + UnusedPrivateMember: + active: false + allowedNames: '(_|ignored|expected|serialVersionUID)' + UseArrayLiteralsInAnnotations: + active: false + UseCheckNotNull: + active: false + UseCheckOrError: + active: false + UseDataClass: + active: false + excludeAnnotatedClasses: [] + allowVars: false + UseEmptyCounterpart: + active: false + UseIfEmptyOrIfBlank: + active: false + UseIfInsteadOfWhen: + active: false + UseIsNullOrEmpty: + active: false + UseOrEmpty: + active: false + UseRequire: + active: false + UseRequireNotNull: + active: false + UselessCallOnNotNull: + active: true + UtilityClassWithPublicConstructor: + active: true + VarCouldBeVal: + active: true + WildcardImport: + active: true + excludes: [] + excludeImports: []