Skip to content

Commit

Permalink
More explicit implementation instructions
Browse files Browse the repository at this point in the history
Supports actions for backgrounded app but still suffers from issue of silent actions on force-quitted app (see holmesal#3)
  • Loading branch information
irfaan committed Jan 14, 2016
1 parent c9f4d19 commit 679dbf2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,28 @@ The basic workflow is:

# Getting Started
1. Follow the instructions [here](https://facebook.github.io/react-native/docs/pushnotificationios.html) to set up push notifications in your app.
2. Add the library + link it in Build Phases.
3. Add boilerplate to `AppDelegate.m`
```objective-c
// Import 'RNNotificationActions.h' at top.
#import "RNNotificationActions.h"

// Add support for push notification actions (optional)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forLocalNotification:(nonnull UILocalNotification *)notification withResponseInfo:(nonnull NSDictionary *)responseInfo completionHandler:(nonnull void (^)())completionHandler
{
NSLog(@"got local notification!");
[RNNotificationActions application:application handleActionWithIdentifier:identifier forLocalNotification:notification withResponseInfo:responseInfo completionHandler:completionHandler];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void (^)())completionHandler
{
[RNNotificationActions application:application handleActionWithIdentifier:identifier forRemoteNotification:userInfo withResponseInfo:responseInfo completionHandler:completionHandler];
}

```
# Example
```javascript
import NotificationActions from 'react-native-ios-notification-actions'
import NotificationActions from 'react-native-notification-actions'

This comment has been minimized.

Copy link
@holmesal

holmesal Feb 17, 2016

I think this undoes an earlier fix - can you correct?

Thanks for the more explicit instructions!

// Create an "upvote" action that will display a button when a notification is swiped
let upvoteButton = new NotificationActions.Action({
Expand Down

0 comments on commit 679dbf2

Please sign in to comment.