Skip to content

Commit d6a093e

Browse files
DevmateDropRctExportMethod Botfacebook-github-bot
authored andcommitted
xplat/js/react-native-github/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm
Summary: ...Actions taken: 1. Ran build_codegen_spec to generate the FBReactNativeSpec protocol and located/read the `NativePushNotificationManagerIOSSpec` protocol. 2. Ran apply_cast_mod, which mechanically converted all clean methods and flagged two `type-mismatch` methods. 3. Hand-reconciled `cancelLocalNotifications:` and `removeDeliveredNotifications:` by moving to the spec's exact parameter types and restoring the implicit `RCTConvert` coercion in the body. 4. Ran buck_build_verify (BUILD SUCCEEDED) and Lint (no lints). Verified no `RCT_EXPORT_METHOD`/`RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD` macros remain. </summary> </invoke> _____ * Do **NOT** post in the CodemodService Feedback group about this specific diff. * If you have feedback, comment on the diff and use an appropriate diff action. This [diff was created](https://www.internalfb.com/intern/sandcastle/job/18014401344983091/) with [CodemodService](https://www.internalfb.com/codemod_service/CodemodConfigDevmateDropRctExportMethod). Reviewed By: cortinico Differential Revision: D114840928
1 parent 1bb746c commit d6a093e

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

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

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
305305
[self sendEventWithName:@"remoteNotificationRegistrationError" body:errorDetails];
306306
}
307307

