Update dependencies and migrate new deprecated stuff.

This commit is contained in:
Thomas Andres Gomez 2024-01-09 15:20:02 +01:00
parent 091e76bbf0
commit a2f26cc2a5
7 changed files with 49 additions and 49 deletions

View file

@ -4,7 +4,6 @@ plugins {
id("com.google.dagger.hilt.android") id("com.google.dagger.hilt.android")
id("com.google.gms.google-services") id("com.google.gms.google-services")
id("com.google.firebase.crashlytics") id("com.google.firebase.crashlytics")
id("org.jetbrains.kotlin.kapt")
id("com.google.devtools.ksp") id("com.google.devtools.ksp")
} }
@ -80,7 +79,7 @@ android {
} }
composeOptions { composeOptions {
kotlinCompilerExtensionVersion = "1.5.3" kotlinCompilerExtensionVersion = "1.5.7"
} }
packaging { packaging {
@ -96,7 +95,7 @@ android {
dependencies { dependencies {
implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.activity:activity-compose:1.8.0") implementation("androidx.activity:activity-compose:1.8.2")
// Compose // Compose
implementation("androidx.compose.ui:ui:1.5.4") implementation("androidx.compose.ui:ui:1.5.4")
@ -110,10 +109,10 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1") implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
// Navigation // Navigation
implementation("androidx.navigation:navigation-compose:2.7.5") implementation("androidx.navigation:navigation-compose:2.7.6")
// Accompanist // Accompanist
implementation("com.google.accompanist:accompanist-placeholder:0.30.1") implementation("com.google.accompanist:accompanist-placeholder:0.32.0")
// Splash Screen support prior to Android 12 // Splash Screen support prior to Android 12
implementation("androidx.core:core-splashscreen:1.0.1") implementation("androidx.core:core-splashscreen:1.0.1")
@ -130,7 +129,7 @@ dependencies {
) )
// Import the BoM for the Firebase platform // Import the BoM for the Firebase platform
implementation(platform("com.google.firebase:firebase-bom:32.3.1")) implementation(platform("com.google.firebase:firebase-bom:32.7.0"))
implementation("com.google.firebase:firebase-crashlytics-ktx") implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation("com.google.firebase:firebase-analytics-ktx") implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-auth-ktx") implementation("com.google.firebase:firebase-auth-ktx")
@ -138,11 +137,12 @@ dependencies {
// Hilt: Dependency injection // Hilt: Dependency injection
implementation("androidx.hilt:hilt-navigation-compose:1.1.0") implementation("androidx.hilt:hilt-navigation-compose:1.1.0")
implementation("com.google.dagger:hilt-android:2.48") implementation("com.google.dagger:hilt-android:2.50")
kapt("com.google.dagger:hilt-compiler:2.48") ksp("com.google.dagger:hilt-android-compiler:2.50")
ksp("com.google.dagger:hilt-compiler:2.50")
// Image // Image
implementation("io.coil-kt:coil-compose:2.4.0") implementation("io.coil-kt:coil-compose:2.5.0")
} }
java { java {

View file

@ -46,7 +46,7 @@ sealed class FetchErrorUio {
fun HandleFetchError( fun HandleFetchError(
snack: SnackbarHostState = LocalSnack.current, snack: SnackbarHostState = LocalSnack.current,
errors: Flow<FetchErrorUio?>, errors: Flow<FetchErrorUio?>,
onStructureError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Structure) -> Unit = { context, snack, error -> onStructureError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Structure) -> Unit = { context, snackHost, error ->
val messageResources = when (error.type) { val messageResources = when (error.type) {
FetchErrorUio.Structure.Type.UNKNOWN -> R.string.error_structure_unknowed FetchErrorUio.Structure.Type.UNKNOWN -> R.string.error_structure_unknowed
FetchErrorUio.Structure.Type.ACTION -> R.string.error_structure_action FetchErrorUio.Structure.Type.ACTION -> R.string.error_structure_action
@ -63,15 +63,15 @@ fun HandleFetchError(
FetchErrorUio.Structure.Type.LOCATION -> R.string.error_structure_location FetchErrorUio.Structure.Type.LOCATION -> R.string.error_structure_location
FetchErrorUio.Structure.Type.QUEST -> R.string.error_structure_quest FetchErrorUio.Structure.Type.QUEST -> R.string.error_structure_quest
} }
snack.showSnackbar(message = context.getString(messageResources)) snackHost.showSnackbar(message = context.getString(messageResources))
}, },
onFirebaseError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Firebase) -> Unit = { context, snack, error -> onFirebaseError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Firebase) -> Unit = { context, snackHost, error ->
snack.showSnackbar( snackHost.showSnackbar(
message = error.exception.localizedMessage ?: context.getString(R.string.error_generic) message = error.exception.localizedMessage ?: context.getString(R.string.error_generic)
) )
}, },
onDefaultError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Default) -> Unit = { context, snack, _ -> onDefaultError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Default) -> Unit = { context, snackHost, _ ->
snack.showSnackbar(message = context.getString(R.string.error_generic)) snackHost.showSnackbar(message = context.getString(R.string.error_generic))
}, },
) { ) {
val context = LocalContext.current val context = LocalContext.current

View file

@ -39,14 +39,14 @@ fun ResourcePoint(
valueStyle: TextStyle = MaterialTheme.typography.headlineSmall, valueStyle: TextStyle = MaterialTheme.typography.headlineSmall,
maxStyle: TextStyle = MaterialTheme.typography.titleSmall, maxStyle: TextStyle = MaterialTheme.typography.titleSmall,
resource: ResourcePointUio, resource: ResourcePointUio,
onClick: (ResourcePointUio) -> Unit, onClick: ((ResourcePointUio) -> Unit)?,
) { ) {
Column( Column(
modifier = Modifier modifier = Modifier
.clickable( .clickable(
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false), indication = rememberRipple(bounded = false),
onClick = { onClick(resource) } onClick = { onClick?.invoke(resource) }
) )
.then(other = modifier), .then(other = modifier),
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally

View file

@ -92,7 +92,7 @@ fun LexiconDetailScreen(
) { ) {
LexiconDetailContent( LexiconDetailContent(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
item = viewModel.character, lexicon = viewModel.character,
highlight = viewModel.highlight, highlight = viewModel.highlight,
haveCharacterSheet = viewModel.haveCharacterSheet, haveCharacterSheet = viewModel.haveCharacterSheet,
onBack = { screen.popBackStack() }, onBack = { screen.popBackStack() },
@ -111,7 +111,7 @@ fun LexiconDetailScreen(
private fun LexiconDetailContent( private fun LexiconDetailContent(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
state: ScrollState = rememberScrollState(), state: ScrollState = rememberScrollState(),
item: State<LexiconDetailUio?>, lexicon: State<LexiconDetailUio?>,
highlight: String?, highlight: String?,
haveCharacterSheet: State<Boolean>, haveCharacterSheet: State<Boolean>,
onBack: () -> Unit, onBack: () -> Unit,
@ -122,7 +122,7 @@ private fun LexiconDetailContent(
val highlightRegex = remember(highlight) { highlightRegex(terms = highlight.searchCriterion()) } val highlightRegex = remember(highlight) { highlightRegex(terms = highlight.searchCriterion()) }
val dropCapRegex = remember { dropCapRegex() } val dropCapRegex = remember { dropCapRegex() }
val item = item.value val item = lexicon.value
val backgroundUri = remember(item) { val backgroundUri = remember(item) {
item?.portrait?.firstOrNull() item?.portrait?.firstOrNull()
} }
@ -400,7 +400,7 @@ private fun LexiconDetailPreview() {
} }
LexiconDetailContent( LexiconDetailContent(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
item = character, lexicon = character,
highlight = "Bru poule faible", highlight = "Bru poule faible",
haveCharacterSheet = remember { mutableStateOf(true) }, haveCharacterSheet = remember { mutableStateOf(true) },
onBack = { }, onBack = { },

View file

@ -54,7 +54,7 @@ fun Modifier.placeholder(
contentFadeTransitionSpec: @Composable Transition.Segment<Boolean>.() -> FiniteAnimationSpec<Float> = { spring() }, contentFadeTransitionSpec: @Composable Transition.Segment<Boolean>.() -> FiniteAnimationSpec<Float> = { spring() },
visible: () -> Boolean, visible: () -> Boolean,
): Modifier = composed { ): Modifier = composed {
placeholder( this then Modifier.placeholder(
visible = visible(), visible = visible(),
color = if (color == Color.Unspecified) MaterialTheme.lexicon.colorScheme.placeholder else color, color = if (color == Color.Unspecified) MaterialTheme.lexicon.colorScheme.placeholder else color,
shape = shape, shape = shape,
@ -67,8 +67,7 @@ fun Modifier.placeholder(
fun Modifier.zoomable() = composed { fun Modifier.zoomable() = composed {
var offset by remember { mutableStateOf(Offset.Zero) } var offset by remember { mutableStateOf(Offset.Zero) }
var zoom by remember { mutableFloatStateOf(1f) } var zoom by remember { mutableFloatStateOf(1f) }
this then Modifier
return@composed this
.pointerInput(Unit) { .pointerInput(Unit) {
detectTransformGestures( detectTransformGestures(
onGesture = { centroid, pan, gestureZoom, _ -> onGesture = { centroid, pan, gestureZoom, _ ->
@ -93,7 +92,7 @@ fun Modifier.zoomable() = composed {
@Stable @Stable
fun Modifier.cell() = composed { fun Modifier.cell() = composed {
Modifier this then Modifier
.fillMaxWidth() .fillMaxWidth()
.heightIn(min = MaterialTheme.lexicon.dimens.item) .heightIn(min = MaterialTheme.lexicon.dimens.item)
.padding(horizontal = 16.dp, vertical = 4.dp) .padding(horizontal = 16.dp, vertical = 4.dp)
@ -105,11 +104,11 @@ fun Modifier.scrollOffset(
block: Density.(Dp) -> Dp block: Density.(Dp) -> Dp
): Modifier = composed { ): Modifier = composed {
val density = LocalDensity.current val density = LocalDensity.current
this.offset(y = with(density) { block(scrollState.value.toDp()) }) this then Modifier.offset(y = with(density) { block(scrollState.value.toDp()) })
} }
fun Modifier.clickableInterceptor(): Modifier = composed { fun Modifier.clickableInterceptor(): Modifier = composed {
this.clickable( this then Modifier.clickable(
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
indication = null, indication = null,
onClick = { }, onClick = { },
@ -127,8 +126,7 @@ fun Modifier.ddBorder(
val isDarkTheme = isSystemInDarkTheme() val isDarkTheme = isSystemInDarkTheme()
val elevation = remember { derivedStateOf { if (isDarkTheme) 2.dp else 0.dp } } val elevation = remember { derivedStateOf { if (isDarkTheme) 2.dp else 0.dp } }
val colorScheme = MaterialTheme.lexicon.colorScheme val colorScheme = MaterialTheme.lexicon.colorScheme
this then Modifier
return@composed this then Modifier
.border( .border(
width = outlineWidth, width = outlineWidth,
color = colorScheme.characterSheet.outlineBorder, color = colorScheme.characterSheet.outlineBorder,
@ -156,7 +154,8 @@ fun Modifier.ddBorder(
) )
} }
fun Modifier.lexiconShadow() = composed { fun Modifier.lexiconShadow(): Modifier {
return this then composed {
if (isSystemInDarkTheme()) { if (isSystemInDarkTheme()) {
val color = DividerDefaults.color val color = DividerDefaults.color
drawWithContent { drawWithContent {
@ -173,6 +172,7 @@ fun Modifier.lexiconShadow() = composed {
} else { } else {
shadow(elevation = 4.dp) shadow(elevation = 4.dp)
} }
}
} }
fun Modifier.verticalDivider() = this fun Modifier.verticalDivider() = this

View file

@ -1,10 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id("com.android.application") version "8.1.4" apply false id("com.android.application") version "8.2.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.10" apply false id("org.jetbrains.kotlin.android") version "1.9.21" apply false
id("com.google.gms.google-services") version "4.3.14" apply false id("com.google.gms.google-services") version "4.3.14" apply false
id("com.google.dagger.hilt.android") version "2.44" apply false id("com.google.dagger.hilt.android") version "2.50" apply false
id("com.google.firebase.crashlytics") version "2.9.7" apply false id("com.google.firebase.crashlytics") version "2.9.7" apply false
id("org.jetbrains.kotlin.kapt") version "1.9.10" apply false id("org.jetbrains.kotlin.kapt") version "1.9.10" apply false
id("com.google.devtools.ksp") version "1.9.10-1.0.13" apply false id("com.google.devtools.ksp") version "1.9.21-1.0.16" apply false
} }

View file

@ -1,6 +1,6 @@
#Wed Jul 12 18:52:35 CEST 2023 #Wed Jul 12 18:52:35 CEST 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists