Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev-launcher] rename tryToLaunchLastOpenedBundle config plugin option to launchModeExperimental #24758

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/expo-dev-launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
### 🎉 New features

- Improve 'Development servers' and 'Recently opened' UX. ([#24665](https://github.com/expo/expo/pull/24665) by [@gabrieldonadel](https://github.com/gabrieldonadel))
- Add support for skipping the launcher screen and launching directly into a previously opened project. ([#24614](https://github.com/expo/expo/pull/24614), [#24646](https://github.com/expo/expo/pull/24646) by [@gabrieldonadel](https://github.com/gabrieldonadel))
- Add support for skipping the launcher screen and launching directly into a previously opened project. ([#24614](https://github.com/expo/expo/pull/24614), [#24646](https://github.com/expo/expo/pull/24646), [#24758](https://github.com/expo/expo/pull/24758) by [@gabrieldonadel](https://github.com/gabrieldonadel))

### 🐛 Bug fixes

Expand Down
10 changes: 8 additions & 2 deletions packages/expo-dev-launcher/plugin/build/pluginConfig.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions packages/expo-dev-launcher/plugin/build/pluginConfig.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/expo-dev-launcher/plugin/build/withDevLauncher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions packages/expo-dev-launcher/plugin/src/pluginConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,45 @@ export type PluginConfigOptionsByPlatform = {
*/
export type PluginConfigOptions = {
/**
* Attempts to launch directly into a previously opened project. If unable to connect,
* **Experimental:** Determines whether to launch the most recently opened project or navigate to the launcher screen.
*
* - `'most-recent'` - Attempt to launch directly into a previously opened project and if unable to connect,
* fall back to the launcher screen.
*
* - `'launcher'` - Opens the launcher screen.
*
* @default 'launcher'
*/
tryToLaunchLastOpenedBundle?: boolean;
launchModeExperimental?: 'most-recent' | 'launcher';
};

const schema: JSONSchemaType<PluginConfigType> = {
type: 'object',
properties: {
tryToLaunchLastOpenedBundle: { type: 'boolean', nullable: true },
launchModeExperimental: {
type: 'string',
enum: ['most-recent', 'launcher'],
nullable: true,
},
android: {
type: 'object',
properties: {
tryToLaunchLastOpenedBundle: { type: 'boolean', nullable: true },
launchModeExperimental: {
type: 'string',
enum: ['most-recent', 'launcher'],
nullable: true,
},
},
nullable: true,
},
ios: {
type: 'object',
properties: {
tryToLaunchLastOpenedBundle: { type: 'boolean', nullable: true },
launchModeExperimental: {
type: 'string',
enum: ['most-recent', 'launcher'],
nullable: true,
},
},
nullable: true,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-dev-launcher/plugin/src/withDevLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export default createRunOncePlugin<PluginConfigType>(
(config, props = {}) => {
validateConfig(props);

if (props.ios?.tryToLaunchLastOpenedBundle ?? props.tryToLaunchLastOpenedBundle) {
if ((props.ios?.launchModeExperimental || props.launchModeExperimental) === 'most-recent') {
config = withInfoPlist(config, (config) => {
config.modResults['DEV_CLIENT_TRY_TO_LAUNCH_LAST_BUNDLE'] = true;
return config;
});
}

if (props.android?.tryToLaunchLastOpenedBundle ?? props.tryToLaunchLastOpenedBundle) {
if ((props.android?.launchModeExperimental || props.launchModeExperimental) === 'most-recent') {
config = withAndroidManifest(config, (config) => {
const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);

Expand Down