{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/client/pulls/comments/87468810","pull_request_review_id":8079358,"id":87468810,"diff_hunk":"@@ -0,0 +1,110 @@\n+// @flow\n+import * as Constants from '../constants/push'\n+\n+// $FlowIssue tell flow about this module\n+import * as PushNotifications from 'react-native-push-notification'\n+\n+import {apiserverPostRpcPromise} from '../constants/types/flow-types'\n+\n+import {call, put, select} from 'redux-saga/effects'\n+import {takeEvery, takeLatest} from 'redux-saga'\n+\n+import type {SagaGenerator} from '../constants/types/saga'\n+import type {TypedState} from '../constants/reducer'\n+\n+import type {PushNotification, PushNotificationAction, PushPermissionsPromptAction, PushPermissionsRequestAction, PushPermissionsRequestingAction, PushTokenAction, SavePushTokenAction, TokenType, UpdatePushTokenAction} from '../constants/push'\n+\n+export function permissionsRequest (): PushPermissionsRequestAction {\n+  return {type: Constants.permissionsRequest, payload: undefined}\n+}\n+\n+function * permissionsRequestSaga (): SagaGenerator<any, any> {\n+  try {\n+    yield put({type: Constants.permissionsRequesting, payload: true})\n+\n+    console.log('Requesting permissions')\n+    const permissions = yield call(() => { return PushNotifications.requestPermissions() })\n+    console.log('Permissions:', permissions)\n+    // TODO(gabriel): Set permissions we have in store, might want it at some point?\n+  } finally {\n+    yield put({type: Constants.permissionsRequesting, payload: false})\n+    yield put({type: Constants.permissionsPrompt, payload: false})\n+  }\n+}\n+\n+export function permissionsRequesting (enabled: boolean): PushPermissionsRequestingAction {\n+  return {type: Constants.permissionsRequesting, payload: enabled}\n+}\n+\n+export function permissionsPrompt (enabled: boolean): PushPermissionsPromptAction {\n+  return {type: Constants.permissionsPrompt, payload: enabled}\n+}\n+\n+export function pushNotification (notification: PushNotification): PushNotificationAction {\n+  return {type: Constants.pushNotification, payload: notification}\n+}\n+\n+function * pushNotificationSaga (notification: PushNotification): SagaGenerator<any, any> {\n+  console.warn('Push notification:', notification)\n+}\n+\n+export function pushToken (token: string, tokenType: TokenType): PushTokenAction {\n+  return {type: Constants.pushToken, payload: {token, tokenType}}\n+}\n+\n+function * pushTokenSaga (action: PushTokenAction): SagaGenerator<any, any> {\n+  const {token, tokenType} = action.payload\n+  yield put(updatePushToken(token, tokenType))\n+  yield put(savePushToken())\n+}\n+\n+export function savePushToken (): SavePushTokenAction {\n+  return {type: Constants.savePushToken, payload: undefined}\n+}\n+\n+function * savePushTokenSaga (): SagaGenerator<any, any> {\n+  try {\n+    const pushSelector = (state: TypedState) => state.push","path":"shared/actions/push.js","position":67,"original_position":67,"commit_id":"2b5c231d825bc58740d77def6d1313de57356b06","original_commit_id":"2b5c231d825bc58740d77def6d1313de57356b06","user":{"login":"MarcoPolo","id":594035,"avatar_url":"https://avatars.githubusercontent.com/u/594035?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcoPolo","html_url":"https://github.com/MarcoPolo","followers_url":"https://api.github.com/users/MarcoPolo/followers","following_url":"https://api.github.com/users/MarcoPolo/following{/other_user}","gists_url":"https://api.github.com/users/MarcoPolo/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcoPolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcoPolo/subscriptions","organizations_url":"https://api.github.com/users/MarcoPolo/orgs","repos_url":"https://api.github.com/users/MarcoPolo/repos","events_url":"https://api.github.com/users/MarcoPolo/events{/privacy}","received_events_url":"https://api.github.com/users/MarcoPolo/received_events","type":"User","site_admin":false},"body":"Do this so you can leverage the type checker\r\n```\r\nconst pushSelector = ({push: {token, tokenType}}: TypedState) => ({token, tokenType})\r\n```","created_at":"2016-11-10T19:33:18Z","updated_at":"2016-11-10T20:04:37Z","html_url":"https://github.com/keybase/client/pull/4800#discussion_r87468810","pull_request_url":"https://api.github.com/repos/keybase/client/pulls/4800","_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/comments/87468810"},"html":{"href":"https://github.com/keybase/client/pull/4800#discussion_r87468810"},"pull_request":{"href":"https://api.github.com/repos/keybase/client/pulls/4800"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/client/pulls/4800","id":92420822,"html_url":"https://github.com/keybase/client/pull/4800","diff_url":"https://github.com/keybase/client/pull/4800.diff","patch_url":"https://github.com/keybase/client/pull/4800.patch","issue_url":"https://api.github.com/repos/keybase/client/issues/4800","number":4800,"state":"open","locked":false,"title":"Push notifications (iOS+Android)","user":{"login":"gabriel","id":2669,"avatar_url":"https://avatars.githubusercontent.com/u/2669?v=3","gravatar_id":"","url":"https://api.github.com/users/gabriel","html_url":"https://github.com/gabriel","followers_url":"https://api.github.com/users/gabriel/followers","following_url":"https://api.github.com/users/gabriel/following{/other_user}","gists_url":"https://api.github.com/users/gabriel/gists{/gist_id}","starred_url":"https://api.github.com/users/gabriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabriel/subscriptions","organizations_url":"https://api.github.com/users/gabriel/orgs","repos_url":"https://api.github.com/users/gabriel/repos","events_url":"https://api.github.com/users/gabriel/events{/privacy}","received_events_url":"https://api.github.com/users/gabriel/received_events","type":"User","site_admin":false},"body":"Push notifications iOS.\r\n\r\n![2016-11-04 at 2 48 pm](https://cloud.githubusercontent.com/assets/2669/20023510/b8bb027a-a29d-11e6-90af-dea11e9e8a97.png)\r\n\r\nThis is mostly compatible with Android, which is coming next.","created_at":"2016-11-04T21:44:33Z","updated_at":"2016-11-10T20:04:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"326d456ac886add3924884ee7c0eacc1ae4e5c2d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/client/pulls/4800/commits","review_comments_url":"https://api.github.com/repos/keybase/client/pulls/4800/comments","review_comment_url":"https://api.github.com/repos/keybase/client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/client/issues/4800/comments","statuses_url":"https://api.github.com/repos/keybase/client/statuses/2b5c231d825bc58740d77def6d1313de57356b06","head":{"label":"keybase:pushmodal2","ref":"pushmodal2","sha":"2b5c231d825bc58740d77def6d1313de57356b06","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2016-11-08T20:45:48Z","pushed_at":"2016-11-10T19:43:33Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":167942,"stargazers_count":840,"watchers_count":840,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":569,"forks":78,"open_issues":569,"watchers":840,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"649b8bdb13a746f1884c31d1091edda10a8a5c3f","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2016-11-08T20:45:48Z","pushed_at":"2016-11-10T19:43:33Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":167942,"stargazers_count":840,"watchers_count":840,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":569,"forks":78,"open_issues":569,"watchers":840,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/4800"},"html":{"href":"https://github.com/keybase/client/pull/4800"},"issue":{"href":"https://api.github.com/repos/keybase/client/issues/4800"},"comments":{"href":"https://api.github.com/repos/keybase/client/issues/4800/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/client/pulls/4800/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/client/pulls/4800/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/client/statuses/2b5c231d825bc58740d77def6d1313de57356b06"}}}}
{"actor":{"display_login":"MarcoPolo"}}