{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react-native/pulls/comments/60946860","id":60946860,"diff_hunk":"@@ -251,4 +251,53 @@ - (void)handleRemoteNotificationsRegistered:(NSNotification *)notification\n   }\n }\n \n+RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTResponseSenderBlock)callback)\n+{\n+  NSArray<UILocalNotification *> *scheduledLocalNotifications = [UIApplication sharedApplication].scheduledLocalNotifications;\n+\n+\n+  NSMutableArray *formattedScheduledLocalNotifications = [[NSMutableArray alloc] init];\n+\n+  for (UILocalNotification *notification in scheduledLocalNotifications) {\n+\n+    NSMutableDictionary* formattedScheduledLocalNotification = [NSMutableDictionary dictionary];\n+\n+    if (notification.fireDate) {\n+      NSDateFormatter *formatter = [[NSDateFormatter alloc] init];\n+      [formatter setDateFormat:@\"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\"];\n+      NSString *fireDateString = [formatter stringFromDate:notification.fireDate];\n+\n+      [formattedScheduledLocalNotification setObject: fireDateString forKey:@\"fireDate\"];","path":"Libraries/PushNotificationIOS/RCTPushNotificationManager.m","position":20,"original_position":20,"commit_id":"5a036539fe96257e68089b2cd52b08e2a3ba645e","original_commit_id":"5a036539fe96257e68089b2cd52b08e2a3ba645e","user":{"login":"joshuapinter","id":180819,"avatar_url":"https://avatars.githubusercontent.com/u/180819?v=3","gravatar_id":"","url":"https://api.github.com/users/joshuapinter","html_url":"https://github.com/joshuapinter","followers_url":"https://api.github.com/users/joshuapinter/followers","following_url":"https://api.github.com/users/joshuapinter/following{/other_user}","gists_url":"https://api.github.com/users/joshuapinter/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuapinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuapinter/subscriptions","organizations_url":"https://api.github.com/users/joshuapinter/orgs","repos_url":"https://api.github.com/users/joshuapinter/repos","events_url":"https://api.github.com/users/joshuapinter/events{/privacy}","received_events_url":"https://api.github.com/users/joshuapinter/received_events","type":"User","site_admin":false},"body":"Ha. Yes, yes I can.","created_at":"2016-04-25T16:49:10Z","updated_at":"2016-04-25T16:49:10Z","html_url":"https://github.com/facebook/react-native/pull/6907#discussion_r60946860","pull_request_url":"https://api.github.com/repos/facebook/react-native/pulls/6907","_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments/60946860"},"html":{"href":"https://github.com/facebook/react-native/pull/6907#discussion_r60946860"},"pull_request":{"href":"https://api.github.com/repos/facebook/react-native/pulls/6907"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/6907","id":65922569,"html_url":"https://github.com/facebook/react-native/pull/6907","diff_url":"https://github.com/facebook/react-native/pull/6907.diff","patch_url":"https://github.com/facebook/react-native/pull/6907.patch","issue_url":"https://api.github.com/repos/facebook/react-native/issues/6907","number":6907,"state":"open","locked":false,"title":"Add getScheduledLocalNotifications to PushNotificationIOS.","user":{"login":"joshuapinter","id":180819,"avatar_url":"https://avatars.githubusercontent.com/u/180819?v=3","gravatar_id":"","url":"https://api.github.com/users/joshuapinter","html_url":"https://github.com/joshuapinter","followers_url":"https://api.github.com/users/joshuapinter/followers","following_url":"https://api.github.com/users/joshuapinter/following{/other_user}","gists_url":"https://api.github.com/users/joshuapinter/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuapinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuapinter/subscriptions","organizations_url":"https://api.github.com/users/joshuapinter/orgs","repos_url":"https://api.github.com/users/joshuapinter/repos","events_url":"https://api.github.com/users/joshuapinter/events{/privacy}","received_events_url":"https://api.github.com/users/joshuapinter/received_events","type":"User","site_admin":false},"body":"This returns an `Array` of Local Notifications that have been scheduled to be delivered.\r\n\r\n_Not to be confused for `scheduleLocalNotification`, which actually **schedules** a local notification._\r\n\r\nAvailable attributes on return Notification object (if set in the local notification itself):\r\n\r\n`alertAction`\r\n`alertBody`\r\n`applicationIconBadgeNumber`\r\n`category`\r\n`fireDate`\r\n`soundName`\r\n`userInfo`\r\n\r\nMore could be added to this but I just matched what was available in the `Object` passed to `presentLocalNotification` and `scheduleLocalNotification`.\r\n\r\n**Motivation**\r\n\r\nI needed to determine the number and other details about local notifications that were already scheduled. There is an API for this in iOS but one hadn't been built yet for React Native.\r\n\r\nI created the Obj-C method and updated the documentation in `PushNotificationIOS.js` as well.\r\n\r\n**Usage:**\r\n\r\n```js\r\nPushNotificationIOS.scheduledLocalNotifications( (notifications) => {\r\n  console.log(notifications);\r\n});\r\n```\r\n\r\n**Sample Output:**\r\n\r\n```js\r\n[\r\n  Object {\r\n    alertBody: \"It's about time you check in with Aaron, eh?\", \r\n    applicationIconBadgeNumber: 2, \r\n    soundName: \"UILocalNotificationDefaultSoundName\", \r\n    fireDate: \"2016-04-10T14:43:45.755-06:00\", \r\n    userInfo: Object {\r\n      id: 5 \r\n    }\r\n  }\r\n]\r\n```","created_at":"2016-04-10T20:54:45Z","updated_at":"2016-04-25T16:49:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"148926047f4c1f5a8e97ee422214d224c28aef12","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react-native/pulls/6907/commits","review_comments_url":"https://api.github.com/repos/facebook/react-native/pulls/6907/comments","review_comment_url":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/6907/comments","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/5a036539fe96257e68089b2cd52b08e2a3ba645e","head":{"label":"joshuapinter:add-scheduled-local-notifications","ref":"add-scheduled-local-notifications","sha":"5a036539fe96257e68089b2cd52b08e2a3ba645e","user":{"login":"joshuapinter","id":180819,"avatar_url":"https://avatars.githubusercontent.com/u/180819?v=3","gravatar_id":"","url":"https://api.github.com/users/joshuapinter","html_url":"https://github.com/joshuapinter","followers_url":"https://api.github.com/users/joshuapinter/followers","following_url":"https://api.github.com/users/joshuapinter/following{/other_user}","gists_url":"https://api.github.com/users/joshuapinter/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuapinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuapinter/subscriptions","organizations_url":"https://api.github.com/users/joshuapinter/orgs","repos_url":"https://api.github.com/users/joshuapinter/repos","events_url":"https://api.github.com/users/joshuapinter/events{/privacy}","received_events_url":"https://api.github.com/users/joshuapinter/received_events","type":"User","site_admin":false},"repo":{"id":55861189,"name":"react-native","full_name":"joshuapinter/react-native","owner":{"login":"joshuapinter","id":180819,"avatar_url":"https://avatars.githubusercontent.com/u/180819?v=3","gravatar_id":"","url":"https://api.github.com/users/joshuapinter","html_url":"https://github.com/joshuapinter","followers_url":"https://api.github.com/users/joshuapinter/followers","following_url":"https://api.github.com/users/joshuapinter/following{/other_user}","gists_url":"https://api.github.com/users/joshuapinter/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuapinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuapinter/subscriptions","organizations_url":"https://api.github.com/users/joshuapinter/orgs","repos_url":"https://api.github.com/users/joshuapinter/repos","events_url":"https://api.github.com/users/joshuapinter/events{/privacy}","received_events_url":"https://api.github.com/users/joshuapinter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joshuapinter/react-native","description":"A framework for building native apps with React.","fork":true,"url":"https://api.github.com/repos/joshuapinter/react-native","forks_url":"https://api.github.com/repos/joshuapinter/react-native/forks","keys_url":"https://api.github.com/repos/joshuapinter/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joshuapinter/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joshuapinter/react-native/teams","hooks_url":"https://api.github.com/repos/joshuapinter/react-native/hooks","issue_events_url":"https://api.github.com/repos/joshuapinter/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/joshuapinter/react-native/events","assignees_url":"https://api.github.com/repos/joshuapinter/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/joshuapinter/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/joshuapinter/react-native/tags","blobs_url":"https://api.github.com/repos/joshuapinter/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joshuapinter/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joshuapinter/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/joshuapinter/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joshuapinter/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/joshuapinter/react-native/languages","stargazers_url":"https://api.github.com/repos/joshuapinter/react-native/stargazers","contributors_url":"https://api.github.com/repos/joshuapinter/react-native/contributors","subscribers_url":"https://api.github.com/repos/joshuapinter/react-native/subscribers","subscription_url":"https://api.github.com/repos/joshuapinter/react-native/subscription","commits_url":"https://api.github.com/repos/joshuapinter/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/joshuapinter/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/joshuapinter/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/joshuapinter/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/joshuapinter/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/joshuapinter/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joshuapinter/react-native/merges","archive_url":"https://api.github.com/repos/joshuapinter/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joshuapinter/react-native/downloads","issues_url":"https://api.github.com/repos/joshuapinter/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/joshuapinter/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/joshuapinter/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/joshuapinter/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joshuapinter/react-native/labels{/name}","releases_url":"https://api.github.com/repos/joshuapinter/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/joshuapinter/react-native/deployments","created_at":"2016-04-09T18:42:39Z","updated_at":"2016-04-21T17:02:11Z","pushed_at":"2016-04-23T17:33:06Z","git_url":"git://github.com/joshuapinter/react-native.git","ssh_url":"git@github.com:joshuapinter/react-native.git","clone_url":"https://github.com/joshuapinter/react-native.git","svn_url":"https://github.com/joshuapinter/react-native","homepage":"http://facebook.github.io/react-native/","size":53717,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"47a470a97ce4198adc012a462f7e4493b99256aa","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":29028775,"name":"react-native","full_name":"facebook/react-native","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/react-native","description":"A framework for building native apps with React.","fork":false,"url":"https://api.github.com/repos/facebook/react-native","forks_url":"https://api.github.com/repos/facebook/react-native/forks","keys_url":"https://api.github.com/repos/facebook/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react-native/teams","hooks_url":"https://api.github.com/repos/facebook/react-native/hooks","issue_events_url":"https://api.github.com/repos/facebook/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react-native/events","assignees_url":"https://api.github.com/repos/facebook/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react-native/tags","blobs_url":"https://api.github.com/repos/facebook/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react-native/languages","stargazers_url":"https://api.github.com/repos/facebook/react-native/stargazers","contributors_url":"https://api.github.com/repos/facebook/react-native/contributors","subscribers_url":"https://api.github.com/repos/facebook/react-native/subscribers","subscription_url":"https://api.github.com/repos/facebook/react-native/subscription","commits_url":"https://api.github.com/repos/facebook/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react-native/merges","archive_url":"https://api.github.com/repos/facebook/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react-native/downloads","issues_url":"https://api.github.com/repos/facebook/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react-native/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react-native/deployments","created_at":"2015-01-09T18:10:16Z","updated_at":"2016-04-25T16:09:50Z","pushed_at":"2016-04-25T16:45:26Z","git_url":"git://github.com/facebook/react-native.git","ssh_url":"git@github.com:facebook/react-native.git","clone_url":"https://github.com/facebook/react-native.git","svn_url":"https://github.com/facebook/react-native","homepage":"http://facebook.github.io/react-native/","size":92408,"stargazers_count":31234,"watchers_count":31234,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6199,"mirror_url":null,"open_issues_count":694,"forks":6199,"open_issues":694,"watchers":31234,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/6907"},"html":{"href":"https://github.com/facebook/react-native/pull/6907"},"issue":{"href":"https://api.github.com/repos/facebook/react-native/issues/6907"},"comments":{"href":"https://api.github.com/repos/facebook/react-native/issues/6907/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react-native/pulls/6907/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react-native/pulls/6907/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react-native/statuses/5a036539fe96257e68089b2cd52b08e2a3ba645e"}}}}