Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-fcm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
react-native-fcm
Commits
485333ab
Commit
485333ab
authored
Jan 29, 2017
by
Libin Lu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update method type
parent
5a663ed8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
ios/RNFIRMessaging.h
ios/RNFIRMessaging.h
+7
-3
ios/RNFIRMesssaging.m
ios/RNFIRMesssaging.m
+3
-7
No files found.
ios/RNFIRMessaging.h
View file @
485333ab
...
...
@@ -9,13 +9,17 @@
@interface
RNFIRMessaging
:
NSObject
<
RCTBridgeModule
>
typedef
void
(
^
RCTRemoteNotificationCallback
)(
UIBackgroundFetchResult
result
);
typedef
void
(
^
RCTWillPresentNotificationCallback
)(
UNNotificationPresentationOptions
result
);
typedef
void
(
^
RCTNotificationResponseCallback
)();
@property
(
nonatomic
,
assign
)
bool
connectedToFCM
;
#if !TARGET_OS_TV
+
(
void
)
didReceiveRemoteNotification
:(
nonnull
NSDictionary
*
)
userInfo
fetchCompletionHandler
:(
nonnull
void
(
^
)(
UIBackgroundFetchResult
)
)
completionHandler
;
+
(
void
)
didReceiveRemoteNotification
:(
nonnull
NSDictionary
*
)
userInfo
fetchCompletionHandler
:(
nonnull
RCTRemoteNotificationCallback
)
completionHandler
;
+
(
void
)
didReceiveLocalNotification
:(
nonnull
UILocalNotification
*
)
notification
;
+
(
void
)
didReceiveNotificationResponse
:(
nonnull
UNNotificationResponse
*
)
response
withCompletionHandler
:(
nonnull
void
(
^
)()
)
completionHandler
;
+
(
void
)
willPresentNotification
:(
nonnull
UNNotification
*
)
notification
withCompletionHandler
:(
nonnull
void
(
^
)(
UNNotificationPresentationOptions
)
)
completionHandler
;
+
(
void
)
didReceiveNotificationResponse
:(
nonnull
UNNotificationResponse
*
)
response
withCompletionHandler
:(
nonnull
RCTNotificationResponseCallback
)
completionHandler
;
+
(
void
)
willPresentNotification
:(
nonnull
UNNotification
*
)
notification
withCompletionHandler
:(
nonnull
RCTWillPresentNotificationCallback
)
completionHandler
;
#endif
@end
...
...
ios/RNFIRMesssaging.m
View file @
485333ab
...
...
@@ -18,10 +18,6 @@
#endif
typedef
void
(
^
RCTRemoteNotificationCallback
)(
UIBackgroundFetchResult
result
);
typedef
void
(
^
RCTWillPresentNotificationCallback
)(
UNNotificationPresentationOptions
result
);
typedef
void
(
^
RCTNotificationResponseCallback
)();
NSString
*
const
FCMNotificationReceived
=
@"FCMNotificationReceived"
;
@implementation
RCTConvert
(
NSCalendarUnit
)
...
...
@@ -142,7 +138,7 @@ RCT_EXPORT_MODULE()
@synthesize
bridge
=
_bridge
;
+
(
void
)
didReceiveRemoteNotification
:(
nonnull
NSDictionary
*
)
userInfo
fetchCompletionHandler
:(
RCTRemoteNotificationCallback
)
completionHandler
{
+
(
void
)
didReceiveRemoteNotification
:(
nonnull
NSDictionary
*
)
userInfo
fetchCompletionHandler
:(
nonnull
RCTRemoteNotificationCallback
)
completionHandler
{
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
initWithDictionary
:
userInfo
];
[
data
setValue
:
@"remote_notification"
forKey
:
@"_notificationType"
];
[
data
setValue
:
@
(
RCTSharedApplication
().
applicationState
==
UIApplicationStateInactive
)
forKey
:
@"opened_from_tray"
];
...
...
@@ -155,7 +151,7 @@ RCT_EXPORT_MODULE()
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
FCMNotificationReceived
object
:
self
userInfo
:
data
];
}
+
(
void
)
didReceiveNotificationResponse
:(
UNNotificationResponse
*
)
response
withCompletionHandler
:(
RCTNotificationResponseCallback
)
completionHandler
+
(
void
)
didReceiveNotificationResponse
:(
UNNotificationResponse
*
)
response
withCompletionHandler
:(
nonnull
RCTNotificationResponseCallback
)
completionHandler
{
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
initWithDictionary
:
response
.
notification
.
request
.
content
.
userInfo
];
[
data
setValue
:
@"notification_response"
forKey
:
@"_notificationType"
];
...
...
@@ -163,7 +159,7 @@ RCT_EXPORT_MODULE()
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
FCMNotificationReceived
object
:
self
userInfo
:
@{
@"data"
:
data
,
@"completionHandler"
:
completionHandler
}];
}
+
(
void
)
willPresentNotification
:(
UNNotification
*
)
notification
withCompletionHandler
:(
RCTWillPresentNotificationCallback
)
completionHandler
+
(
void
)
willPresentNotification
:(
UNNotification
*
)
notification
withCompletionHandler
:(
nonnull
RCTWillPresentNotificationCallback
)
completionHandler
{
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
initWithDictionary
:
notification
.
request
.
content
.
userInfo
];
[
data
setValue
:
@"will_present_notification"
forKey
:
@"_notificationType"
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment