Skip to content

Commit 7c18536

Browse files
committed
Fix channel creation flow issues, bump JVM & proguard
1 parent daf6227 commit 7c18536

File tree

8 files changed

+36
-21
lines changed

8 files changed

+36
-21
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
steps:
1515
- name: Checkout sources
1616
uses: actions/checkout@v4
17-
- name: Setup Java
17+
- name: "Setup | JBR 21"
1818
uses: actions/setup-java@v4
1919
with:
2020
distribution: 'jetbrains'
21-
java-version: 17
21+
java-version: 21
2222
cache: 'gradle'
2323

2424
- name: "Setup | Gradle"
@@ -33,11 +33,11 @@ jobs:
3333
steps:
3434
- name: Checkout sources
3535
uses: actions/checkout@v4
36-
- name: Setup Java
36+
- name: "Setup | JBR 21"
3737
uses: actions/setup-java@v4
3838
with:
3939
distribution: 'jetbrains'
40-
java-version: 17
40+
java-version: 21
4141
cache: 'gradle'
4242

4343
- name: "Setup | Gradle"
@@ -52,11 +52,11 @@ jobs:
5252
steps:
5353
- name: Checkout sources
5454
uses: actions/checkout@v4
55-
- name: Setup Java
55+
- name: "Setup | JBR 21"
5656
uses: actions/setup-java@v4
5757
with:
5858
distribution: 'jetbrains'
59-
java-version: 17
59+
java-version: 21
6060
cache: 'gradle'
6161
- name: Generate and submit dependency graph
6262
uses: gradle/actions/dependency-submission@v4

.github/workflows/publish.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
- name: "Setup | Checkout"
2929
uses: actions/checkout@v4
3030

31-
- name: "Setup | JDK 17"
31+
- name: "Setup | JDK 21"
3232
uses: actions/setup-java@v4
3333
with:
34-
java-version: '17'
34+
java-version: 21
3535
distribution: 'jetbrains'
3636
cache: 'gradle'
3737
env:
@@ -83,10 +83,10 @@ jobs:
8383
- name: Checkout Code
8484
uses: actions/checkout@v4
8585

86-
- name: Set up JDK 17
86+
- name: Set up JDK 21
8787
uses: actions/setup-java@v4
8888
with:
89-
java-version: '17'
89+
java-version: 21
9090
distribution: 'jetbrains'
9191
cache: 'gradle'
9292
env:
@@ -120,7 +120,6 @@ jobs:
120120
path: composeApp/build/outputs/apk/release/artifacts
121121
overwrite: true
122122

123-
124123
github_release:
125124
name: Create GitHub Release
126125
needs: [build-desktop, build-android]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ It runs natively on Android and iOS, desktop via the JVM, and experimentally in
66

77
## Building
88

9-
The recommended JDK version for this project is **OpenJDK 17**. Higher versions may not work, especially in release builds due to lacking Proguard support.
9+
The recommended JDK version for this project is **OpenJDK 21**. Higher versions may not work, especially in release builds due to lacking Proguard support.
1010

1111
### Desktop
1212

composeApp/build.gradle.kts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ plugins {
1818
}
1919

2020
kotlin {
21-
androidTarget { compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } }
21+
androidTarget { compilerOptions { jvmTarget.set(JvmTarget.JVM_21) } }
2222

2323
listOf(iosX64(), iosArm64(), iosSimulatorArm64()).forEach { iosTarget ->
2424
iosTarget.binaries.framework {
@@ -207,8 +207,8 @@ android {
207207
}
208208
}
209209
compileOptions {
210-
sourceCompatibility = JavaVersion.VERSION_17
211-
targetCompatibility = JavaVersion.VERSION_17
210+
sourceCompatibility = JavaVersion.VERSION_21
211+
targetCompatibility = JavaVersion.VERSION_21
212212
}
213213
}
214214

@@ -228,6 +228,7 @@ compose.desktop {
228228
}
229229

