diff --git a/.gitignore b/.gitignore index 7d51a70..cf85a36 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ +### Fleet ### +.fleet/run.json + ### IntelliJ IDEA ### .idea/modules.xml .idea/jarRepositories.xml diff --git a/camera-permission/build.gradle.kts b/camera-permission/build.gradle.kts index 6ab9fb2..117249a 100644 --- a/camera-permission/build.gradle.kts +++ b/camera-permission/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl + plugins { alias(libs.plugins.kotlin.multiplatform) apply true alias(libs.plugins.android.library) apply true @@ -25,9 +27,15 @@ kotlin { iosArm64() iosSimulatorArm64() + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser() + } + applyDefaultHierarchyTemplate() sourceSets { + val stubMain by creating val desktopMain by getting commonMain.dependencies { @@ -36,6 +44,8 @@ kotlin { implementation(project(":util")) } + stubMain.dependsOn(commonMain.get()) + androidMain.dependencies { implementation(libs.accompanist.permissions) } @@ -43,6 +53,7 @@ kotlin { implementation(libs.webcam.capture) implementation(libs.webcam.capture.driver.native) } + wasmJsMain.get().dependsOn(stubMain) } } diff --git a/camera-permission/src/stubMain/kotlin/in/procyk/compose/camera/permission/CameraPermission.kt b/camera-permission/src/stubMain/kotlin/in/procyk/compose/camera/permission/CameraPermission.kt new file mode 100644 index 0000000..c41e27d --- /dev/null +++ b/camera-permission/src/stubMain/kotlin/in/procyk/compose/camera/permission/CameraPermission.kt @@ -0,0 +1,17 @@ +package `in`.procyk.compose.camera.permission + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember + +@Composable +actual fun rememberCameraPermissionState(): CameraPermissionState = remember { + UnavailableCameraPermissionState +} + +private object UnavailableCameraPermissionState : CameraPermissionState { + override val isAvailable: Boolean = false + + override val permission: CameraPermission = CameraPermission.Denied + + override fun launchRequest() = Unit +} \ No newline at end of file diff --git a/camera-qr/build.gradle.kts b/camera-qr/build.gradle.kts index 64be3c4..9eb2f8c 100644 --- a/camera-qr/build.gradle.kts +++ b/camera-qr/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl + plugins { alias(libs.plugins.kotlin.multiplatform) apply true alias(libs.plugins.android.library) apply true @@ -25,9 +27,15 @@ kotlin { iosArm64() iosSimulatorArm64() + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser() + } + applyDefaultHierarchyTemplate() sourceSets { + val stubMain by creating val desktopMain by getting commonMain.dependencies { @@ -36,6 +44,8 @@ kotlin { implementation(project(":util")) } + stubMain.dependsOn(commonMain.get()) + androidMain.dependencies { implementation(libs.androidx.camera) implementation(libs.androidx.cameraLifecycle) @@ -50,6 +60,7 @@ kotlin { implementation(libs.webcam.capture.driver.native) implementation(libs.zxing.javase) } + wasmJsMain.get().dependsOn(stubMain) } } diff --git a/camera-qr/src/stubMain/kotlin/in/procyk/compose/camera/qr/QRCodeScanner.kt b/camera-qr/src/stubMain/kotlin/in/procyk/compose/camera/qr/QRCodeScanner.kt new file mode 100644 index 0000000..66e4612 --- /dev/null +++ b/camera-qr/src/stubMain/kotlin/in/procyk/compose/camera/qr/QRCodeScanner.kt @@ -0,0 +1,14 @@ +package `in`.procyk.compose.camera.qr + +import androidx.compose.runtime.* +import androidx.compose.ui.graphics.Color + +@Composable +actual fun QRCodeScanner( + onResult: (QRResult) -> Boolean, + onIsLoadingChange: (Boolean) -> Unit, + backgroundColor: Color, + contentDescription: String?, + missingCameraContent: @Composable () -> Unit, +) { +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 949e22c..dc62e94 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ barcodeScanning = "17.2.0" cameraX = "1.3.0" compose = "1.6.2" # @keep -compose-extensions = "1.6.2.0" +compose-extensions = "1.6.2.1" gradle-versions = "0.51.0" # @pin kotlin = "2.0.0-RC1"