@onekeyfe/react-native-device-utils 6.7.0-alpha.390 → 6.7.0-alpha.392
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.
|
@@ -47,25 +47,24 @@ final class WindowControlsInsetsObserver {
|
|
|
47
47
|
listeners.removeValue(forKey: id)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
private func install() {
|
|
50
|
+
private func install(in keyWindow: UIWindow? = nil) {
|
|
51
51
|
// UIView.LayoutRegion ships in the iOS 26 SDK (Swift 6.2). Older
|
|
52
52
|
// toolchains and systems keep the all-zero value.
|
|
53
53
|
#if compiler(>=6.2)
|
|
54
54
|
guard #available(iOS 26.0, *) else { return }
|
|
55
|
-
|
|
56
|
-
guard let window = WindowControlsInsetsObserver.keyWindow() else {
|
|
57
|
-
// Native modules can initialize before the first window exists.
|
|
58
|
-
guard keyWindowObserver == nil else { return }
|
|
55
|
+
if keyWindowObserver == nil {
|
|
59
56
|
keyWindowObserver = NotificationCenter.default.addObserver(
|
|
60
57
|
forName: UIWindow.didBecomeKeyNotification,
|
|
61
58
|
object: nil,
|
|
62
59
|
queue: .main
|
|
63
|
-
) { [weak self]
|
|
64
|
-
guard let
|
|
65
|
-
|
|
66
|
-
self.keyWindowObserver = nil
|
|
67
|
-
self.install()
|
|
60
|
+
) { [weak self] notification in
|
|
61
|
+
guard let window = notification.object as? UIWindow else { return }
|
|
62
|
+
self?.install(in: window)
|
|
68
63
|
}
|
|
64
|
+
}
|
|
65
|
+
guard let window = keyWindow ?? WindowControlsInsetsObserver.keyWindow() else { return }
|
|
66
|
+
if let view = trackingView, view.window === window {
|
|
67
|
+
update(from: view)
|
|
69
68
|
return
|
|
70
69
|
}
|
|
71
70
|
let view = WindowControlsTrackingView(frame: window.bounds) { [weak self] view in
|
|
@@ -76,8 +75,10 @@ final class WindowControlsInsetsObserver {
|
|
|
76
75
|
view.isAccessibilityElement = false
|
|
77
76
|
// Behind the root view controller's view, so it never draws or
|
|
78
77
|
// receives touches above app content.
|
|
79
|
-
|
|
78
|
+
let previousView = trackingView
|
|
80
79
|
trackingView = view
|
|
80
|
+
previousView?.removeFromSuperview()
|
|
81
|
+
window.insertSubview(view, at: 0)
|
|
81
82
|
update(from: view)
|
|
82
83
|
#endif
|
|
83
84
|
}
|
|
@@ -85,6 +86,7 @@ final class WindowControlsInsetsObserver {
|
|
|
85
86
|
#if compiler(>=6.2)
|
|
86
87
|
@available(iOS 26.0, *)
|
|
87
88
|
private func update(from view: UIView) {
|
|
89
|
+
guard view === trackingView else { return }
|
|
88
90
|
let safeArea = view.safeAreaInsets
|
|
89
91
|
let adapted = view.edgeInsets(for: .safeArea(cornerAdaptation: .horizontal))
|
|
90
92
|
let next = WindowControlsInsets(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-device-utils",
|
|
3
|
-
"version": "6.7.0-alpha.
|
|
3
|
+
"version": "6.7.0-alpha.392",
|
|
4
4
|
"description": "Native device, launch, system appearance and boot recovery utilities for OneKey",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|