Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 2 additions & 2 deletions documentscanner-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ kotlin {
commonMain {
dependencies {
api(projects.documentscannerCore)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(libs.compose.runtime)
implementation(libs.compose.foundation)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,24 @@ actual fun rememberDocumentScanner(
}

private fun VNDocumentCameraViewController.setManualMode() {
// iOS < 26
val autoButton = view.findChild {
it.hasChild {
val text = (it as? UILabel)?.text
text == "Auto" || text == "Automatisch"
} != 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)
}
}
}
Expand All @@ -91,11 +102,11 @@ private fun UIView.findChildren(predicate: (UIView) -> Boolean): List<UIView> {
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
Expand Down
14 changes: 9 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" }
Expand Down