Skip to content

Commit 217b3ff

Browse files
renovate[bot]jmartinesp
authored andcommitted
Update kotlin (#5317)
* Update kotlin * Upgrade Metro and add new `@Origin` annotation * Suppress warnings in overridden method as nothing else would work * "Fix" quality warnings about reusing the same string literal * Don't use `compat` version for `datetime` dependency --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <[email protected]>
1 parent 7b18e3d commit 217b3ff

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codegen/src/main/kotlin/io/element/android/codegen/ContributesNodeProcessor.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import dev.zacsweers.metro.BindingContainer
3535
import dev.zacsweers.metro.Binds
3636
import dev.zacsweers.metro.ContributesTo
3737
import dev.zacsweers.metro.IntoMap
38+
import dev.zacsweers.metro.Origin
3839
import io.element.android.annotations.ContributesNode
3940
import org.jetbrains.kotlin.name.FqName
4041

@@ -71,14 +72,16 @@ class ContributesNodeProcessor(
7172
val scope = annotation.arguments.find { it.name?.asString() == "scope" }!!.value as KSType
7273
val modulePackage = ksClass.packageName.asString()
7374
val moduleClassName = "${ksClass.simpleName.asString()}_Module"
75+
val nodeClassName = ClassName.bestGuess(ksClass.qualifiedName!!.asString())
7476
val content = FileSpec.builder(
7577
packageName = modulePackage,
7678
fileName = moduleClassName,
7779
)
7880
.addType(
7981
TypeSpec.interfaceBuilder(moduleClassName)
82+
.addAnnotation(AnnotationSpec.builder(Origin::class).addMember(CLASS_PLACEHOLDER, nodeClassName).build())
8083
.addAnnotation(BindingContainer::class)
81-
.addAnnotation(AnnotationSpec.builder(ContributesTo::class).addMember("%T::class", scope.toTypeName()).build())
84+
.addAnnotation(AnnotationSpec.builder(ContributesTo::class).addMember(CLASS_PLACEHOLDER, scope.toTypeName()).build())
8285
.addFunction(
8386
FunSpec.builder("bind${ksClass.simpleName.asString()}Factory")
8487
.addModifiers(KModifier.ABSTRACT)
@@ -88,7 +91,7 @@ class ContributesNodeProcessor(
8891
.addAnnotation(IntoMap::class)
8992
.addAnnotation(
9093
AnnotationSpec.Companion.builder(ClassName.bestGuess(nodeKeyFqName.asString())).addMember(
91-
"%T::class",
94+
CLASS_PLACEHOLDER,
9295
ClassName.bestGuess(ksClass.qualifiedName!!.asString())
9396
).build()
9497
)
@@ -138,6 +141,7 @@ class ContributesNodeProcessor(
138141
.addType(
139142
TypeSpec.interfaceBuilder(assistedFactoryClassName)
140143
.addSuperinterface(ClassName.bestGuess(assistedNodeFactoryFqName.asString()).parameterizedBy(nodeClassName))
144+
.addAnnotation(AnnotationSpec.builder(Origin::class).addMember("%T::class", nodeClassName).build())
141145
.addAnnotation(AssistedFactory::class)
142146
.addFunction(
143147
FunSpec.builder("create")
@@ -161,6 +165,7 @@ class ContributesNodeProcessor(
161165
}
162166

163167
companion object {
168+
private const val CLASS_PLACEHOLDER = "%T::class"
164169
private val assistedNodeFactoryFqName = FqName("io.element.android.libraries.architecture.AssistedNodeFactory")
165170
private val nodeKeyFqName = FqName("io.element.android.libraries.architecture.NodeKey")
166171
}

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewWidgetMessageInterceptor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class WebViewWidgetMessageInterceptor(
133133
return assetLoader.shouldInterceptRequest(request.url)
134134
}
135135

136+
@Suppress("OVERRIDE_DEPRECATION")
136137
override fun shouldInterceptRequest(view: WebView?, url: String): WebResourceResponse? {
137138
return assetLoader.shouldInterceptRequest(url.toUri())
138139
}

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# We cannot use 8.12.+ since it breaks F-Droid build (see https://github.com/element-hq/element-x-android/issues/3420#issuecomment-3199571010)
77
android_gradle_plugin = "8.11.1"
88
# When updateing this, please also update the version in the file ./idea/kotlinc.xml
9-
kotlin = "2.2.10"
9+
kotlin = "2.2.20"
1010
kotlinpoet = "2.2.0"
11-
ksp = "2.2.10-2.0.2"
11+
ksp = "2.2.20-2.0.2"
1212
firebaseAppDistribution = "5.1.1"
1313

1414
# AndroidX
@@ -51,7 +51,7 @@ haze = "1.6.10"
5151
dependencyAnalysis = "3.0.4"
5252

5353
# DI
54-
metro = "0.6.4"
54+
metro = "0.6.6"
5555

5656
# Auto service
5757
autoservice = "1.1.1"

libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMap.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
package io.element.android.libraries.maplibre.compose
1010

11-
import android.content.ComponentCallbacks
11+
import android.content.ComponentCallbacks2
1212
import android.content.Context
1313
import android.content.res.Configuration
1414
import android.os.Bundle
@@ -235,11 +235,15 @@ private fun MapView.lifecycleObserver(previousState: MutableState<Lifecycle.Even
235235
previousState.value = event
236236
}
237237

238-
private fun MapView.componentCallbacks(): ComponentCallbacks =
239-
object : ComponentCallbacks {
240-
override fun onConfigurationChanged(config: Configuration) {}
238+
private fun MapView.componentCallbacks(): ComponentCallbacks2 =
239+
object : ComponentCallbacks2 {
240+
override fun onConfigurationChanged(config: Configuration) = Unit
241241

242-
override fun onLowMemory() {
242+
@Suppress("OVERRIDE_DEPRECATION")
243+
override fun onLowMemory() = Unit
244+
245+
override fun onTrimMemory(level: Int) {
246+
// We call the `MapView.onLowMemory` method for any memory trim level
243247
this@componentCallbacks.onLowMemory()
244248
}
245249
}

0 commit comments

Comments
 (0)