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
a3cc50ad
Commit
a3cc50ad
authored
Nov 28, 2016
by
Libin Lu
Committed by
GitHub
Nov 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.md
parent
87213c60
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
README.md
README.md
+5
-9
No files found.
README.md
View file @
a3cc50ad
...
...
@@ -172,12 +172,9 @@ Edit `AppDelegate.m`:
{
//...
+
[FIRApp configure];
+
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
+
#endif
}
+
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+
}
+
+
- (void)userNotificationCenter:(UNUserNotificationCenter
*)center willPresentNotification:(UNNotification *
)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
+
{
+
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:notification.request.content.userInfo];
...
...
@@ -186,21 +183,20 @@ Edit `AppDelegate.m`:
+
}else{
+
completionHandler(UNNotificationPresentationOptionNone);
+
}
+
+
}
+
+
- (void)userNotificationCenter:(UNUserNotificationCenter
*)center didReceiveNotificationResponse:(UNNotificationResponse *
)response withCompletionHandler:(void (^)())completionHandler
+
{
+
NSDictionary
*
userInfo = [[NSMutableDictionary alloc] initWithDictionary: response.notification.request.content.userInfo];
+
[userInfo setValue:@YES forKey:@"opened_from_tray"];
+
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:userInfo];
+
}
+
#else
+
+
//You can skip this method if you don't want to use local notification
+
-(void)application:(UIApplication
*)application didReceiveLocalNotification:(UILocalNotification *
)notification {
+
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self + userInfo:notification.userInfo];
+
}
+
#endif
+
+
- (void)application:(UIApplication
*)application didReceiveRemoteNotification:(nonnull NSDictionary *
)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
+
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:userInfo];
...
...
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