230230
buildTypes.release.proguard {
231+
version.set("7.6.1")
231232
configurationFiles.from("proguard-desktop-rules.pro")
232233
joinOutputJars = true
233234
optimize = true
@@ -256,6 +257,7 @@ detekt {
256257
config.setFrom("$projectDir/detekt.yml")
257258
source.setFrom(
258259
"src/commonMain/kotlin",
260+
"src/commonTest/kotlin",
259261
"src/androidMain/kotlin",
260262
"src/desktopMain/kotlin",
261263
"src/iosMain/kotlin",
@@ -273,6 +275,6 @@ tasks.withType<Detekt>().configureEach {
273275
}
274276
}
275277

276-
tasks.withType<Detekt>().configureEach { jvmTarget = "17" }
278+
tasks.withType<Detekt>().configureEach { jvmTarget = "21" }
277279

278-
tasks.withType<DetektCreateBaselineTask>().configureEach { jvmTarget = "17" }
280+
tasks.withType<DetektCreateBaselineTask>().configureEach { jvmTarget = "21" }

composeApp/proguard-desktop-rules.pro

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
-keep class org.freedesktop.dbus.** { *; }
1414
-keep class * implements org.freedesktop.dbus.** { *; }
1515

16-
-keepclasseswithmembers public class com.hypergonial.chat.Mainkt {
16+
-keepclasseswithmembers public class com.hypergonial.chat.MainKt {
1717
public static void main(java.lang.String[]);
1818
}
1919
-keep class kotlin.** { *; }
@@ -29,6 +29,20 @@
2929
void sourceInformationMarkerEnd(androidx.compose.runtime.Composer);
3030
}
3131

32+
# Fix for VerifyError in androidx.compose.runtime
33+
-keep class androidx.compose.runtime.State { *; }
34+
-keep class androidx.compose.runtime.DerivedSnapshotState { *; }
35+
-keep class androidx.compose.runtime.SnapshotStateKt { *; }
36+
-keep class androidx.compose.runtime.SnapshotStateKt__DerivedStateKt { *; }
37+
38+
# Keep all implementations of State
39+
-keep class * implements androidx.compose.runtime.State { *; }
40+
41+
# Keep derivedStateOf function and related classes
42+
-keepclassmembers class androidx.compose.runtime.** {
43+
** derivedStateOf(...);
44+
}
45+
3246
# Keep all implementations of TextRangeScopeMeasurePolicy (including lambdas)
3347
-keep class * implements androidx.compose.foundation.text.TextRangeScopeMeasurePolicy { *; }
3448

composeApp/src/commonMain/kotlin/com/hypergonial/chat/view/components/MainComponent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class DefaultMainComponent(
491491
data.value = data.value.copy(channels = (data.value.channels + event.channel).sortedBy { it.id })
492492

493493
// Leave fallback slot if it was active
494-
if (data.value.selectedChannel == null || data.value.selectedGuild != null) {
494+
if (data.value.selectedChannel == null && data.value.selectedGuild != null) {
495495
navigateToChannel(event.channel.id)
496496
}
497497
}

composeApp/src/commonMain/kotlin/com/hypergonial/chat/view/components/prompts/CreateChannelComponent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class DefaultCreateChannelComponent(
7373
data.value =
7474
data.value.copy(
7575
channelName = channelName.replace(Regex("\\s+"), "_").lowercase().trim().take(32),
76-
isCreateButtonEnabled = channelName.isNotBlank(),
76+
isCreateButtonEnabled = channelName.length >= 3 && channelName.isNotBlank(),
7777
)
7878
}
7979

composeApp/src/commonMain/kotlin/com/hypergonial/chat/view/components/prompts/CreateGuildComponent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class DefaultCreateGuildComponent(
7171
data.value =
7272
data.value.copy(
7373
guildName = guildName.replace(Regex("\\s+"), " ").take(32),
74-
isCreateButtonEnabled = guildName.isNotBlank(),
74+
isCreateButtonEnabled = guildName.length >= 3 && guildName.isNotBlank(),
7575
)
7676
}
7777

0 commit comments

Comments
 (0)