diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-07-13 01:22:56 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-07-13 01:22:56 +0200 |
commit | 426da03b5a4e2d715c086e1bfd92b34358ae17ee (patch) | |
tree | c842225bf95ee06399cbc9caf546d467f24246cf | |
parent | ba5c00b6992d28cfb6afc7fab108c9009f9e1b7c (diff) | |
download | kvision-426da03b5a4e2d715c086e1bfd92b34358ae17ee.tar.gz kvision-426da03b5a4e2d715c086e1bfd92b34358ae17ee.tar.bz2 kvision-426da03b5a4e2d715c086e1bfd92b34358ae17ee.zip |
Style fixes. Suppress style warnings.
11 files changed, 22 insertions, 8 deletions
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<FileSystem, FileException> { 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() } } diff --git a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt index 8de8d088..a375ef35 100644 --- a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt +++ b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt @@ -260,12 +260,15 @@ open class DateTimeInput( private fun initEventHandlers() { this.getElementJQuery()?.on("changeDate") { e, _ -> + @Suppress("UnsafeCastFromDynamic") this.dispatchEvent("change", obj { detail = e }) } this.getElementJQuery()?.on("show") { e, _ -> + @Suppress("UnsafeCastFromDynamic") this.dispatchEvent("showBsDateTime", obj { detail = e }) } this.getElementJQuery()?.on("hide") { e, _ -> + @Suppress("UnsafeCastFromDynamic") this.dispatchEvent("hideBsDateTime", obj { detail = e }) } } diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt index d3331b2a..86d90e4c 100644 --- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt +++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt @@ -33,10 +33,7 @@ import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.list import kotlinx.serialization.serializer import kotlinx.serialization.stringify -import kotlin.js.console -import kotlin.js.js import kotlin.reflect.KClass -import kotlin.js.JSON as NativeJSON /** * Client side agent for JSON-RPC remote calls. diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt index 47fbe538..290f9f39 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt @@ -380,7 +380,10 @@ open class Tabulator<T : Any>( open fun applyFilter() { if (filter != null) { jsTabulator?.setFilter({ data: dynamic, _: dynamic -> - filter?.let { it(data) } + filter?.let { + @Suppress("UnsafeCastFromDynamic") + it(data) + } }, null, null) } } diff --git a/src/main/kotlin/pl/treksoft/kvision/core/PopupOptions.kt b/src/main/kotlin/pl/treksoft/kvision/core/PopupOptions.kt index c929bea9..0f921f42 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/PopupOptions.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/PopupOptions.kt @@ -62,7 +62,7 @@ data class TooltipOptions( * @return JSON object */ fun TooltipOptions.toJs(): dynamic { - val trigger = this.triggers?.map { it.trigger }?.joinToString(" ") + val trigger = this.triggers?.joinToString(" ") { it.trigger } return obj { if (this@toJs.title != null) this.title = this@toJs.title if (this@toJs.rich != null) this.html = this@toJs.rich @@ -93,7 +93,7 @@ data class PopoverOptions( * @return JSON object */ fun PopoverOptions.toJs(): dynamic { - val trigger = this.triggers?.map { it.trigger }?.joinToString(" ") + val trigger = this.triggers?.joinToString(" ") { it.trigger } return obj { if (this@toJs.content != null) this.content = this@toJs.content if (this@toJs.title != null) this.title = this@toJs.title diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt index 5f911539..7f120f73 100644 --- a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt +++ b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt @@ -128,6 +128,7 @@ open class Modal( content.add(header) content.add(body) content.add(footer) + @Suppress("LeakingThis") modals.add(this) @Suppress("LeakingThis") init?.invoke(this) diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt index ae8360b5..f620f2b0 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt @@ -160,6 +160,7 @@ open class TabPanel( click = { e -> val actIndex = this@TabPanel.content.children.indexOf(childrenMap[currentIndex]) e.asDynamic().data = actIndex + @Suppress("UnsafeCastFromDynamic") if (this@TabPanel.dispatchEvent( "tabClosing", obj { detail = e; cancelable = true }) != false |