@@ -51,9 +51,6 @@ - (void)initialize
51
51
selector: @selector (didReceiveNewContentSizeMultiplier )
52
52
name: RCTAccessibilityManagerDidUpdateMultiplierNotification
53
53
object: [_moduleRegistry moduleForName: " AccessibilityManager" ]];
54
-
55
-
56
- _currentInterfaceOrientation = [RCTSharedApplication () statusBarOrientation ];
57
54
58
55
_currentInterfaceDimensions = [self _exportedDimensions ];
59
56
@@ -71,10 +68,16 @@ - (void)initialize
71
68
selector: @selector (interfaceFrameDidChange )
72
69
name: RCTWindowFrameDidChangeNotification
73
70
object: nil ];
71
+
72
+ #if TARGET_OS_IOS
73
+
74
+ _currentInterfaceOrientation = RCTKeyWindow ().windowScene .interfaceOrientation ;
75
+
74
76
[[NSNotificationCenter defaultCenter ] addObserver: self
75
77
selector: @selector (interfaceFrameDidChange )
76
78
name: UIDeviceOrientationDidChangeNotification
77
79
object: nil ];
80
+ #endif
78
81
79
82
// TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73
80
83
// The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure
@@ -101,12 +104,7 @@ - (void)_cleanupObservers
101
104
[[NSNotificationCenter defaultCenter ] removeObserver: self
102
105
name: RCTAccessibilityManagerDidUpdateMultiplierNotification
103
106
object: [_moduleRegistry moduleForName: " AccessibilityManager" ]];
104
- #if !TARGET_OS_VISION
105
- [[NSNotificationCenter defaultCenter ] removeObserver: self
106
- name: UIApplicationDidChangeStatusBarOrientationNotification
107
- object: nil ];
108
- [[NSNotificationCenter defaultCenter ] removeObserver: self name: UIDeviceOrientationDidChangeNotification object: nil ];
109
- #endif
107
+
110
108
[[NSNotificationCenter defaultCenter ] removeObserver: self name: UIApplicationDidBecomeActiveNotification object: nil ];
111
109
112
110
[[NSNotificationCenter defaultCenter ] removeObserver: self name: RCTUserInterfaceStyleDidChangeNotification object: nil ];
@@ -115,26 +113,25 @@ - (void)_cleanupObservers
115
113
116
114
[[NSNotificationCenter defaultCenter ] removeObserver: self name: RCTBridgeWillInvalidateModulesNotification object: nil ];
117
115
116
+ #if TARGET_OS_IOS
118
117
[[NSNotificationCenter defaultCenter ] removeObserver: self name: UIDeviceOrientationDidChangeNotification object: nil ];
118
+ #endif
119
119
}
120
120
121
121
static BOOL RCTIsIPhoneNotched ()
122
122
{
123
123
static BOOL isIPhoneNotched = NO ;
124
- #if !TARGET_OS_VISION
125
- static dispatch_once_t onceToken;
124
+ static dispatch_once_t onceToken;
126
125
126
+ #if TARGET_OS_IOS
127
127
dispatch_once (&onceToken, ^{
128
128
RCTAssertMainQueue ();
129
129
130
130
// 20pt is the top safeArea value in non-notched devices
131
131
isIPhoneNotched = RCTSharedApplication ().keyWindow .safeAreaInsets .top > 20 ;
132
132
});
133
-
134
- // 20pt is the top safeArea value in non-notched devices
135
- isIPhoneNotched = RCTSharedApplication ().keyWindow .safeAreaInsets .top > 20 ;
136
- });
137
133
#endif
134
+
138
135
return isIPhoneNotched;
139
136
}
140
137
@@ -217,8 +214,9 @@ - (void)interfaceOrientationDidChange
217
214
218
215
- (void )_interfaceOrientationDidChange
219
216
{
217
+ #if TARGET_OS_IOS
220
218
UIApplication *application = RCTSharedApplication ();
221
- UIInterfaceOrientation nextOrientation = [application statusBarOrientation ] ;
219
+ UIInterfaceOrientation nextOrientation = RCTKeyWindow (). windowScene . interfaceOrientation ;
222
220
223
221
BOOL isRunningInFullScreen =
224
222
CGRectEqualToRect (application.delegate .window .frame , application.delegate .window .screen .bounds );
@@ -246,6 +244,7 @@ - (void)_interfaceOrientationDidChange
246
244
_isFullscreen = isRunningInFullScreen;
247
245
#pragma clang diagnostic pop
248
246
}
247
+ #endif
249
248
}
250
249
251
250
- (void )interfaceFrameDidChange
0 commit comments