{"action":"created","comment":{"url":"https://api.github.com/repos/urbanairship/react-native-module/pulls/comments/192790050","pull_request_review_id":125633620,"id":192790050,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Mjc5MDA1MA==","diff_hunk":"@@ -110,6 +114,48 @@ public void onReactContextInitialized(ReactContext reactContext) {\n         }\n     }\n \n+    /**\n+     * Called when a new listener is added for a specified event name.\n+     *\n+     * @param eventName The event name.\n+     */\n+    void addAndroidListener(ReactContext reactContext, String eventName) {\n+        synchronized (knownListeners) {\n+            List<Event> pending = new ArrayList<>();\n+            pending.addAll(pendingEvents);\n+\n+            for (Event event : pendingEvents) {\n+                if (event.equals(eventName)) {\n+                    sendEvent(reactContext, event);\n+                    pending.remove(event);\n+                }\n+            }\n+\n+            pendingEvents.clear();\n+            pendingEvents.addAll(pending);\n+\n+            listenerCount++;\n+            knownListeners.add(eventName);\n+        }\n+    }\n+\n+    /**\n+     * Called when listeners are removed.\n+     *\n+     * @param count The count of listeners.\n+     */\n+    void removeAndroidListeners(ReactContext reactContext, int count) {\n+        synchronized (knownListeners) {\n+            long currentCount = listenerCount;\n+            listenerCount = max(0, currentCount - count);\n+\n+            if (listenerCount == 0) {\n+                setEnabled(reactContext, false);","path":"android/src/main/java/com/urbanairship/reactnative/EventEmitter.java","position":120,"original_position":120,"commit_id":"1908754552147edb3ceea25a055dd1db151ebbac","original_commit_id":"1908754552147edb3ceea25a055dd1db151ebbac","user":{"login":"rlepinski","id":3967591,"node_id":"MDQ6VXNlcjM5Njc1OTE=","avatar_url":"https://avatars0.githubusercontent.com/u/3967591?v=4","gravatar_id":"","url":"https://api.github.com/users/rlepinski","html_url":"https://github.com/rlepinski","followers_url":"https://api.github.com/users/rlepinski/followers","following_url":"https://api.github.com/users/rlepinski/following{/other_user}","gists_url":"https://api.github.com/users/rlepinski/gists{/gist_id}","starred_url":"https://api.github.com/users/rlepinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlepinski/subscriptions","organizations_url":"https://api.github.com/users/rlepinski/orgs","repos_url":"https://api.github.com/users/rlepinski/repos","events_url":"https://api.github.com/users/rlepinski/events{/privacy}","received_events_url":"https://api.github.com/users/rlepinski/received_events","type":"User","site_admin":false},"body":"do we still need the enabled flag?","created_at":"2018-06-04T15:49:26Z","updated_at":"2018-06-04T15:49:26Z","html_url":"https://github.com/urbanairship/react-native-module/pull/118#discussion_r192790050","pull_request_url":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/urbanairship/react-native-module/pulls/comments/192790050"},"html":{"href":"https://github.com/urbanairship/react-native-module/pull/118#discussion_r192790050"},"pull_request":{"href":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118"}}},"pull_request":{"url":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118","id":188144587,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg4MTQ0NTg3","html_url":"https://github.com/urbanairship/react-native-module/pull/118","diff_url":"https://github.com/urbanairship/react-native-module/pull/118.diff","patch_url":"https://github.com/urbanairship/react-native-module/pull/118.patch","issue_url":"https://api.github.com/repos/urbanairship/react-native-module/issues/118","number":118,"state":"open","locked":false,"title":"[MOBILE-179] Queue up push received and registration events","user":{"login":"crow","id":2199816,"node_id":"MDQ6VXNlcjIxOTk4MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/2199816?v=4","gravatar_id":"","url":"https://api.github.com/users/crow","html_url":"https://github.com/crow","followers_url":"https://api.github.com/users/crow/followers","following_url":"https://api.github.com/users/crow/following{/other_user}","gists_url":"https://api.github.com/users/crow/gists{/gist_id}","starred_url":"https://api.github.com/users/crow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crow/subscriptions","organizations_url":"https://api.github.com/users/crow/orgs","repos_url":"https://api.github.com/users/crow/repos","events_url":"https://api.github.com/users/crow/events{/privacy}","received_events_url":"https://api.github.com/users/crow/received_events","type":"User","site_admin":false},"body":"This is cleaned up work from PR#90. \r\n\r\n- drops isCritical in Android\r\n- adds functionality to only emit pending events when a matching listener is added in both iOS and Android","created_at":"2018-05-15T14:19:13Z","updated_at":"2018-06-04T15:49:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44f12b8c46cc5a6a2db71b20e5020047fa821277","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":889203291,"node_id":"MDU6TGFiZWw4ODkyMDMyOTE=","url":"https://api.github.com/repos/urbanairship/react-native-module/labels/needs-review","name":"needs-review","color":"e11d21","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118/commits","review_comments_url":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118/comments","review_comment_url":"https://api.github.com/repos/urbanairship/react-native-module/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urbanairship/react-native-module/issues/118/comments","statuses_url":"https://api.github.com/repos/urbanairship/react-native-module/statuses/1908754552147edb3ceea25a055dd1db151ebbac","head":{"label":"urbanairship:MOBILE-179","ref":"MOBILE-179","sha":"1908754552147edb3ceea25a055dd1db151ebbac","user":{"login":"urbanairship","id":360059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MDA1OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/360059?v=4","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"repo":{"id":89940707,"node_id":"MDEwOlJlcG9zaXRvcnk4OTk0MDcwNw==","name":"react-native-module","full_name":"urbanairship/react-native-module","owner":{"login":"urbanairship","id":360059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MDA1OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/360059?v=4","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urbanairship/react-native-module","description":"React Native module for Urban Airship","fork":false,"url":"https://api.github.com/repos/urbanairship/react-native-module","forks_url":"https://api.github.com/repos/urbanairship/react-native-module/forks","keys_url":"https://api.github.com/repos/urbanairship/react-native-module/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urbanairship/react-native-module/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urbanairship/react-native-module/teams","hooks_url":"https://api.github.com/repos/urbanairship/react-native-module/hooks","issue_events_url":"https://api.github.com/repos/urbanairship/react-native-module/issues/events{/number}","events_url":"https://api.github.com/repos/urbanairship/react-native-module/events","assignees_url":"https://api.github.com/repos/urbanairship/react-native-module/assignees{/user}","branches_url":"https://api.github.com/repos/urbanairship/react-native-module/branches{/branch}","tags_url":"https://api.github.com/repos/urbanairship/react-native-module/tags","blobs_url":"https://api.github.com/repos/urbanairship/react-native-module/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urbanairship/react-native-module/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urbanairship/react-native-module/git/refs{/sha}","trees_url":"https://api.github.com/repos/urbanairship/react-native-module/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urbanairship/react-native-module/statuses/{sha}","languages_url":"https://api.github.com/repos/urbanairship/react-native-module/languages","stargazers_url":"https://api.github.com/repos/urbanairship/react-native-module/stargazers","contributors_url":"https://api.github.com/repos/urbanairship/react-native-module/contributors","subscribers_url":"https://api.github.com/repos/urbanairship/react-native-module/subscribers","subscription_url":"https://api.github.com/repos/urbanairship/react-native-module/subscription","commits_url":"https://api.github.com/repos/urbanairship/react-native-module/commits{/sha}","git_commits_url":"https://api.github.com/repos/urbanairship/react-native-module/git/commits{/sha}","comments_url":"https://api.github.com/repos/urbanairship/react-native-module/comments{/number}","issue_comment_url":"https://api.github.com/repos/urbanairship/react-native-module/issues/comments{/number}","contents_url":"https://api.github.com/repos/urbanairship/react-native-module/contents/{+path}","compare_url":"https://api.github.com/repos/urbanairship/react-native-module/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urbanairship/react-native-module/merges","archive_url":"https://api.github.com/repos/urbanairship/react-native-module/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urbanairship/react-native-module/downloads","issues_url":"https://api.github.com/repos/urbanairship/react-native-module/issues{/number}","pulls_url":"https://api.github.com/repos/urbanairship/react-native-module/pulls{/number}","milestones_url":"https://api.github.com/repos/urbanairship/react-native-module/milestones{/number}","notifications_url":"https://api.github.com/repos/urbanairship/react-native-module/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urbanairship/react-native-module/labels{/name}","releases_url":"https://api.github.com/repos/urbanairship/react-native-module/releases{/id}","deployments_url":"https://api.github.com/repos/urbanairship/react-native-module/deployments","created_at":"2017-05-01T16:25:14Z","updated_at":"2018-05-18T17:02:28Z","pushed_at":"2018-06-01T15:00:39Z","git_url":"git://github.com/urbanairship/react-native-module.git","ssh_url":"git@github.com:urbanairship/react-native-module.git","clone_url":"https://github.com/urbanairship/react-native-module.git","svn_url":"https://github.com/urbanairship/react-native-module","homepage":"","size":398,"stargazers_count":21,"watchers_count":21,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":21,"open_issues":2,"watchers":21,"default_branch":"master"}},"base":{"label":"urbanairship:master","ref":"master","sha":"774cedc77b00bcb3f3896a8a860705c900ede019","user":{"login":"urbanairship","id":360059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MDA1OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/360059?v=4","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"repo":{"id":89940707,"node_id":"MDEwOlJlcG9zaXRvcnk4OTk0MDcwNw==","name":"react-native-module","full_name":"urbanairship/react-native-module","owner":{"login":"urbanairship","id":360059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MDA1OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/360059?v=4","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urbanairship/react-native-module","description":"React Native module for Urban Airship","fork":false,"url":"https://api.github.com/repos/urbanairship/react-native-module","forks_url":"https://api.github.com/repos/urbanairship/react-native-module/forks","keys_url":"https://api.github.com/repos/urbanairship/react-native-module/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urbanairship/react-native-module/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urbanairship/react-native-module/teams","hooks_url":"https://api.github.com/repos/urbanairship/react-native-module/hooks","issue_events_url":"https://api.github.com/repos/urbanairship/react-native-module/issues/events{/number}","events_url":"https://api.github.com/repos/urbanairship/react-native-module/events","assignees_url":"https://api.github.com/repos/urbanairship/react-native-module/assignees{/user}","branches_url":"https://api.github.com/repos/urbanairship/react-native-module/branches{/branch}","tags_url":"https://api.github.com/repos/urbanairship/react-native-module/tags","blobs_url":"https://api.github.com/repos/urbanairship/react-native-module/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urbanairship/react-native-module/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urbanairship/react-native-module/git/refs{/sha}","trees_url":"https://api.github.com/repos/urbanairship/react-native-module/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urbanairship/react-native-module/statuses/{sha}","languages_url":"https://api.github.com/repos/urbanairship/react-native-module/languages","stargazers_url":"https://api.github.com/repos/urbanairship/react-native-module/stargazers","contributors_url":"https://api.github.com/repos/urbanairship/react-native-module/contributors","subscribers_url":"https://api.github.com/repos/urbanairship/react-native-module/subscribers","subscription_url":"https://api.github.com/repos/urbanairship/react-native-module/subscription","commits_url":"https://api.github.com/repos/urbanairship/react-native-module/commits{/sha}","git_commits_url":"https://api.github.com/repos/urbanairship/react-native-module/git/commits{/sha}","comments_url":"https://api.github.com/repos/urbanairship/react-native-module/comments{/number}","issue_comment_url":"https://api.github.com/repos/urbanairship/react-native-module/issues/comments{/number}","contents_url":"https://api.github.com/repos/urbanairship/react-native-module/contents/{+path}","compare_url":"https://api.github.com/repos/urbanairship/react-native-module/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urbanairship/react-native-module/merges","archive_url":"https://api.github.com/repos/urbanairship/react-native-module/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urbanairship/react-native-module/downloads","issues_url":"https://api.github.com/repos/urbanairship/react-native-module/issues{/number}","pulls_url":"https://api.github.com/repos/urbanairship/react-native-module/pulls{/number}","milestones_url":"https://api.github.com/repos/urbanairship/react-native-module/milestones{/number}","notifications_url":"https://api.github.com/repos/urbanairship/react-native-module/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urbanairship/react-native-module/labels{/name}","releases_url":"https://api.github.com/repos/urbanairship/react-native-module/releases{/id}","deployments_url":"https://api.github.com/repos/urbanairship/react-native-module/deployments","created_at":"2017-05-01T16:25:14Z","updated_at":"2018-05-18T17:02:28Z","pushed_at":"2018-06-01T15:00:39Z","git_url":"git://github.com/urbanairship/react-native-module.git","ssh_url":"git@github.com:urbanairship/react-native-module.git","clone_url":"https://github.com/urbanairship/react-native-module.git","svn_url":"https://github.com/urbanairship/react-native-module","homepage":"","size":398,"stargazers_count":21,"watchers_count":21,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":21,"open_issues":2,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118"},"html":{"href":"https://github.com/urbanairship/react-native-module/pull/118"},"issue":{"href":"https://api.github.com/repos/urbanairship/react-native-module/issues/118"},"comments":{"href":"https://api.github.com/repos/urbanairship/react-native-module/issues/118/comments"},"review_comments":{"href":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118/comments"},"review_comment":{"href":"https://api.github.com/repos/urbanairship/react-native-module/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urbanairship/react-native-module/pulls/118/commits"},"statuses":{"href":"https://api.github.com/repos/urbanairship/react-native-module/statuses/1908754552147edb3ceea25a055dd1db151ebbac"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"rlepinski"}}