diff --git a/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm b/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm index aa0abfe6489417..b2247c58d0593c 100644 --- a/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm +++ b/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm @@ -186,15 +186,10 @@ - (BOOL)paused - (void)displayDidRefresh:(CADisplayLink *)displayLink { -#if TARGET_OS_UIKITFORMAC - // TODO: `displayLink.frameInterval` is not available on UIKitForMac - NSTimeInterval durationToNextRefresh = displayLink.duration; -#else // displaylink.duration -- time interval between frames, assuming maximumFramesPerSecond // displayLink.preferredFramesPerSecond (>= iOS 10) -- Set to 30 for displayDidRefresh to be called at 30 fps // durationToNextRefresh -- Time interval to the next time displayDidRefresh is called NSTimeInterval durationToNextRefresh = displayLink.targetTimestamp - displayLink.timestamp; -#endif NSUInteger totalFrameCount = self.totalFrameCount; NSUInteger currentFrameIndex = self.currentFrameIndex; NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount; diff --git a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h index e49f6ed9d54257..546b78021c1740 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +++ b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h @@ -13,13 +13,11 @@ extern NSString *const RCTRemoteNotificationReceived; typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); -#if !TARGET_OS_UIKITFORMAC + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; + (void)didReceiveRemoteNotification:(NSDictionary *)notification; + (void)didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler; + (void)didReceiveLocalNotification:(UILocalNotification *)notification; + (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; -#endif @end diff --git a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index d0c38c91e5ac5c..ef526ab958b6ef 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -24,8 +24,6 @@ static NSString *const kErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS"; -#if !TARGET_OS_UIKITFORMAC - @interface RCTPushNotificationManager () @property (nonatomic, strong) NSMutableDictionary *remoteNotificationCallbacks; @end @@ -95,15 +93,9 @@ @implementation RCTConvert (UIBackgroundFetchResult) integerValue) @end -#else -@interface RCTPushNotificationManager () -@end -#endif // TARGET_OS_UIKITFORMAC @implementation RCTPushNotificationManager -#if !TARGET_OS_UIKITFORMAC - /** DEPRECATED. UILocalNotification was deprecated in iOS 10. Please don't add new callsites. */ static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification) { @@ -176,8 +168,6 @@ @implementation RCTPushNotificationManager return [formatter stringFromDate:date]; } -#endif // TARGET_OS_UIKITFORMAC - RCT_EXPORT_MODULE() - (dispatch_queue_t)methodQueue @@ -185,7 +175,6 @@ - (dispatch_queue_t)methodQueue return dispatch_get_main_queue(); } -#if !TARGET_OS_UIKITFORMAC - (void)startObserving { [[NSNotificationCenter defaultCenter] addObserver:self @@ -577,100 +566,6 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification }]; } -#else // TARGET_OS_UIKITFORMAC - -RCT_EXPORT_METHOD(onFinishRemoteNotification : (NSString *)notificationId fetchResult : (NSString *)fetchResult) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(setApplicationIconBadgeNumber : (double)number) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(getApplicationIconBadgeNumber : (RCTResponseSenderBlock)callback) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(requestPermissions - : (JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission &)permissions resolve - : (RCTPromiseResolveBlock)resolve reject - : (RCTPromiseRejectBlock)reject) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(abandonPermissions) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(checkPermissions : (RCTResponseSenderBlock)callback) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(presentLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(scheduleLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(cancelAllLocalNotifications) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(cancelLocalNotifications : (NSDictionary *)userInfo) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(getInitialNotification - : (RCTPromiseResolveBlock)resolve reject - : (__unused RCTPromiseRejectBlock)reject) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(getScheduledLocalNotifications : (RCTResponseSenderBlock)callback) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(removeAllDeliveredNotifications) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(removeDeliveredNotifications : (NSArray *)identifiers) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(getDeliveredNotifications : (RCTResponseSenderBlock)callback) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -RCT_EXPORT_METHOD(getAuthorizationStatus : (RCTResponseSenderBlock)callback) -{ - RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd)); -} - -- (NSArray *)supportedEvents -{ - return @[]; -} - -#endif // TARGET_OS_UIKITFORMAC - - (std::shared_ptr)getTurboModule: (const facebook::react::ObjCTurboModule::InitParams &)params { diff --git a/packages/react-native/Libraries/Text/Text/RCTTextView.mm b/packages/react-native/Libraries/Text/Text/RCTTextView.mm index bcfb5003ee94e8..1daefe42051079 100644 --- a/packages/react-native/Libraries/Text/Text/RCTTextView.mm +++ b/packages/react-native/Libraries/Text/Text/RCTTextView.mm @@ -240,8 +240,7 @@ - (void)disableContextMenu - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture { -#if !TARGET_OS_UIKITFORMAC - if (@available(iOS 16.0, *)) { + if (@available(iOS 16.0, macCatalyst 16.0, *)) { CGPoint location = [gesture locationInView:self]; UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location]; if (_editMenuInteraction) { @@ -249,7 +248,6 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture } return; } - // TODO: Adopt showMenuFromRect (necessary for UIKitForMac) UIMenuController *menuController = [UIMenuController sharedMenuController]; if (menuController.isMenuVisible) { @@ -260,9 +258,7 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture [self becomeFirstResponder]; } - [menuController setTargetRect:self.bounds inView:self]; - [menuController setMenuVisible:YES animated:YES]; -#endif + [menuController showMenuFromView:self rect:self.bounds]; } - (BOOL)canBecomeFirstResponder diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 0787ef71cafe8e..b62b83040a433c 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -236,7 +236,6 @@ - (void)disableContextMenu - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture { -#if !TARGET_OS_UIKITFORMAC if (@available(iOS 16.0, *)) { CGPoint location = [gesture locationInView:self]; UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location]; @@ -245,7 +244,6 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture } return; } - // TODO: Adopt showMenuFromRect (necessary for UIKitForMac) UIMenuController *menuController = [UIMenuController sharedMenuController]; if (menuController.isMenuVisible) { @@ -256,9 +254,7 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture [self becomeFirstResponder]; } - [menuController setTargetRect:self.bounds inView:self]; - [menuController setMenuVisible:YES animated:YES]; -#endif + [menuController showMenuFromView:self rect:self.bounds]; } - (BOOL)canBecomeFirstResponder diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index 26168a3e4954bc..ddda5db3aa56a5 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -13,9 +13,7 @@ #import #import -#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import -#endif #import #ifndef RN_DISABLE_OSS_PLUGIN_HEADER @@ -84,8 +82,6 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge return nullptr; } -#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC - // Required for the remoteNotificationsRegistered event. - (void)application:(__unused UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken @@ -113,8 +109,6 @@ - (void)application:(__unused UIApplication *)application [RCTPushNotificationManager didReceiveLocalNotification:notification]; } -#endif - #pragma mark - New Arch Enabled settings - (BOOL)bridgelessEnabled