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'
|
applicationId 'de.orfel.schnappix'
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 44
|
versionCode 45
|
||||||
versionName "23.01.44"
|
versionName "23.01.45"
|
||||||
|
|
||||||
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
|
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
|||||||
"newArchEnabled": true,
|
"newArchEnabled": true,
|
||||||
"name": "Schnappix",
|
"name": "Schnappix",
|
||||||
"slug": "Schnappix",
|
"slug": "Schnappix",
|
||||||
"version": "23.01.44",
|
"version": "23.01.45",
|
||||||
"orientation": "landscape",
|
"orientation": "landscape",
|
||||||
"icon": "./Icon.png",
|
"icon": "./Icon.png",
|
||||||
"userInterfaceStyle": "dark",
|
"userInterfaceStyle": "dark",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"package": "de.orfel.schnappix",
|
"package": "de.orfel.schnappix",
|
||||||
"versionCode": 44,
|
"versionCode": 45,
|
||||||
"usesCleartextTraffic": true,
|
"usesCleartextTraffic": true,
|
||||||
"adaptiveIcon": {
|
"adaptiveIcon": {
|
||||||
"backgroundColor": "#050510",
|
"backgroundColor": "#050510",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.facebook.react:react-android'
|
implementation 'com.facebook.react:react-android'
|
||||||
// AndroidUSBCamera library for USB/UVC Webcams
|
// 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.gyf.immersionbar', module: 'immersionbar'
|
||||||
exclude group: 'com.zlc.glide', module: 'webpdecoder'
|
exclude group: 'com.zlc.glide', module: 'webpdecoder'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,50 +92,8 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
|
|||||||
activityContext.registerReceiver(permissionReceiver, filter)
|
activityContext.registerReceiver(permissionReceiver, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a ContextWrapper that automatically injects RECEIVER_EXPORTED
|
cameraClient = CameraClient.newBuilder(activityContext)
|
||||||
// This is required to fix the crash on Android 14+ when the 3rd party ausbc library
|
.setCameraStrategy(CameraUvcStrategy(activityContext))
|
||||||
// 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))
|
|
||||||
.setCameraRequest(cameraRequest)
|
.setCameraRequest(cameraRequest)
|
||||||
.setEnableGLES(false)
|
.setEnableGLES(false)
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "schnappix",
|
"name": "schnappix",
|
||||||
"version": "23.01.44",
|
"version": "23.01.45",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
||||||
|
|||||||
Reference in new issue
Block a user