expo-dev-menu 58.0.10 → 58.0.12
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 +12 -0
- package/android/build.gradle +2 -2
- package/android/src/debug/java/expo/modules/devmenu/api/DevMenuApi.kt +1 -11
- package/android/src/debug/java/expo/modules/devmenu/helpers/DevMenuReflectionExtensions.kt +0 -9
- package/android/src/testDebug/java/expo/modules/devmenu/api/DevMenuApiTest.kt +20 -0
- package/expo-dev-menu.podspec +0 -19
- package/ios/FAB/DevMenuFABWindow.swift +17 -0
- package/package.json +5 -5
- package/android/src/debug/java/expo/modules/devmenu/react/DevMenuShakeDetectorListenerSwapper.kt +0 -39
- package/ios/UITests/DevMenuLooper.swift +0 -29
- package/ios/UITests/DevMenuTestOptions.swift +0 -4
- package/ios/UITests/DevMenuUIMatchers.swift +0 -106
- package/ios/UITests/MockedBridges.swift +0 -19
- package/ios/UITests/UIView+DevMenuExtension.swift +0 -7
- package/ios/UITests/XCTestCase+DevMenuExtension.swift +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [iOS] Fix the floating tools button leaving the app stuck in landscape after returning to a portrait-only screen. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
|
|
8
|
+
|
|
9
|
+
## 58.0.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [Android] Disable the React Native shake gesture with its public API instead of replacing the shake listener through reflection. ([#51130](https://github.com/expo/expo/pull/51130) by [@alanjhughes](https://github.com/alanjhughes))
|
|
14
|
+
|
|
3
15
|
## 58.0.10
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -12,7 +12,7 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
12
12
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
13
13
|
|
|
14
14
|
group = 'host.exp.exponent'
|
|
15
|
-
version = '58.0.
|
|
15
|
+
version = '58.0.12'
|
|
16
16
|
|
|
17
17
|
def hasDevLauncher = findProject(":expo-dev-launcher") != null
|
|
18
18
|
def configureInRelease = findProperty("expo.devmenu.configureInRelease") == "true"
|
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
|
|
30
30
|
defaultConfig {
|
|
31
31
|
versionCode 10
|
|
32
|
-
versionName '58.0.
|
|
32
|
+
versionName '58.0.12'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
buildTypes {
|
|
@@ -17,7 +17,6 @@ import expo.modules.devmenu.GoHomeAction
|
|
|
17
17
|
import expo.modules.devmenu.SwitchToComponentAction
|
|
18
18
|
import expo.modules.devmenu.helpers.getPrivateDeclaredFieldValue
|
|
19
19
|
import expo.modules.devmenu.helpers.setPrivateDeclaredFieldValue
|
|
20
|
-
import expo.modules.devmenu.react.DevMenuShakeDetectorListenerSwapper
|
|
21
20
|
import expo.modules.devmenu.websockets.DevMenuCommandHandlersProvider
|
|
22
21
|
import expo.modules.kotlin.weak
|
|
23
22
|
import java.lang.ref.WeakReference
|
|
@@ -89,15 +88,6 @@ object DevMenuApi {
|
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
fun uninstallDefaultShakeDetector(devSupportManager: DevSupportManager) {
|
|
92
|
-
|
|
93
|
-
Log.w("DevMenu", "DevSupportManager is not an instance of DevSupportManagerBase. Skipping uninstallation of the default shake detector.")
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
DevMenuShakeDetectorListenerSwapper()
|
|
98
|
-
.swapShakeDetectorListener(
|
|
99
|
-
devSupportManager,
|
|
100
|
-
newListener = {}
|
|
101
|
-
)
|
|
91
|
+
devSupportManager.shakeGestureEnabled = false
|
|
102
92
|
}
|
|
103
93
|
}
|
|
@@ -26,12 +26,3 @@ fun <T> Class<out T>.setPrivateDeclaredFieldValue(filedName: String, obj: T, new
|
|
|
26
26
|
|
|
27
27
|
field.set(obj, newValue)
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
fun <T> Class<out T>.hasDeclaredField(fieldName: String): Boolean {
|
|
31
|
-
return try {
|
|
32
|
-
getDeclaredField(fieldName)
|
|
33
|
-
true
|
|
34
|
-
} catch (_: NoSuchFieldException) {
|
|
35
|
-
false
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package expo.modules.devmenu.api
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
|
4
|
+
import io.mockk.mockk
|
|
5
|
+
import io.mockk.verify
|
|
6
|
+
import org.junit.Test
|
|
7
|
+
import org.junit.runner.RunWith
|
|
8
|
+
import org.robolectric.RobolectricTestRunner
|
|
9
|
+
|
|
10
|
+
@RunWith(RobolectricTestRunner::class)
|
|
11
|
+
internal class DevMenuApiTest {
|
|
12
|
+
@Test
|
|
13
|
+
fun `disables the React Native shake gesture`() {
|
|
14
|
+
val devSupportManager = mockk<DevSupportManager>(relaxed = true)
|
|
15
|
+
|
|
16
|
+
DevMenuApi.uninstallDefaultShakeDetector(devSupportManager)
|
|
17
|
+
|
|
18
|
+
verify { devSupportManager.shakeGestureEnabled = false }
|
|
19
|
+
}
|
|
20
|
+
}
|
package/expo-dev-menu.podspec
CHANGED
|
@@ -123,24 +123,5 @@ Pod::Spec.new do |s|
|
|
|
123
123
|
}
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
s.test_spec 'UITests' do |test_spec|
|
|
127
|
-
test_spec.requires_app_host = true
|
|
128
|
-
test_spec.source_files = 'ios/UITests/**/*'
|
|
129
|
-
test_spec.dependency 'React-CoreModules'
|
|
130
|
-
test_spec.dependency 'ReactAppDependencyProvider'
|
|
131
|
-
test_spec.dependency 'React'
|
|
132
|
-
# ExpoModulesCore requires React-hermes or React-jsc in tests, add ExpoModulesTestCore for the underlying dependencies
|
|
133
|
-
test_spec.dependency 'ExpoModulesTestCore'
|
|
134
|
-
test_spec.pod_target_xcconfig = {
|
|
135
|
-
'OTHER_LDFLAGS' => '$(inherited) -lc++'
|
|
136
|
-
}
|
|
137
|
-
test_spec.platforms = {
|
|
138
|
-
:ios => '16.4'
|
|
139
|
-
}
|
|
140
|
-
test_spec.pod_target_xcconfig = {
|
|
141
|
-
'OTHER_LDFLAGS' => '$(inherited) -lc++'
|
|
142
|
-
}
|
|
143
|
-
end
|
|
144
|
-
|
|
145
126
|
s.default_subspec = ['Main']
|
|
146
127
|
end
|
|
@@ -13,11 +13,13 @@ class DevMenuFABWindow: UIWindow {
|
|
|
13
13
|
var fabFrame: CGRect = .zero
|
|
14
14
|
private var currentAnimator: UIViewPropertyAnimator?
|
|
15
15
|
private var targetVisibility: Bool?
|
|
16
|
+
private var appWindowFrameObservation: NSKeyValueObservation?
|
|
16
17
|
|
|
17
18
|
init(manager: DevMenuManager, windowScene: UIWindowScene) {
|
|
18
19
|
self.manager = manager
|
|
19
20
|
super.init(windowScene: windowScene)
|
|
20
21
|
setupWindow()
|
|
22
|
+
observeAppWindowRotation(in: windowScene)
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
@available(*, unavailable)
|
|
@@ -46,6 +48,21 @@ class DevMenuFABWindow: UIWindow {
|
|
|
46
48
|
rootViewController = hostingController
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
// react-native-screens rotates only the app window, and UIKit does not ask this overlay for its orientations again.
|
|
52
|
+
// The scene would then report the overlay's old orientation, and react-native-screens would skip the next rotation.
|
|
53
|
+
private func observeAppWindowRotation(in windowScene: UIWindowScene) {
|
|
54
|
+
guard let appWindow = windowScene.windows.first(where: { $0.windowLevel == .normal }) else {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
appWindowFrameObservation = appWindow.observe(\.frame, options: [.old, .new]) { [weak self] _, change in
|
|
58
|
+
guard let old = change.oldValue, let new = change.newValue,
|
|
59
|
+
(old.width > old.height) != (new.width > new.height) else {
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
self?.hostingController?.setNeedsUpdateOfSupportedInterfaceOrientations()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
49
66
|
private var edgeTranslation: CGAffineTransform {
|
|
50
67
|
let availableWidth = SceneGeometry.bounds(for: self).width
|
|
51
68
|
let isOnRight = fabFrame == .zero || fabFrame.midX > (availableWidth / 2)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-dev-menu",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.12",
|
|
4
4
|
"description": "Expo/React Native module with the developer menu.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dev",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/preset-typescript": "^7.7.4",
|
|
31
|
+
"@expo/internal-scripts": "58.0.4",
|
|
31
32
|
"@testing-library/react-native": "^14.0.1",
|
|
32
|
-
"@types/jest": "^
|
|
33
|
+
"@types/jest": "^30.0.0",
|
|
33
34
|
"@types/node": "^22.14.0",
|
|
34
|
-
"babel-preset-expo": "58.0.
|
|
35
|
-
"expo-module-scripts": "56.0.5",
|
|
35
|
+
"babel-preset-expo": "58.0.21",
|
|
36
36
|
"react": "19.3.0",
|
|
37
|
-
"react-native": "0.88.0
|
|
37
|
+
"react-native": "0.88.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"expo": "*",
|
package/android/src/debug/java/expo/modules/devmenu/react/DevMenuShakeDetectorListenerSwapper.kt
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
package expo.modules.devmenu.react
|
|
2
|
-
|
|
3
|
-
import android.util.Log
|
|
4
|
-
import com.facebook.react.common.ShakeDetector
|
|
5
|
-
import com.facebook.react.devsupport.DevSupportManagerBase
|
|
6
|
-
import expo.modules.devmenu.helpers.getPrivateDeclaredFieldValue
|
|
7
|
-
import expo.modules.devmenu.helpers.hasDeclaredField
|
|
8
|
-
import expo.modules.devmenu.helpers.setPrivateDeclaredFieldValue
|
|
9
|
-
|
|
10
|
-
class DevMenuShakeDetectorListenerSwapper {
|
|
11
|
-
fun swapShakeDetectorListener(
|
|
12
|
-
devSupportManager: DevSupportManagerBase,
|
|
13
|
-
newListener: ShakeDetector.ShakeListener
|
|
14
|
-
) {
|
|
15
|
-
try {
|
|
16
|
-
val shakeDetector: ShakeDetector =
|
|
17
|
-
DevSupportManagerBase::class.java.getPrivateDeclaredFieldValue(
|
|
18
|
-
"shakeDetector",
|
|
19
|
-
devSupportManager
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
if (ShakeDetector::class.java.hasDeclaredField("shakeListener")) {
|
|
23
|
-
ShakeDetector::class.java.setPrivateDeclaredFieldValue(
|
|
24
|
-
"shakeListener",
|
|
25
|
-
shakeDetector,
|
|
26
|
-
newListener
|
|
27
|
-
)
|
|
28
|
-
} else {
|
|
29
|
-
ShakeDetector::class.java.setPrivateDeclaredFieldValue(
|
|
30
|
-
"mShakeListener",
|
|
31
|
-
shakeDetector,
|
|
32
|
-
newListener
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
} catch (e: Exception) {
|
|
36
|
-
Log.w("DevMenu", "Couldn't swap shake detector listener: ${e.message}", e)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import XCTest
|
|
3
|
-
|
|
4
|
-
class DevMenuLooper {
|
|
5
|
-
static func runMainLoop(for sec: Double) {
|
|
6
|
-
RunLoop.main.run(mode: .default, before: Date(timeIntervalSinceNow: sec))
|
|
7
|
-
RunLoop.main.run(mode: .common, before: Date(timeIntervalSinceNow: sec))
|
|
8
|
-
RunLoop.main.run(mode: .tracking, before: Date(timeIntervalSinceNow: sec))
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
static func runMainLoopUntilEmpty() {
|
|
12
|
-
var isEmpty = false
|
|
13
|
-
|
|
14
|
-
DispatchQueue.main.async {
|
|
15
|
-
isEmpty = true
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let timout = Date(timeIntervalSinceNow: DevMenuTestOptions.defaultTimeout)
|
|
19
|
-
while timout.timeIntervalSinceNow > 0 {
|
|
20
|
-
if isEmpty {
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
DevMenuLooper.runMainLoop(for: DevMenuTestOptions.loopTime)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
XCTFail("Wait for main thread timeout.")
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import XCTest
|
|
2
|
-
import UIKit
|
|
3
|
-
|
|
4
|
-
class DevMenuViews {
|
|
5
|
-
static let mainScreen = "DevMenuMainScreen"
|
|
6
|
-
static let footer = "DevMenuFooter"
|
|
7
|
-
static let settingsScreen = "DevMenuSettingsScreen"
|
|
8
|
-
static let profileScreen = "DevMenuProfileScreen"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
class DevMenuUIMatchers {
|
|
12
|
-
static func currentRootView() -> UIView? {
|
|
13
|
-
return UIApplication.shared.keyWindow?.rootViewController?.view
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static func findView(rootView: UIView, _ matcher: (UIView) -> Bool) -> UIView? {
|
|
17
|
-
if matcher(rootView) {
|
|
18
|
-
return rootView
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
for subView in rootView.subviews {
|
|
22
|
-
let found = findView(rootView: subView, matcher)
|
|
23
|
-
if found != nil {
|
|
24
|
-
return found
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return nil
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static func findView(_ matcher: (UIView) -> Bool) -> UIView? {
|
|
32
|
-
guard let view = DevMenuUIMatchers.currentRootView() else {
|
|
33
|
-
return nil
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return findView(rootView: view, matcher)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static func findView(rootView: UIView, tag: String) -> UIView? {
|
|
40
|
-
return DevMenuUIMatchers.findView(rootView: rootView) {
|
|
41
|
-
return $0.accessibilityIdentifier == tag && $0.isVisible()
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static func findView(tag: String) -> UIView? {
|
|
46
|
-
guard let view = DevMenuUIMatchers.currentRootView() else {
|
|
47
|
-
return nil
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return findView(rootView: view, tag: tag)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static func waitForView(_ matcher: (UIView) -> Bool) -> UIView {
|
|
54
|
-
let timer = Date(timeIntervalSinceNow: DevMenuTestOptions.defaultTimeout)
|
|
55
|
-
|
|
56
|
-
while timer.timeIntervalSinceNow > 0 {
|
|
57
|
-
DevMenuLooper.runMainLoop(for: DevMenuTestOptions.loopTime)
|
|
58
|
-
|
|
59
|
-
guard let view = DevMenuUIMatchers.currentRootView() else {
|
|
60
|
-
continue
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let found = findView(rootView: view, matcher)
|
|
64
|
-
if found != nil {
|
|
65
|
-
return found!
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
XCTFail("Can not find view.")
|
|
70
|
-
return UIView() // just for compiler
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
static func waitForView(tag: String) -> UIView {
|
|
74
|
-
return waitForView {
|
|
75
|
-
return $0.accessibilityIdentifier == tag && $0.isVisible()
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
static func waitForView(text: String) -> UIView {
|
|
80
|
-
return waitForView {
|
|
81
|
-
if type(of: $0) == NSClassFromString("RCTTextView")! {
|
|
82
|
-
return $0.isVisible() && ($0.value(forKey: "_textStorage") as! NSTextStorage).string == text
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return false
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
static func findView(rootView: UIView, text: String) -> UIView? {
|
|
90
|
-
findView(rootView: rootView) {
|
|
91
|
-
if type(of: $0) == NSClassFromString("RCTTextView")! {
|
|
92
|
-
return $0.isVisible() && ($0.value(forKey: "_textStorage") as! NSTextStorage).string == text
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return false
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
static func findView(text: String) -> UIView? {
|
|
100
|
-
guard let view = DevMenuUIMatchers.currentRootView() else {
|
|
101
|
-
return nil
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return findView(rootView: view, text: text)
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
@testable import EXDevMenu
|
|
2
|
-
@testable import EXDevMenuInterface
|
|
3
|
-
import React
|
|
4
|
-
|
|
5
|
-
class UIMockedNOOPBridge: RCTBridge {
|
|
6
|
-
override func invalidate() {
|
|
7
|
-
// NOOP
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
override func setUp() {
|
|
11
|
-
bundleURL = URL(string: "http://localhost:1234")
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class BridgeWithDevMenuExtension: UIMockedNOOPBridge {
|
|
16
|
-
override func module(forName moduleName: String!) -> Any! {
|
|
17
|
-
return []
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import XCTest
|
|
2
|
-
|
|
3
|
-
@testable import EXDevMenu
|
|
4
|
-
|
|
5
|
-
extension XCTest {
|
|
6
|
-
func assertViewExists(tag: String) {
|
|
7
|
-
XCTAssertNotNil(DevMenuUIMatchers.findView(tag: tag), "View with tag \(tag) does not exist.")
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
func assertViewExists(text: String) {
|
|
11
|
-
let view = DevMenuUIMatchers.findView(text: text)
|
|
12
|
-
XCTAssertNotNil(view, "View with text \(text) does not exist.")
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
func waitForView(tag: String) {
|
|
16
|
-
XCTAssertNotNil(DevMenuUIMatchers.waitForView(tag: tag))
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
func waitForDevMenu() {
|
|
20
|
-
waitForView(tag: DevMenuViews.mainScreen)
|
|
21
|
-
waitForView(tag: DevMenuViews.footer)
|
|
22
|
-
XCTAssertTrue(DevMenuManager.shared.isVisible)
|
|
23
|
-
|
|
24
|
-
DevMenuLooper.runMainLoopUntilEmpty()
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
func runMainLoop(for sec: Double) {
|
|
28
|
-
DevMenuLooper.runMainLoop(for: sec)
|
|
29
|
-
}
|
|
30
|
-
}
|