@@ -51,9 +51,6 @@ - (void)initialize
5151 selector: @selector (didReceiveNewContentSizeMultiplier )
5252 name: RCTAccessibilityManagerDidUpdateMultiplierNotification
5353 object: [_moduleRegistry moduleForName: " AccessibilityManager" ]];
54-
55-
56- _currentInterfaceOrientation = [RCTSharedApplication () statusBarOrientation ];
5754
5855 _currentInterfaceDimensions = [self _exportedDimensions ];
5956
@@ -71,10 +68,16 @@ - (void)initialize
7168 selector: @selector (interfaceFrameDidChange )
7269 name: RCTWindowFrameDidChangeNotification
7370 object: nil ];
71+
72+ #if TARGET_OS_IOS
73+
74+ _currentInterfaceOrientation = RCTKeyWindow ().windowScene .interfaceOrientation ;
75+
7476 [[NSNotificationCenter defaultCenter ] addObserver: self
7577 selector: @selector (interfaceFrameDidChange )
7678 name: UIDeviceOrientationDidChangeNotification
7779 object: nil ];
80+ #endif
7881
7982 // TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73
8083 // The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure
@@ -101,12 +104,7 @@ - (void)_cleanupObservers
101104 [[NSNotificationCenter defaultCenter ] removeObserver: self
102105 name: RCTAccessibilityManagerDidUpdateMultiplierNotification
103106 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+
110108 [[NSNotificationCenter defaultCenter ] removeObserver: self name: UIApplicationDidBecomeActiveNotification object: nil ];
111109
112110 [[NSNotificationCenter defaultCenter ] removeObserver: self name: RCTUserInterfaceStyleDidChangeNotification object: nil ];
@@ -115,26 +113,25 @@ - (void)_cleanupObservers
115113
116114 [[NSNotificationCenter defaultCenter ] removeObserver: self name: RCTBridgeWillInvalidateModulesNotification object: nil ];
117115
116+ #if TARGET_OS_IOS
118117 [[NSNotificationCenter defaultCenter ] removeObserver: self name: UIDeviceOrientationDidChangeNotification object: nil ];
118+ #endif
119119}
120120
121121static BOOL RCTIsIPhoneNotched ()
122122{
123123 static BOOL isIPhoneNotched = NO ;
124- #if !TARGET_OS_VISION
125- static dispatch_once_t onceToken;
124+ static dispatch_once_t onceToken;
126125
126+ #if TARGET_OS_IOS
127127 dispatch_once (&onceToken, ^{
128128 RCTAssertMainQueue ();
129129
130130 // 20pt is the top safeArea value in non-notched devices
131131 isIPhoneNotched = RCTSharedApplication ().keyWindow .safeAreaInsets .top > 20 ;
132132 });
133-
134- // 20pt is the top safeArea value in non-notched devices
135- isIPhoneNotched = RCTSharedApplication ().keyWindow .safeAreaInsets .top > 20 ;
136- });
137133#endif
134+
138135 return isIPhoneNotched;
139136}
140137
@@ -217,8 +214,9 @@ - (void)interfaceOrientationDidChange
217214
218215- (void )_interfaceOrientationDidChange
219216{
217+ #if TARGET_OS_IOS
220218 UIApplication *application = RCTSharedApplication ();
221- UIInterfaceOrientation nextOrientation = [application statusBarOrientation ] ;
219+ UIInterfaceOrientation nextOrientation = RCTKeyWindow (). windowScene . interfaceOrientation ;
222220
223221 BOOL isRunningInFullScreen =
224222 CGRectEqualToRect (application.delegate .window .frame , application.delegate .window .screen .bounds );
@@ -246,6 +244,7 @@ - (void)_interfaceOrientationDidChange
246244 _isFullscreen = isRunningInFullScreen;
247245#pragma clang diagnostic pop
248246 }
247+ #endif
249248}
250249
251250- (void )interfaceFrameDidChange
0 commit comments