expo-dev-menu 5.0.8 → 5.0.10

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 CHANGED
@@ -10,6 +10,21 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 5.0.10 — 2024-05-02
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fixed some dev menu items like "Reload" that are not functional. ([#28578](https://github.com/expo/expo/pull/28578) by [@kudo](https://github.com/kudo))
18
+ - Fixed DevMenu showing up before the app is loaded when using the new architecture. ([#28589](https://github.com/expo/expo/pull/28589) by [@gabrieldonadel](https://github.com/gabrieldonadel))
19
+
20
+ ### 💡 Others
21
+
22
+ - Update Menu background color in dark mode. ([#28549](https://github.com/expo/expo/pull/28549) by [@gabrieldonadel](https://github.com/gabrieldonadel))
23
+
24
+ ## 5.0.9 — 2024-05-01
25
+
26
+ _This version does not introduce any user-facing changes._
27
+
13
28
  ## 5.0.8 — 2024-04-29
14
29
 
15
30
  _This version does not introduce any user-facing changes._
@@ -1,7 +1,7 @@
1
1
  apply plugin: 'com.android.library'
2
2
 
3
3
  group = 'host.exp.exponent'
4
- version = '5.0.8'
4
+ version = '5.0.10'
5
5
 
6
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
7
  apply from: expoModulesCorePlugin
@@ -20,7 +20,7 @@ android {
20
20
  namespace "expo.modules.devmenu"
21
21
  defaultConfig {
22
22
  versionCode 10
23
- versionName '5.0.8'
23
+ versionName '5.0.10'
24
24
  }
25
25
 
26
26
  buildTypes {
@@ -61,15 +61,11 @@ object DevMenuAppInfo {
61
61
  }
62
62
 
63
63
  private fun getApplicationIconUri(reactContext: ReactContext): String {
64
- var appIcon = ""
65
64
  val packageManager = reactContext.packageManager
66
65
  val packageName = reactContext.packageName
67
66
  val applicationInfo = packageManager.getApplicationInfo(packageName, 0)
68
67
 
69
- if (applicationInfo.icon != null) {
70
- appIcon = "" + applicationInfo.icon
71
- }
72
68
  // TODO - figure out how to get resId for AdaptiveIconDrawable icons
73
- return appIcon
69
+ return applicationInfo.icon.toString()
74
70
  }
75
71
  }
@@ -91,23 +91,9 @@ object DevMenuManager : DevMenuManagerInterface, LifecycleEventListener {
91
91
 
92
92
  /**
93
93
  * Returns an collection of modules conforming to [DevMenuExtensionInterface].
94
- * Bridge may register multiple modules with the same name – in this case it returns only the one that overrides the others.
95
94
  */
96
- private val delegateExtensions: Collection<DevMenuExtensionInterface>
97
- get() {
98
- val reactContext = delegateReactContext ?: return emptyList()
99
- val uniqueExtensionClasses = reactContext
100
- .nativeModules
101
- .filterIsInstance<DevMenuExtensionInterface>()
102
- .filterIsInstance<NativeModule>()
103
- .map { it.javaClass }
104
- .toSet()
105
-
106
- return uniqueExtensionClasses
107
- .map { extensionClass ->
108
- reactContext.getNativeModule(extensionClass) as DevMenuExtensionInterface
109
- }
110
- }
95
+ @get:Synchronized
96
+ private val delegateExtensions = mutableListOf<DevMenuExtensionInterface>()
111
97
 
112
98
  private val cachedDevMenuDataSources by KeyValueCachedProperty<ReactHostWrapper, List<DevMenuDataSourceInterface>> {
113
99
  delegateExtensions
@@ -460,6 +446,10 @@ object DevMenuManager : DevMenuManagerInterface, LifecycleEventListener {
460
446
  }
461
447
  }
462
448
 
449
+ override fun registerExtensionInterface(extensionInterface: DevMenuExtensionInterface) {
450
+ delegateExtensions.add(extensionInterface)
451
+ }
452
+
463
453
  override fun sendEventToDelegateBridge(eventName: String, eventData: Any?) {
464
454
  delegateReactContext
465
455
  ?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
@@ -22,6 +22,10 @@ class DevMenuExtension(reactContext: ReactApplicationContext) :
22
22
  ReactContextBaseJavaModule(reactContext), DevMenuExtensionInterface {
23
23
  override fun getName() = "ExpoDevMenuExtensions"
24
24
 
25
+ init {
26
+ DevMenuManager.registerExtensionInterface(this)
27
+ }
28
+
25
29
  override fun devMenuItems(settings: DevMenuExtensionSettingsInterface) = DevMenuItemsContainer.export {
26
30
  if (!settings.wasRunOnDevelopmentBridge()) {
27
31
  return@export
@@ -7,6 +7,7 @@ import android.view.KeyEvent
7
7
  import android.view.MotionEvent
8
8
  import com.facebook.react.bridge.ReadableMap
9
9
  import expo.interfaces.devmenu.DevMenuDelegateInterface
10
+ import expo.interfaces.devmenu.DevMenuExtensionInterface
10
11
  import expo.interfaces.devmenu.DevMenuManagerInterface
11
12
  import expo.interfaces.devmenu.DevMenuPreferencesInterface
12
13
  import expo.interfaces.devmenu.ReactHostWrapper
@@ -71,6 +72,10 @@ object DevMenuManager : DevMenuManagerInterface {
71
72
  throw IllegalStateException(DEV_MENU_IS_NOT_AVAILABLE)
72
73
  }
73
74
 
75
+ override fun registerExtensionInterface(extensionInterface: DevMenuExtensionInterface) {
76
+ throw IllegalStateException(DEV_MENU_IS_NOT_AVAILABLE)
77
+ }
78
+
74
79
  override fun serializedItems(): List<Bundle> {
75
80
  throw IllegalStateException(DEV_MENU_IS_NOT_AVAILABLE)
76
81
  }