{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react-native/pulls/comments/65783042","id":65783042,"diff_hunk":"@@ -145,6 +159,22 @@ - (void)handleRemoteNotificationsRegistered:(NSNotification *)notification\n   [self sendEventWithName:@\"remoteNotificationsRegistered\" body:notification.userInfo];\n }\n \n+- (void)handleRegisterUserNotificationSettings:(NSNotification *)notification\n+{\n+  if (self.requestPermissionsResolveBlock == nil) {\n+    return;\n+  }\n+  UIUserNotificationSettings *notificationSettings = notification.userInfo;","path":"Libraries/PushNotificationIOS/RCTPushNotificationManager.m","position":null,"original_position":44,"commit_id":"45c9e152b3f6982315be3614b22c232cb8f5c237","original_commit_id":"dbabb780ed7a5d3e6f4bfa708629398f77f52376","user":{"login":"nicklockwood","id":546885,"avatar_url":"https://avatars.githubusercontent.com/u/546885?v=3","gravatar_id":"","url":"https://api.github.com/users/nicklockwood","html_url":"https://github.com/nicklockwood","followers_url":"https://api.github.com/users/nicklockwood/followers","following_url":"https://api.github.com/users/nicklockwood/following{/other_user}","gists_url":"https://api.github.com/users/nicklockwood/gists{/gist_id}","starred_url":"https://api.github.com/users/nicklockwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicklockwood/subscriptions","organizations_url":"https://api.github.com/users/nicklockwood/orgs","repos_url":"https://api.github.com/users/nicklockwood/repos","events_url":"https://api.github.com/users/nicklockwood/events{/privacy}","received_events_url":"https://api.github.com/users/nicklockwood/received_events","type":"User","site_admin":false},"body":"@JAStanton ah, I totally missed that. Should just be a simple case of wrapping notificationSettings in a dictionary and then unwrapping it then:\r\n\r\n    @{ @\"settings\": notificationSettings }","created_at":"2016-06-03T22:09:37Z","updated_at":"2016-06-03T22:09:37Z","html_url":"https://github.com/facebook/react-native/pull/7900#discussion_r65783042","pull_request_url":"https://api.github.com/repos/facebook/react-native/pulls/7900","_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments/65783042"},"html":{"href":"https://github.com/facebook/react-native/pull/7900#discussion_r65783042"},"pull_request":{"href":"https://api.github.com/repos/facebook/react-native/pulls/7900"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/7900","id":72412452,"html_url":"https://github.com/facebook/react-native/pull/7900","diff_url":"https://github.com/facebook/react-native/pull/7900.diff","patch_url":"https://github.com/facebook/react-native/pull/7900.patch","issue_url":"https://api.github.com/repos/facebook/react-native/issues/7900","number":7900,"state":"open","locked":false,"title":"PushNotificationIOS requestPermission promisified","user":{"login":"JAStanton","id":645300,"avatar_url":"https://avatars.githubusercontent.com/u/645300?v=3","gravatar_id":"","url":"https://api.github.com/users/JAStanton","html_url":"https://github.com/JAStanton","followers_url":"https://api.github.com/users/JAStanton/followers","following_url":"https://api.github.com/users/JAStanton/following{/other_user}","gists_url":"https://api.github.com/users/JAStanton/gists{/gist_id}","starred_url":"https://api.github.com/users/JAStanton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JAStanton/subscriptions","organizations_url":"https://api.github.com/users/JAStanton/orgs","repos_url":"https://api.github.com/users/JAStanton/repos","events_url":"https://api.github.com/users/JAStanton/events{/privacy}","received_events_url":"https://api.github.com/users/JAStanton/received_events","type":"User","site_admin":false},"body":"**Motivation**\r\nToday it's hard to build a good flow around requesting permissions if we don't know when the user rejects the push notification permission.\r\n\r\nWith this PR I wrap `PushNotificationIOS#requestPermission` in a promise. The promise will return with the updated permissions when the user accepts, rejects or has previously rejected the permission. \r\n\r\nAn example flow of how an app should handle push notifications with the change proposed:\r\n1) Show user an explanation of push notification permissions with a button to enable,\r\n2) User presses the enable push notifications button,\r\n3) If the user accepts -> take them into the app,\r\n4) if the user rejects -> explain how to enable permission in the settings app.\r\n5) My app will now store some state about how it has asked permissions for push notifications so that the next time the user is taken through this flow they will go straight to step 4.\r\n\r\nWithout this change we could listen to the `register` event that PushNotificationIOS fires on the success scenario but we would have no clean way to determine if they have rejected the permission. It would break the example flow.\r\n\r\n**Test plan**\r\nIn this video I display:\r\n- Requesting permission -- if the dialog is currently open. <-- Only available with this PR\r\n- Active - if I have all (badge, sound, and alert) push notification permissions or not\r\n- Detailed permissions which show device token (truncated), badge, sound, and alert.\r\n\r\n![pushnotifications 1](https://cloud.githubusercontent.com/assets/645300/15759927/d50441dc-28c5-11e6-9fd7-794ada307386.gif)","created_at":"2016-06-02T20:31:41Z","updated_at":"2016-06-03T22:09:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15755576fa56a0189989e2780bde5e7ee05e3293","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react-native/pulls/7900/commits","review_comments_url":"https://api.github.com/repos/facebook/react-native/pulls/7900/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/7900/comments","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/45c9e152b3f6982315be3614b22c232cb8f5c237","head":{"label":"convoyinc:master","ref":"master","sha":"45c9e152b3f6982315be3614b22c232cb8f5c237","user":{"login":"convoyinc","id":11140206,"avatar_url":"https://avatars.githubusercontent.com/u/11140206?v=3","gravatar_id":"","url":"https://api.github.com/users/convoyinc","html_url":"https://github.com/convoyinc","followers_url":"https://api.github.com/users/convoyinc/followers","following_url":"https://api.github.com/users/convoyinc/following{/other_user}","gists_url":"https://api.github.com/users/convoyinc/gists{/gist_id}","starred_url":"https://api.github.com/users/convoyinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convoyinc/subscriptions","organizations_url":"https://api.github.com/users/convoyinc/orgs","repos_url":"https://api.github.com/users/convoyinc/repos","events_url":"https://api.github.com/users/convoyinc/events{/privacy}","received_events_url":"https://api.github.com/users/convoyinc/received_events","type":"Organization","site_admin":false},"repo":{"id":50050533,"name":"react-native","full_name":"convoyinc/react-native","owner":{"login":"convoyinc","id":11140206,"avatar_url":"https://avatars.githubusercontent.com/u/11140206?v=3","gravatar_id":"","url":"https://api.github.com/users/convoyinc","html_url":"https://github.com/convoyinc","followers_url":"https://api.github.com/users/convoyinc/followers","following_url":"https://api.github.com/users/convoyinc/following{/other_user}","gists_url":"https://api.github.com/users/convoyinc/gists{/gist_id}","starred_url":"https://api.github.com/users/convoyinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convoyinc/subscriptions","organizations_url":"https://api.github.com/users/convoyinc/orgs","repos_url":"https://api.github.com/users/convoyinc/repos","events_url":"https://api.github.com/users/convoyinc/events{/privacy}","received_events_url":"https://api.github.com/users/convoyinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/convoyinc/react-native","description":"A framework for building native apps with React.","fork":true,"url":"https://api.github.com/repos/convoyinc/react-native","forks_url":"https://api.github.com/repos/convoyinc/react-native/forks","keys_url":"https://api.github.com/repos/convoyinc/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/convoyinc/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/convoyinc/react-native/teams","hooks_url":"https://api.github.com/repos/convoyinc/react-native/hooks","issue_events_url":"https://api.github.com/repos/convoyinc/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/convoyinc/react-native/events","assignees_url":"https://api.github.com/repos/convoyinc/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/convoyinc/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/convoyinc/react-native/tags","blobs_url":"https://api.github.com/repos/convoyinc/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/convoyinc/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/convoyinc/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/convoyinc/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/convoyinc/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/convoyinc/react-native/languages","stargazers_url":"https://api.github.com/repos/convoyinc/react-native/stargazers","contributors_url":"https://api.github.com/repos/convoyinc/react-native/contributors","subscribers_url":"https://api.github.com/repos/convoyinc/react-native/subscribers","subscription_url":"https://api.github.com/repos/convoyinc/react-native/subscription","commits_url":"https://api.github.com/repos/convoyinc/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/convoyinc/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/convoyinc/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/convoyinc/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/convoyinc/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/convoyinc/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/convoyinc/react-native/merges","archive_url":"https://api.github.com/repos/convoyinc/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/convoyinc/react-native/downloads","issues_url":"https://api.github.com/repos/convoyinc/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/convoyinc/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/convoyinc/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/convoyinc/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/convoyinc/react-native/labels{/name}","releases_url":"https://api.github.com/repos/convoyinc/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/convoyinc/react-native/deployments","created_at":"2016-01-20T18:24:02Z","updated_at":"2016-06-02T14:46:58Z","pushed_at":"2016-06-03T22:03:09Z","git_url":"git://github.com/convoyinc/react-native.git","ssh_url":"git@github.com:convoyinc/react-native.git","clone_url":"https://github.com/convoyinc/react-native.git","svn_url":"https://github.com/convoyinc/react-native","homepage":"http://facebook.github.io/react-native/","size":51661,"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":"7028929d8f44872e790376875c7971155bb99f81","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-06-03T21:44:52Z","pushed_at":"2016-06-03T22:03:10Z","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":107272,"stargazers_count":33071,"watchers_count":33071,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6801,"mirror_url":null,"open_issues_count":879,"forks":6801,"open_issues":879,"watchers":33071,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/7900"},"html":{"href":"https://github.com/facebook/react-native/pull/7900"},"issue":{"href":"https://api.github.com/repos/facebook/react-native/issues/7900"},"comments":{"href":"https://api.github.com/repos/facebook/react-native/issues/7900/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react-native/pulls/7900/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/7900/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react-native/statuses/45c9e152b3f6982315be3614b22c232cb8f5c237"}}}}
{"actor":{"display_login":"nicklockwood"}}