Skip to content

Commit 6b6e598

Browse files
renovate[bot]frettclaude
authored
Update androidx.compose.runtime to v1.11.0 (#4395)
* Update androidx.compose.runtime to v1.11.0 * Fix Android lint issues by replacing MutableStateFlow with rememberStateFlow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Frett <daniel.frett@cru.org> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 85a8050 commit 6b6e598

6 files changed

Lines changed: 17 additions & 15 deletions

File tree

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ dependencies {
159159
implementation(libs.gtoSupport.appcompat)
160160
implementation(libs.gtoSupport.base)
161161
implementation(libs.gtoSupport.compat)
162+
implementation(libs.gtoSupport.compose)
162163
implementation(libs.gtoSupport.dagger)
163164
implementation(libs.gtoSupport.eventbus)
164165
implementation(libs.gtoSupport.firebase.crashlytics)

app/src/main/kotlin/org/cru/godtools/ui/dashboard/tools/ToolFiltersStateProducer.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import java.util.Locale
1515
import javax.inject.Inject
1616
import kotlinx.coroutines.CoroutineDispatcher
1717
import kotlinx.coroutines.ExperimentalCoroutinesApi
18-
import kotlinx.coroutines.flow.MutableStateFlow
1918
import kotlinx.coroutines.flow.SharingStarted
2019
import kotlinx.coroutines.flow.combine
2120
import kotlinx.coroutines.flow.distinctUntilChanged
@@ -24,6 +23,7 @@ import kotlinx.coroutines.flow.flowOn
2423
import kotlinx.coroutines.flow.map
2524
import kotlinx.coroutines.flow.shareIn
2625
import kotlinx.coroutines.launch
26+
import org.ccci.gto.android.common.compose.util.rememberStateFlow
2727
import org.ccci.gto.android.common.dagger.coroutines.DispatcherType
2828
import org.ccci.gto.android.common.dagger.coroutines.DispatcherType.Type.IO
2929
import org.cru.godtools.base.Settings
@@ -109,10 +109,10 @@ internal class DefaultToolFiltersStateProducer @Inject constructor(
109109
private fun rememberFilterLanguages(category: String?, query: String): List<FilterMenu.UiState.Item<Language?>> {
110110
val scope = rememberCoroutineScope()
111111

112-
val categoryFlow = remember { MutableStateFlow(category) }.apply { value = category }
113-
val queryFlow = remember { MutableStateFlow(query) }.apply { value = query }
112+
val categoryFlow = rememberStateFlow(category)
113+
val queryFlow = rememberStateFlow(query)
114114

115-
val languagesFlow = remember {
115+
val languagesFlow = remember(categoryFlow, queryFlow) {
116116
categoryFlow
117117
.flatMapLatest {
118118
when (it) {

app/src/main/kotlin/org/cru/godtools/ui/tooldetails/ToolDetailsPresenter.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ import kotlinx.collections.immutable.persistentListOf
2929
import kotlinx.collections.immutable.toImmutableList
3030
import kotlinx.coroutines.CoroutineDispatcher
3131
import kotlinx.coroutines.ExperimentalCoroutinesApi
32-
import kotlinx.coroutines.flow.MutableStateFlow
3332
import kotlinx.coroutines.flow.StateFlow
3433
import kotlinx.coroutines.flow.combine
3534
import kotlinx.coroutines.flow.distinctUntilChanged
3635
import kotlinx.coroutines.flow.flatMapLatest
3736
import kotlinx.coroutines.flow.flowOn
3837
import kotlinx.coroutines.flow.map
3938
import kotlinx.coroutines.launch
39+
import org.ccci.gto.android.common.compose.util.rememberStateFlow
4040
import org.ccci.gto.android.common.dagger.coroutines.DispatcherType
4141
import org.ccci.gto.android.common.dagger.coroutines.DispatcherType.Type.IO
4242
import org.cru.godtools.analytics.model.OpenAnalyticsActionEvent
@@ -258,9 +258,8 @@ class ToolDetailsPresenter @AssistedInject constructor(
258258
@Composable
259259
@OptIn(ExperimentalCoroutinesApi::class)
260260
private fun rememberAvailableLanguages(code: String): ImmutableList<String> {
261-
val codeFlow = remember { MutableStateFlow(code) }.apply { value = code }
262-
263-
return remember {
261+
val codeFlow = rememberStateFlow(code)
262+
return remember(codeFlow) {
264263
codeFlow
265264
.flatMapLatest { translationsRepository.getTranslationsFlowForTool(it) }
266265
.map { it.mapTo(mutableSetOf()) { it.languageCode } }

app/src/main/kotlin/org/cru/godtools/ui/tools/ToolCardPresenter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import javax.inject.Inject
1515
import javax.inject.Singleton
1616
import kotlinx.coroutines.ExperimentalCoroutinesApi
1717
import kotlinx.coroutines.NonCancellable
18-
import kotlinx.coroutines.flow.MutableStateFlow
1918
import kotlinx.coroutines.flow.SharingStarted
2019
import kotlinx.coroutines.flow.combine
2120
import kotlinx.coroutines.flow.distinctUntilChanged
@@ -26,6 +25,7 @@ import kotlinx.coroutines.flow.onEach
2625
import kotlinx.coroutines.flow.onStart
2726
import kotlinx.coroutines.flow.shareIn
2827
import kotlinx.coroutines.launch
28+
import org.ccci.gto.android.common.compose.util.rememberStateFlow
2929
import org.cru.godtools.base.Settings
3030
import org.cru.godtools.base.ToolFileSystem
3131
import org.cru.godtools.db.repository.AttachmentsRepository
@@ -77,9 +77,9 @@ class ToolCardPresenter @Inject constructor(
7777
val appLanguage = if (loadAppLanguage) languagesRepository.rememberLanguage(appLocale) else null
7878

7979
// Custom Translation
80-
val customLocaleFlow = remember { MutableStateFlow(customLocale) }.apply { value = customLocale }
80+
val customLocaleFlow = rememberStateFlow(customLocale)
8181
val customLanguage = languagesRepository.rememberLanguage(customLocale)
82-
val customTranslationFlow = remember {
82+
val customTranslationFlow = remember(customLocaleFlow) {
8383
combine(
8484
snapshotFlow { toolCode },
8585
customLocaleFlow

app/src/testDebug/kotlin/org/cru/godtools/ui/dashboard/tools/ToolFiltersTest.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.cru.godtools.ui.dashboard.tools
22

33
import android.app.Application
44
import androidx.compose.runtime.mutableStateOf
5+
import androidx.compose.runtime.remember
56
import androidx.compose.ui.test.assertHasClickAction
67
import androidx.compose.ui.test.hasClickAction
78
import androidx.compose.ui.test.junit4.createComposeRule
@@ -195,7 +196,7 @@ class ToolFiltersTest {
195196
composeTestRule.setContent {
196197
LanguageFilter(
197198
UiState(
198-
menuExpanded = mutableStateOf(true),
199+
menuExpanded = remember { mutableStateOf(true) },
199200
items = persistentListOf(
200201
Item(null, 0),
201202
Item(Language(Locale.FRENCH), 1),
@@ -217,7 +218,7 @@ class ToolFiltersTest {
217218
composeTestRule.setContent {
218219
LanguageFilter(
219220
UiState(
220-
menuExpanded = mutableStateOf(true),
221+
menuExpanded = remember { mutableStateOf(true) },
221222
items = persistentListOf(
222223
Item(null, 0),
223224
Item(Language(Locale.FRENCH), 1),
@@ -238,7 +239,7 @@ class ToolFiltersTest {
238239
composeTestRule.setContent {
239240
LanguageFilter(
240241
UiState(
241-
menuExpanded = mutableStateOf(true),
242+
menuExpanded = remember { mutableStateOf(true) },
242243
items = persistentListOf(
243244
Item(null, 0),
244245
Item(Language(Locale.FRENCH), 1),

gradle/libs.versions.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ android-gradle-plugin = "8.13.2"
44
androidx-activity = "1.13.0"
55
androidx-compose-foundation = "1.10.6"
66
androidx-compose-material3 = "1.4.0"
7-
androidx-compose-runtime = "1.10.6"
7+
androidx-compose-runtime = "1.11.0"
88
androidx-compose-ui = "1.10.6"
99
androidx-core = "1.18.0"
1010
androidx-datastore = "1.2.1"
@@ -139,6 +139,7 @@ gtoSupport-appcompat = { module = "org.ccci.gto.android:gto-support-appcompat",
139139
gtoSupport-base = { module = "org.ccci.gto.android:gto-support-base", version.ref = "gtoSupport" }
140140
gtoSupport-circuit = { module = "org.ccci.gto.android:gto-support-circuit", version.ref = "gtoSupport" }
141141
gtoSupport-compat = { module = "org.ccci.gto.android:gto-support-compat", version.ref = "gtoSupport" }
142+
gtoSupport-compose = { module = "org.ccci.gto.android:gto-support-compose", version.ref = "gtoSupport" }
142143
gtoSupport-core = { module = "org.ccci.gto.android:gto-support-core", version.ref = "gtoSupport" }
143144
gtoSupport-dagger = { module = "org.ccci.gto.android:gto-support-dagger", version.ref = "gtoSupport" }
144145
gtoSupport-db = { module = "org.ccci.gto.android:gto-support-db", version.ref = "gtoSupport" }

0 commit comments

Comments
 (0)