From 426da03b5a4e2d715c086e1bfd92b34358ae17ee Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 13 Jul 2019 01:22:56 +0200 Subject: Style fixes. Suppress style warnings. --- .../src/main/kotlin/pl/treksoft/kvision/cordova/Camera.kt | 2 ++ .../src/main/kotlin/pl/treksoft/kvision/cordova/File.kt | 3 ++- .../src/main/kotlin/pl/treksoft/kvision/cordova/InAppBrowser.kt | 1 + .../src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt | 5 ++++- .../src/main/kotlin/pl/treksoft/kvision/cordova/Splashscreen.kt | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) (limited to 'kvision-modules/kvision-cordova') diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Camera.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Camera.kt index 40c731c7..44f51a3f 100644 --- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Camera.kt +++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Camera.kt @@ -158,8 +158,10 @@ object Camera { if (isCameraActive && resumeEvent.pendingResult != null) { window.localStorage.removeItem(CAMERA_ACTIVE_STORAGE_KEY) if (resumeEvent.pendingResult.pluginStatus == CAMERA_STATUS_OK) { + @Suppress("UnsafeCastFromDynamic") resultCallback(Result.success(resumeEvent.pendingResult.result)) } else { + @Suppress("UnsafeCastFromDynamic") resultCallback(Result.error(CameraException(resumeEvent.pendingResult.result))) } } diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt index 6e7ba732..944042fa 100644 --- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt +++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt @@ -92,6 +92,7 @@ object File { suspend fun getSystemDirectories(): SystemDirs { return suspendCoroutine { continuation -> addDeviceReadyListener { + @Suppress("UnsafeCastFromDynamic") continuation.resume(window.asDynamic().cordova.file) } } @@ -163,7 +164,7 @@ object File { */ @Suppress("UnsafeCastFromDynamic") suspend fun requestFileSystem( - fileSystemType: File.FileSystemType, + fileSystemType: FileSystemType, size: Long = 0 ): Result { return suspendCoroutine { continuation -> diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/InAppBrowser.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/InAppBrowser.kt index c0c8f0b4..5ca8cf6f 100644 --- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/InAppBrowser.kt +++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/InAppBrowser.kt @@ -66,6 +66,7 @@ object InAppBrowser { return suspendCoroutine { continuation -> addDeviceReadyListener { val ref = window.asDynamic().cordova.InAppBrowser.open(url, target, options) + @Suppress("UnsafeCastFromDynamic") continuation.resume(ref) } } diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt index 6765b44e..a33b2453 100644 --- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt +++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt @@ -62,7 +62,10 @@ object Screen { */ fun getOrientation(): Orientation { val type = window.screen.asDynamic().orientation.type - return Orientation.values().find { it.type == type } ?: Screen.Orientation.ANY + return Orientation.values().find { + @Suppress("UnsafeCastFromDynamic") + it.type == type + } ?: Screen.Orientation.ANY } /** diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Splashscreen.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Splashscreen.kt index 03157534..c300c194 100644 --- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Splashscreen.kt +++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Splashscreen.kt @@ -34,6 +34,7 @@ object Splashscreen { */ fun show() { addDeviceReadyListener { + @Suppress("UnsafeCastFromDynamic") window.navigator.asDynamic().splashscreen.show() } } @@ -43,6 +44,7 @@ object Splashscreen { */ fun hide() { addDeviceReadyListener { + @Suppress("UnsafeCastFromDynamic") window.navigator.asDynamic().splashscreen.hide() } } -- cgit