expo-dev-launcher 0.11.6 → 0.11.7
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.
- package/CHANGELOG.md +10 -0
- package/android/build.gradle +1 -1
- package/android/src/debug/assets/expo_dev_launcher_android.bundle +2 -2
- package/android/src/debug/java/expo/modules/devlauncher/DevLauncherController.kt +22 -15
- package/android/src/debug/java/expo/modules/devlauncher/launcher/loaders/DevLauncherAppLoaderFactory.kt +0 -1
- package/android/src/debug/java/expo/modules/devlauncher/modules/DevLauncherAuth.kt +2 -7
- package/android/src/debug/java/expo/modules/devlauncher/modules/DevLauncherInternalModule.kt +15 -17
- package/android/src/expo-45/expo/modules/devlauncher/DevLauncherPackageDelegate.kt +7 -4
- package/android/src/main/java/expo/modules/devlauncher/helpers/DevLauncherOkHttpExtensions.kt +0 -1
- package/android/src/main/java/expo/modules/devlauncher/helpers/DevLauncherUpdatesHelper.kt +24 -21
- package/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt +9 -6
- package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherErrorActivity.kt +6 -6
- package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherErrorRegistry.kt +7 -5
- package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherStackAdapter.kt +1 -1
- package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherUncaughtExceptionHandler.kt +0 -1
- package/android/src/main/java/expo/modules/devlauncher/launcher/manifest/DevLauncherManifestParser.kt +3 -3
- package/android/src/main/java/expo/modules/devlauncher/splashscreen/DevLauncherSplashScreenProvider.kt +10 -10
- package/android/src/react-native-64/expo/modules/devlauncher/rncompatibility/DevLauncherDevSupportManager.kt +2 -1
- package/android/src/react-native-65/expo/modules/devlauncher/rncompatibility/DevLauncherDevSupportManager.kt +18 -17
- package/android/src/react-native-66/expo/modules/devlauncher/rncompatibility/DevLauncherDevSupportManager.kt +32 -16
- package/android/src/react-native-67/expo/modules/devlauncher/rncompatibility/DevLauncherDevSupportManager.kt +32 -16
- package/android/src/react-native-67/expo/modules/devlauncher/rncompatibility/DevLauncherDevSupportManagerFactory.kt +1 -1
- package/android/src/release/java/expo/modules/devlauncher/DevLauncherPackageDelegate.kt +1 -1
- package/android/src/release/java/expo/modules/devlauncher/launcher/loaders/DevLauncherAppLoaderFactory.kt +2 -5
- package/android/src/testDebug/java/expo/modules/devlauncher/DevLauncherControllerTest.kt +7 -6
- package/android/src/testDebug/java/expo/modules/devlauncher/launcher/loaders/DevLauncherAppLoaderFactoryTest.kt +19 -15
- package/android/src/testDebug/java/expo/modules/devlauncher/modules/DevLauncherModuleTest.kt +4 -2
- package/ios/EXDevLauncherController.m +20 -0
- package/ios/main.jsbundle +2 -2
- package/package.json +3 -3
- package/yarn-error.log +31 -122
- package/ios/assets/__node_modules/css-select/node_modules/dom-serializer/foreignNames.json +0 -102
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.11.7 — 2022-06-07
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix opening published EAS Update from URL on Android. ([#17734](https://github.com/expo/expo/pull/17734) by [@esamelson](https://github.com/esamelson))
|
|
18
|
+
|
|
19
|
+
### 💡 Others
|
|
20
|
+
|
|
21
|
+
- Stop persisting remote debugging setting between app loads on iOS. ([#17650](https://github.com/expo/expo/pull/17650) by [@esamelson](https://github.com/esamelson))
|
|
22
|
+
|
|
13
23
|
## 0.11.6 — 2022-05-19
|
|
14
24
|
|
|
15
25
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -67,8 +67,8 @@ __d(function(g,r,i,a,m,e,d){function t(n){if("function"!=typeof WeakMap)return n
|
|
|
67
67
|
__d(function(g,r,i,a,m,e,d){'use strict';var l,n,s=r(d[0]).polyfillGlobal;if(null!=(l=g)&&null!=(n=l.HermesInternal)&&null!=n.hasPromise&&n.hasPromise())g.Promise;else s('Promise',function(){return r(d[1])})},61,[62,63]);
|
|
68
68
|
__d(function(g,r,i,a,m,e,d){'use strict';var l=r(d[0]);function o(o,t,n){var c=Object.getOwnPropertyDescriptor(o,t),b=c||{},f=b.enumerable,u=b.writable,p=b.configurable;!c||void 0!==p&&p?l(o,t,{get:n,enumerable:!1!==f,writable:!1!==u}):console.error('Failed to set polyfill. '+t+' is not configurable.')}m.exports={polyfillObjectProperty:o,polyfillGlobal:function(l,t){o(g,l,t)}}},62,[58]);
|
|
69
69
|
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]);r(d[1]),r(d[2]),m.exports=t},63,[64,66,67]);
|
|
70
|
-
__d(function(g,r,_i,a,m,e,d){'use strict';var n=r(d[0]);m.exports=n;var t=l(!0),o=l(!1),f=l(null),i=l(void 0),u=l(0),c=l('');function l(t){var o=new n(n.
|
|
71
|
-
__d(function(g,r,_i,_a,m,e,d){'use strict';function n(){}var t=null,o={};function i(n){try{return n.then}catch(n){return t=n,o}}function u(n,i){try{return n(i)}catch(n){return t=n,o}}function f(n,i,u){try{n(i,u)}catch(n){return t=n,o}}function c(t){if('object'!=typeof this)throw new TypeError('Promises must be constructed via new');if('function'!=typeof t)throw new TypeError('Promise constructor\'s argument is not a function');this.
|
|
70
|
+
__d(function(g,r,_i,a,m,e,d){'use strict';var n=r(d[0]);m.exports=n;var t=l(!0),o=l(!1),f=l(null),i=l(void 0),u=l(0),c=l('');function l(t){var o=new n(n._61);return o._65=1,o._55=t,o}n.resolve=function(h){if(h instanceof n)return h;if(null===h)return f;if(void 0===h)return i;if(!0===h)return t;if(!1===h)return o;if(0===h)return u;if(''===h)return c;if('object'==typeof h||'function'==typeof h)try{var v=h.then;if('function'==typeof v)return new n(v.bind(h))}catch(t){return new n(function(n,o){o(t)})}return l(h)},n.all=function(t){var o=Array.prototype.slice.call(t);return new n(function(t,f){if(0===o.length)return t([]);var i=o.length;function u(c,l){if(l&&('object'==typeof l||'function'==typeof l)){if(l instanceof n&&l.then===n.prototype.then){for(;3===l._65;)l=l._55;return 1===l._65?u(c,l._55):(2===l._65&&f(l._55),void l.then(function(n){u(c,n)},f))}var h=l.then;if('function'==typeof h)return void new n(h.bind(l)).then(function(n){u(c,n)},f)}o[c]=l,0==--i&&t(o)}for(var c=0;c<o.length;c++)u(c,o[c])})},n.reject=function(t){return new n(function(n,o){o(t)})},n.race=function(t){return new n(function(o,f){t.forEach(function(t){n.resolve(t).then(o,f)})})},n.prototype.catch=function(n){return this.then(null,n)}},64,[65]);
|
|
71
|
+
__d(function(g,r,_i,_a,m,e,d){'use strict';function n(){}var t=null,o={};function i(n){try{return n.then}catch(n){return t=n,o}}function u(n,i){try{return n(i)}catch(n){return t=n,o}}function f(n,i,u){try{n(i,u)}catch(n){return t=n,o}}function c(t){if('object'!=typeof this)throw new TypeError('Promises must be constructed via new');if('function'!=typeof t)throw new TypeError('Promise constructor\'s argument is not a function');this._40=0,this._65=0,this._55=null,this._72=null,t!==n&&y(t,this)}function _(t,o,i){return new t.constructor(function(u,f){var _=new c(n);_.then(u,f),s(t,new v(o,i,_))})}function s(n,t){for(;3===n._65;)n=n._55;if(c._37&&c._37(n),0===n._65)return 0===n._40?(n._40=1,void(n._72=t)):1===n._40?(n._40=2,void(n._72=[n._72,t])):void n._72.push(t);l(n,t)}function l(n,i){setImmediate(function(){var f=1===n._65?i.onFulfilled:i.onRejected;if(null!==f){var c=u(f,n._55);c===o?p(i.promise,t):h(i.promise,c)}else 1===n._65?h(i.promise,n._55):p(i.promise,n._55)})}function h(n,u){if(u===n)return p(n,new TypeError('A promise cannot be resolved with itself.'));if(u&&('object'==typeof u||'function'==typeof u)){var f=i(u);if(f===o)return p(n,t);if(f===n.then&&u instanceof c)return n._65=3,n._55=u,void a(n);if('function'==typeof f)return void y(f.bind(u),n)}n._65=1,n._55=u,a(n)}function p(n,t){n._65=2,n._55=t,c._87&&c._87(n,t),a(n)}function a(n){if(1===n._40&&(s(n,n._72),n._72=null),2===n._40){for(var t=0;t<n._72.length;t++)s(n,n._72[t]);n._72=null}}function v(n,t,o){this.onFulfilled='function'==typeof n?n:null,this.onRejected='function'==typeof t?t:null,this.promise=o}function y(n,i){var u=!1,c=f(n,function(n){u||(u=!0,h(i,n))},function(n){u||(u=!0,p(i,n))});u||c!==o||(u=!0,p(i,t))}m.exports=c,c._37=null,c._87=null,c._61=n,c.prototype.then=function(t,o){if(this.constructor!==c)return _(this,t,o);var i=new c(n);return s(this,new v(t,o,i)),i}},65,[]);
|
|
72
72
|
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]);m.exports=t,t.prototype.done=function(t,n){(arguments.length?this.then.apply(this,arguments):this).then(null,function(t){setTimeout(function(){throw t},0)})}},66,[65]);
|
|
73
73
|
__d(function(g,r,i,a,m,e,d){'use strict';var n=r(d[0]);m.exports=n,n.prototype.finally=function(t){return this.then(function(o){return n.resolve(t()).then(function(){return o})},function(o){return n.resolve(t()).then(function(){throw o})})}},67,[65]);
|
|
74
74
|
__d(function(g,r,i,a,m,e,d){'use strict';var t,n=r(d[0]),o=r(d[1]).polyfillGlobal,c=r(d[2]).hasNativeConstructor;try{t=c(n.mark(function t(){return n.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}},t)}),'GeneratorFunction')}catch(n){t=!1}t||o('regeneratorRuntime',function(){return delete g.regeneratorRuntime,r(d[3])})},68,[69,62,71,70]);
|
|
@@ -55,8 +55,8 @@ private const val NEW_ACTIVITY_FLAGS = Intent.FLAG_ACTIVITY_NEW_TASK or
|
|
|
55
55
|
Intent.FLAG_ACTIVITY_CLEAR_TASK or
|
|
56
56
|
Intent.FLAG_ACTIVITY_NO_ANIMATION
|
|
57
57
|
|
|
58
|
-
class DevLauncherController private constructor()
|
|
59
|
-
|
|
58
|
+
class DevLauncherController private constructor() :
|
|
59
|
+
DevLauncherKoinComponent, DevLauncherControllerInterface {
|
|
60
60
|
private val context: Context by lazy {
|
|
61
61
|
DevLauncherKoinContext.app.koin.get()
|
|
62
62
|
}
|
|
@@ -69,9 +69,13 @@ class DevLauncherController private constructor()
|
|
|
69
69
|
var devMenuManager: DevMenuManager = DevMenuManager
|
|
70
70
|
override var updatesInterface: UpdatesInterface?
|
|
71
71
|
get() = internalUpdatesInterface
|
|
72
|
-
set(value) = DevLauncherKoinContext.app.koin.loadModules(
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
set(value) = DevLauncherKoinContext.app.koin.loadModules(
|
|
73
|
+
listOf(
|
|
74
|
+
module {
|
|
75
|
+
single { value }
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
)
|
|
75
79
|
override val coroutineScope = CoroutineScope(Dispatchers.Default)
|
|
76
80
|
|
|
77
81
|
override val devClientHost = DevLauncherClientHost((context as Application), DEV_LAUNCHER_HOST)
|
|
@@ -115,7 +119,7 @@ class DevLauncherController private constructor()
|
|
|
115
119
|
|
|
116
120
|
// default to the EXPO_UPDATE_URL value configured in AndroidManifest.xml when project url is unspecified for an EAS update
|
|
117
121
|
if (isEASUpdate && projectUrl == null) {
|
|
118
|
-
val projectUrlString =
|
|
122
|
+
val projectUrlString = getMetadataValue(context, "expo.modules.updates.EXPO_UPDATE_URL")
|
|
119
123
|
parsedProjectUrl = Uri.parse(projectUrlString)
|
|
120
124
|
}
|
|
121
125
|
|
|
@@ -325,9 +329,9 @@ class DevLauncherController private constructor()
|
|
|
325
329
|
internal var sAdditionalPackages: List<ReactPackage>? = null
|
|
326
330
|
|
|
327
331
|
@JvmStatic
|
|
328
|
-
fun getMetadataValue(
|
|
329
|
-
val packageManager =
|
|
330
|
-
val packageName =
|
|
332
|
+
fun getMetadataValue(context: Context, key: String): String {
|
|
333
|
+
val packageManager = context.packageManager
|
|
334
|
+
val packageName = context.packageName
|
|
331
335
|
val applicationInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
|
|
332
336
|
var metaDataValue = ""
|
|
333
337
|
|
|
@@ -360,12 +364,15 @@ class DevLauncherController private constructor()
|
|
|
360
364
|
if (!testInterceptor.allowReinitialization()) {
|
|
361
365
|
check(!wasInitialized()) { "DevelopmentClientController was initialized." }
|
|
362
366
|
}
|
|
363
|
-
DevLauncherKoinContext.app.koin.loadModules(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
DevLauncherKoinContext.app.koin.loadModules(
|
|
368
|
+
listOf(
|
|
369
|
+
module {
|
|
370
|
+
single { context }
|
|
371
|
+
single { appHost }
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
allowOverride = true
|
|
375
|
+
)
|
|
369
376
|
|
|
370
377
|
val controller = DevLauncherController()
|
|
371
378
|
DevLauncherKoinContext.app.koin.declare<DevLauncherControllerInterface>(controller)
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
package expo.modules.devlauncher.modules
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import android.content.Context
|
|
5
4
|
import android.content.Intent
|
|
6
5
|
import android.net.Uri
|
|
7
|
-
import android.se.omapi.Session
|
|
8
|
-
import android.util.Log
|
|
9
6
|
import androidx.browser.customtabs.CustomTabsIntent
|
|
10
7
|
import com.facebook.react.bridge.*
|
|
11
8
|
import expo.modules.devlauncher.koin.DevLauncherKoinComponent
|
|
12
9
|
import expo.modules.devmenu.DevMenuManager
|
|
13
|
-
import org.json.JSONObject
|
|
14
|
-
|
|
15
10
|
|
|
16
11
|
private const val SessionKey = "expo-dev-menu.session"
|
|
17
12
|
private const val SessionStore = "expo.modules.devmenu.sessionstore"
|
|
18
13
|
|
|
19
|
-
class DevLauncherAuth(reactContext: ReactApplicationContext?)
|
|
20
|
-
|
|
14
|
+
class DevLauncherAuth(reactContext: ReactApplicationContext?) :
|
|
15
|
+
ReactContextBaseJavaModule(reactContext), DevLauncherKoinComponent {
|
|
21
16
|
|
|
22
17
|
private val localStore = reactApplicationContext.getSharedPreferences(SessionStore, Context.MODE_PRIVATE)
|
|
23
18
|
|
package/android/src/debug/java/expo/modules/devlauncher/modules/DevLauncherInternalModule.kt
CHANGED
|
@@ -19,7 +19,6 @@ import expo.modules.devlauncher.koin.DevLauncherKoinComponent
|
|
|
19
19
|
import expo.modules.devlauncher.launcher.DevLauncherControllerInterface
|
|
20
20
|
import expo.modules.devlauncher.launcher.DevLauncherIntentRegistryInterface
|
|
21
21
|
import expo.modules.devlauncher.launcher.errors.DevLauncherErrorRegistry
|
|
22
|
-
import expo.modules.devmenu.DevMenuAppInfo
|
|
23
22
|
import expo.modules.devmenu.DevMenuManager
|
|
24
23
|
import kotlinx.coroutines.launch
|
|
25
24
|
import org.koin.core.component.inject
|
|
@@ -28,8 +27,8 @@ private const val ON_NEW_DEEP_LINK_EVENT = "expo.modules.devlauncher.onnewdeepli
|
|
|
28
27
|
private const val CLIENT_PACKAGE_NAME = "host.exp.exponent"
|
|
29
28
|
private val CLIENT_HOME_QR_SCANNER_DEEP_LINK = Uri.parse("expo-home://qr-scanner")
|
|
30
29
|
|
|
31
|
-
class DevLauncherInternalModule(reactContext: ReactApplicationContext?)
|
|
32
|
-
|
|
30
|
+
class DevLauncherInternalModule(reactContext: ReactApplicationContext?) :
|
|
31
|
+
ReactContextBaseJavaModule(reactContext), DevLauncherKoinComponent {
|
|
33
32
|
private val controller: DevLauncherControllerInterface by inject()
|
|
34
33
|
private val intentRegistry: DevLauncherIntentRegistryInterface by inject()
|
|
35
34
|
private val installationIDHelper: DevLauncherInstallationIDHelper by inject()
|
|
@@ -88,13 +87,13 @@ class DevLauncherInternalModule(reactContext: ReactApplicationContext?)
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
private fun sanitizeUrlString(url: String): Uri {
|
|
91
|
-
val parsedUrl = Uri.parse(url
|
|
90
|
+
val parsedUrl = Uri.parse(url.trim())
|
|
92
91
|
val appUrl = if (isDevLauncherUrl(parsedUrl)) {
|
|
93
92
|
requireNotNull(getAppUrlFromDevLauncherUrl(parsedUrl)) { "The provided url doesn't contain the app url." }
|
|
94
93
|
} else {
|
|
95
94
|
parsedUrl
|
|
96
95
|
}
|
|
97
|
-
return appUrl
|
|
96
|
+
return appUrl
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
@ReactMethod
|
|
@@ -136,13 +135,15 @@ class DevLauncherInternalModule(reactContext: ReactApplicationContext?)
|
|
|
136
135
|
|
|
137
136
|
@ReactMethod
|
|
138
137
|
fun getRecentlyOpenedApps(promise: Promise) {
|
|
139
|
-
promise.resolve(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
promise.resolve(
|
|
139
|
+
Arguments
|
|
140
|
+
.createMap()
|
|
141
|
+
.apply {
|
|
142
|
+
controller.getRecentlyOpenedApps().forEach { (key, value) ->
|
|
143
|
+
putString(key, value)
|
|
144
|
+
}
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
+
)
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
@ReactMethod
|
|
@@ -214,17 +215,16 @@ class DevLauncherInternalModule(reactContext: ReactApplicationContext?)
|
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
|
|
217
|
-
|
|
218
218
|
@ReactMethod
|
|
219
219
|
fun getBuildInfo(promise: Promise) {
|
|
220
220
|
val map = Arguments.createMap()
|
|
221
221
|
val packageManager = reactApplicationContext.packageManager
|
|
222
222
|
val packageName = reactApplicationContext.packageName
|
|
223
223
|
|
|
224
|
-
val packageInfo =
|
|
224
|
+
val packageInfo = packageManager.getPackageInfo(packageName, 0)
|
|
225
225
|
val applicationInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
|
|
226
226
|
val appName = packageManager.getApplicationLabel(applicationInfo).toString()
|
|
227
|
-
val runtimeVersion = DevLauncherController.getMetadataValue(reactApplicationContext,"expo.modules.updates.EXPO_RUNTIME_VERSION")
|
|
227
|
+
val runtimeVersion = DevLauncherController.getMetadataValue(reactApplicationContext, "expo.modules.updates.EXPO_RUNTIME_VERSION")
|
|
228
228
|
val sdkVersion = DevLauncherController.getMetadataValue(reactApplicationContext, "expo.modules.updates.EXPO_SDK_VERSION")
|
|
229
229
|
var appIcon = getApplicationIconUri()
|
|
230
230
|
|
|
@@ -257,13 +257,11 @@ class DevLauncherInternalModule(reactContext: ReactApplicationContext?)
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
private fun getApplicationIconUri(): String {
|
|
260
|
-
var appIcon = ""
|
|
261
260
|
val packageManager = reactApplicationContext.packageManager
|
|
262
261
|
val packageName = reactApplicationContext.packageName
|
|
263
262
|
val applicationInfo = packageManager.getApplicationInfo(packageName, 0)
|
|
264
|
-
appIcon = "" + applicationInfo.icon
|
|
265
263
|
// TODO - figure out how to get resId for AdaptiveIconDrawable icons
|
|
266
|
-
return
|
|
264
|
+
return "" + applicationInfo.icon
|
|
267
265
|
}
|
|
268
266
|
|
|
269
267
|
@ReactMethod
|
|
@@ -76,11 +76,14 @@ object DevLauncherPackageDelegate {
|
|
|
76
76
|
if (!shouldEnableAutoSetup) {
|
|
77
77
|
return null
|
|
78
78
|
}
|
|
79
|
-
return DevLauncherController.wrapReactActivityDelegate(
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
return DevLauncherController.wrapReactActivityDelegate(
|
|
80
|
+
activity,
|
|
81
|
+
object : DevLauncherReactActivityDelegateSupplier {
|
|
82
|
+
override fun get(): ReactActivityDelegate {
|
|
83
|
+
return delegate
|
|
84
|
+
}
|
|
82
85
|
}
|
|
83
|
-
|
|
86
|
+
)
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
)
|
|
@@ -15,29 +15,32 @@ suspend fun UpdatesInterface.loadUpdate(
|
|
|
15
15
|
shouldContinue: (manifest: JSONObject) -> Boolean
|
|
16
16
|
): UpdatesInterface.Update =
|
|
17
17
|
suspendCoroutine { cont ->
|
|
18
|
-
this.fetchUpdateWithConfiguration(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
this.fetchUpdateWithConfiguration(
|
|
19
|
+
configuration, context,
|
|
20
|
+
object : UpdatesInterface.UpdateCallback {
|
|
21
|
+
override fun onSuccess(update: UpdatesInterface.Update?) {
|
|
22
|
+
// if the update is null, we previously aborted the fetch, so we've already resumed
|
|
23
|
+
update?.let { cont.resume(update) }
|
|
24
|
+
}
|
|
25
|
+
override fun onFailure(e: Exception?) {
|
|
26
|
+
cont.resumeWithException(e ?: Exception("There was an unexpected error loading the update."))
|
|
27
|
+
}
|
|
28
|
+
override fun onProgress(successfulAssetCount: Int, failedAssetCount: Int, totalAssetCount: Int) = Unit
|
|
29
|
+
override fun onManifestLoaded(manifest: JSONObject): Boolean {
|
|
30
|
+
return if (shouldContinue(manifest)) {
|
|
31
|
+
true
|
|
32
|
+
} else {
|
|
33
|
+
cont.resume(object : UpdatesInterface.Update {
|
|
34
|
+
override fun getLaunchAssetPath(): String {
|
|
35
|
+
throw Exception("Tried to access launch asset path for a manifest that was not loaded")
|
|
36
|
+
}
|
|
37
|
+
override fun getManifest(): JSONObject = manifest
|
|
38
|
+
})
|
|
39
|
+
false
|
|
40
|
+
}
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
|
-
|
|
43
|
+
)
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
fun createUpdatesConfigurationWithUrl(url: Uri, projectUrl: Uri, installationID: String?): HashMap<String, Any> {
|
|
@@ -33,11 +33,13 @@ class DevLauncherExpoActivityConfigurator(
|
|
|
33
33
|
val color = Color.parseColor(manifest.getPrimaryColor())
|
|
34
34
|
val icon = BitmapFactory.decodeResource(context.resources, context.applicationInfo.icon)
|
|
35
35
|
|
|
36
|
-
activity.setTaskDescription(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
activity.setTaskDescription(
|
|
37
|
+
ActivityManager.TaskDescription(
|
|
38
|
+
manifest.getName(),
|
|
39
|
+
icon,
|
|
40
|
+
color
|
|
41
|
+
)
|
|
42
|
+
)
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
fun applyOrientation(activity: ReactActivity) {
|
|
@@ -131,7 +133,8 @@ class DevLauncherExpoActivityConfigurator(
|
|
|
131
133
|
defaultInsets.systemWindowInsetLeft,
|
|
132
134
|
0,
|
|
133
135
|
defaultInsets.systemWindowInsetRight,
|
|
134
|
-
defaultInsets.systemWindowInsetBottom
|
|
136
|
+
defaultInsets.systemWindowInsetBottom
|
|
137
|
+
)
|
|
135
138
|
}
|
|
136
139
|
} else {
|
|
137
140
|
decorView.setOnApplyWindowInsetsListener(null)
|
package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherErrorActivity.kt
CHANGED
|
@@ -13,8 +13,8 @@ import kotlinx.coroutines.launch
|
|
|
13
13
|
import org.koin.core.component.inject
|
|
14
14
|
import java.lang.ref.WeakReference
|
|
15
15
|
|
|
16
|
-
class DevLauncherErrorActivity
|
|
17
|
-
|
|
16
|
+
class DevLauncherErrorActivity :
|
|
17
|
+
FragmentActivity(), DevLauncherKoinComponent {
|
|
18
18
|
|
|
19
19
|
private val controller: DevLauncherControllerInterface by inject()
|
|
20
20
|
private lateinit var binding: ErrorFragmentBinding
|
|
@@ -53,7 +53,6 @@ class DevLauncherErrorActivity
|
|
|
53
53
|
adapter.notifyDataSetChanged()
|
|
54
54
|
}
|
|
55
55
|
binding.errorDetails.text = error.message ?: "Unknown error"
|
|
56
|
-
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
private fun launchHome() {
|
|
@@ -126,9 +125,10 @@ class DevLauncherErrorActivity
|
|
|
126
125
|
|
|
127
126
|
context.startActivity(
|
|
128
127
|
Intent(context, DevLauncherErrorActivity::class.java).apply {
|
|
129
|
-
addFlags(
|
|
130
|
-
Intent.
|
|
131
|
-
|
|
128
|
+
addFlags(
|
|
129
|
+
Intent.FLAG_ACTIVITY_NEW_TASK or
|
|
130
|
+
Intent.FLAG_ACTIVITY_CLEAR_TASK or
|
|
131
|
+
Intent.FLAG_ACTIVITY_NO_ANIMATION
|
|
132
132
|
)
|
|
133
133
|
}
|
|
134
134
|
)
|
package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherErrorRegistry.kt
CHANGED
|
@@ -15,11 +15,13 @@ data class DevLauncherErrorInstance(
|
|
|
15
15
|
val throwable: Throwable,
|
|
16
16
|
val timestamp: Long = DevLauncherRecentlyOpenedAppsRegistry.TimeHelper.getCurrentTime()
|
|
17
17
|
) {
|
|
18
|
-
fun toWritableMap(): WritableMap? = Arguments.fromBundle(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
fun toWritableMap(): WritableMap? = Arguments.fromBundle(
|
|
19
|
+
Bundle().apply {
|
|
20
|
+
putLong("timestamp", timestamp)
|
|
21
|
+
putString("message", throwable.message ?: "Unknown")
|
|
22
|
+
putString("stack", throwable.stackTraceToString())
|
|
23
|
+
}
|
|
24
|
+
)
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
class DevLauncherErrorRegistry(context: Context) {
|
package/android/src/main/java/expo/modules/devlauncher/launcher/errors/DevLauncherStackAdapter.kt
CHANGED
|
@@ -11,7 +11,7 @@ import expo.modules.devlauncher.databinding.ErrorConsoleListItemBinding
|
|
|
11
11
|
class DevLauncherStackAdapter(
|
|
12
12
|
val context: Context,
|
|
13
13
|
var data: DevLauncherAppError?
|
|
14
|
-
): BaseAdapter() {
|
|
14
|
+
) : BaseAdapter() {
|
|
15
15
|
override fun getCount(): Int {
|
|
16
16
|
return data?.error?.stackTrace?.size ?: 0
|
|
17
17
|
}
|
|
@@ -18,9 +18,9 @@ class DevLauncherManifestParser(
|
|
|
18
18
|
val response = fetch(url, "HEAD", getHeaders()).await(httpClient)
|
|
19
19
|
val contentType = response.header("Content-Type")
|
|
20
20
|
// published projects may respond unsuccessfully to HEAD requests sent with no headers
|
|
21
|
-
return !response.isSuccessful
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
return !response.isSuccessful ||
|
|
22
|
+
response.header("Exponent-Server", null) != null ||
|
|
23
|
+
(contentType != null && !contentType.startsWith("text/html") && !contentType.contains("/javascript"))
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
private suspend fun downloadManifest(): Reader {
|
|
@@ -8,17 +8,17 @@ import androidx.core.graphics.ColorUtils
|
|
|
8
8
|
|
|
9
9
|
class DevLauncherSplashScreenProvider {
|
|
10
10
|
fun attachSplashScreenViewAsync(activity: Activity): DevLauncherSplashScreen? {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
|
12
|
+
?: return null
|
|
13
|
+
val backgroundColor = getBackgroundColor(activity)
|
|
14
|
+
val splashScreenView = DevLauncherSplashScreen(
|
|
15
|
+
activity,
|
|
16
|
+
getTextColorForBackgroundColor(backgroundColor)
|
|
17
|
+
)
|
|
18
|
+
splashScreenView.setBackgroundColor(backgroundColor)
|
|
19
|
+
contentView.addView(splashScreenView)
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
return splashScreenView
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
private fun getBackgroundColor(context: Context): Int {
|
|
@@ -32,7 +32,8 @@ class DevLauncherDevSupportManager(
|
|
|
32
32
|
devBundleDownloadListener,
|
|
33
33
|
minNumShakes,
|
|
34
34
|
customPackagerCommandHandlers
|
|
35
|
-
),
|
|
35
|
+
),
|
|
36
|
+
DevLauncherKoinComponent {
|
|
36
37
|
private val controller: DevLauncherControllerInterface by inject()
|
|
37
38
|
override fun showNewJavaError(message: String?, e: Throwable) {
|
|
38
39
|
if (!DevLauncherController.wasInitialized()) {
|
|
@@ -15,24 +15,25 @@ import expo.modules.devlauncher.launcher.errors.DevLauncherErrorActivity
|
|
|
15
15
|
import org.koin.core.component.inject
|
|
16
16
|
|
|
17
17
|
class DevLauncherDevSupportManager(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
applicationContext: Context?,
|
|
19
|
+
val reactInstanceManagerHelper: ReactInstanceDevHelper?,
|
|
20
|
+
packagerPathForJSBundleName: String?,
|
|
21
|
+
enableOnCreate: Boolean,
|
|
22
|
+
redBoxHandler: RedBoxHandler?,
|
|
23
|
+
devBundleDownloadListener: DevBundleDownloadListener?,
|
|
24
|
+
minNumShakes: Int,
|
|
25
|
+
customPackagerCommandHandlers: MutableMap<String, RequestHandler>?
|
|
26
26
|
) : DevSupportManagerBase(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
),
|
|
27
|
+
applicationContext,
|
|
28
|
+
reactInstanceManagerHelper,
|
|
29
|
+
packagerPathForJSBundleName,
|
|
30
|
+
enableOnCreate,
|
|
31
|
+
redBoxHandler,
|
|
32
|
+
devBundleDownloadListener,
|
|
33
|
+
minNumShakes,
|
|
34
|
+
customPackagerCommandHandlers
|
|
35
|
+
),
|
|
36
|
+
DevLauncherKoinComponent {
|
|
36
37
|
private val controller: DevLauncherControllerInterface by inject()
|
|
37
38
|
override fun showNewJavaError(message: String?, e: Throwable) {
|
|
38
39
|
if (!DevLauncherController.wasInitialized()) {
|