308-
RCT_EXPORT_METHOD(onFinishRemoteNotification : (NSString *)notificationId fetchResult : (NSString *)fetchResult)
308+
- (void)onFinishRemoteNotification:(NSString *)notificationId fetchResult:(NSString *)fetchResult
309309
{
310310
UIBackgroundFetchResult result = [RCTConvert UIBackgroundFetchResult:fetchResult];
311311
RCTRemoteNotificationCallback completionHandler = self.remoteNotificationCallbacks[notificationId];
@@ -320,7 +320,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
320320
/**
321321
* Update the application icon badge number on the home screen
322322
*/
323-
RCT_EXPORT_METHOD(setApplicationIconBadgeNumber : (double)number)
323+
- (void)setApplicationIconBadgeNumber:(double)number
324324
{
325325
NSInteger badgeCount = (NSInteger)lround(number);
326326
if (@available(iOS 16.0, *)) {
@@ -339,14 +339,14 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
339339
/**
340340
* Get the current application icon badge number on the home screen
341341
*/
342-
RCT_EXPORT_METHOD(getApplicationIconBadgeNumber : (RCTResponseSenderBlock)callback)
342+
- (void)getApplicationIconBadgeNumber:(RCTResponseSenderBlock)callback
343343
{
344344
callback(@[ @(RCTSharedApplication().applicationIconBadgeNumber) ]);
345345
}
346346

347-
RCT_EXPORT_METHOD(
348-
requestPermissions : (JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission &)
349-
permissions resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject)
347+
- (void)requestPermissions:(JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission &)permissions
348+
resolve:(RCTPromiseResolveBlock)resolve
349+
reject:(RCTPromiseRejectBlock)reject
350350
{
351351
if (RCTRunningInAppExtension()) {
352352
reject(
@@ -389,12 +389,12 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
389389
}];
390390
}
391391

392-
RCT_EXPORT_METHOD(abandonPermissions)
392+
- (void)abandonPermissions
393393
{
394394
[RCTSharedApplication() unregisterForRemoteNotifications];
395395
}
396396

397-
RCT_EXPORT_METHOD(checkPermissions : (RCTResponseSenderBlock)callback)
397+
- (void)checkPermissions:(RCTResponseSenderBlock)callback
398398
{
399399
if (RCTRunningInAppExtension()) {
400400
callback(@[ RCTSettingsDictForUNNotificationSettings(NO, NO, NO, NO, NO, NO, UNAuthorizationStatusNotDetermined) ]);
@@ -444,7 +444,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
444444
};
445445
}
446446

447-
RCT_EXPORT_METHOD(presentLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification)
447+
- (void)presentLocalNotification:(JS::NativePushNotificationManagerIOS::Notification &)notification
448448
{
449449
NSDictionary<NSString *, id> *notificationDict = [RCTConvert NSDictionaryForNotification:notification];
450450
UNNotificationContent *content = [RCTConvert UNNotificationContent:notificationDict];
@@ -458,7 +458,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
458458
[center addNotificationRequest:request withCompletionHandler:nil];
459459
}
460460

461-
RCT_EXPORT_METHOD(scheduleLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification)
461+
- (void)scheduleLocalNotification:(JS::NativePushNotificationManagerIOS::Notification &)notification
462462
{
463463
NSDictionary<NSString *, id> *notificationDict = [RCTConvert NSDictionaryForNotification:notification];
464464
UNNotificationContent *content = [RCTConvert UNNotificationContent:notificationDict];
@@ -486,7 +486,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
486486
[center addNotificationRequest:request withCompletionHandler:nil];
487487
}
488488

489-
RCT_EXPORT_METHOD(cancelAllLocalNotifications)
489+
- (void)cancelAllLocalNotifications
490490
{
491491
[[UNUserNotificationCenter currentNotificationCenter]
492492
getPendingNotificationRequestsWithCompletionHandler:^(NSArray<UNNotificationRequest *> *requests) {
@@ -499,9 +499,10 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
499499
}];
500500
}
501501

502-
RCT_EXPORT_METHOD(cancelLocalNotifications : (NSDictionary<NSString *, id> *)userInfo)
502+
- (void)cancelLocalNotifications:(NSDictionary *)userInfoRaw
503503
{
504504
#if !TARGET_OS_TV
505+
NSDictionary<NSString *, id> *userInfo = [RCTConvert NSDictionary:userInfoRaw];
505506
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
506507
[center getPendingNotificationRequestsWithCompletionHandler:^(NSArray<UNNotificationRequest *> *_Nonnull requests) {
507508
NSMutableArray<NSString *> *notificationIdentifiersToCancel = [NSMutableArray new];
@@ -529,8 +530,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
529530
#endif
530531
}
531532

532-
RCT_EXPORT_METHOD(
533-
getInitialNotification : (RCTPromiseResolveBlock)resolve reject : (__unused RCTPromiseRejectBlock)reject)
533+
- (void)getInitialNotification:(RCTPromiseResolveBlock)resolve reject:(__unused RCTPromiseRejectBlock)reject
534534
{
535535
// The user actioned a local or remote notification to launch the app. Notification is represented by UNNotification.
536536
// Set this property in the implementation of
@@ -553,7 +553,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
553553
resolve((id)kCFNull);
554554
}
555555

556-
RCT_EXPORT_METHOD(getScheduledLocalNotifications : (RCTResponseSenderBlock)callback)
556+
- (void)getScheduledLocalNotifications:(RCTResponseSenderBlock)callback
557557
{
558558
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
559559
[center getPendingNotificationRequestsWithCompletionHandler:^(NSArray<UNNotificationRequest *> *_Nonnull requests) {
@@ -565,23 +565,24 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
565565
}];
566566
}
567567

568-
RCT_EXPORT_METHOD(removeAllDeliveredNotifications)
568+
- (void)removeAllDeliveredNotifications
569569
{
570570
#if !TARGET_OS_TV
571571
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
572572
[center removeAllDeliveredNotifications];
573573
#endif
574574
}
575575

576-
RCT_EXPORT_METHOD(removeDeliveredNotifications : (NSArray<NSString *> *)identifiers)
576+
- (void)removeDeliveredNotifications:(NSArray *)identifiersRaw
577577
{
578578
#if !TARGET_OS_TV
579+
NSArray<NSString *> *identifiers = [RCTConvert NSStringArray:identifiersRaw];
579580
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
580581
[center removeDeliveredNotificationsWithIdentifiers:identifiers];
581582
#endif
582583
}
583584

584-
RCT_EXPORT_METHOD(getDeliveredNotifications : (RCTResponseSenderBlock)callback)
585+
- (void)getDeliveredNotifications:(RCTResponseSenderBlock)callback
585586
{
586587
#if !TARGET_OS_TV
587588
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
@@ -598,7 +599,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
598599
#endif
599600
}
600601

601-
RCT_EXPORT_METHOD(getAuthorizationStatus : (RCTResponseSenderBlock)callback)
602+
- (void)getAuthorizationStatus:(RCTResponseSenderBlock)callback
602603
{
603604
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
604605
[center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings *_Nonnull settings) {

0 commit comments

Comments
 (0)