diff options
| author | MohamedBassem <me@mbassem.com> | 2024-12-28 17:58:55 +0200 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-12-28 17:59:51 +0200 |
| commit | 74962d3bab7e43d4fd5fd2d045b4f9b3e975b64e (patch) | |
| tree | b7b629e970113be9868f6990d8a8aba224318f86 /apps | |
| parent | cc708a4d567098ff32f2c4020a450daff7bb2067 (diff) | |
| download | karakeep-74962d3bab7e43d4fd5fd2d045b4f9b3e975b64e.tar.zst | |
fix(mobile): Mark the camera explicitly as not required in android manifest. Fixed #755.
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/mobile/app.json | 1 | ||||
| -rw-r--r-- | apps/mobile/package.json | 3 | ||||
| -rw-r--r-- | apps/mobile/plugins/camera-not-required.js | 23 |
3 files changed, 26 insertions, 1 deletions
diff --git a/apps/mobile/app.json b/apps/mobile/app.json index 4772c25b..87db856f 100644 --- a/apps/mobile/app.json +++ b/apps/mobile/app.json @@ -51,6 +51,7 @@ "versionCode": 20 }, "plugins": [ + "./plugins/camera-not-required.js", "expo-router", [ "expo-share-intent", diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 5d4b6089..6f21820c 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -79,7 +79,8 @@ "ignorePatterns": [ "expo-plugins/**", "ios/**", - "android/**" + "android/**", + "plugins/**" ] }, "prettier": "@hoarder/prettier-config" diff --git a/apps/mobile/plugins/camera-not-required.js b/apps/mobile/plugins/camera-not-required.js new file mode 100644 index 00000000..75116604 --- /dev/null +++ b/apps/mobile/plugins/camera-not-required.js @@ -0,0 +1,23 @@ +const { withAndroidManifest } = require("@expo/config-plugins"); + +const withCameraNotRequired = (config) => { + return withAndroidManifest(config, async (config) => { + config.modResults = await setCustomConfigAsync(config, config.modResults); + return config; + }); +}; + +async function setCustomConfigAsync(_config, androidManifest) { + const usesFeature = androidManifest.manifest["uses-feature"] ?? []; + usesFeature.push({ + $: { + "android:name": "android.hardware.camera", + "android:required": "false", + }, + }); + androidManifest.manifest["uses-feature"] = usesFeature; + + return androidManifest; +} + +module.exports = withCameraNotRequired; |
