Skip to content

Commit f9a64ff

Browse files
committed
Fix more PR feedback
1 parent a1099dc commit f9a64ff

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ local.properties
3737
*.iml
3838
.idea/
3939
captures/
40+
41+
# Kotlin Metadata
42+
.kotlin/

gradle/libs.versions.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
agpVersion = "8.8.0"
44

55
compileSdk = "34"
6-
# Any version above 0.10.0-beta03 requires Compose 1.8.0 or higher.
7-
filekitDialogsComposeVersion = "0.10.0-beta03"
86
minSdk = "24"
9-
moshiKotlinVersion = "1.15.2"
107
targetSdk = "33"
118

129
jdk-target = "1.8"
@@ -42,6 +39,8 @@ androidx-viewbinding = "8.1.2"
4239
detekt = "1.19.0"
4340
dokka = "2.0.0"
4441
dependencyGuard = "0.5.0"
42+
# Any version above 0.10.0-beta03 requires Compose 1.8.0 or higher, beta03 is 1.7.3 or higher.
43+
filekit-dialogs-compose = "0.10.0-beta03"
4544

4645
google-accompanist = "0.18.0"
4746
google-dagger = "2.40.5"
@@ -81,6 +80,7 @@ squareup-curtains = "1.2.5"
8180
squareup-cycler = "0.1.9"
8281
squareup-leakcanary = "3.0-alpha-8"
8382
squareup-moshi = "1.15.0"
83+
squareup-moshi-kotlin = "1.15.2"
8484
squareup-okhttp = "4.9.1"
8585
squareup-okio = "3.3.0"
8686
squareup-radiography = "2.4.1"
@@ -92,7 +92,6 @@ timber = "5.0.1"
9292
truth = "1.4.4"
9393
turbine = "1.0.0"
9494
vanniktech-publish = "0.32.0"
95-
uiGraphicsAndroidVersion = "1.8.2"
9695

9796
[plugins]
9897

@@ -189,7 +188,7 @@ dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", vers
189188

190189
dropbox-dependencyGuard = { module = "com.dropbox.dependency-guard:dependency-guard", version.ref = "dependencyGuard" }
191190

192-
filekit-dialogs-compose = { module = "io.github.vinceglb:filekit-dialogs-compose", version.ref = "filekitDialogsComposeVersion" }
191+
filekit-dialogs-compose = { module = "io.github.vinceglb:filekit-dialogs-compose", version.ref = "filekit-dialogs-compose" }
193192
google-android-material = { module = "com.google.android.material:material", version.ref = "material" }
194193
google-ksp = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "google-ksp" }
195194

@@ -236,7 +235,6 @@ mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "
236235

237236
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
238237

239-
moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshiKotlinVersion" }
240238
reactivestreams = "org.reactivestreams:reactive-streams:1.0.4"
241239

242240
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
@@ -256,6 +254,7 @@ squareup-leakcanary-objectwatcher-android = { module = "com.squareup.leakcanary:
256254
squareup-moshi = { module = "com.squareup.moshi:moshi", version.ref = "squareup-moshi" }
257255
squareup-moshi-adapters = { module = "com.squareup.moshi:moshi-adapters", version.ref = "squareup-moshi" }
258256
squareup-moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "squareup-moshi" }
257+
squareup-moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "squareup-moshi-kotlin" }
259258

260259
squareup-okio = { module = "com.squareup.okio:okio", version.ref = "squareup-okio" }
261260

@@ -270,6 +269,5 @@ truth = { module = "com.google.truth:truth", version.ref = "truth" }
270269
turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" }
271270

272271
vanniktech-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "vanniktech-publish" }
273-
androidx-ui-graphics-android = { group = "androidx.compose.ui", name = "ui-graphics-android", version.ref = "uiGraphicsAndroidVersion" }
274272

275273
[bundles]

workflow-trace-viewer/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@ It can be run via Gradle using:
1212

1313
### External Libraries
1414

