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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ Supported Compose version:
|-----------------|--------------------------|
| 1.7 | 0.1.0+ |
| 1.8 | 0.2.0+ |
| 1.9 | 0.3.0+ |

# Dependency
Add the dependency to your commonMain sourceSet (KMP) / Android dependencies (android only):
```kotlin
implementation("io.github.kalinjul.easydocumentscan:documentscanner:0.2.0")
implementation("io.github.kalinjul.easydocumentscan:documentscanner:0.3.0")
```

Or, for your libs.versions.toml:
```toml
[versions]
easydocumentscan = "0.2.0"
easydocumentscan = "0.3.0"
[libraries]
easydocumentscan = { module = "io.github.kalinjul.easydocumentscan:documentscanner", version.ref = "easydocumentscan" }
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import io.github.kalinjul.convention.config.configureAndroidTarget
import io.github.kalinjul.convention.config.configureKotlin
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

/**
* No JVM target, only android + ios
Expand All @@ -21,7 +21,11 @@ class KotlinMultiplatformMobileConventionPlugin : Plugin<Project> {
applyDefaultHierarchyTemplate()

if (pluginManager.hasPlugin("com.android.library")) {
this.configureAndroidTarget()
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget((libs.versions.jvmTarget.get())))
}
}
}
}
configureKotlin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ fun Project.configureKotlin() {
extensions.configure<KotlinMultiplatformExtension> {
targets.all {
compilations.all {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
compileTaskProvider.configure {
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
package io.github.kalinjul.convention.config

import org.gradle.api.JavaVersion
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import io.github.kalinjul.convention.libs

fun KotlinMultiplatformExtension.configureAndroidTarget() {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = JavaVersion.toVersion(project.libs.versions.jvmTarget.get()).toString()
}
}
}
}

fun KotlinMultiplatformExtension.configureIosTargets(baseName: String? = null) {
listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.uikit.LocalUIViewController
import platform.AVFoundation.AVErrorApplicationIsNotAuthorizedToUseDevice
import platform.UIKit.UIButton
import platform.UIKit.UIControlEventTouchUpInside
Expand Down Expand Up @@ -61,39 +61,13 @@ actual fun rememberDocumentScanner(
}

private fun VNDocumentCameraViewController.setManualMode() {
// val buttons = controller.view.findChildren { it is UIButton }
// buttons.forEach {
// println("${it.accessibilityLabel} ${it}")
// it.findChildren { true }.forEach {
// if (it is UILabel) {
// println(" ${it.text} ${it.accessibilityLabel} $it")
// if (it.text == "Auto") {
// println("Found Auto button")
// }
// }
// }
// }

val autoButton = view.findChild {
it.hasChild {
val text = (it as? UILabel)?.text
text == "Auto" || text == "Automatisch"
} != null
}
(autoButton as? UIButton)?.sendActionsForControlEvents(UIControlEventTouchUpInside)

// var view = autoButton
// println("View hierarchy:")
// while(view != null) {
// println(view)
// view = view.superview
// }

// val navigationbar = navigationController?.navigationBar
// println("Navigationbar: $navigationbar")
// buttons.find { it.accessibilityLabel?.contains("Filtereinstellungen") == true }?.removeFromSuperview()
// val imageViews = controller.view.findChildren { it is UIImageView }
// imageViews.forEach { it.removeFromSuperview() }
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
[versions]
compileSdk = "35"
targetSdk = "35"
compileSdk = "36"
targetSdk = "36"
minSdk = "24" # required for exif interface

jvmTarget = "17"
# https://developer.android.com/build/releases/gradle-plugin#compatibility
agp = "8.7.3"
agp = "8.11.1"

#https://github.com/JetBrains/compose-multiplatform
compose-multiplatform = "1.8.0"
compose-multiplatform = "1.9.0"
#https://kotlinlang.org/docs/multiplatform-compatibility-guide.html
kotlin = "2.1.20"
kotlin = "2.2.20"
# https://github.com/google/ksp
ksp = "2.1.20-1.0.32"
ksp = "2.2.20-2.0.3"

# https://developer.android.com/jetpack/androidx/releases/activity
androidxActivity = "1.10.1"
androidxActivity = "1.11.0"
# https://developer.android.com/jetpack/androidx/releases/appcompat
androidxAppCompat = "1.7.0"
coreKtx = "1.16.0"
androidxAppCompat = "1.7.1"
coreKtx = "1.17.0"

dokka = "1.9.20"
nexus-publish-plugin = "1.3.0"
nexus-publish-plugin = "2.0.0"
mlkit-document-scanner = "16.0.0-beta1"

[libraries]
Expand Down
2 changes: 1 addition & 1 deletion sample-app/android-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
kotlin {
androidTarget()
sourceSets {
val androidMain by getting {
androidMain {
dependencies {
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.core.ktx)
Expand Down
15 changes: 2 additions & 13 deletions sample-app/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
kotlin {
configureIosTargets()
sourceSets {
val commonMain by getting {
commonMain {
dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
Expand All @@ -20,21 +20,10 @@ kotlin {
implementation(projects.documentscanner)
}
}
val androidMain by getting {
androidMain {
dependencies {
// api(libs.androidx.activity.compose)
// api(libs.androidx.core.ktx)
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by getting {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}

targets.withType<KotlinNativeTarget>().configureEach {
Expand Down