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 <jorgem@element.io>
This commit is contained in:
parent
ebaf14a5e2
commit
2d6031d3ac
5 changed files with 21 additions and 11 deletions
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="KotlinJpsPluginSettings">
|
<component name="KotlinJpsPluginSettings">
|
||||||
<option name="version" value="2.2.10" />
|
<option name="version" value="2.2.20" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -35,6 +35,7 @@ import dev.zacsweers.metro.BindingContainer
|
||||||
import dev.zacsweers.metro.Binds
|
import dev.zacsweers.metro.Binds
|
||||||
import dev.zacsweers.metro.ContributesTo
|
import dev.zacsweers.metro.ContributesTo
|
||||||
import dev.zacsweers.metro.IntoMap
|
import dev.zacsweers.metro.IntoMap
|
||||||
|
import dev.zacsweers.metro.Origin
|
||||||
import io.element.android.annotations.ContributesNode
|
import io.element.android.annotations.ContributesNode
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
|
||||||
|
|
@ -71,14 +72,16 @@ class ContributesNodeProcessor(
|
||||||
val scope = annotation.arguments.find { it.name?.asString() == "scope" }!!.value as KSType
|
val scope = annotation.arguments.find { it.name?.asString() == "scope" }!!.value as KSType
|
||||||
val modulePackage = ksClass.packageName.asString()
|
val modulePackage = ksClass.packageName.asString()
|
||||||
val moduleClassName = "${ksClass.simpleName.asString()}_Module"
|
val moduleClassName = "${ksClass.simpleName.asString()}_Module"
|
||||||
|
val nodeClassName = ClassName.bestGuess(ksClass.qualifiedName!!.asString())
|
||||||
val content = FileSpec.builder(
|
val content = FileSpec.builder(
|
||||||
packageName = modulePackage,
|
packageName = modulePackage,
|
||||||
fileName = moduleClassName,
|
fileName = moduleClassName,
|
||||||
)
|
)
|
||||||
.addType(
|
.addType(
|
||||||
TypeSpec.interfaceBuilder(moduleClassName)
|
TypeSpec.interfaceBuilder(moduleClassName)
|
||||||
|
.addAnnotation(AnnotationSpec.builder(Origin::class).addMember(CLASS_PLACEHOLDER, nodeClassName).build())
|
||||||
.addAnnotation(BindingContainer::class)
|
.addAnnotation(BindingContainer::class)
|
||||||
.addAnnotation(AnnotationSpec.builder(ContributesTo::class).addMember("%T::class", scope.toTypeName()).build())
|
.addAnnotation(AnnotationSpec.builder(ContributesTo::class).addMember(CLASS_PLACEHOLDER, scope.toTypeName()).build())
|
||||||
.addFunction(
|
.addFunction(
|
||||||
FunSpec.builder("bind${ksClass.simpleName.asString()}Factory")
|
FunSpec.builder("bind${ksClass.simpleName.asString()}Factory")
|
||||||
.addModifiers(KModifier.ABSTRACT)
|
.addModifiers(KModifier.ABSTRACT)
|
||||||
|
|
@ -88,7 +91,7 @@ class ContributesNodeProcessor(
|
||||||
.addAnnotation(IntoMap::class)
|
.addAnnotation(IntoMap::class)
|
||||||
.addAnnotation(
|
.addAnnotation(
|
||||||
AnnotationSpec.Companion.builder(ClassName.bestGuess(nodeKeyFqName.asString())).addMember(
|
AnnotationSpec.Companion.builder(ClassName.bestGuess(nodeKeyFqName.asString())).addMember(
|
||||||
"%T::class",
|
CLASS_PLACEHOLDER,
|
||||||
ClassName.bestGuess(ksClass.qualifiedName!!.asString())
|
ClassName.bestGuess(ksClass.qualifiedName!!.asString())
|
||||||
).build()
|
).build()
|
||||||
)
|
)
|
||||||
|
|
@ -138,6 +141,7 @@ class ContributesNodeProcessor(
|
||||||
.addType(
|
.addType(
|
||||||
TypeSpec.interfaceBuilder(assistedFactoryClassName)
|
TypeSpec.interfaceBuilder(assistedFactoryClassName)
|
||||||
.addSuperinterface(ClassName.bestGuess(assistedNodeFactoryFqName.asString()).parameterizedBy(nodeClassName))
|
.addSuperinterface(ClassName.bestGuess(assistedNodeFactoryFqName.asString()).parameterizedBy(nodeClassName))
|
||||||
|
.addAnnotation(AnnotationSpec.builder(Origin::class).addMember("%T::class", nodeClassName).build())
|
||||||
.addAnnotation(AssistedFactory::class)
|
.addAnnotation(AssistedFactory::class)
|
||||||
.addFunction(
|
.addFunction(
|
||||||
FunSpec.builder("create")
|
FunSpec.builder("create")
|
||||||
|
|
@ -161,6 +165,7 @@ class ContributesNodeProcessor(
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val CLASS_PLACEHOLDER = "%T::class"
|
||||||
private val assistedNodeFactoryFqName = FqName("io.element.android.libraries.architecture.AssistedNodeFactory")
|
private val assistedNodeFactoryFqName = FqName("io.element.android.libraries.architecture.AssistedNodeFactory")
|
||||||
private val nodeKeyFqName = FqName("io.element.android.libraries.architecture.NodeKey")
|
private val nodeKeyFqName = FqName("io.element.android.libraries.architecture.NodeKey")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,7 @@ class WebViewWidgetMessageInterceptor(
|
||||||
return assetLoader.shouldInterceptRequest(request.url)
|
return assetLoader.shouldInterceptRequest(request.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION")
|
||||||
override fun shouldInterceptRequest(view: WebView?, url: String): WebResourceResponse? {
|
override fun shouldInterceptRequest(view: WebView?, url: String): WebResourceResponse? {
|
||||||
return assetLoader.shouldInterceptRequest(url.toUri())
|
return assetLoader.shouldInterceptRequest(url.toUri())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
# We cannot use 8.12.+ since it breaks F-Droid build (see https://github.com/element-hq/element-x-android/issues/3420#issuecomment-3199571010)
|
# We cannot use 8.12.+ since it breaks F-Droid build (see https://github.com/element-hq/element-x-android/issues/3420#issuecomment-3199571010)
|
||||||
android_gradle_plugin = "8.11.1"
|
android_gradle_plugin = "8.11.1"
|
||||||
# When updateing this, please also update the version in the file ./idea/kotlinc.xml
|
# When updateing this, please also update the version in the file ./idea/kotlinc.xml
|
||||||
kotlin = "2.2.10"
|
kotlin = "2.2.20"
|
||||||
kotlinpoet = "2.2.0"
|
kotlinpoet = "2.2.0"
|
||||||
ksp = "2.2.10-2.0.2"
|
ksp = "2.2.20-2.0.2"
|
||||||
firebaseAppDistribution = "5.1.1"
|
firebaseAppDistribution = "5.1.1"
|
||||||
|
|
||||||
# AndroidX
|
# AndroidX
|
||||||
|
|
@ -51,7 +51,7 @@ haze = "1.6.10"
|
||||||
dependencyAnalysis = "3.0.4"
|
dependencyAnalysis = "3.0.4"
|
||||||
|
|
||||||
# DI
|
# DI
|
||||||
metro = "0.6.4"
|
metro = "0.6.6"
|
||||||
|
|
||||||
# Auto service
|
# Auto service
|
||||||
autoservice = "1.1.1"
|
autoservice = "1.1.1"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
package io.element.android.libraries.maplibre.compose
|
package io.element.android.libraries.maplibre.compose
|
||||||
|
|
||||||
import android.content.ComponentCallbacks
|
import android.content.ComponentCallbacks2
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
|
@ -235,11 +235,15 @@ private fun MapView.lifecycleObserver(previousState: MutableState<Lifecycle.Even
|
||||||
previousState.value = event
|
previousState.value = event
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MapView.componentCallbacks(): ComponentCallbacks =
|
private fun MapView.componentCallbacks(): ComponentCallbacks2 =
|
||||||
object : ComponentCallbacks {
|
object : ComponentCallbacks2 {
|
||||||
override fun onConfigurationChanged(config: Configuration) {}
|
override fun onConfigurationChanged(config: Configuration) = Unit
|
||||||
|
|
||||||
override fun onLowMemory() {
|
@Suppress("OVERRIDE_DEPRECATION")
|
||||||
|
override fun onLowMemory() = Unit
|
||||||
|
|
||||||
|
override fun onTrimMemory(level: Int) {
|
||||||
|
// We call the `MapView.onLowMemory` method for any memory trim level
|
||||||
this@componentCallbacks.onLowMemory()
|
this@componentCallbacks.onLowMemory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue