From ccb489051973e3c6b41b21433ff4a24125f67dfe Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 30 Jan 2026 15:13:29 +0200 Subject: [PATCH] allow creating profileable builds --- app.config.js | 1 + package.json | 1 + plugins/withProfileableAndroid.js | 32 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 plugins/withProfileableAndroid.js diff --git a/app.config.js b/app.config.js index 83fe9d7e86..0cbebb8420 100644 --- a/app.config.js +++ b/app.config.js @@ -289,6 +289,7 @@ module.exports = function (_config) { './plugins/withAndroidNoJitpackPlugin.js', './plugins/shareExtension/withShareExtensions.js', './plugins/notificationsExtension/withNotificationsExtension.js', + './plugins/withProfileableAndroid.js', [ 'expo-font', { diff --git a/package.json b/package.json index e8baad5c50..9b0a50c59d 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "prepare": "is-ci || husky install", "postinstall": "patch-package && yarn intl:compile-if-needed", "prebuild": "EXPO_NO_GIT_STATUS=1 expo prebuild --clean", + "prebuild:profile": "BSKY_PROFILE=1 EXPO_NO_GIT_STATUS=1 expo prebuild --clean", "android": "expo run:android", "android:prod": "expo run:android --variant release", "android:profile": "BSKY_PROFILE=1 expo run:android --variant release", diff --git a/plugins/withProfileableAndroid.js b/plugins/withProfileableAndroid.js new file mode 100644 index 0000000000..a7a31c644e --- /dev/null +++ b/plugins/withProfileableAndroid.js @@ -0,0 +1,32 @@ +const {withAndroidManifest} = require('@expo/config-plugins') + +module.exports = function withProfileableAndroid(config) { + return withAndroidManifest(config, mod => { + if (process.env.BSKY_PROFILE !== '1') return mod + + const manifest = mod.modResults.manifest + + // Ensure + manifest.$ = manifest.$ || {} + manifest.$['xmlns:tools'] = + manifest.$['xmlns:tools'] || 'http://schemas.android.com/tools' + + const app = manifest.application?.[0] + if (!app) return mod + + app.profileable = app.profileable || [] + const already = app.profileable.some( + p => p.$ && p.$['android:shell'] === 'true', + ) + if (!already) { + app.profileable.push({ + $: { + 'android:shell': 'true', + 'tools:targetApi': 'q', + }, + }) + } + + return mod + }) +}