diff options
author | Nick Manos <nick@manos.tech> | 2024-05-29 05:56:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-29 02:56:36 -0700 |
commit | 65ad16e394d0525d68e6fc8cd9508de4675c88d5 (patch) | |
tree | e698258d8942eb6a3e3df38de31f0d762c2ae73b /plugins | |
parent | 33de856c32711b2b5a83d5b27583eec0cc6e1248 (diff) | |
download | voidsky-65ad16e394d0525d68e6fc8cd9508de4675c88d5.tar.zst |
Change Android's MainActivity launchMode to singleTop (#4255)
* Add build config plugin to set .MainActivity launchMode * Change android:launchMode to standard * Revert "Change android:launchMode to standard" This reverts commit fddbc4e1b512ff9a55009e227f1f44e99ddabaf3. * adjust --------- Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/withAndroidManifestLaunchModePlugin.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/withAndroidManifestLaunchModePlugin.js b/plugins/withAndroidManifestLaunchModePlugin.js new file mode 100644 index 000000000..45ab9aeb7 --- /dev/null +++ b/plugins/withAndroidManifestLaunchModePlugin.js @@ -0,0 +1,17 @@ +const {withAndroidManifest} = require('expo/config-plugins') + +module.exports = function withAndroidManifestLaunchModePlugin(appConfig) { + return withAndroidManifest(appConfig, function (decoratedAppConfig) { + try { + const mainApplication = + decoratedAppConfig.modResults.manifest.application[0] + const mainActivity = mainApplication.activity.find( + elem => elem.$['android:name'] === '.MainActivity', + ) + mainActivity.$['android:launchMode'] = 'singleTop' + } catch (e) { + console.error(`withAndroidManifestLaunchModePlugin failed`, e) + } + return decoratedAppConfig + }) +} |