Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Remove dependency on Lyricist processor #1412

Merged
merged 3 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/ui/compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ kotlin {
api(libs.circuit.foundation)

api(projects.common.ui.resources)
api(libs.lyricist.library)

implementation(compose.foundation)
implementation(compose.material)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import app.tivi.common.compose.ui.PlaceholderPosterCard
import app.tivi.common.compose.ui.PosterCard
import app.tivi.common.compose.ui.RefreshButton
import app.tivi.common.compose.ui.plus
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.compoundmodels.EntryWithShow
import app.tivi.data.models.Entry
import com.moriatsushi.insetsx.systemBars
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2023, Christopher Banes and the Tivi project contributors
// SPDX-License-Identifier: Apache-2.0

package app.tivi.common.compose

import androidx.compose.runtime.Composable
import androidx.compose.runtime.ProvidableCompositionLocal
import androidx.compose.runtime.compositionLocalOf
import app.tivi.common.ui.resources.EnTiviStrings
import app.tivi.common.ui.resources.Strings
import app.tivi.common.ui.resources.TiviStrings
import cafe.adriel.lyricist.LanguageTag
import cafe.adriel.lyricist.Lyricist
import cafe.adriel.lyricist.ProvideStrings
import cafe.adriel.lyricist.rememberStrings

val LocalStrings: ProvidableCompositionLocal<TiviStrings> = compositionLocalOf { EnTiviStrings }

@Composable
fun rememberStrings(
languageTag: LanguageTag = "en",
): Lyricist<TiviStrings> = rememberStrings(Strings, languageTag)

@Composable
fun ProvideStrings(
lyricist: Lyricist<TiviStrings> = rememberStrings(),
content: @Composable () -> Unit,
) {
ProvideStrings(lyricist, LocalStrings, content)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.layout.ContentScale
import app.tivi.common.compose.Layout
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings

@Composable
fun Backdrop(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package app.tivi.common.compose.ui

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviDateFormatter
import app.tivi.common.ui.resources.LocalStrings
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import app.tivi.data.imagemodels.asImageModel
import app.tivi.data.models.ImageType
import app.tivi.data.models.TiviShow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings

@Composable
fun RefreshButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.text.input.TextFieldValue
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings

@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class)
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import app.tivi.data.models.SortOption

@OptIn(ExperimentalMaterial3Api::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import app.tivi.common.ui.resources.TiviStrings
import app.tivi.data.models.SortOption

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import app.tivi.data.models.TraktUser

@Composable
Expand Down
1 change: 1 addition & 0 deletions common/ui/resources/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ kotlin {
dependencies {
implementation(kotlin("test"))
implementation(libs.assertk)
implementation(libs.lyricist.library)
}
}

Expand Down
13 changes: 1 addition & 12 deletions common/ui/strings/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,16 @@
// SPDX-License-Identifier: Apache-2.0


import app.tivi.gradle.addKspDependencyForCommon

plugins {
id("app.tivi.kotlin.multiplatform")
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.ksp)
}

kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api(libs.lyricist.library)
api(compose.foundation)
api(libs.lyricist.core)
}
}
}
}

ksp {
arg("lyricist.packageName", "app.tivi.common.ui.resources")
}

addKspDependencyForCommon(libs.lyricist.processor)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

package app.tivi.common.ui.resources

val Strings: Map<String, TiviStrings> = mapOf(
"en" to EnTiviStrings,
)

object Locales {
const val EN = "en"
}

