diff --git a/README.md b/README.md index 4464efd..602adff 100644 --- a/README.md +++ b/README.md @@ -14,20 +14,21 @@ Supported Compose versions: | 0.1.0+ | 1.7 | | 0.2.0+ | 1.8 | | 0.3.0+ | 1.9 | +| 0.4.0+ | 1.10 | # Dependency > [!NOTE] -> Artifact id changed from "documentscanner" to "documentscanner-compose" and a new "documentscanner-core" artifact was introduced with 0.3.2 that contains the KmpFile abstraction as well as some Helper functions. +> Starting with 0.3.2, artifact id changed from "documentscanner" to "documentscanner-compose" and a new "documentscanner-core" artifact was introduced that contains the KmpFile abstraction as well as some Helper functions. Add the dependency to your commonMain sourceSet (KMP) / Android dependencies (android only): ```kotlin -implementation("io.github.kalinjul.easydocumentscan:documentscanner-compose:0.3.2") +implementation("io.github.kalinjul.easydocumentscan:documentscanner-compose:0.4.0") ``` Or, for your libs.versions.toml: ```toml [versions] -easydocumentscanner = "0.3.2" +easydocumentscanner = "0.4.0" [libraries] easydocumentscanner-compose = { module = "io.github.kalinjul.easydocumentscan:documentscanner-compose", version.ref = "easydocumentscanner" } easydocumentscanner-core = { module = "io.github.kalinjul.easydocumentscan:documentscanner-core", version.ref = "easydocumentscanner" } diff --git a/documentscanner-compose/build.gradle.kts b/documentscanner-compose/build.gradle.kts index ec46ac5..0b50db4 100644 --- a/documentscanner-compose/build.gradle.kts +++ b/documentscanner-compose/build.gradle.kts @@ -23,8 +23,8 @@ kotlin { commonMain { dependencies { api(projects.documentscannerCore) - implementation(compose.runtime) - implementation(compose.foundation) + implementation(libs.compose.runtime) + implementation(libs.compose.foundation) } } diff --git a/documentscanner-compose/src/iosMain/kotlin/io/github/kalinjul/easydocumentscan/DocumentScanner.ios.kt b/documentscanner-compose/src/iosMain/kotlin/io/github/kalinjul/easydocumentscan/DocumentScanner.ios.kt index 7a9a206..f89f2eb 100644 --- a/documentscanner-compose/src/iosMain/kotlin/io/github/kalinjul/easydocumentscan/DocumentScanner.ios.kt +++ b/documentscanner-compose/src/iosMain/kotlin/io/github/kalinjul/easydocumentscan/DocumentScanner.ios.kt @@ -61,6 +61,7 @@ actual fun rememberDocumentScanner( } private fun VNDocumentCameraViewController.setManualMode() { + // iOS < 26 val autoButton = view.findChild { it.hasChild { val text = (it as? UILabel)?.text @@ -68,6 +69,16 @@ actual fun rememberDocumentScanner( } != null } (autoButton as? UIButton)?.sendActionsForControlEvents(UIControlEventTouchUpInside) + + // iOS 26 + val shutterButton = view.findChild { + it.hasChild { + val text = (it as? UILabel)?.text + text == "Shutter" || text == "Verschluss" + } != null + } + + (shutterButton?.subviews?.firstOrNull() as? UIButton)?.sendActionsForControlEvents(UIControlEventTouchUpInside) } } } @@ -91,11 +102,11 @@ private fun UIView.findChildren(predicate: (UIView) -> Boolean): List { private fun UIView.findChild(predicate: (UIView) -> Boolean): UIView? { subviews.forEach { val view:UIView? = it as? UIView - when(view) { - is UIButton -> println(view) - is UILabel -> println(view.text) - else -> println(view) - } +// when(view) { +// is UIButton -> println(view) +// is UILabel -> println(view.text) +// else -> println(view) +// } if (view != null && predicate(view)) { return view diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d40aea2..a94aeba 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,17 +5,17 @@ minSdk = "24" # required for exif interface jvmTarget = "17" # https://developer.android.com/build/releases/gradle-plugin#compatibility -agp = "8.11.1" +agp = "8.13.0" #https://github.com/JetBrains/compose-multiplatform -compose-multiplatform = "1.9.0" +compose-multiplatform = "1.10.1" #https://kotlinlang.org/docs/multiplatform-compatibility-guide.html -kotlin = "2.2.20" +kotlin = "2.2.21" # https://github.com/google/ksp -ksp = "2.2.20-2.0.3" +ksp = "2.3.4" # https://developer.android.com/jetpack/androidx/releases/activity -androidxActivity = "1.11.0" +androidxActivity = "1.12.4" # https://developer.android.com/jetpack/androidx/releases/appcompat androidxAppCompat = "1.7.1" coreKtx = "1.17.0" @@ -30,6 +30,10 @@ androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "a androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } mlkit-documentscanner = { module = "com.google.android.gms:play-services-mlkit-document-scanner", version.ref = "mlkit-document-scanner" } +# compose +compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "compose-multiplatform" } +compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "compose-multiplatform" } + # Build logic dependencies android-gradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "agp" } kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }