expo-dev-launcher 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +33 -17
  2. package/README.md +3 -367
  3. package/android/build.gradle +5 -3
  4. package/android/src/debug/assets/expo_dev_launcher_android.bundle +415 -409
  5. package/android/src/debug/java/expo/modules/devlauncher/DevLauncherController.kt +21 -7
  6. package/android/src/debug/java/expo/modules/devlauncher/modules/DevLauncherInternalModule.kt +1 -2
  7. package/android/src/main/java/expo/modules/devlauncher/helpers/DevLauncherURLHelper.kt +1 -1
  8. package/android/src/main/java/expo/modules/devlauncher/launcher/DevLauncherControllerInterface.kt +2 -0
  9. package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherErrorActivity.kt +15 -3
  10. package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherUncaughtExceptionHandler.kt +87 -0
  11. package/android/src/main/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt +25 -3
  12. package/android/src/react-native-66/expo/modules/devlauncher/rncompatibility/DevLauncherDevSupportManager.kt +251 -0
  13. package/android/src/release/java/expo/modules/devlauncher/DevLauncherController.kt +4 -0
  14. package/expo-dev-launcher.podspec +2 -0
  15. package/ios/EXDevLauncherController.m +6 -0
  16. package/ios/EXDevLauncherMenuDelegate.swift +2 -2
  17. package/ios/EXDevLauncherRecentlyOpenedAppsRegistry.swift +4 -0
  18. package/ios/EXDevLauncherURLHelper.swift +1 -1
  19. package/ios/Errors/EXDevLauncherUncaughtExceptionHandler.swift +36 -0
  20. package/ios/ReactNative/EXDevLauncherRCTBridge.h +4 -0
  21. package/ios/ReactNative/EXDevLauncherRCTBridge.m +10 -5
  22. package/ios/Tests/EXDevLauncherControllerTest.swift +40 -0
  23. package/ios/Tests/EXDevLauncherMenuDelegateTest.swift +89 -0
  24. package/ios/Tests/EXDevLauncherPendingDeepLinkRegistryTest.swift +50 -0
  25. package/ios/Tests/EXDevLauncherRCTBridgeTest.swift +31 -0
  26. package/ios/Tests/EXDevLauncherRecentlyOpenedAppsRegistryTest.swift +37 -0
  27. package/ios/Tests/EXDevLauncherTest.swift +17 -0
  28. package/ios/Tests/EXDevLauncherURLHelperTests.swift +5 -2
  29. package/ios/main.jsbundle +419 -414
  30. package/package.json +4 -4
  31. package/plugin/build/resolveExpoUpdatesVersion.js +1 -1
  32. package/plugin/build/withDevLauncher.js +12 -12
  33. package/plugin/build/withDevLauncherAppDelegate.js +45 -12
  34. package/plugin/src/withDevLauncherAppDelegate.ts +52 -9
  35. package/write_embedded_bundle.sh +5 -0
  36. package/yarn-error.log +19075 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,36 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.9.0 — 2021-12-03
