Skip to content

chore: remove not necessary ifs TARGET_OS_VISION, minimise code diff #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ @implementation RCTConvert (UIBackgroundFetchResult)

@end
#else
@interface RCTPushNotificationManager ()
@interface RCTPushNotificationManager () <NativePushNotificationManagerIOSSpec>
@end
#endif // TARGET_OS_UIKITFORMAC

Expand Down
12 changes: 6 additions & 6 deletions packages/react-native/React/CoreModules/RCTDeviceInfo.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ static BOOL RCTIsIPhoneNotched()
{
static BOOL isIPhoneNotched = NO;
#if !TARGET_OS_VISION
static dispatch_once_t onceToken;
static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{
RCTAssertMainQueue();
dispatch_once(&onceToken, ^{
RCTAssertMainQueue();

// 20pt is the top safeArea value in non-notched devices
isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20;
});
// 20pt is the top safeArea value in non-notched devices
isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20;
});
#endif
return isIPhoneNotched;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
[RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
#pragma clang diagnostic pop
}
});
Expand All @@ -172,7 +172,9 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
{
#if !TARGET_OS_VISION
RCTSharedApplication().networkActivityIndicatorVisible = visible;
dispatch_async(dispatch_get_main_queue(), ^{
RCTSharedApplication().networkActivityIndicatorVisible = visible;
});
#endif
}

Expand Down
3 changes: 0 additions & 3 deletions packages/react-native/React/Views/RCTWrapperViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ - (instancetype)initWithContentView:(UIView *)contentView

if ((self = [super initWithNibName:nil bundle:nil])) {
_contentView = contentView;
#if !TARGET_OS_VISION
self.automaticallyAdjustsScrollViewInsets = NO;
#endif
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
@interface RCTScrollViewManager : RCTViewManager

@end


Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#import "RCTShadowView.h"
#import "RCTUIManager.h"



@implementation RCTConvert (UIScrollView)

#if !TARGET_OS_VISION
Expand Down
6 changes: 4 additions & 2 deletions packages/rn-tester/RNTester/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import <ReactCommon/RCTSampleTurboModule.h>
#import <ReactCommon/SampleTurboCxxModule.h>

#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC && !TARGET_OS_VISION
#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC
#import <React/RCTPushNotificationManager.h>
#endif

Expand Down Expand Up @@ -86,7 +86,7 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge
return nullptr;
}

#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC && !TARGET_OS_VISION
#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC

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

#if !TARGET_OS_VISION
// Required for the remoteNotificationReceived event.
- (void)application:(__unused UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
{
Expand All @@ -114,6 +115,7 @@ - (void)application:(__unused UIApplication *)application
{
[RCTPushNotificationManager didReceiveLocalNotification:notification];
}
#endif

#endif

Expand Down