xref: /expo/packages/expo-dev-launcher/plugin/src/withDevLauncher.ts (revision 04e66b12)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import {
2  createRunOncePlugin,
3  AndroidConfig,
4  withInfoPlist,
5  withAndroidManifest,
6} from 'expo/config-plugins';
7
8import { PluginConfigType, validateConfig } from './pluginConfig';
9
10const pkg = require('expo-dev-launcher/package.json');
11
12export default createRunOncePlugin<PluginConfigType>(
13  (config, props) => {
14    validateConfig(props || {});
15
16    if (props.ios?.tryToLaunchLastOpenedBundle ?? props.tryToLaunchLastOpenedBundle) {
17      config = withInfoPlist(config, (config) => {
18        config.modResults['DEV_CLIENT_TRY_TO_LAUNCH_LAST_BUNDLE'] = true;
19        return config;
20      });
21    }
22
23    if (props.android?.tryToLaunchLastOpenedBundle ?? props.tryToLaunchLastOpenedBundle) {
24      config = withAndroidManifest(config, (config) => {
25        const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);
26
27        AndroidConfig.Manifest.addMetaDataItemToMainApplication(
28          mainApplication,
29          'DEV_CLIENT_TRY_TO_LAUNCH_LAST_BUNDLE',
30          true?.toString()
31        );
32        return config;
33      });
34    }
35
36    return config;
37  },
38  pkg.name,
39  pkg.version
40);
41

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025