chore: bump version to 23.01.49, fix Android 14 USB crash, and delay disconnected text
This commit is contained in:
1 parent
7048b72cc5
commit
5079cbed24
7 files changed
+66
-12
No files matched your search
@@ -93,7 +93,7 @@ android {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 48
|
||||
versionName "23.01.48"
|
||||
versionName "23.01.49"
|
||||
|
||||
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.48",
|
||||
"version": "23.01.49",
|
||||
"orientation": "landscape",
|
||||
"icon": "./Icon.png",
|
||||
"userInterfaceStyle": "dark",
|
||||
|
||||
@@ -14,6 +14,34 @@ import expo.modules.kotlin.Promise
|
||||
|
||||
import expo.modules.kotlin.viewevent.EventDispatcher
|
||||
import androidx.annotation.Keep
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
|
||||
class UsbContextWrapper(base: Context) : android.content.ContextWrapper(base), LifecycleOwner {
|
||||
override val lifecycle: Lifecycle
|
||||
get() = (baseContext as LifecycleOwner).lifecycle
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
|
||||
@@ -92,8 +120,10 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
|
||||
activityContext.registerReceiver(permissionReceiver, filter)
|
||||
}
|
||||
|
||||
cameraClient = CameraClient.newBuilder(activityContext)
|
||||
.setCameraStrategy(CameraUvcStrategy(activityContext))
|
||||
val safeContext = UsbContextWrapper(activityContext)
|
||||
|
||||
cameraClient = CameraClient.newBuilder(safeContext)
|
||||
.setCameraStrategy(CameraUvcStrategy(safeContext))
|
||||
.setCameraRequest(cameraRequest)
|
||||
.setEnableGLES(false)
|
||||
.build()
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "schnappix",
|
||||
"version": "23.01.48",
|
||||
"version": "23.01.49",
|
||||
"main": "index.ts",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
||||
|
||||
@@ -86,6 +86,20 @@ export default function CameraScreen({
|
||||
}: CameraScreenProps) {
|
||||
const [permission, requestPermission] = useCameraPermissions();
|
||||
const [isUsbConnected, setIsUsbConnected] = useState<boolean>(false);
|
||||
const [showDisconnectedText, setShowDisconnectedText] = useState<boolean>(false);
|
||||
|
||||
// Delay showing the "not connected" text so it doesn't flash during background reconnects
|
||||
useEffect(() => {
|
||||
let timeout: NodeJS.Timeout;
|
||||
if (!isUsbConnected) {
|
||||
timeout = setTimeout(() => {
|
||||
setShowDisconnectedText(true);
|
||||
}, 3000); // 3 seconds grace period
|
||||
} else {
|
||||
setShowDisconnectedText(false);
|
||||
}
|
||||
return () => clearTimeout(timeout);
|
||||
}, [isUsbConnected]);
|
||||
const [countdown, setCountdown] = useState<number | 'smile'>(countdownDuration);
|
||||
const [isCapturing, setIsCapturing] = useState<boolean>(false);
|
||||
const [hasStarted, setHasStarted] = useState<boolean>(false);
|
||||
@@ -744,13 +758,20 @@ export default function CameraScreen({
|
||||
onCameraReady={handleCameraReady}
|
||||
/>
|
||||
) : (
|
||||
<View style={[StyleSheet.absoluteFill, { backgroundColor: 'black', justifyContent: 'center', alignItems: 'center', zIndex: 20 }]}>
|
||||
<Text style={{ color: 'white', fontSize: 24, fontWeight: 'bold' }}>USB-Kamera nicht verbunden</Text>
|
||||
<Text style={{ color: 'gray', fontSize: 16, marginTop: 15, textAlign: 'center', paddingHorizontal: 40 }}>
|
||||
1. Überprüfe, ob das USB-Kabel richtig eingesteckt ist.{'\n\n'}
|
||||
2. Falls der Kiosk-Modus aktiv ist: Beende ihn kurz (oben rechts), stecke die Kamera neu ein und setze den Haken bei "Immer zulassen", wenn das Android-Popup erscheint.
|
||||
</Text>
|
||||
</View>
|
||||
showDisconnectedText ? (
|
||||
<View style={[StyleSheet.absoluteFill, { backgroundColor: 'black', justifyContent: 'center', alignItems: 'center', zIndex: 20 }]}>
|
||||
<Text style={{ color: 'white', fontSize: 24, fontWeight: 'bold' }}>USB-Kamera nicht verbunden</Text>
|
||||
<Text style={{ color: '#aaa', fontSize: 16, marginTop: 10 }}>Bitte Kabelverbindung prüfen...</Text>
|
||||
<Text style={{ color: 'gray', fontSize: 16, marginTop: 15, textAlign: 'center', paddingHorizontal: 40 }}>
|
||||
1. Überprüfe, ob das USB-Kabel richtig eingesteckt ist.{'\n\n'}
|
||||
2. Falls der Kiosk-Modus aktiv ist: Beende ihn kurz (oben rechts), stecke die Kamera neu ein und setze den Haken bei "Immer zulassen", wenn das Android-Popup erscheint.
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<View style={[StyleSheet.absoluteFill, { backgroundColor: 'black', justifyContent: 'center', alignItems: 'center', zIndex: 20 }]}>
|
||||
<ActivityIndicator size="large" color="#ff2bd6" />
|
||||
</View>
|
||||
)
|
||||
)
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user