From d8277c3f24567809c09a2fcd1c425c77b75e58e8 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 11 Jul 2022 19:05:29 +0100 Subject: [PATCH 1/3] updating to kotlin 1.7.0 with separating compose compiler --- dependencies.gradle | 4 ++-- .../main/kotlin/app/dapk/st/core/ComposeExtensions.kt | 3 +++ .../src/testFixtures/kotlin/ViewModelTest.kt | 1 + .../kotlin/app/dapk/st/messenger/MessengerScreen.kt | 11 +++++++++-- .../kotlin/app/dapk/st/settings/SettingsScreen.kt | 7 +++++++ .../dapk/st/settings/eventlogger/EventLogScreen.kt | 7 +++++++ 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 69ba916..71ba55b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -88,7 +88,7 @@ ext.Dependencies.with { } } - def kotlinVer = "1.6.10" + def kotlinVer = "1.7.0" def sqldelightVer = "1.5.3" def composeVer = "1.1.1" def ktorVer = "2.0.3" @@ -102,7 +102,7 @@ ext.Dependencies.with { androidxComposeMaterial = "androidx.compose.material:material:${composeVer}" androidxComposeIconsExtended = "androidx.compose.material:material-icons-extended:${composeVer}" androidxActivityCompose = "androidx.activity:activity-compose:1.4.0" - kotlinCompilerExtensionVersion = "${composeVer}" + kotlinCompilerExtensionVersion = "1.2.0" } mavenCentral = new DependenciesContainer() diff --git a/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/ComposeExtensions.kt b/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/ComposeExtensions.kt index 4166d6b..a06b4b7 100644 --- a/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/ComposeExtensions.kt +++ b/domains/android/compose-core/src/main/kotlin/app/dapk/st/core/ComposeExtensions.kt @@ -41,6 +41,9 @@ fun LifecycleEffect(onStart: () -> Unit = {}, onStop: () -> Unit = {}) { when (event) { Lifecycle.Event.ON_START -> onStart() Lifecycle.Event.ON_STOP -> onStop() + else -> { + // ignored + } } } diff --git a/domains/android/viewmodel/src/testFixtures/kotlin/ViewModelTest.kt b/domains/android/viewmodel/src/testFixtures/kotlin/ViewModelTest.kt index 9cdadde..018c6cd 100644 --- a/domains/android/viewmodel/src/testFixtures/kotlin/ViewModelTest.kt +++ b/domains/android/viewmodel/src/testFixtures/kotlin/ViewModelTest.kt @@ -6,6 +6,7 @@ import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.setMain import test.ExpectTest +@Suppress("UNCHECKED_CAST") class ViewModelTest { var instance: TestMutableState? = null diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt index f0f2a9a..6454056 100644 --- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt +++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/MessengerScreen.kt @@ -84,8 +84,7 @@ internal fun MessengerScreen(roomId: RoomId, viewModel: MessengerViewModel, navi private fun MessengerViewModel.ObserveEvents() { StartObserving { this@ObserveEvents.events.launch { - when (it) { - } + // TODO() } } } @@ -429,6 +428,10 @@ private fun ReplyBubbleContent(content: BubbleContent) { ) Spacer(modifier = Modifier.height(4.dp)) } + + is RoomEvent.Reply -> { + // TODO - a reply to a reply + } } } @@ -466,6 +469,10 @@ private fun ReplyBubbleContent(content: BubbleContent) { ) Spacer(modifier = Modifier.height(4.dp)) } + + is RoomEvent.Reply -> { + // TODO - a reply to a reply + } } Spacer(modifier = Modifier.height(2.dp)) diff --git a/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt b/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt index 3832fd3..8338af8 100644 --- a/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt +++ b/features/settings/src/main/kotlin/app/dapk/st/settings/SettingsScreen.kt @@ -199,6 +199,13 @@ private fun RootSettings(page: Page.Root, onClick: (SettingItem) -> Unit) { item { Spacer(Modifier.height(12.dp)) } } } + + is Lce.Error -> { + // TODO + } + is Lce.Loading -> { + // TODO + } } } diff --git a/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt b/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt index 885c985..43a24dd 100644 --- a/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt +++ b/features/settings/src/main/kotlin/app/dapk/st/settings/eventlogger/EventLogScreen.kt @@ -42,6 +42,13 @@ fun EventLogScreen(viewModel: EventLoggerViewModel) { } } } + + is Lce.Error -> { + // TODO + } + is Lce.Loading -> { + // TODO + } } } From 880a4fd78a93207907ecf57bfed18790e9691088 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 11 Jul 2022 19:13:55 +0100 Subject: [PATCH 2/3] updating crashlytics plugin --- build.gradle | 2 +- core/src/main/kotlin/app/dapk/st/core/SingletonFlows.kt | 2 ++ dependencies.gradle | 2 ++ .../src/main/kotlin/androidx/compose/runtime/MutableState.kt | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 434d190..207b7e3 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { classpath Dependencies.mavenCentral.kotlinGradlePlugin classpath Dependencies.mavenCentral.sqldelightGradlePlugin classpath Dependencies.mavenCentral.kotlinSerializationGradlePlugin - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' + classpath Dependencies.google.firebaseCrashlyticsPlugin } } diff --git a/core/src/main/kotlin/app/dapk/st/core/SingletonFlows.kt b/core/src/main/kotlin/app/dapk/st/core/SingletonFlows.kt index 1d09273..64f66b8 100644 --- a/core/src/main/kotlin/app/dapk/st/core/SingletonFlows.kt +++ b/core/src/main/kotlin/app/dapk/st/core/SingletonFlows.kt @@ -31,10 +31,12 @@ class SingletonFlows( } } + @Suppress("UNCHECKED_CAST") fun get(key: String): Flow { return cache[key]!! as Flow } + @Suppress("UNCHECKED_CAST") suspend fun update(key: String, value: T) { (cache[key] as? MutableSharedFlow)?.emit(value) } diff --git a/dependencies.gradle b/dependencies.gradle index 71ba55b..5ae5c0f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -103,6 +103,8 @@ ext.Dependencies.with { androidxComposeIconsExtended = "androidx.compose.material:material-icons-extended:${composeVer}" androidxActivityCompose = "androidx.activity:activity-compose:1.4.0" kotlinCompilerExtensionVersion = "1.2.0" + + firebaseCrashlyticsPlugin = "com.google.firebase:firebase-crashlytics-gradle:2.9.1" } mavenCentral = new DependenciesContainer() diff --git a/domains/android/viewmodel-stub/src/main/kotlin/androidx/compose/runtime/MutableState.kt b/domains/android/viewmodel-stub/src/main/kotlin/androidx/compose/runtime/MutableState.kt index 543df16..c1bfc7a 100644 --- a/domains/android/viewmodel-stub/src/main/kotlin/androidx/compose/runtime/MutableState.kt +++ b/domains/android/viewmodel-stub/src/main/kotlin/androidx/compose/runtime/MutableState.kt @@ -1,5 +1,5 @@ @file:JvmName("SnapshotStateKt") - +@file:Suppress("UNUSED") package androidx.compose.runtime import kotlin.reflect.KProperty From 6c3311284c80009a45c69654aeb069396c3571eb Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 11 Jul 2022 19:37:53 +0100 Subject: [PATCH 3/3] lifting desugar'd dep to the deps file --- app/build.gradle | 2 +- dependencies.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 36dfe6f..3642d4d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { } dependencies { - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' + coreLibraryDesugaring Dependencies.google.jdkLibs implementation project(":features:home") implementation project(":features:directory") diff --git a/dependencies.gradle b/dependencies.gradle index 5ae5c0f..c687110 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -105,6 +105,7 @@ ext.Dependencies.with { kotlinCompilerExtensionVersion = "1.2.0" firebaseCrashlyticsPlugin = "com.google.firebase:firebase-crashlytics-gradle:2.9.1" + jdkLibs = "com.android.tools:desugar_jdk_libs:1.1.5" } mavenCentral = new DependenciesContainer()