Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add threadIdentifier to local notifications #41

Closed
holden-caulfield opened this issue Oct 29, 2019 · 1 comment
Closed

Add threadIdentifier to local notifications #41

holden-caulfield opened this issue Oct 29, 2019 · 1 comment
Assignees

Comments

@holden-caulfield
Copy link

holden-caulfield commented Oct 29, 2019

Feature Request

Add the possibility for local notifications (e.g. as in PushNotificationIOS.presentLocalNotification()) to include threadIdentifier on its details.

Why it is needed

Using the threadIdentifier allows to group notifications together on the notification center

Possible implementation

I'm happy to send a PR, it seems to me it should be as simple as adding the parsing of that parameter on the UILocalNotification object. This would be an iOS only property

@implementation RCTConvert (UILocalNotification)

+ (UILocalNotification *)UILocalNotification:(id)json
{
  NSDictionary<NSString *, id> *details = [self NSDictionary:json];
  ....
  if (details[@"threadIdentifier"]) {
    notification.threadIdentifier = [RCTConvert NSString:details[@"threadIdentifier"]];
  }
  return notification;
}

(Adding the if statement because I guess that if not explicitly set, iOS sets a "smart" threadIdentifier based on application, title, etc.)

Code sample

PushNotificationIOS.presentLocalNotification({
// should also work with PushNotificationIOS.scheduleLocalNotification
   alertTitle: "My threaded local notification"
   alertBody: "This will be threaded",
   threadIdentifier: "SomeIdentifier"
})
@Naturalclar
Copy link
Collaborator

@holden-caulfield Thanks for raising the issue!
Support for threadId in local notification has been added in v1.7.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants