Skip to content

Commit

Permalink
🐛 [kmp/helperPlatform] 添加一个16.4的版本比较,用于测试机器使用
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsword09 committed Nov 1, 2023
1 parent 04e7c2f commit ecc1866
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import platform.CoreGraphics.CGRectZero
import platform.Foundation.NSURL.Companion.URLWithString
import platform.Foundation.NSURLRequest.Companion.requestWithURL
import platform.Foundation.setValue
import platform.UIKit.UIDevice
import platform.WebKit.WKWebView
import platform.WebKit.WKWebViewConfiguration
import platform.WebKit.javaScriptEnabled
Expand All @@ -26,8 +27,10 @@ actual class OffscreenWebCanvas private actual constructor(width: Int, height: I
) : this(width, height) {
config.preferences.javaScriptEnabled = true
this.webview = WKWebView(frame = cValue { CGRectZero }, configuration = config).also {
// if(UIDevice.currentDevice.systemVersion)
it.setValue(value = true, forKey = "inspectable")
if(UIDevice.currentDevice.systemVersion.compareTo("16.4", true) >= 0) {
it.setValue(value = true, forKey = "inspectable")
}

CoroutineScope(mainAsyncExceptionHandler).launch {
it.loadRequest(requestWithURL(URLWithString(core.channel.getEntryUrl(width, height))!!))
}
Expand Down

0 comments on commit ecc1866

Please sign in to comment.