data class TiviStrings(
val accountNameUnknown: String,
val accountTitle: String,
Expand Down Expand Up @@ -157,8 +165,4 @@ data class TiviStrings(
val watchedShowsTitle: String,
)

object Locales {
const val EN = "en"
}

expect fun String.fmt(vararg args: Any?): String
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ ktlint = { module = "com.pinterest:ktlint", version.ref = "ktlint" }

leakCanary = "com.squareup.leakcanary:leakcanary-android:2.12"

lyricist-core = { module = "cafe.adriel.lyricist:lyricist-core", version.ref = "lyricist" }
lyricist-library = { module = "cafe.adriel.lyricist:lyricist", version.ref = "lyricist" }
lyricist-processor = { module = "cafe.adriel.lyricist:lyricist-processor", version.ref = "lyricist" }

multiplatformsettings-core = { module = "com.russhwolf:multiplatform-settings", version.ref = "multiplatformsettings" }
multiplatformsettings-coroutines = { module = "com.russhwolf:multiplatform-settings-coroutines", version.ref = "multiplatformsettings" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.ui.AsyncImage
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.models.TraktUser
import app.tivi.data.traktauth.TraktAuthState
import app.tivi.overlays.LocalNavigator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import androidx.compose.ui.layout.FirstBaseline
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviTextCreator
import app.tivi.common.compose.ReportDrawnWhen
import app.tivi.common.compose.bodyWidth
Expand All @@ -62,7 +63,6 @@ import app.tivi.common.compose.rememberTiviSnapFlingBehavior
import app.tivi.common.compose.ui.AutoSizedCircularProgressIndicator
import app.tivi.common.compose.ui.PosterCard
import app.tivi.common.compose.ui.TiviRootScreenAppBar
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.compoundmodels.EntryWithShow
import app.tivi.data.models.Episode
import app.tivi.data.models.Season
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviDateFormatter
import app.tivi.common.compose.rememberCoroutineScope
import app.tivi.common.compose.theme.TiviTheme
Expand All @@ -73,7 +74,6 @@ import app.tivi.common.compose.ui.Backdrop
import app.tivi.common.compose.ui.ExpandingText
import app.tivi.common.compose.ui.ScrimmedIconButton
import app.tivi.common.compose.ui.none
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.imagemodels.asImageModel
import app.tivi.data.models.Episode
import app.tivi.data.models.EpisodeWatchEntry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviTextCreator
import app.tivi.common.compose.ui.AsyncImage
import app.tivi.common.compose.ui.DateTextField
import app.tivi.common.compose.ui.LoadingButton
import app.tivi.common.compose.ui.TimeTextField
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.imagemodels.asImageModel
import app.tivi.data.models.Episode
import app.tivi.data.models.Season
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import androidx.compose.ui.unit.dp
import app.cash.paging.LoadStateLoading
import app.cash.paging.compose.LazyPagingItems
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviDateFormatter
import app.tivi.common.compose.LocalTiviTextCreator
import app.tivi.common.compose.bodyWidth
Expand All @@ -77,7 +78,6 @@ import app.tivi.common.compose.ui.SearchTextField
import app.tivi.common.compose.ui.SortChip
import app.tivi.common.compose.ui.TiviRootScreenAppBar
import app.tivi.common.compose.ui.plus
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.compoundmodels.LibraryShow
import app.tivi.data.models.SortOption
import app.tivi.data.models.TiviShow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package app.tivi.home.popular
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import app.tivi.common.compose.EntryGrid
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import app.tivi.screens.PopularShowsScreen
import com.slack.circuit.runtime.CircuitContext
import com.slack.circuit.runtime.Screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package app.tivi.home.recommended
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import app.tivi.common.compose.EntryGrid
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import app.tivi.screens.RecommendedShowsScreen
import com.slack.circuit.runtime.CircuitContext
import com.slack.circuit.runtime.Screen
Expand Down
2 changes: 1 addition & 1 deletion ui/root/src/commonMain/kotlin/app/tivi/home/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalWindowSizeClass
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.ui.resources.TiviStrings
import app.tivi.screens.DiscoverScreen
import app.tivi.screens.LibraryScreen
Expand Down
2 changes: 1 addition & 1 deletion ui/root/src/commonMain/kotlin/app/tivi/home/TiviContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import androidx.compose.ui.Modifier
import app.tivi.common.compose.LocalTiviDateFormatter
import app.tivi.common.compose.LocalTiviTextCreator
import app.tivi.common.compose.LocalWindowSizeClass
import app.tivi.common.compose.ProvideStrings
import app.tivi.common.compose.rememberCoroutineScope
import app.tivi.common.compose.shouldUseDarkColors
import app.tivi.common.compose.shouldUseDynamicColors
import app.tivi.common.compose.theme.TiviTheme
import app.tivi.common.ui.resources.ProvideStrings
import app.tivi.core.analytics.Analytics
import app.tivi.overlays.LocalNavigator
import app.tivi.screens.TiviScreen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.bodyWidth
import app.tivi.common.compose.rememberTiviFlingBehavior
import app.tivi.common.compose.ui.EmptyContent
import app.tivi.common.compose.ui.PosterCard
import app.tivi.common.compose.ui.SearchTextField
import app.tivi.common.compose.ui.plus
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.models.TiviShow
import app.tivi.screens.SearchScreen
import com.moriatsushi.insetsx.statusBarsPadding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.itemSpacer
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.screens.SettingsScreen
import com.moriatsushi.insetsx.systemBars
import com.slack.circuit.runtime.CircuitContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.max
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviTextCreator
import app.tivi.common.compose.bodyWidth
import app.tivi.common.compose.gutterSpacer
Expand All @@ -95,7 +96,6 @@ import app.tivi.common.compose.ui.Backdrop
import app.tivi.common.compose.ui.ExpandingText
import app.tivi.common.compose.ui.PosterCard
import app.tivi.common.compose.ui.RefreshButton
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.compoundmodels.EpisodeWithSeason
import app.tivi.data.compoundmodels.RelatedShowEntryWithShow
import app.tivi.data.compoundmodels.SeasonWithEpisodesAndWatches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.lerp
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviTextCreator
import app.tivi.common.compose.bodyWidth
import app.tivi.common.compose.rememberCoroutineScope
import app.tivi.common.compose.rememberTiviDecayAnimationSpec
import app.tivi.common.compose.rememberTiviFlingBehavior
import app.tivi.common.compose.ui.RefreshButton
import app.tivi.common.compose.ui.TopAppBarWithBottomContent
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.compoundmodels.EpisodeWithWatches
import app.tivi.data.compoundmodels.SeasonWithEpisodesAndWatches
import app.tivi.data.models.Episode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package app.tivi.home.trending
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import app.tivi.common.compose.EntryGrid
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.common.compose.LocalStrings
import app.tivi.screens.TrendingShowsScreen
import com.slack.circuit.runtime.CircuitContext
import com.slack.circuit.runtime.Screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp
import app.cash.paging.LoadStateLoading
import app.tivi.common.compose.Layout
import app.tivi.common.compose.LocalStrings
import app.tivi.common.compose.LocalTiviTextCreator
import app.tivi.common.compose.bodyWidth
import app.tivi.common.compose.fullSpanItem
Expand All @@ -71,7 +72,6 @@ import app.tivi.common.compose.ui.EmptyContent
import app.tivi.common.compose.ui.SortChip
import app.tivi.common.compose.ui.TiviRootScreenAppBar
import app.tivi.common.compose.ui.plus
import app.tivi.common.ui.resources.LocalStrings
import app.tivi.data.imagemodels.EpisodeImageModel
import app.tivi.data.imagemodels.asImageModel
import app.tivi.data.models.Episode
Expand Down