Bump ausbc to 3.3.3 and remove ContextWrapper hack
This commit is contained in:
1 parent
a509dc4e59
commit
aec447a2ff
7 files changed
+11
-50
No files matched your search
@@ -92,8 +92,8 @@ android {
|
||||
applicationId 'de.orfel.schnappix'
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 44
|
||||
versionName "23.01.44"
|
||||
versionCode 45
|
||||
versionName "23.01.45"
|
||||
|
||||
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
"newArchEnabled": true,
|
||||
"name": "Schnappix",
|
||||
"slug": "Schnappix",
|
||||
"version": "23.01.44",
|
||||
"version": "23.01.45",
|
||||
"orientation": "landscape",
|
||||
"icon": "./Icon.png",
|
||||
"userInterfaceStyle": "dark",
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"android": {
|
||||
"package": "de.orfel.schnappix",
|
||||
"versionCode": 44,
|
||||
"versionCode": 45,
|
||||
"usesCleartextTraffic": true,
|
||||
"adaptiveIcon": {
|
||||
"backgroundColor": "#050510",
|
||||
|
||||
@@ -27,7 +27,7 @@ repositories {
|
||||
dependencies {
|
||||
implementation 'com.facebook.react:react-android'
|
||||
// AndroidUSBCamera library for USB/UVC Webcams
|
||||
implementation('com.github.jiangdongguo.AndroidUSBCamera:libausbc:3.2.7') {
|
||||
implementation('com.github.jiangdongguo.AndroidUSBCamera:libausbc:3.3.3') {
|
||||
exclude group: 'com.gyf.immersionbar', module: 'immersionbar'
|
||||
exclude group: 'com.zlc.glide', module: 'webpdecoder'
|
||||
}
|
||||
|
||||
@@ -92,50 +92,8 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
|
||||
activityContext.registerReceiver(permissionReceiver, filter)
|
||||
}
|
||||
|
||||
// Create a ContextWrapper that automatically injects RECEIVER_EXPORTED
|
||||
// This is required to fix the crash on Android 14+ when the 3rd party ausbc library
|
||||
// calls registerReceiver without the required flag.
|
||||
val wrappedContext = object : android.content.ContextWrapper(activityContext), androidx.lifecycle.LifecycleOwner {
|
||||
override val lifecycle: androidx.lifecycle.Lifecycle
|
||||
get() {
|
||||
if (activityContext is androidx.lifecycle.LifecycleOwner) {
|
||||
return (activityContext as androidx.lifecycle.LifecycleOwner).lifecycle
|
||||
}
|
||||
// Fallback to avoid crash, though CameraX needs a real lifecycle
|
||||
throw IllegalStateException("activityContext is not a LifecycleOwner!")
|
||||
}
|
||||
|
||||
override fun getApplicationContext(): android.content.Context {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun registerReceiver(
|
||||
receiver: android.content.BroadcastReceiver?,
|
||||
filter: android.content.IntentFilter?
|
||||
): android.content.Intent? {
|
||||
return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
|
||||
super.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED)
|
||||
} else {
|
||||
super.registerReceiver(receiver, filter)
|
||||
}
|
||||
}
|
||||
|
||||
override fun registerReceiver(
|
||||
receiver: android.content.BroadcastReceiver?,
|
||||
filter: android.content.IntentFilter?,
|
||||
broadcastPermission: String?,
|
||||
scheduler: android.os.Handler?
|
||||
): android.content.Intent? {
|
||||
return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
|
||||
super.registerReceiver(receiver, filter, broadcastPermission, scheduler, Context.RECEIVER_EXPORTED)
|
||||
} else {
|
||||
super.registerReceiver(receiver, filter, broadcastPermission, scheduler)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cameraClient = CameraClient.newBuilder(wrappedContext)
|
||||
.setCameraStrategy(CameraUvcStrategy(wrappedContext))
|
||||
cameraClient = CameraClient.newBuilder(activityContext)
|
||||
.setCameraStrategy(CameraUvcStrategy(activityContext))
|
||||
.setCameraRequest(cameraRequest)
|
||||
.setEnableGLES(false)
|
||||
.build()
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "schnappix",
|
||||
"version": "23.01.44",
|
||||
"version": "23.01.45",
|
||||
"main": "index.ts",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
||||
|
||||
Reference in new issue
Block a user