diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log index 4f15af0b..7ef0b9e3 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log @@ -66,3 +66,5 @@ 7 49 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 4 58 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 3 37 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 +6 44 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 +5 43 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin index 646013a1..66d85898 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin @@ -2,41 +2,41 @@ C/C++ Structured Logg e cC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  Ô½µ³�4Å, ½Ñªðò3d +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ø“žÃ�4Å, ½Ñªðò3d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build.json  Ô½µ³�4û" ÂѪðò3i +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build.json  ø“žÃ�4û" ÂѪðò3i g -eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build_mini.json  Ô½µ³�4ï  Òªðò3V +eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build_mini.json  ø“žÃ�4ï  Òªðò3V T -RC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja  Ô½µ³�4œÞ åͪðò3Z +RC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja  ø“žÃ�4œÞ åͪðò3Z X -VC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja.txt  Ô½µ³�4_ +VC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja.txt  ø“žÃ�4_ ] -[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build_file_index.txt  Õ½µ³�4� ¨Òªðò3` +[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build_file_index.txt  ø“žÃ�4� ¨Òªðò3` ^ -\C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json  Õ½µ³�4‘Ø ãͪðò3d +\C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json  ø“žÃ�4‘Ø ãͪðò3d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json.bin  Õ½µ³�4 Ê„ ãͪðò3j +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json.bin  ø“žÃ�4 Ê„ ãͪðò3j h -fC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\metadata_generation_command.txt  Õ½µ³�4 +fC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\metadata_generation_command.txt  ø“žÃ�4 ¸ §Òªðò3] [ -YC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\prefab_config.json  Õ½µ³�4 € ¨Òªðò3b +YC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\prefab_config.json  ø“žÃ�4 € ¨Òªðò3b ` -^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\symbol_folder_index.txt  Õ½µ³�4  ] ¨Òªðò3{ +^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\symbol_folder_index.txt  ø“žÃ�4  ] ¨Òªðò3{ y -wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  Õ½µ³�4 ¾ Ü…§ðò3v +wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4 ¾ Ü…§ðò3v t -rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  Õ½µ³�4ö ùާðò3µ +rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4ö ùާðò3µ ² -¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  Õ½µ³�4Y +¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ø“žÃ�4Y W -UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  Õ½µ³�4½ œ§ØÖç3u +UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  ø“žÃ�4½ œ§ØÖç3u s -qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  Õ½µ³�4ê ú„§ðò3t +qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4ê ú„§ðò3t r -pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  Õ½µ³�4ê è„§ðò3³ +pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4ê è„§ðò3³ ° -­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  Õ½µ³�4k +­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ø“žÃ�4k i -gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  Õ½µ³�4ð ®¡ÈÑç3 \ No newline at end of file +gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  ø“žÃ�4ð ®¡ÈÑç3 \ No newline at end of file diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log index 036232ce..11533c22 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log @@ -66,3 +66,5 @@ 5 32 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 3 71 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 4 42 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 +4 42 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 +3 48 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin index 6cd332a2..e294d785 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin @@ -2,41 +2,41 @@ C/C++ Structured Logi g eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ÜÀµ³�4ý, ÷íðò3f +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  §—žÃ�4ý, ÷íðò3f d -bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build.json  ÜÀµ³�4�# øÃ­ðò3k +bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build.json  §—žÃ�4�# øÃ­ðò3k i -gC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build_mini.json  ÜÀµ³�4‘ ŸÄ­ðò3X +gC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build_mini.json  §—žÃ�4‘ ŸÄ­ðò3X V -TC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja  ÜÀµ³�4Áå âÀ­ðò3\ +TC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja  §—žÃ�4Áå âÀ­ðò3\ Z -XC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja.txt  ÜÀµ³�4a +XC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja.txt  §—žÃ�4a _ -]C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build_file_index.txt  ÜÀµ³�4�  Ä­ðò3b +]C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build_file_index.txt  §—žÃ�4�  Ä­ðò3b ` -^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json  ÜÀµ³�4´à àÀ­ðò3f +^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json  §—žÃ�4´à àÀ­ðò3f d -bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json.bin  ÜÀµ³�4 ò„ àÀ­ðò3l +bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json.bin  §—žÃ�4 ò„ àÀ­ðò3l j -hC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\metadata_generation_command.txt  ÜÀµ³�4 +hC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\metadata_generation_command.txt  §—žÃ�4 Ä ŸÄ­ðò3_ ] -[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\prefab_config.json  ÜÀµ³�4 € ŸÄ­ðò3d +[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\prefab_config.json  §—žÃ�4 € ŸÄ­ðò3d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\symbol_folder_index.txt  ÜÀµ³�4  _  Ä­ðò3{ +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\symbol_folder_index.txt  §—žÃ�4  _  Ä­ðò3{ y -wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  ÜÀµ³�4 ¾ Ü…§ðò3v +wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4 ¾ Ü…§ðò3v t -rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  ÜÀµ³�4ö ùާðò3µ +rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4ö ùާðò3µ ² -¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ÜÀµ³�4Y +¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  §—žÃ�4Y W -UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  ÜÀµ³�4½ œ§ØÖç3u +UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  §—žÃ�4½ œ§ØÖç3u s -qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  ÜÀµ³�4ê ú„§ðò3t +qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4ê ú„§ðò3t r -pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  ÜÀµ³�4ê è„§ðò3³ +pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4ê è„§ðò3³ ° -­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ÜÀµ³�4k +­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  §—žÃ�4k i -gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  ÜÀµ³�4ð ®¡ÈÑç3 \ No newline at end of file +gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  §—žÃ�4ð ®¡ÈÑç3 \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 474f9504..19161b31 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -92,8 +92,8 @@ android { applicationId 'de.orfel.schnappix' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 32 - versionName "23.01.32" + versionCode 33 + versionName "23.01.33" buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\"" } diff --git a/apks/Schnappix_v23.01.33.aab b/apks/Schnappix_v23.01.33.aab new file mode 100644 index 00000000..f9488904 Binary files /dev/null and b/apks/Schnappix_v23.01.33.aab differ diff --git a/apks/Schnappix_v23.01.33.apk b/apks/Schnappix_v23.01.33.apk new file mode 100644 index 00000000..e53a791b --- /dev/null +++ b/apks/Schnappix_v23.01.33.apk @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e7344cc0a688b4809affa8a34d283970124d1600783d92c4a005315616f3f5c +size 116713779 diff --git a/app.json b/app.json index 5bde7a88..38463187 100644 --- a/app.json +++ b/app.json @@ -3,7 +3,7 @@ "newArchEnabled": true, "name": "Schnappix", "slug": "Schnappix", - "version": "23.01.32", + "version": "23.01.33", "orientation": "landscape", "icon": "./Icon.png", "userInterfaceStyle": "dark", @@ -13,7 +13,7 @@ }, "android": { "package": "de.orfel.schnappix", - "versionCode": 32, + "versionCode": 33, "usesCleartextTraffic": true, "adaptiveIcon": { "backgroundColor": "#050510", diff --git a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt index d6c06b1b..e8140460 100644 --- a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt +++ b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt @@ -28,69 +28,75 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context textureView = AspectRatioTextureView(context) addView(textureView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)) - val cameraRequest = CameraRequest.Builder() - .setFrontCamera(false) - .create() - - val activityContext = appContext.currentActivity ?: context - - // Explicitly request permission for any connected USB camera before starting ausbc try { - val usbManager = context.getSystemService(Context.USB_SERVICE) as android.hardware.usb.UsbManager - val devices = usbManager.deviceList.values - android.util.Log.e("UsbCameraView", "Found ${devices.size} USB devices connected") - for (device in devices) { - android.util.Log.e("UsbCameraView", "Checking device: ${device.deviceName}, class: ${device.deviceClass}, interfaces: ${device.interfaceCount}") - if (!usbManager.hasPermission(device)) { - val intent = android.content.Intent("com.schnappix.USB_PERMISSION") - intent.setPackage(context.packageName) - val permissionIntent = android.app.PendingIntent.getBroadcast( - activityContext, - 0, - intent, - android.app.PendingIntent.FLAG_MUTABLE or android.app.PendingIntent.FLAG_UPDATE_CURRENT - ) - usbManager.requestPermission(device, permissionIntent) - android.util.Log.e("UsbCameraView", "Requested USB permission manually for ${device.deviceName}") - } else { - android.util.Log.e("UsbCameraView", "Already has USB permission for ${device.deviceName}") - } - } - } catch (e: Exception) { - e.printStackTrace() - } + val cameraRequest = CameraRequest.Builder() + .setFrontCamera(false) + .create() - val permissionReceiver = object : android.content.BroadcastReceiver() { - override fun onReceive(context: Context, intent: android.content.Intent) { - if ("com.schnappix.USB_PERMISSION" == intent.action) { - synchronized(this) { - val granted = intent.getBooleanExtra(android.hardware.usb.UsbManager.EXTRA_PERMISSION_GRANTED, false) - if (granted) { - android.util.Log.e("UsbCameraView", "Permission granted from Broadcast!") - startPreview() - } else { - android.util.Log.e("UsbCameraView", "Permission denied from Broadcast!") + val activityContext = appContext.currentActivity ?: context + + // Explicitly request permission for any connected USB camera before starting ausbc + try { + val usbManager = context.getSystemService(Context.USB_SERVICE) as android.hardware.usb.UsbManager + val devices = usbManager.deviceList.values + android.util.Log.e("UsbCameraView", "Found ${devices.size} USB devices connected") + for (device in devices) { + android.util.Log.e("UsbCameraView", "Checking device: ${device.deviceName}, class: ${device.deviceClass}, interfaces: ${device.interfaceCount}") + if (!usbManager.hasPermission(device)) { + val intent = android.content.Intent("com.schnappix.USB_PERMISSION") + intent.setPackage(context.packageName) + val permissionIntent = android.app.PendingIntent.getBroadcast( + activityContext, + 0, + intent, + android.app.PendingIntent.FLAG_MUTABLE or android.app.PendingIntent.FLAG_UPDATE_CURRENT + ) + usbManager.requestPermission(device, permissionIntent) + android.util.Log.e("UsbCameraView", "Requested USB permission manually for ${device.deviceName}") + } else { + android.util.Log.e("UsbCameraView", "Already has USB permission for ${device.deviceName}") + } + } + } catch (e: Exception) { + e.printStackTrace() + android.util.Log.e("UsbCameraView", "Error checking USB devices: ${e.message}", e) + } + + val permissionReceiver = object : android.content.BroadcastReceiver() { + override fun onReceive(context: Context, intent: android.content.Intent) { + if ("com.schnappix.USB_PERMISSION" == intent.action) { + synchronized(this) { + val granted = intent.getBooleanExtra(android.hardware.usb.UsbManager.EXTRA_PERMISSION_GRANTED, false) + if (granted) { + android.util.Log.e("UsbCameraView", "Permission granted from Broadcast!") + startPreview() + } else { + android.util.Log.e("UsbCameraView", "Permission denied from Broadcast!") + } } } } } - } - - val filter = android.content.IntentFilter("com.schnappix.USB_PERMISSION") - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) { - activityContext.registerReceiver(permissionReceiver, filter, Context.RECEIVER_EXPORTED) - } else { - activityContext.registerReceiver(permissionReceiver, filter) - } - - cameraClient = CameraClient.newBuilder(activityContext) - .setCameraStrategy(CameraUvcStrategy(activityContext)) - .setCameraRequest(cameraRequest) - .setEnableGLES(false) - .build() - post { - startPreview() + val filter = android.content.IntentFilter("com.schnappix.USB_PERMISSION") + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) { + activityContext.registerReceiver(permissionReceiver, filter, Context.RECEIVER_EXPORTED) + } else { + activityContext.registerReceiver(permissionReceiver, filter) + } + + cameraClient = CameraClient.newBuilder(activityContext) + .setCameraStrategy(CameraUvcStrategy(activityContext)) + .setCameraRequest(cameraRequest) + .setEnableGLES(false) + .build() + + post { + startPreview() + } + } catch (e: Throwable) { + android.util.Log.e("UsbCameraView", "CRASH IN INIT: ${e.message}", e) + e.printStackTrace() } } diff --git a/package.json b/package.json index c3ab9357..acd5ce27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "schnappix", - "version": "23.01.32", + "version": "23.01.33", "main": "index.ts", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.7.2",