Skip to content

Commit

Permalink
1.7.0 iOS interop API (#pull/1494)[JetBrains/compose-multiplatform-co…
Browse files Browse the repository at this point in the history
  • Loading branch information
vickyleu committed Aug 31, 2024
1 parent 8cf9dd1 commit 3de0999
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
14 changes: 13 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ tasks.register("deletePackages") {
val mavenAuthor = "vickyleu"
val mavenGroup = "com.$mavenAuthor.$rootProjectName"

var versionCount:Int? = null

if(true){
val map = mapOf("1.0.2" to 1,"1.0.3" to 2)
versionCount=map["1.0.2"]
}


group = "publishing"
description = "Delete all packages in the GitHub Packages registry"

Expand All @@ -126,6 +134,7 @@ tasks.register("deletePackages") {
"Authorization" to "Bearer ${myExtra["githubToken"]}",
"X-GitHub-Api-Version" to "2022-11-28"
)
// 如何指定一个版本,比如有1.0.2和1.0.3两个版本,如何指定删除1.0.2版本
doLast {
runBlocking {
val executor = Executors.newFixedThreadPool(10)
Expand All @@ -140,9 +149,12 @@ tasks.register("deletePackages") {
fetchJobs.awaitAll().forEach { packages ->
allPackages.addAll(packages)
}

val deleteJobs = allPackages.filter { pkg ->
val packageName = pkg["name"] as String
packageName.contains(keyword)
packageName.contains(keyword) && if(versionCount!=null){
pkg["version_count"].toString().toInt() == versionCount
}else true
}.map { pkg ->
val packageType = pkg["package_type"] as String
val packageName = pkg["name"] as String
Expand Down
10 changes: 4 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ android-targetSdk = "34"
annotations = "23.0.0"
kcef = "2024.01.07.1"
kermit = "2.0.3"
kotlin = "2.0.10"
kotlin = "2.0.20"
jvmTarget = "17"
#compose-plugin = "1.6.11"
#compose-plugin = "1.7.0-dev1731"
#compose-plugin = "1.7.0-dev1756"
compose-plugin = "1.7.0-alpha01"
compose-plugin = "1.7.0-dev1783"
#compose-plugin = "1.7.0-alpha01"
dokka = "1.9.20"
ktlint = "12.1.1"
kotlinxSerializationJson = "1.6.3"
webkit = "1.11.0"
jetpack-compose-bom = "2024.06.00"
jetpack-compose-bom = "2024.08.00"
coroutines-bom = "1.8.1"
kotlinx-atomicfu = "0.25.0"
appcompat = "1.7.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion webview/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ buildscript {
}
}
group = "com.vickyleu.webview"
version = "1.0.2"
version = "1.0.3"

tasks.withType<PublishToMavenRepository> {
val isMac = getCurrentOperatingSystem().isMacOsX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.interop.UIKitView
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.viewinterop.UIKitInteropInteractionMode
import androidx.compose.ui.viewinterop.UIKitInteropProperties
import androidx.compose.ui.viewinterop.UIKitView
import com.multiplatform.webview.jsbridge.WebViewJsBridge
import com.multiplatform.webview.setting.PlatformWebSettings.MediaTypesRequiringUserActionForPlayback.ALL
import com.multiplatform.webview.setting.PlatformWebSettings.MediaTypesRequiringUserActionForPlayback.AUDIO
Expand Down Expand Up @@ -82,7 +86,7 @@ fun Size.isLargerThan(other: Size): Boolean {
/**
* iOS WebView implementation.
*/
@OptIn(ExperimentalForeignApi::class)
@OptIn(ExperimentalForeignApi::class, ExperimentalComposeUiApi::class)
@Composable
fun IOSWebView(
state: WebViewState,
Expand Down Expand Up @@ -186,7 +190,6 @@ fun IOSWebView(
webViewJsBridge?.webView = iosWebView
}
},
background = Color.White,
modifier = modifier,
onRelease = {
state.webView?.stopLoading()
Expand All @@ -197,6 +200,13 @@ fun IOSWebView(
it.navigationDelegate = null
onDispose(it)
},
properties = UIKitInteropProperties(
interactionMode= UIKitInteropInteractionMode.Cooperative(
delayMillis = 1,
),
// isInteractive = true,
isNativeAccessibilityEnabled = false
)
)
}
}
Expand Down

0 comments on commit 3de0999

Please sign in to comment.