expo-dev-menu-interface 1.7.2 → 1.8.1
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/android/build.gradle +6 -79
- package/android/src/main/java/expo/interfaces/devmenu/DevMenuDelegateInterface.kt +2 -3
- package/android/src/main/java/expo/interfaces/devmenu/DevMenuManagerInterface.kt +3 -4
- package/android/src/main/java/expo/interfaces/devmenu/ReactHostWrapper.kt +117 -0
- package/ios/MenuItems/DevMenuSelectionList.swift +3 -3
- package/package.json +2 -2
package/android/build.gradle
CHANGED
|
@@ -1,91 +1,19 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven-publish'
|
|
4
2
|
|
|
5
3
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '1.
|
|
4
|
+
version = '1.8.1'
|
|
7
5
|
|
|
8
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
buildscript {
|
|
15
|
-
// Simple helper that allows the root project to override versions declared by this library.
|
|
16
|
-
ext.safeExtGet = { prop, fallback ->
|
|
17
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Ensures backward compatibility
|
|
21
|
-
ext.getKotlinVersion = {
|
|
22
|
-
if (ext.has("kotlinVersion")) {
|
|
23
|
-
ext.kotlinVersion()
|
|
24
|
-
} else {
|
|
25
|
-
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
repositories {
|
|
30
|
-
mavenCentral()
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
dependencies {
|
|
34
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
afterEvaluate {
|
|
39
|
-
publishing {
|
|
40
|
-
publications {
|
|
41
|
-
release(MavenPublication) {
|
|
42
|
-
from components.release
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
repositories {
|
|
46
|
-
maven {
|
|
47
|
-
url = mavenLocal().url
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
7
|
+
apply from: expoModulesCorePlugin
|
|
8
|
+
applyKotlinExpoModulesCorePlugin()
|
|
9
|
+
useCoreDependencies()
|
|
10
|
+
useDefaultAndroidSdkVersions()
|
|
52
11
|
|
|
53
12
|
android {
|
|
54
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
55
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
56
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
57
|
-
|
|
58
|
-
defaultConfig {
|
|
59
|
-
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
60
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
lintOptions {
|
|
64
|
-
abortOnError false
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
69
|
-
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
70
|
-
compileOptions {
|
|
71
|
-
sourceCompatibility JavaVersion.VERSION_11
|
|
72
|
-
targetCompatibility JavaVersion.VERSION_11
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
kotlinOptions {
|
|
76
|
-
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
13
|
namespace "expo.interfaces.devmenu"
|
|
81
14
|
defaultConfig {
|
|
82
15
|
versionCode 6
|
|
83
|
-
versionName '1.
|
|
84
|
-
}
|
|
85
|
-
publishing {
|
|
86
|
-
singleVariant("release") {
|
|
87
|
-
withSourcesJar()
|
|
88
|
-
}
|
|
16
|
+
versionName '1.8.1'
|
|
89
17
|
}
|
|
90
18
|
}
|
|
91
19
|
|
|
@@ -94,6 +22,5 @@ dependencies {
|
|
|
94
22
|
|
|
95
23
|
implementation 'com.squareup.okhttp3:okhttp:3.14.9'
|
|
96
24
|
|
|
97
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
98
25
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3"
|
|
99
26
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package expo.interfaces.devmenu
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
|
-
import com.facebook.react.ReactInstanceManager
|
|
5
4
|
|
|
6
5
|
interface DevMenuDelegateInterface {
|
|
7
6
|
/**
|
|
@@ -10,9 +9,9 @@ interface DevMenuDelegateInterface {
|
|
|
10
9
|
fun appInfo(): Bundle?
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
|
-
* Returns a
|
|
12
|
+
* Returns a [ReactHostWrapper] ot the currently shown app. It is a context of what the dev menu displays.
|
|
14
13
|
*/
|
|
15
|
-
fun
|
|
14
|
+
fun reactHost(): ReactHostWrapper
|
|
16
15
|
|
|
17
16
|
fun supportsDevelopment(): Boolean {
|
|
18
17
|
return true
|
|
@@ -4,7 +4,6 @@ import android.app.Activity
|
|
|
4
4
|
import android.os.Bundle
|
|
5
5
|
import android.view.KeyEvent
|
|
6
6
|
import android.view.MotionEvent
|
|
7
|
-
import com.facebook.react.ReactNativeHost
|
|
8
7
|
import com.facebook.react.bridge.ReadableMap
|
|
9
8
|
import expo.interfaces.devmenu.items.DevMenuDataSourceItem
|
|
10
9
|
import kotlinx.coroutines.CoroutineScope
|
|
@@ -48,9 +47,9 @@ interface DevMenuManagerInterface {
|
|
|
48
47
|
fun setDelegate(newDelegate: DevMenuDelegateInterface)
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
|
-
* Initializes the dev menu manager to work with react
|
|
50
|
+
* Initializes the dev menu manager to work with react host.
|
|
52
51
|
*/
|
|
53
|
-
fun
|
|
52
|
+
fun initializeWithReactHost(reactHost: ReactHostWrapper)
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
55
|
* Finds and dispatches action with provided [actionId].
|
|
@@ -77,7 +76,7 @@ interface DevMenuManagerInterface {
|
|
|
77
76
|
/**
|
|
78
77
|
* @return the dev menu application host.
|
|
79
78
|
*/
|
|
80
|
-
fun getMenuHost():
|
|
79
|
+
fun getMenuHost(): ReactHostWrapper
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
82
|
* Synchronizes [ReactInstanceManager] from delegate with one saved in [DevMenuManger].
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@file:Suppress("DEPRECATION")
|
|
2
|
+
|
|
3
|
+
package expo.interfaces.devmenu
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.JSEngineResolutionAlgorithm
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactInstanceEventListener
|
|
8
|
+
import com.facebook.react.ReactNativeHost
|
|
9
|
+
import com.facebook.react.bridge.ReactContext
|
|
10
|
+
import com.facebook.react.common.LifecycleState
|
|
11
|
+
import com.facebook.react.config.ReactFeatureFlags
|
|
12
|
+
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
|
13
|
+
import com.facebook.react.runtime.ReactHostImpl
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* An abstract wrapper to host [ReactNativeHost] and [ReactHost],
|
|
17
|
+
* so that call-sites do not have to handle the difference between legacy bridge and bridgeless mode.
|
|
18
|
+
*/
|
|
19
|
+
class ReactHostWrapper(reactNativeHost: ReactNativeHost, reactHost: ReactHost?) {
|
|
20
|
+
lateinit var reactNativeHost: ReactNativeHost
|
|
21
|
+
lateinit var reactHost: ReactHost
|
|
22
|
+
|
|
23
|
+
init {
|
|
24
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
25
|
+
this.reactHost = requireNotNull(reactHost)
|
|
26
|
+
} else {
|
|
27
|
+
this.reactNativeHost = reactNativeHost
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun hashCode(): Int {
|
|
32
|
+
return if (isBridgelessMode) {
|
|
33
|
+
reactHost.hashCode()
|
|
34
|
+
} else {
|
|
35
|
+
reactNativeHost.hashCode()
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
val currentReactContext: ReactContext?
|
|
40
|
+
get() {
|
|
41
|
+
return if (isBridgelessMode) {
|
|
42
|
+
reactHost.currentReactContext
|
|
43
|
+
} else {
|
|
44
|
+
reactNativeHost.reactInstanceManager.currentReactContext
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
val lifecycleState: LifecycleState
|
|
49
|
+
get() {
|
|
50
|
+
return if (isBridgelessMode) {
|
|
51
|
+
reactHost.lifecycleState
|
|
52
|
+
} else {
|
|
53
|
+
reactNativeHost.reactInstanceManager.lifecycleState
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
val hasInstance: Boolean
|
|
58
|
+
get() {
|
|
59
|
+
return currentReactContext?.hasActiveReactInstance() ?: false
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
val devSupportManager: DevSupportManager?
|
|
63
|
+
get() {
|
|
64
|
+
return if (isBridgelessMode) {
|
|
65
|
+
reactHost.devSupportManager
|
|
66
|
+
} else {
|
|
67
|
+
reactNativeHost.reactInstanceManager.devSupportManager
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
val isBridgelessMode = ReactFeatureFlags.enableBridgelessArchitecture
|
|
72
|
+
|
|
73
|
+
val jsExecutorName: String
|
|
74
|
+
get() {
|
|
75
|
+
if (isBridgelessMode) {
|
|
76
|
+
return if (reactHost.jsEngineResolutionAlgorithm == JSEngineResolutionAlgorithm.JSC) {
|
|
77
|
+
"JSC"
|
|
78
|
+
} else {
|
|
79
|
+
"Hermes"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return reactNativeHost.reactInstanceManager.jsExecutorName
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
fun addReactInstanceEventListener(listener: ReactInstanceEventListener) {
|
|
87
|
+
if (isBridgelessMode) {
|
|
88
|
+
(reactHost as ReactHostImpl).addReactInstanceEventListener(listener)
|
|
89
|
+
} else {
|
|
90
|
+
reactNativeHost.reactInstanceManager.addReactInstanceEventListener(listener)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
fun removeReactInstanceEventListener(listener: ReactInstanceEventListener) {
|
|
95
|
+
if (isBridgelessMode) {
|
|
96
|
+
(reactHost as ReactHostImpl).removeReactInstanceEventListener(listener)
|
|
97
|
+
} else {
|
|
98
|
+
reactNativeHost.reactInstanceManager.removeReactInstanceEventListener(listener)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
fun start() {
|
|
103
|
+
if (isBridgelessMode) {
|
|
104
|
+
(reactHost as ReactHostImpl).start()
|
|
105
|
+
} else {
|
|
106
|
+
reactNativeHost.reactInstanceManager.createReactContextInBackground()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
fun destroy(reason: String = "DevLauncher reloading app") {
|
|
111
|
+
if (isBridgelessMode) {
|
|
112
|
+
reactHost.destroy(reason, null)
|
|
113
|
+
} else {
|
|
114
|
+
reactNativeHost.clear()
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import Foundation
|
|
4
4
|
|
|
5
|
-
@objc
|
|
5
|
+
@objc(EXDevMenuSelectionList)
|
|
6
6
|
public class DevMenuSelectionList: DevMenuScreenItem, DevMenuCallableProvider {
|
|
7
|
-
@objc
|
|
7
|
+
@objc(EXDevMenuItem)
|
|
8
8
|
public class Item: NSObject, DevMenuDataSourceItem {
|
|
9
|
-
@objc
|
|
9
|
+
@objc(EXDevMenuTag)
|
|
10
10
|
public class Tag: NSObject {
|
|
11
11
|
@objc
|
|
12
12
|
public var text: () -> String = { "" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-dev-menu-interface",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Interface for expo-dev-menu",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"expo": "*"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "75658dcbae535ec32cbb296de1c811eba059e03a"
|
|
29
29
|
}
|