Skip to content

Commit

Permalink
feat:Ktlint format
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinnZou committed Dec 27, 2023
1 parent f438a52 commit 1b30695
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class CustomWebViewJsBridge : WebViewJsBridge() {
init {
register(GreetJsMessageHandler())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.multiplatform.webview.util

internal actual fun getPlatform(): Platform {
return Platform.Android
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ interface IWebView {
KLogger.d {
"IWebView injectInitJS"
}
val initJs = """
val initJs =
"""
window.kmpJsBridge = {
callbacks: {},
callbackId: 0,
Expand All @@ -183,7 +184,7 @@ interface IWebView {
}
}
};
""".trimIndent()
""".trimIndent()
evaluateJavaScript(initJs)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.multiplatform.webview.util

internal actual fun getPlatform(): Platform {
return Platform.Desktop
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class WKJsMessageHandler(private val webViewJsBridge: WebViewJsBridge) :
NSObject() {
override fun userContentController(
userContentController: WKUserContentController,
didReceiveScriptMessage: WKScriptMessage
didReceiveScriptMessage: WKScriptMessage,
) {
val body = didReceiveScriptMessage.body
val method = didReceiveScriptMessage.name
Expand All @@ -28,4 +28,4 @@ class WKJsMessageHandler(private val webViewJsBridge: WebViewJsBridge) :
webViewJsBridge.dispatch(message)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.multiplatform.webview.util

internal actual fun getPlatform(): Platform {
return Platform.IOS
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import platform.darwin.NSObject
/**
* Created By Kevin Zou On 2023/9/13
*/
val observedProgressList = listOf(
"estimatedProgress",
"title",
"URL",
"canGoBack",
"canGoForward",
)
val observedProgressList =
listOf(
"estimatedProgress",
"title",
"URL",
"canGoBack",
"canGoForward",
)

/**
* Adds observers for the given properties
Expand Down Expand Up @@ -48,9 +49,7 @@ fun WKWebView.removeObservers(
}

@OptIn(ExperimentalForeignApi::class)
fun WKWebView.addProgressObservers(
observer: NSObject,
) {
fun WKWebView.addProgressObservers(observer: NSObject) {
this.addObservers(
observer = observer,
properties = observedProgressList,
Expand All @@ -60,9 +59,7 @@ fun WKWebView.addProgressObservers(
/**
* Removes observers for the given properties
*/
fun WKWebView.removeProgressObservers(
observer: NSObject,
) {
fun WKWebView.removeProgressObservers(observer: NSObject) {
this.removeObservers(
observer = observer,
properties = observedProgressList,
Expand Down

0 comments on commit 1b30695

Please sign in to comment.