From 81767c208c919cab1d6d92c461dcbe32c613e656 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 19 Jun 2024 20:36:12 -0700 Subject: [PATCH] kotlin: fix syntax of kotlin suggested by AS --- .../kotlin/pro/truongsinh/appium_flutter/FlutterFinder.kt | 5 ++--- .../pro/truongsinh/appium_flutter/finder/serializer.kt | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/FlutterFinder.kt b/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/FlutterFinder.kt index c89eb307..374f8d2e 100644 --- a/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/FlutterFinder.kt +++ b/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/FlutterFinder.kt @@ -15,9 +15,8 @@ import pro.truongsinh.appium_flutter.finder.pageBack as _pageBack import pro.truongsinh.appium_flutter.finder.text as _text -public class FlutterFinder(driver: RemoteWebDriver) { - private val driver = driver - private val fileDetector = FileDetector({ _ -> null }) +public class FlutterFinder(private val driver: RemoteWebDriver) { + private val fileDetector = FileDetector { _ -> null } fun ancestor(of: FlutterElement, matching: FlutterElement, matchRoot: Boolean = false, firstMatchOnly: Boolean = false): FlutterElement { val f = _ancestor(of, matching, matchRoot, firstMatchOnly) f.setParent(driver) diff --git a/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/finder/serializer.kt b/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/finder/serializer.kt index 6bc4ce8d..08ff7181 100644 --- a/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/finder/serializer.kt +++ b/finder/kotlin/src/main/kotlin/pro/truongsinh/appium_flutter/finder/serializer.kt @@ -21,8 +21,7 @@ fun serialize(o: Map): String { @UseExperimental(ImplicitReflectionSerializer::class) fun jsonObjectFrom(o: Map): Map { return o.map { - val value = it.value - val jsonO = when (value) { + val jsonO = when (val value = it.value) { is String -> JsonLiteral(value) is Number -> JsonLiteral(value) is Boolean -> JsonLiteral(value)