android, desktop: compose 1.8.0-beta01 + Kotlin 2.1.20 + compileSdk 35

This commit is contained in:
Avently 2025-03-22 02:34:48 +07:00
parent 15742aee30
commit b67d85f4f5
12 changed files with 26 additions and 16 deletions

1
.gitignore vendored
View file

@ -79,3 +79,4 @@ website/package-lock.json
website/.cache
website/test/stubs-layout-cache/_includes/*.js
apps/android/app/release
apps/multiplatform/.kotlin/sessions

View file

@ -5,10 +5,11 @@ plugins {
id("org.jetbrains.compose")
kotlin("android")
id("org.jetbrains.kotlin.plugin.serialization")
id("org.jetbrains.kotlin.plugin.compose")
}
android {
compileSdk = 34
compileSdk = 35
defaultConfig {
applicationId = "chat.simplex.app"

View file

@ -3,6 +3,7 @@ plugins {
id("org.jetbrains.compose")
id("com.android.library")
id("org.jetbrains.kotlin.plugin.serialization")
id("org.jetbrains.kotlin.plugin.compose")
id("dev.icerock.mobile.multiplatform-resources")
id("com.github.gmazzo.buildconfig") version "5.3.5"
}
@ -125,7 +126,7 @@ kotlin {
android {
namespace = "chat.simplex.common"
compileSdk = 34
compileSdk = 35
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 26

View file

@ -26,6 +26,8 @@ import kotlinx.coroutines.flow.*
import kotlinx.coroutines.sync.Mutex
import kotlin.collections.removeAll as remAll
import kotlinx.datetime.*
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import kotlinx.datetime.TimeZone
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
@ -2798,7 +2800,8 @@ fun MutableState<SnapshotStateList<ChatItem>>.removeLastAndNotify(contentTag: Ms
value = SnapshotStateList<ChatItem>().apply {
addAll(value)
val remIndex = lastIndex
val rem = removeLast()
// note: removeLast() produce NoSuchMethodError on Android but removeLastOrNull() works
val rem = removeLastOrNull() ?: return
removed = Triple(rem.id, remIndex, rem.isRcvNew)
}
chatModel.chatItemsChangesListenerForContent(contentTag)?.removed(listOf(removed), value)

View file

@ -327,7 +327,8 @@ private fun removeDuplicatesAndUpperSplits(
if (idsToTrim.last().isNotEmpty()) {
// it has some elements to trim from currently visible range which means the items shouldn't be trimmed
// Otherwise, the last set would be empty
idsToTrim.removeLast()
// note: removeLast() produce NoSuchMethodError on Android but removeLastOrNull() works
idsToTrim.removeLastOrNull()
}
val allItemsToDelete = idsToTrim.flatten()
if (allItemsToDelete.isNotEmpty()) {

View file

@ -58,6 +58,7 @@ class ProcessedErrors <T: AgentErrorType>(val interval: Long) {
text = generalGetString(MR.strings.agent_internal_error_desc).format(error.internalErr),
)
}
else -> {}
}
}
}

View file

@ -32,7 +32,7 @@ import chat.simplex.res.MR
import java.text.DecimalFormat
@Composable
fun ModalData.AdvancedNetworkSettingsView(showModal: (ModalData.() -> Unit) -> Unit, close: () -> Unit) {
fun ModalData.AdvancedNetworkSettingsView(showModal: (@Composable ModalData.() -> Unit) -> Unit, close: () -> Unit) {
val currentRemoteHost by remember { chatModel.currentRemoteHost }
val developerTools = remember { appPrefs.developerTools.get() }
@ -201,7 +201,7 @@ fun ModalData.AdvancedNetworkSettingsView(showModal: (ModalData.() -> Unit) -> U
updateSessionMode: (TransportSessionMode) -> Unit,
updateSMPProxyMode: (SMPProxyMode) -> Unit,
updateSMPProxyFallback: (SMPProxyFallback) -> Unit,
showModal: (ModalData.() -> Unit) -> Unit,
showModal: (@Composable ModalData.() -> Unit) -> Unit,
resetDisabled: Boolean,
reset: () -> Unit,
saveDisabled: Boolean,

View file

@ -93,7 +93,7 @@ actual fun LazyColumnWithScrollBar(
}
val modifier = if (fillMaxSize) Modifier.fillMaxSize().then(modifier) else modifier
Box(Modifier.copyViewToAppBar(remember { appPrefs.appearanceBarsBlurRadius.state }.value, LocalAppBarHandler.current?.graphicsLayer).nestedScroll(connection)) {
LazyColumn(modifier.then(scrollModifier), state, contentPadding, reverseLayout, verticalArrangement, horizontalAlignment, flingBehavior, userScrollEnabled, content)
LazyColumn(modifier.then(scrollModifier), state, contentPadding, reverseLayout, verticalArrangement, horizontalAlignment, flingBehavior, userScrollEnabled, content = content)
ScrollBar(reverseLayout, state, scrollBarAlpha, scrollJob, scrollBarDraggingState, additionalBarOffset, additionalTopBar, chatBottomBar)
}
}
@ -138,7 +138,7 @@ actual fun LazyColumnWithScrollBarNoAppBar(
// (only first visible row is useful because LazyColumn doesn't have absolute scroll position, only relative to row)
val scrollBarDraggingState = remember { mutableStateOf(false) }
Box(contentAlignment = containerAlignment) {
LazyColumn(modifier.then(scrollModifier), state, contentPadding, reverseLayout, verticalArrangement, horizontalAlignment, flingBehavior, userScrollEnabled, content)
LazyColumn(modifier.then(scrollModifier), state, contentPadding, reverseLayout, verticalArrangement, horizontalAlignment, flingBehavior, userScrollEnabled, content = content)
Box(if (maxHeight?.value != null) Modifier.height(maxHeight.value).fillMaxWidth() else Modifier.fillMaxSize(), contentAlignment = Alignment.CenterEnd) {
DesktopScrollBar(rememberScrollbarAdapter(state), Modifier.fillMaxHeight(), scrollBarAlpha, scrollJob, reverseLayout, scrollBarDraggingState)
}

View file

@ -1,9 +1,10 @@
import org.gradle.internal.extensions.stdlib.toDefaultLowerCase
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
id("org.jetbrains.kotlin.plugin.compose")
id("io.github.tomtzook.gradle-cmake") version "1.2.2"
}
@ -89,7 +90,7 @@ compose {
}
}
}
val os = System.getProperty("os.name", "generic").toLowerCaseAsciiOnly()
val os = System.getProperty("os.name", "generic").toDefaultLowerCase()
if (os.contains("mac") || os.contains("win")) {
packageName = "SimpleX"
} else {

View file

@ -30,9 +30,9 @@ android.version_code=279
desktop.version_name=6.3
desktop.version_code=96
kotlin.version=1.9.23
gradle.plugin.version=8.2.0
compose.version=1.7.0
kotlin.version=2.1.20
gradle.plugin.version=8.7.0
compose.version=1.8.0-beta01
# Choose sqlite or postgres backend
database.backend=sqlite

View file

@ -1,6 +1,6 @@
#Mon Feb 14 14:23:51 GMT 2022
#Fri Mar 21 20:38:56 ICT 2025
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -12,6 +12,7 @@ pluginManagement {
id("com.android.application").version(extra["gradle.plugin.version"] as String)
id("com.android.library").version(extra["gradle.plugin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String)
id("org.jetbrains.kotlin.plugin.compose").version(extra["kotlin.version"] as String)
id("org.jetbrains.kotlin.plugin.serialization").version(extra["kotlin.version"] as String)
}
}