14
+
15
+ ### 🎉 New features
16
+
17
+ - Added support for th React Native `0.66.X`. ([#15242](https://github.com/expo/expo/pull/15242) by [@lukmccall](https://github.com/lukmccall))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fix `No native splash screen registered for given view controller` error happening when project is using both `expo-dev-client` and `expo-splash-screen` packages. ([#14745](https://github.com/expo/expo/pull/14745) by [@kudo](https://github.com/kudo))
22
+ - Fix cannot load url that starts with exp. (by [@lukmccall](https://github.com/lukmccall))
23
+ - [plugin] Fix config plugin compatibility with expo-screen-orientation. ([#14752](https://github.com/expo/expo/pull/14752) by [@esamelson](https://github.com/esamelson))
24
+
25
+ ## 0.8.4 — 2021-10-21
26
+
27
+ ### 🐛 Bug fixes
28
+
29
+ - Fix crash in SDK 42 Android projects. (by [@esamelson](https://github.com/esamelson))
30
+
31
+ ## 0.8.3 — 2021-10-15
32
+
33
+ ### 🐛 Bug fixes
34
+
35
+ - Fix config plugin compatibility with expo-screen-orientation. ([#14752](https://github.com/expo/expo/pull/14752) by [@esamelson](https://github.com/esamelson))
36
+
37
+ ## 0.8.2 — 2021-10-15
38
+
39
+ ### 🐛 Bug fixes
40
+
41
+ - Fix `No native splash screen registered for given view controller` error happening when project is using both `expo-dev-client` and `expo-splash-screen` packages. ([#14745](https://github.com/expo/expo/pull/14745) by [@kudo](https://github.com/kudo))
42
+
13
43
  ## 0.8.1 — 2021-10-07
14
44
 
15
45
  _This version does not introduce any user-facing changes._
@@ -18,23 +48,7 @@ _This version does not introduce any user-facing changes._
18
48
 
19
49
  ### 🛠 Breaking changes
20
50
 
21
- - Added a native dependency on the `expo-manifests` package. ([#14461](https://github.com/expo/expo/pull/14461) by [@esamelson](https://github.com/esamelson))
22
- - This is a breaking change for projects **without `react-native-unimodules` or `expo-modules-core` installed**. In order to upgrade from `expo-dev-client@0.5.1` or below to this version in such projects, the following changes must be made:
23
- - In `ios/Podfile`, change the deployment target to `platform :ios, '12.0'` and add the following lines inside the main target:
24
- ```ruby
25
- pod 'EXJSONUtils', path: '../node_modules/expo-json-utils/ios', :configurations => :debug
26
- pod 'EXManifests', path: '../node_modules/expo-manifests/ios', :configurations => :debug
27
- ```
28
- - In `android/settings.gradle`, add the following lines:
29
- ```groovy
30
- include ':expo-json-utils'
31
- project(':expo-json-utils').projectDir = new File('../node_modules/expo-json-utils/android')
32
-
33
- ```
34
- include ':expo-manifests'
35
- project(':expo-manifests').projectDir = new File('../node_modules/expo-manifests/android')
36
- ```
37
- - No additional setup is necessary for projects already using `react-native-unimodules` or `expo-modules-core`.
51
+ - Added a native dependency on the `expo-manifests` package. **Projects without `react-native-unimodules` or `expo-modules-core` installed will need to follow the upgrade guide [here](https://docs.expo.dev/clients/upgrading/) when upgrading from an older version of this package.** ([#14461](https://github.com/expo/expo/pull/14461) by [@esamelson](https://github.com/esamelson))
38
52
  - Replace Android DevLauncherManifest class with `expo-manifests`. ([#14462](https://github.com/expo/expo/pull/14462) by [@esamelson](https://github.com/esamelson))
39
53
  - Replace iOS EXDevLauncherManifest class with `expo-manifests`. ([#14463](https://github.com/expo/expo/pull/14463) by [@esamelson](https://github.com/esamelson))
40
54
 
@@ -42,7 +56,9 @@ project(':expo-manifests').projectDir = new File('../node_modules/expo-manifests
42
56
 
43
57
  - Suppress the `"main" has not been registered` exception if it was caused by a different error. ([#14363](https://github.com/expo/expo/pull/14363) by [@lukmccall](https://github.com/lukmccall))
44
58
  - Added support for SDK 43. ([#14633](https://github.com/expo/expo/pull/14633) & [#14635](https://github.com/expo/expo/pull/14635) by [@lukmccall](https://github.com/lukmccall))
59
+
45
60
  ### 🐛 Bug fixes
61
+
46
62
  - Fix intent that started activity isn't passed further. ([#14097](https://github.com/expo/expo/pull/14097) by [@lukmccall](https://github.com/lukmccall))
47
63
  - Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
48
64
 
package/README.md CHANGED
@@ -1,371 +1,7 @@
1
1
  # expo-dev-launcher
2
2
 
3
- `expo-dev-launcher` is an npm package installable in any Expo or React Native project. Once installed, any Debug builds of your application will gain the ability to load projects from Expo CLI. Release builds of your application will not change other than the addition of a few header files. This package is intended to be included in your project through [`expo-dev-client`](https://docs.expo.io/clients/introduction/).
3
+ `expo-dev-launcher` is an npm package installable in any Expo or React Native project. Once installed, any Debug builds of your application will gain the ability to load projects from Expo CLI. Release builds of your application will not change other than the addition of a few header files. This package is intended to be included in your project through [`expo-dev-client`](https://docs.expo.dev/clients/introduction/).
4
4
 
5
- # ⚙️ Installation
5
+ ## Documentation
6
6
 
7
- Firstly, you need to add the `expo-dev-launcher` package to your project.
8
-
9
- <details>
10
- <summary>yarn</summary>
11
-
12
- ```bash
13
- yarn add expo-dev-launcher expo-dev-menu-interface
14
- ```
15
-
16
- </details>
17
-
18
- <details>
19
- <summary>npm</summary>
20
-
21
- ```bash
22
- npm install expo-dev-launcher expo-dev-menu-interface
23
- ```
24
-
25
- </details>
26
-
27
- <br>
28
-
29
- Then you can start to configure the native projects using steps below.
30
-
31
- ## 🤖 Android
32
-
33
- 1. Initialize the `DevLauncherController`.
34
-
35
- Open your `MainApplication.{java|kt}` and add the following lines:
36
-
37
- <details>
38
- <summary>Java</summary>
39
-
40
- ```java
41
- ...
42
- // You need to import the `DevLauncherController` class
43
- import expo.modules.devlauncher.DevLauncherController;
44
- ...
45
- public class MainApplication extends Application implements ReactApplication {
46
- ...
47
- @Override
48
- public void onCreate() {
49
- super.onCreate();
50
- ...
51
- DevLauncherController.initialize(this, mReactNativeHost); // Initialize the `DevLauncherController` with the `ReactNativeHost`
52
- }
53
- }
54
- ```
55
-
56
- </details>
57
- <details>
58
- <summary>Kotlin</summary>
59
-
60
- ```kotlin
61
- ...
62
- // You need to import the `DevLauncherController` class
63
- import expo.modules.devlauncher.DevLauncherController;
64
- ...
65
- public class MainApplication : Application(), ReactApplication {
66
- ...
67
- override public fun onCreate() {
68
- super.onCreate();
69
- ...
70
- DevLauncherController.initialize(this, mReactNativeHost); // Initialize the `DevLauncherController` with the `ReactNativeHost`
71
- }
72
- }
73
- ```
74
-
75
- </details>
76
- <br>
77
-
78
- 2. Wrap the default `ReactActivityDelegate` with the one from `DevLauncher`.
79
-
80
- Open your `MainActivity.{java|kt}` and add the following lines:
81
-
82
- <details>
83
- <summary>Java</summary>
84
-
85
- ```java
86
- ...
87
- // You need to import the `DevLauncherController` class
88
- import expo.modules.devlauncher.DevLauncherController;
89
- ...
90
- public class MainActivity extends DevMenuAwareReactActivity {
91
- ...
92
- @Override
93
- protected ReactActivityDelegate createReactActivityDelegate() {
94
- return DevLauncherController.wrapReactActivityDelegate(
95
- this,
96
- () -> new ReactActivityDelegate(this, getMainComponentName()) // Here you can pass your custom `ReactActivityDelegate`
97
- );
98
- }
99
- }
100
- ```
101
-
102
- </details>
103
- <details>
104
- <summary>Kotlin</summary>
105
-
106
- ```kotlin
107
- ...
108
- // You need to import the `DevLauncherController` class
109
- import expo.modules.devlauncher.DevLauncherController;
110
- ...
111
- public class MainActivity : DevMenuAwareReactActivity() {
112
- ...
113
- protected override fun ReactActivityDelegate createReactActivityDelegate(): ReactActivityDelegate {
114
- return DevLauncherController.wrapReactActivityDelegate(this) {
115
- ReactActivityDelegate(this, getMainComponentName()) // Here you can pass your custom `ReactActivityDelegate`
116
- });
117
- }
118
- }
119
- ```
120
-
121
- </details>
122
-
123
- <br>
124
-
125
- 3. Pass new intents to the `DevLauncherController`.
126
-
127
- > **Note:** This step is not required but without it, **deep-link** handling **won't work**.
128
-
129
- Open your `MainActivity.{java|kt}` and add the following method:
130
-
131
- <details>
132
- <summary>Java</summary>
133
-
134
- ```java
135
- ...
136
- public class MainActivity extends DevMenuAwareReactActivity {
137
- ...
138
- @Override
139
- public void onNewIntent(Intent intent) {
140
- if (DevLauncherController.tryToHandleIntent(this, intent)) {
141
- return;
142
- }
143
- super.onNewIntent(intent);
144
- }
145
- }
146
- ```
147
-
148
- </details>
149
- <details>
150
- <summary>Kotlin</summary>
151
-
152
- ```kotlin
153
- ...
154
- public class MainActivity : DevMenuAwareReactActivity() {
155
- ...
156
- public override fun onNewIntent(intent: Intent) {
157
- if (DevLauncherController.tryToHandleIntent(this, intent)) {
158
- return;
159
- }
160
- super.onNewIntent(intent);
161
- }
162
- }
163
- ```
164
-
165
- </details>
166
-
167
- ## 🍏 iOS
168
-
169
- 1. Run `npx pod-install` after installing the npm package.
170
-
171
- 2. Set up the `EXDevLauncherControllerDelegate`.
172
-
173
- <details>
174
- <summary>Objective-C</summary>
175
-
176
- Open your `AppDelegate.h` and implement `EXDevLauncherControllerDelegate`.
177
-
178
- ```objc
179
- ...
180
- // You need to import the `EXDevLauncherController` and `EXDevLauncherControllerDelegate.
181
- #import <EXDevLauncherController.h>
182
- ...
183
- @interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate, EXDevLauncherControllerDelegate> // Here you're implementing the `EXDevLauncherControllerDelegate`
184
-
185
- @end
186
-
187
- ```
188
-
189
- Open your `AppDelegate.m` and add the following method:
190
-
191
- ```objc
192
- ...
193
- @implementation AppDelegate
194
- ...
195
- - (void)developmentClientController:(EXDevLauncherController * )devLauncherController
196
- didStartWithSuccess:(BOOL)success
197
- {
198
- devLauncherController.appBridge = [self initializeReactNativeApp];
199
- }
200
- ...
201
- @end
202
- ```
203
-
204
- </details>
205
-
206
- <details>
207
- <summary>Swift</summary>
208
-
209
- Open your `AppDelegate.swift` and implement `EXDevLauncherControllerDelegate`.
210
-
211
- ```swift
212
- ...
213
- @UIApplicationMain
214
- class AppDelegate: UMAppDelegateWrapper, EXDevLauncherControllerDelegate { // You need to implement the `EXDevLauncherControllerDelegate`
215
- ...
216
- func developmentClientController(_ devLauncherController: EXDevLauncherController!, didStartWithSuccess success: Bool) {
217
- devLauncherController.appBridge = initializeReactNativeBridge()
218
- }
219
- ...
220
- }
221
- ```
222
-
223
- </details>
224
-
225
- <br>
226
-
227
- 3. Start the `EXDevLauncherController`.
228
-
229
- Open your `AppDelegate.{m|swift}` and add the following lines:
230
-
231
- <details>
232
- <summary>Objective-C</summary>
233
-
234
- ```objc
235
- @implementation AppDelegate
236
- ...
237
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
238
- {
239
- // Remove [self initializeReactNativeApp];
240
- // and instead add:
241
- EXDevLauncherController *controller = [EXDevLauncherController sharedInstance];
242
- [controller startWithWindow:self.window delegate:self launchOptions:launchOptions];
243
- }
244
- ...
245
- @end
246
- ```
247
-
248
- </details>
249
- <details>
250
- <summary>Swift</summary>
251
-
252
- ```swift
253
- ...
254
- @UIApplicationMain
255
- class AppDelegate: UMAppDelegateWrapper {
256
- ...
257
- override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
258
- // Remove
259
- // [self initializeReactNativeApp];
260
- // and instead add:
261
- let controller = EXDevLauncherController.sharedInstance()
262
- controller?.start(with: window, delegate: self, launchOptions: launchOptions);
263
- }
264
- ...
265
- }
266
- ```
267
-
268
- </details>
269
-
270
- <br>
271
-
272
- 4. Change the source URL.
273
-
274
- Open your `AppDelegate.{m|swift}` and add the following lines:
275
-
276
- <details>
277
- <summary>Objective-C</summary>
278
-
279
- ```objc
280
- ...
281
- @implementation AppDelegate
282
- ...
283
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
284
- {
285
- // Remove
286
- // return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
287
- // and instead add:
288
- return [[EXDevLauncherController sharedInstance] sourceUrl];
289
- }
290
- ...
291
- @end
292
- ```
293
-
294
- </details>
295
- <details>
296
- <summary>Swift</summary>
297
-
298
- ```swift
299
- ...
300
- @UIApplicationMain
301
- class AppDelegate: UMAppDelegateWrapper {
302
- ...
303
- func sourceURL(for bridge: RCTBridge!) -> URL! {
304
- // Remove
305
- // return RCTBundleURLProvider.sharedSettings()?.jsBundleURL(forBundleRoot: "index", fallbackResource: nil)
306
- // and instead add:
307
- return EXDevLauncherController.sharedInstance()?.sourceUrl()
308
- }
309
- ...
310
- }
311
- ```
312
-
313
- </details>
314
-
315
- <br>
316
-
317
- 5. Handle deep links.
318
-
319
- Open your `AppDelegate.{m|swift}` and add the following lines:
320
-
321
- <details>
322
- <summary>Objective-C</summary>
323
-
324
- ```objc
325
- ...
326
- #import <React/RCTLinkingManager.h>
327
- ...
328
- @implementation AppDelegate
329
-
330
- - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
331
- {
332
- if ([EXDevLauncherController.sharedInstance onDeepLink:url options:options]) {
333
- return true;
334
- }
335
- return [RCTLinkingManager application:application openURL:url options:options];
336
- }
337
- ...
338
- @end
339
- ```
340
-
341
- </details>
342
- <details>
343
- <summary>Swift</summary>
344
-
345
- ```swift
346
- ...
347
- class AppDelegate: UMAppDelegateWrapper {
348
- ...
349
- func initializeReactNativeBridge() -> RCTBridge? {
350
- // change
351
- // RCTBridge(delegate: self, launchOptions: self.launchOptions)
352
- // to
353
- // RCTBridge(delegate: self, launchOptions: EXDevelopmentClientController.sharedInstance()!.getLaunchOptions())
354
- // the final version looks like this:
355
- if let bridge = RCTBridge(delegate: self, launchOptions: EXDevelopmentClientController.sharedInstance()!.getLaunchOptions()) {
356
- ...
357
- }
358
- }
359
- ...
360
- override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
361
- if (useDevClient && EXDevLauncherController.sharedInstance()!.onDeepLink(url, options: options)) {
362
- return true;
363
- }
364
-
365
- return RCTLinkingManager.application(app, open: url, options: options)
366
- }
367
- ...
368
- }
369
- ```
370
-
371
- </details>
7
+ You can find the documentation under [https://docs.expo.dev/clients/introduction](https://docs.expo.dev/clients/introduction).
@@ -25,7 +25,7 @@ android {
25
25
  minSdkVersion safeExtGet('minSdkVersion', 21)
26
26
  targetSdkVersion safeExtGet('targetSdkVersion', 30)
27
27
  versionCode 9
28
- versionName "0.8.1"
28
+ versionName "0.9.0"
29
29
  }
30
30
 
31
31
  lintOptions {
@@ -56,8 +56,10 @@ android {
56
56
  main {
57
57
  java {
58
58
  def rnVersion = getRNVersion()
59
-
60
- if (rnVersion >= versionToNumber(0, 65, 0)) {
59
+
60
+ if (rnVersion >= versionToNumber(0, 66, 0)) {
61
+ srcDirs += "src/react-native-66"
62
+ } else if (rnVersion >= versionToNumber(0, 65, 0)) {
61
63
  srcDirs += "src/react-native-65"
62
64
  } else {
63
65
  srcDirs += 'src/react-native-64'