@onefootprint/footprint-native-camera-module
v0.1.0
Published
Native KMM camera module: detection, autocapture, and document capture UI for iOS + Android. Consumed by @onefootprint/footprint-expo-camera-module (the Expo bridge) and by HandoffSharedLogic.
Readme
footprint-native-camera-module
KMM module providing the native document capture screen, detection / autocapture, and per-side upload contract. Same source consumed by:
HandoffSharedLogic— via SwiftPM (iOS) and a Gradle composite build (Android), for the existing handoff flow.@onefootprint/footprint-expo-camera-module— via React Native autolinking (iOS podspec + Android gradle subproject), for the Expo SDK's native document capture.
Public surface (common)
| File | What |
|---|---|
| CameraCaptureState.kt / CaptureMode.kt / AutoCaptureStatus.kt | Camera/capture state enums (.value: String for cross-runtime mapping). |
| DocumentSide.kt | typealias DocumentSide = String + DocumentSides constants. |
| CaptureAppearance.kt / CaptureTheme.kt | Theme contract painted by the capture screen. Built via CaptureAppearance.fromVariables(...) from the broader Appearance.variables bag. |
| CaptureCopy.kt / CaptureTranslations.kt | Localized copy table keyed by language code. |
| CaptureUploadClient.kt | Interface for per-side upload + process. Adapters provided by consumers. |
Public surface (Android)
| File | What |
|---|---|
| DocumentCaptureScreen.kt | Compose screen. Same name as iOS's SwiftUI view. |
| DocumentCaptureActivity.kt | Hosts the Compose screen. Declared in this module's AndroidManifest.xml; merged into consumer apps automatically. |
| DocumentCaptureContract.kt | ActivityResultContract<DocumentCaptureInput, DocumentCaptureOutcome>. |
| AutocaptureManager.kt / DocumentDetection.kt / FaceDetection.kt | Per-frame detection. |
Public surface (iOS — via FootprintNativeCameraSwift/Sources/)
| File | What |
|---|---|
| DocumentCaptureScreen.swift | SwiftUI view. Wrap in UIHostingController from UIKit hosts. |
| CameraManager.swift / AutocaptureManager.swift / CameraPreview.swift / PhotoPicker.swift | Capture primitives. |
Distribution
| Target | How |
|---|---|
| HandoffSwift (iOS) | Consumes FootprintNativeCameraSwift/Package.swift (SwiftPM). |
| HandoffSharedLogic (Android) | Composite Gradle build — includeBuild("../footprint-native-camera-module") in HandoffSharedLogic/settings.gradle.kts. |
| Expo bridge (both) | React Native autolinking via react-native.config.js → FootprintNativeCameraSwift.podspec (iOS) + android/build.gradle (Android). |
Build
pnpm build:native # ./gradlew :shared:assembleRelease + :shared:packForXcode, copies AAR to android/libs/
pnpm build:android # just the AAR
pnpm build:ios # just the xcframeworkOutputs:
FootprintNativeCameraSwift/Frameworks/FootprintNativeCamera.xcframework— Kotlin typesandroid/libs/footprint-native-camera-module.aar— Android library- Both are gitignored and regenerated from source.
Dev workflow
When you change Kotlin or Swift in this module:
# In this directory:
pnpm build:native # rebuilds xcframework + AAR
yalc publish # pushes to local yalc store
# In any consumer (footprint-expo-camera-module, ...):
yalc update # pulls the latest from yalc
pnpm installFor HandoffSwift / HandoffSharedLogic, no yalc — they consume sources via SwiftPM / composite Gradle build directly.
Publishing to npm
Published as @onefootprint/footprint-native-camera-module via the mobile_npm_publish GitHub
workflow (macOS runner, npm OIDC trusted publishing). prepack runs build:native, so the
gitignored xcframeworks + AAR are rebuilt from source and packed into the tarball. Preview the
tarball contents with npm pack --dry-run.
Publish the native module before the Expo bridge — the bridge peer-depends on it.
