From ce7579e9921c53d610a3d668d65f8fd64cb34015 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:15:58 +0000 Subject: [PATCH] Update dependency androidx.collection:collection-ktx to v1.3.0 (#3140) * Update dependency androidx.collection:collection-ktx to v1.3.0 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Frett --- gradle/libs.versions.toml | 2 +- .../activity/MultiLanguageToolActivityDataModel.kt | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6b120fbb5a..fee5d24237 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -42,7 +42,7 @@ androidx-appcompat = "androidx.appcompat:appcompat:1.6.1" androidx-arch-core-testing = "androidx.arch.core:core-testing:2.2.0" androidx-browser = "androidx.browser:browser:1.6.0" androidx-cardview = "androidx.cardview:cardview:1.0.0" -androidx-collection-ktx = "androidx.collection:collection-ktx:1.2.0" +androidx-collection-ktx = "androidx.collection:collection-ktx:1.3.0" androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "androidx-compose-material" } androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "androidx-compose-material" } androidx-compose-material3 = "androidx.compose.material3:material3:1.1.2" diff --git a/ui/base-tool/src/main/kotlin/org/cru/godtools/base/tool/activity/MultiLanguageToolActivityDataModel.kt b/ui/base-tool/src/main/kotlin/org/cru/godtools/base/tool/activity/MultiLanguageToolActivityDataModel.kt index f2134b2c6d..15bbd41e6e 100644 --- a/ui/base-tool/src/main/kotlin/org/cru/godtools/base/tool/activity/MultiLanguageToolActivityDataModel.kt +++ b/ui/base-tool/src/main/kotlin/org/cru/godtools/base/tool/activity/MultiLanguageToolActivityDataModel.kt @@ -106,7 +106,7 @@ class MultiLanguageToolActivityDataModel @Inject constructor( @VisibleForTesting internal val translations = locales.asLiveData().switchFold(ImmutableLiveData(emptyList>())) { acc, locale -> - distinctToolCode.switchMap { translationCache.get(it, locale).withInitialValue(null) } + distinctToolCode.switchMap { translationCache[it, locale]!!.withInitialValue(null) } .distinctUntilChanged() .combineWith(acc.distinctUntilChanged()) { it, translations -> translations + Pair(locale, it) } }.map { it.toMap() } @@ -114,7 +114,7 @@ class MultiLanguageToolActivityDataModel @Inject constructor( @VisibleForTesting internal val manifests = locales.asLiveData().switchFold(ImmutableLiveData(emptyList>())) { acc, locale -> - distinctToolCode.switchMap { manifestCache.get(it, locale).asLiveData().withInitialValue(null) } + distinctToolCode.switchMap { manifestCache[it, locale]!!.asLiveData().withInitialValue(null) } .distinctUntilChanged() .combineWith(acc.distinctUntilChanged()) { it, manifests -> manifests + Pair(locale, it) } }.map { it.toMap() } @@ -147,8 +147,8 @@ class MultiLanguageToolActivityDataModel @Inject constructor( val activeLoadingState = distinctToolCode.switchCombineWith(activeLocale) { tool, l -> combine( - manifestCache.get(tool, l).asLiveData(), - translationCache.get(tool, l), + manifestCache[tool, l]!!.asLiveData(), + translationCache[tool, l]!!, supportedType.asLiveData(), isConnected, isInitialSyncFinished.asLiveData() @@ -224,4 +224,5 @@ class MultiLanguageToolActivityDataModel @Inject constructor( } } -private fun LruCache.get(tool: String?, locale: Locale?) = get(TranslationKey(tool, locale))!! +private operator fun LruCache.get(tool: String?, locale: Locale?) = + get(TranslationKey(tool, locale))