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.gms.google-services")
id("com.google.firebase.crashlytics")
id("org.jetbrains.kotlin.kapt")
id("com.google.devtools.ksp")
}
@ -80,7 +79,7 @@ android {
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
kotlinCompilerExtensionVersion = "1.5.7"
}
packaging {
@ -96,7 +95,7 @@ android {
dependencies {
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
implementation("androidx.compose.ui:ui:1.5.4")
@ -110,10 +109,10 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
// Navigation
implementation("androidx.navigation:navigation-compose:2.7.5")
implementation("androidx.navigation:navigation-compose:2.7.6")
// 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
implementation("androidx.core:core-splashscreen:1.0.1")
@ -130,7 +129,7 @@ dependencies {
)
// 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-analytics-ktx")
implementation("com.google.firebase:firebase-auth-ktx")
@ -138,11 +137,12 @@ dependencies {
// Hilt: Dependency injection
implementation("androidx.hilt:hilt-navigation-compose:1.1.0")
implementation("com.google.dagger:hilt-android:2.48")
kapt("com.google.dagger:hilt-compiler:2.48")
implementation("com.google.dagger:hilt-android:2.50")
ksp("com.google.dagger:hilt-android-compiler:2.50")
ksp("com.google.dagger:hilt-compiler:2.50")
// Image
implementation("io.coil-kt:coil-compose:2.4.0")
implementation("io.coil-kt:coil-compose:2.5.0")
}
java {

View file

@ -46,7 +46,7 @@ sealed class FetchErrorUio {
fun HandleFetchError(
snack: SnackbarHostState = LocalSnack.current,
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) {
FetchErrorUio.Structure.Type.UNKNOWN -> R.string.error_structure_unknowed
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.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 ->
snack.showSnackbar(
onFirebaseError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Firebase) -> Unit = { context, snackHost, error ->
snackHost.showSnackbar(
message = error.exception.localizedMessage ?: context.getString(R.string.error_generic)
)
},
onDefaultError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Default) -> Unit = { context, snack, _ ->
snack.showSnackbar(message = context.getString(R.string.error_generic))
onDefaultError: suspend (context: Context, snack: SnackbarHostState, error: FetchErrorUio.Default) -> Unit = { context, snackHost, _ ->
snackHost.showSnackbar(message = context.getString(R.string.error_generic))
},
) {
val context = LocalContext.current

View file

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

View file

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

View file

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