15-
[FileKit](https://github.com/vinceglb/FileKit) is an external library made to apply file operations
16-
on Kotlin and KMP projects. It's purpose in this app is to allow developers to upload their own
17-
json trace files. The motivation for its use is to quickly implement a file picker.
15+
[FileKit](https://github.com/vinceglb/FileKit) is an external library made to apply file operations on Kotlin and KMP projects. It's purpose in this app is to allow developers to upload their own json trace files. The motivation for its use is to quickly implement a file picker.

workflow-trace-viewer/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ kotlin {
2323
implementation(compose.desktop.currentOs)
2424
implementation(libs.kotlinx.coroutines.swing)
2525
implementation(compose.materialIconsExtended)
26-
implementation(libs.moshi.kotlin)
26+
implementation(libs.squareup.moshi.kotlin)
2727
implementation(libs.filekit.dialogs.compose)
2828
}
2929
}

workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/App.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import androidx.compose.foundation.layout.Box
44
import androidx.compose.material.Text
55
import androidx.compose.runtime.Composable
66
import androidx.compose.runtime.LaunchedEffect
7+
import androidx.compose.runtime.getValue
78
import androidx.compose.runtime.mutableStateOf
89
import androidx.compose.runtime.remember
10+
import androidx.compose.runtime.setValue
911
import androidx.compose.ui.Modifier
1012
import io.github.vinceglb.filekit.PlatformFile
1113
import io.github.vinceglb.filekit.readString
@@ -18,23 +20,23 @@ public fun App(
1820
modifier: Modifier = Modifier
1921
) {
2022
Box {
21-
val selectedFile = remember { mutableStateOf<PlatformFile?>(null) }
23+
var selectedFile by remember { mutableStateOf<PlatformFile?>(null) }
2224

23-
if (selectedFile.value != null) {
24-
SandboxBackground { WorkflowContent(selectedFile.value) }
25+
if (selectedFile != null) {
26+
SandboxBackground { WorkflowContent(selectedFile!!) }
2527
}
2628

27-
UploadFile(onFileSelect = { selectedFile.value = it })
29+
UploadFile(onFileSelect = { selectedFile = it })
2830
}
2931
}
3032

3133
@Composable
32-
private fun WorkflowContent(file: PlatformFile?) {
33-
val jsonString = remember { mutableStateOf<String?>(null) }
34+
private fun WorkflowContent(file: PlatformFile) {
35+
var jsonString by remember { mutableStateOf<String?>(null) }
3436
LaunchedEffect(file) {
35-
jsonString.value = file?.readString()
37+
jsonString = file.readString()
3638
}
37-
val root = jsonString.value?.let { parseTrace(it) }
39+
val root = jsonString?.let { parseTrace(it) }
3840

3941
if (root != null) {
4042
DrawWorkflowTree(root)

workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/WorkflowTree.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import androidx.compose.foundation.layout.fillMaxSize
1010
import androidx.compose.foundation.layout.padding
1111
import androidx.compose.material.Text
1212
import androidx.compose.runtime.Composable
13+
import androidx.compose.runtime.getValue
1314
import androidx.compose.runtime.mutableStateOf
1415
import androidx.compose.runtime.remember
16+
import androidx.compose.runtime.setValue
1517
import androidx.compose.ui.Alignment
1618
import androidx.compose.ui.Modifier
1719
import androidx.compose.ui.graphics.Color
@@ -68,16 +70,16 @@ public fun DrawWorkflowTree(
6870
private fun DrawNode(
6971
node: WorkflowNode,
7072
) {
71-
val open = remember { mutableStateOf(false) }
73+
var open by remember { mutableStateOf(false) }
7274
Box(
7375
modifier = Modifier
74-
.clickable { open.value = !open.value }
76+
.clickable { open = !open }
7577
.padding(10.dp)
7678
) {
7779
Column(horizontalAlignment = Alignment.CenterHorizontally) {
7880
Text(text = node.name)
7981
Text(text = "ID: ${node.id}")
80-
if (open.value) {
82+
if (open) {
8183
Text("node is opened")
8284
}
8385
}

0 commit comments

Comments
 (0)