Skip to content

Commit

Permalink
add stubs for qr
Browse files Browse the repository at this point in the history
  • Loading branch information
avan1235 committed Apr 14, 2024
1 parent 666918a commit a7cac2e
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/

### Fleet ###
.fleet/run.json

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
Expand Down
11 changes: 11 additions & 0 deletions camera-permission/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -25,9 +27,15 @@ kotlin {
iosArm64()
iosSimulatorArm64()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
}

applyDefaultHierarchyTemplate()

sourceSets {
val stubMain by creating
val desktopMain by getting

commonMain.dependencies {
Expand All @@ -36,13 +44,16 @@ kotlin {

implementation(project(":util"))
}
stubMain.dependsOn(commonMain.get())

androidMain.dependencies {
implementation(libs.accompanist.permissions)
}
desktopMain.dependencies {
implementation(libs.webcam.capture)
implementation(libs.webcam.capture.driver.native)
}
wasmJsMain.get().dependsOn(stubMain)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
11 changes: 11 additions & 0 deletions camera-qr/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -25,9 +27,15 @@ kotlin {
iosArm64()
iosSimulatorArm64()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
}

applyDefaultHierarchyTemplate()

sourceSets {
val stubMain by creating
val desktopMain by getting

commonMain.dependencies {
Expand All @@ -36,6 +44,8 @@ kotlin {

implementation(project(":util"))
}
stubMain.dependsOn(commonMain.get())

androidMain.dependencies {
implementation(libs.androidx.camera)
implementation(libs.androidx.cameraLifecycle)
Expand All @@ -50,6 +60,7 @@ kotlin {
implementation(libs.webcam.capture.driver.native)
implementation(libs.zxing.javase)
}
wasmJsMain.get().dependsOn(stubMain)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
) {
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a7cac2e

Please sign in to comment.