RNFIRMessaging.h 1.21 KB
Newer Older
Libin Lu's avatar
init  
Libin Lu committed
1 2 3

#import <UIKit/UIKit.h>

Libin Lu's avatar
Libin Lu committed
4 5 6 7 8
#if __has_include(<Firebase.h>)
#import <FirebaseCore/FirebaseCore.h>
#import <FirebaseMessaging/FirebaseMessaging.h>
#import <FirebaseInstanceID/FirebaseInstanceID.h>
#else
Libin Lu's avatar
Libin Lu committed
9
@import Firebase;
Libin Lu's avatar
Libin Lu committed
10 11
#endif

Libin Lu's avatar
Libin Lu committed
12
#import <React/RCTEventEmitter.h>
Libin Lu's avatar
init  
Libin Lu committed
13

Libin Lu's avatar
Libin Lu committed
14
@import UserNotifications;
Libin Lu's avatar
init  
Libin Lu committed
15

Libin Lu's avatar
Libin Lu committed
16
@interface RNFIRMessaging : RCTEventEmitter <RCTBridgeModule, FIRMessagingDelegate>
Libin Lu's avatar
init  
Libin Lu committed
17

Libin Lu's avatar
Libin Lu committed
18 19 20 21
typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result);
typedef void (^RCTWillPresentNotificationCallback)(UNNotificationPresentationOptions result);
typedef void (^RCTNotificationResponseCallback)();

Libin Lu's avatar
init  
Libin Lu committed
22 23
@property (nonatomic, assign) bool connectedToFCM;

Libin Lu's avatar
Libin Lu committed
24
#if !TARGET_OS_TV
Libin Lu's avatar
Libin Lu committed
25
+ (void)didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull RCTRemoteNotificationCallback)completionHandler;
Libin Lu's avatar
Libin Lu committed
26
+ (void)didReceiveLocalNotification:(nonnull UILocalNotification *)notification;
Libin Lu's avatar
Libin Lu committed
27 28
+ (void)didReceiveNotificationResponse:(nonnull UNNotificationResponse *)response withCompletionHandler:(nonnull RCTNotificationResponseCallback)completionHandler;
+ (void)willPresentNotification:(nonnull UNNotification *)notification withCompletionHandler:(nonnull RCTWillPresentNotificationCallback)completionHandler;
Libin Lu's avatar
Libin Lu committed
29 30
#endif

Libin Lu's avatar
init  
Libin Lu committed
31
@end
32