expo-dev-launcher 58.0.9 → 58.0.11
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 +13 -0
- package/android/build.gradle +2 -2
- package/android/src/debug/java/expo/modules/devlauncher/DevLauncherPackageDelegate.kt +3 -1
- package/android/src/debug/java/expo/modules/devlauncher/compose/models/HomeViewModel.kt +3 -1
- package/android/src/debug/java/expo/modules/devlauncher/compose/screens/ErrorScreen.kt +5 -1
- package/android/src/debug/java/expo/modules/devlauncher/compose/ui/ActionButton.kt +5 -1
- package/android/src/debug/java/expo/modules/devlauncher/compose/ui/PullToRefresh.kt +5 -1
- package/android/src/debug/java/expo/modules/devlauncher/helpers/DevLauncherReactUtils.kt +5 -1
- package/android/src/debug/java/expo/modules/devlauncher/helpers/DevLauncherURLHelper.kt +5 -1
- package/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherActivity.kt +13 -0
- package/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherNetworkInterceptor.kt +10 -2
- package/android/src/debug/java/expo/modules/devlauncher/launcher/LocalNetworkPermission.kt +30 -0
- package/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherReactNativeHostHandler.kt +5 -1
- package/android/src/debug/java/expo/modules/devlauncher/react/activitydelegates/DevLauncherReactActivityRedirectDelegate.kt +13 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Android] Request the local network permission on Android 17 so the launcher can discover and load development servers. ([#50951](https://github.com/expo/expo/pull/50951) by [@alanjhughes](https://github.com/alanjhughes))
|
|
8
|
+
|
|
9
|
+
## 58.0.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies. ([#50900](https://github.com/expo/expo/pull/50900))
|
|
14
|
+
- expo-dev-menu@58.0.10
|
|
15
|
+
|
|
3
16
|
## 58.0.9
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -24,13 +24,13 @@ expoModule {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
group = "host.exp.exponent"
|
|
27
|
-
version = "58.0.
|
|
27
|
+
version = "58.0.11"
|
|
28
28
|
|
|
29
29
|
android {
|
|
30
30
|
namespace "expo.modules.devlauncher"
|
|
31
31
|
defaultConfig {
|
|
32
32
|
versionCode 9
|
|
33
|
-
versionName "58.0.
|
|
33
|
+
versionName "58.0.11"
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
buildTypes {
|
|
@@ -100,7 +100,9 @@ object DevLauncherPackageDelegate {
|
|
|
100
100
|
container = containerHolder.get(),
|
|
101
101
|
moduleName = moduleName
|
|
102
102
|
)
|
|
103
|
-
if (ok)
|
|
103
|
+
if (ok) {
|
|
104
|
+
currentModuleName = moduleName
|
|
105
|
+
}
|
|
104
106
|
ok
|
|
105
107
|
},
|
|
106
108
|
appInfoProvider = { application, reactHost ->
|
|
@@ -176,7 +176,9 @@ class HomeViewModel : ViewModel(), DefaultLifecycleObserver {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
private fun refreshServers() {
|
|
179
|
-
if (_state.value.isRefreshing)
|
|
179
|
+
if (_state.value.isRefreshing) {
|
|
180
|
+
return
|
|
181
|
+
}
|
|
180
182
|
_state.value = _state.value.copy(isRefreshing = true)
|
|
181
183
|
|
|
182
184
|
viewModelScope.launch {
|
|
@@ -108,7 +108,11 @@ fun ErrorScreen(
|
|
|
108
108
|
|
|
109
109
|
Box(modifier = Modifier.weight(1f)) {
|
|
110
110
|
ActionButton(
|
|
111
|
-
if (copied)
|
|
111
|
+
if (copied) {
|
|
112
|
+
"Copied!"
|
|
113
|
+
} else {
|
|
114
|
+
"Copy"
|
|
115
|
+
},
|
|
112
116
|
foreground = NewAppTheme.colors.buttons.secondary.foreground,
|
|
113
117
|
background = NewAppTheme.colors.buttons.secondary.background,
|
|
114
118
|
modifier = Modifier.padding(vertical = NewAppTheme.spacing.`2`),
|
|
@@ -33,7 +33,11 @@ fun ActionButton(
|
|
|
33
33
|
onClick = onClick,
|
|
34
34
|
enabled = enabled,
|
|
35
35
|
shape = RoundedCornerShape(borderRadius),
|
|
36
|
-
backgroundColor = if (enabled)
|
|
36
|
+
backgroundColor = if (enabled) {
|
|
37
|
+
background
|
|
38
|
+
} else {
|
|
39
|
+
background.copy(alpha = 0.5f)
|
|
40
|
+
},
|
|
37
41
|
indication = ripple(color = foreground)
|
|
38
42
|
) {
|
|
39
43
|
Box(
|
|
@@ -199,7 +199,11 @@ fun injectDevServerHelper(
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
private fun parseUrl(url: Uri): Pair<String, String> {
|
|
202
|
-
val port = if (url.port != -1)
|
|
202
|
+
val port = if (url.port != -1) {
|
|
203
|
+
url.port
|
|
204
|
+
} else {
|
|
205
|
+
HttpUrl.defaultPort(url.scheme ?: "http")
|
|
206
|
+
}
|
|
203
207
|
val debugServerHost = url.host + ":" + port
|
|
204
208
|
// We need to remove "/" which is added to begin of the path by the Uri
|
|
205
209
|
// and the bundle type
|
|
@@ -3,7 +3,11 @@ package expo.modules.devlauncher.helpers
|
|
|
3
3
|
import android.net.Uri
|
|
4
4
|
import expo.modules.devmenu.launch.ExpoLauncherUrl
|
|
5
5
|
|
|
6
|
-
fun replaceEXPScheme(uri: Uri, scheme: String): Uri = if (uri.scheme == "exp")
|
|
6
|
+
fun replaceEXPScheme(uri: Uri, scheme: String): Uri = if (uri.scheme == "exp") {
|
|
7
|
+
uri.buildUpon().scheme(scheme).build()
|
|
8
|
+
} else {
|
|
9
|
+
uri
|
|
10
|
+
}
|
|
7
11
|
|
|
8
12
|
/** Strict `name=1` flag on this URL. Used for the `disableFab` and `disableAutoLaunch` params, which update the saved preferences. */
|
|
9
13
|
fun hasEnabledFlag(uri: Uri, name: String): Boolean {
|
|
@@ -2,11 +2,20 @@ package expo.modules.devlauncher.launcher
|
|
|
2
2
|
|
|
3
3
|
import android.os.Build
|
|
4
4
|
import android.os.Bundle
|
|
5
|
+
import androidx.activity.result.contract.ActivityResultContracts
|
|
5
6
|
import androidx.appcompat.app.AppCompatActivity
|
|
6
7
|
import expo.modules.devlauncher.compose.BindingView
|
|
7
8
|
import expo.modules.devlauncher.helpers.enableEdgeToEdge
|
|
9
|
+
import expo.modules.devlauncher.services.PackagerService
|
|
10
|
+
import expo.modules.devlauncher.services.injectService
|
|
8
11
|
|
|
9
12
|
class DevLauncherActivity : AppCompatActivity() {
|
|
13
|
+
private val localNetworkPermissionRequest = registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
|
|
14
|
+
if (granted) {
|
|
15
|
+
injectService<PackagerService>().restart()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
10
19
|
override fun onStart() {
|
|
11
20
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
|
12
21
|
@Suppress("DEPRECATION")
|
|
@@ -28,6 +37,10 @@ class DevLauncherActivity : AppCompatActivity() {
|
|
|
28
37
|
setContentView(
|
|
29
38
|
BindingView(this)
|
|
30
39
|
)
|
|
40
|
+
|
|
41
|
+
LocalNetworkPermission.requestIfNeeded(this) {
|
|
42
|
+
localNetworkPermissionRequest.launch(LocalNetworkPermission.PERMISSION)
|
|
43
|
+
}
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
override fun onPause() {
|
package/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherNetworkInterceptor.kt
CHANGED
|
@@ -47,7 +47,15 @@ internal class DevLauncherNetworkInterceptor(appUrl: Uri) : Closeable, ExpoReque
|
|
|
47
47
|
|
|
48
48
|
private fun createNetworkInspectorUrl(appUrl: Uri): String {
|
|
49
49
|
val host = appUrl.host ?: "localhost"
|
|
50
|
-
val port = if (appUrl.port > 0)
|
|
51
|
-
|
|
50
|
+
val port = if (appUrl.port > 0) {
|
|
51
|
+
appUrl.port
|
|
52
|
+
} else {
|
|
53
|
+
8081
|
|
54
|
+
}
|
|
55
|
+
val scheme = if (appUrl.scheme == "https") {
|
|
56
|
+
"wss"
|
|
57
|
+
} else {
|
|
58
|
+
"ws"
|
|
59
|
+
}
|
|
52
60
|
return "$scheme://$host:$port/inspector/network"
|
|
53
61
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package expo.modules.devlauncher.launcher
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.pm.PackageManager
|
|
6
|
+
import android.os.Build
|
|
7
|
+
|
|
8
|
+
// Android 17 blocks dev server traffic and discovery until the app holds the permission React Native's debug manifest declares.
|
|
9
|
+
internal object LocalNetworkPermission {
|
|
10
|
+
const val PERMISSION = "android.permission.ACCESS_LOCAL_NETWORK"
|
|
11
|
+
const val REQUEST_CODE = 0x4c4e
|
|
12
|
+
|
|
13
|
+
private const val FIRST_ENFORCED_SDK = 37
|
|
14
|
+
|
|
15
|
+
private var wasRequested = false
|
|
16
|
+
|
|
17
|
+
private fun isRequired(context: Context): Boolean =
|
|
18
|
+
Build.VERSION.SDK_INT >= FIRST_ENFORCED_SDK &&
|
|
19
|
+
context.checkSelfPermission(PERMISSION) != PackageManager.PERMISSION_GRANTED
|
|
20
|
+
|
|
21
|
+
// Asks once per process, so the launcher does not ask again right after a denial at startup.
|
|
22
|
+
fun requestIfNeeded(activity: Activity, request: () -> Unit): Boolean {
|
|
23
|
+
if (wasRequested || !isRequired(activity)) {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
wasRequested = true
|
|
27
|
+
request()
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
30
|
+
}
|
package/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherReactNativeHostHandler.kt
CHANGED
|
@@ -23,7 +23,11 @@ class DevLauncherReactNativeHostHandler(context: Context) : ReactNativeHostHandl
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
override fun getUseDeveloperSupport(): Boolean? {
|
|
26
|
-
return if (DevLauncherController.wasInitialized())
|
|
26
|
+
return if (DevLauncherController.wasInitialized()) {
|
|
27
|
+
DevLauncherController.instance.useDeveloperSupport
|
|
28
|
+
} else {
|
|
29
|
+
null
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory? {
|
|
@@ -3,6 +3,7 @@ package expo.modules.devlauncher.react.activitydelegates
|
|
|
3
3
|
import android.content.Intent
|
|
4
4
|
import android.os.Bundle
|
|
5
5
|
import com.facebook.react.ReactActivity
|
|
6
|
+
import expo.modules.devlauncher.launcher.LocalNetworkPermission
|
|
6
7
|
import expo.modules.devlauncher.splashscreen.DevLauncherSplashScreenProvider
|
|
7
8
|
|
|
8
9
|
class DevLauncherReactActivityRedirectDelegate(
|
|
@@ -13,6 +14,17 @@ class DevLauncherReactActivityRedirectDelegate(
|
|
|
13
14
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
14
15
|
DevLauncherSplashScreenProvider()
|
|
15
16
|
.attachSplashScreenViewAsync(plainActivity)
|
|
16
|
-
|
|
17
|
+
val requested = LocalNetworkPermission.requestIfNeeded(plainActivity) {
|
|
18
|
+
plainActivity.requestPermissions(arrayOf(LocalNetworkPermission.PERMISSION), LocalNetworkPermission.REQUEST_CODE)
|
|
19
|
+
}
|
|
20
|
+
if (!requested) {
|
|
21
|
+
redirect(plainActivity.intent)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
|
26
|
+
if (requestCode == LocalNetworkPermission.REQUEST_CODE) {
|
|
27
|
+
redirect(plainActivity.intent)
|
|
28
|
+
}
|
|
17
29
|
}
|
|
18
30
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-dev-launcher",
|
|
3
3
|
"title": "Expo Development Launcher",
|
|
4
|
-
"version": "58.0.
|
|
4
|
+
"version": "58.0.11",
|
|
5
5
|
"description": "Pre-release version of the Expo development launcher package for testing.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"homepage": "https://docs.expo.dev",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@expo/schema-utils": "^58.0.1",
|
|
19
|
-
"expo-dev-menu": "~58.0.
|
|
19
|
+
"expo-dev-menu": "~58.0.10",
|
|
20
20
|
"expo-manifests": "~58.0.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"react-native": "*"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/jest": "^
|
|
27
|
+
"@types/jest": "^30.0.0",
|
|
28
28
|
"@types/node": "^22.14.0"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|