Skip to content

Commit 119268a

Browse files
committed
chore: remove not necessary ifs TARGET_OS_VISION, minimise code diff (#22)
1 parent a5cfc18 commit 119268a

7 files changed

Lines changed: 15 additions & 18 deletions

File tree

packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ @implementation RCTConvert (UIBackgroundFetchResult)
9696

9797
@end
9898
#else
99-
@interface RCTPushNotificationManager ()
99+
@interface RCTPushNotificationManager () <NativePushNotificationManagerIOSSpec>
100100
@end
101101
#endif // TARGET_OS_UIKITFORMAC
102102

packages/react-native/React/CoreModules/RCTDeviceInfo.mm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ static BOOL RCTIsIPhoneNotched()
8989
{
9090
static BOOL isIPhoneNotched = NO;
9191
#if !TARGET_OS_VISION
92-
static dispatch_once_t onceToken;
92+
static dispatch_once_t onceToken;
9393

94-
dispatch_once(&onceToken, ^{
95-
RCTAssertMainQueue();
94+
dispatch_once(&onceToken, ^{
95+
RCTAssertMainQueue();
9696

97-
// 20pt is the top safeArea value in non-notched devices
98-
isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20;
99-
});
97+
// 20pt is the top safeArea value in non-notched devices
98+
isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20;
99+
});
100100
#endif
101101
return isIPhoneNotched;
102102
}

packages/react-native/React/CoreModules/RCTStatusBarManager.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
162162
} else {
163163
#pragma clang diagnostic push
164164
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
165-
[RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
165+
[RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
166166
#pragma clang diagnostic pop
167167
}
168168
});
@@ -172,7 +172,9 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
172172
RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
173173
{
174174
#if !TARGET_OS_VISION
175-
RCTSharedApplication().networkActivityIndicatorVisible = visible;
175+
dispatch_async(dispatch_get_main_queue(), ^{
176+
RCTSharedApplication().networkActivityIndicatorVisible = visible;
177+
});
176178
#endif
177179
}
178180

packages/react-native/React/Views/RCTWrapperViewController.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ - (instancetype)initWithContentView:(UIView *)contentView
2929

3030
if ((self = [super initWithNibName:nil bundle:nil])) {
3131
_contentView = contentView;
32-
#if !TARGET_OS_VISION
33-
self.automaticallyAdjustsScrollViewInsets = NO;
34-
#endif
3532
}
3633
return self;
3734
}

packages/react-native/React/Views/ScrollView/RCTScrollViewManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@
2121
@interface RCTScrollViewManager : RCTViewManager
2222

2323
@end
24-
25-

packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#import "RCTShadowView.h"
1313
#import "RCTUIManager.h"
1414

15-
16-
1715
@implementation RCTConvert (UIScrollView)
1816

1917
#if !TARGET_OS_VISION

packages/rn-tester/RNTester/AppDelegate.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#import <ReactCommon/RCTSampleTurboModule.h>
1313
#import <ReactCommon/SampleTurboCxxModule.h>
1414

15-
#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC && !TARGET_OS_VISION
15+
#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC
1616
#import <React/RCTPushNotificationManager.h>
1717
#endif
1818

@@ -86,7 +86,7 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge
8686
return nullptr;
8787
}
8888

89-
#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC && !TARGET_OS_VISION
89+
#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC
9090

9191
// Required for the remoteNotificationsRegistered event.
9292
- (void)application:(__unused UIApplication *)application
@@ -102,6 +102,7 @@ - (void)application:(__unused UIApplication *)application
102102
[RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
103103
}
104104

105+
#if !TARGET_OS_VISION
105106
// Required for the remoteNotificationReceived event.
106107
- (void)application:(__unused UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
107108
{
@@ -114,6 +115,7 @@ - (void)application:(__unused UIApplication *)application
114115
{
115116
[RCTPushNotificationManager didReceiveLocalNotification:notification];
116117
}
118+
#endif
117119

118120
#endif
119121

0 commit comments

Comments
 (0)