{"action":"created","comment":{"url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/comments/67596940","id":67596940,"diff_hunk":"@@ -0,0 +1,120 @@\n+package com.visiontech.yummysmile.ui.activity;\n+\n+import android.content.DialogInterface;\n+import android.content.Intent;\n+import android.content.pm.PackageManager;\n+import android.net.Uri;\n+import android.os.Bundle;\n+import android.support.annotation.NonNull;\n+import android.support.v4.app.ActivityCompat;\n+import android.support.v7.app.AlertDialog;\n+\n+import com.google.common.base.Preconditions;\n+import com.visiontech.yummysmile.R;\n+import com.visiontech.yummysmile.util.PermissionsHelper;\n+\n+/**\n+ * Activity to handle the flow and logic for Permissions on Android M or above. Also handle permission declined contingency.\n+ *\n+ * @author hetorres\n+ */\n+public class PermissionsActivity extends BaseActivity {\n+    private static final int PERMISSION_REQUEST_CODE = 200;\n+    private static final String PACKAGE = \"package:\";\n+\n+    public static final int PERMISSIONS_GRANTED = 0;\n+    public static final int PERMISSIONS_DENIED = 1;\n+    public static final String PERMISSIONS_KEY = \"PERMISSIONS\";\n+\n+    private PermissionsHelper permissionsHelper;\n+    private boolean requiresCheck;\n+\n+    @Override\n+    protected void onCreate(Bundle savedInstanceState) {\n+        super.onCreate(savedInstanceState);\n+        Preconditions.checkNotNull(getIntent());\n+        Preconditions.checkArgument(getIntent().hasExtra(PERMISSIONS_KEY), \"This Activity needs to have PERMISSIONS_KEY parameter.\");\n+\n+        setContentView(R.layout.activity_permissions);\n+        permissionsHelper = application.getCoreComponent().getPermissionsHelper();\n+        requiresCheck = true;\n+    }\n+\n+    @Override\n+    protected void onResume() {\n+        super.onResume();\n+        String[] permissions = getIntent().getStringArrayExtra(PERMISSIONS_KEY);\n+\n+        if (requiresCheck) {\n+            if (permissionsHelper.permissionsCheck(permissions)) {\n+                ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_CODE);\n+            } else {\n+                allPermissionsGranted();\n+            }\n+        } else {\n+            requiresCheck = true;","path":"app/src/main/java/com/visiontech/yummysmile/ui/activity/PermissionsActivity.java","position":54,"original_position":55,"commit_id":"22c741825a282c37fc37c86765dfd7f9b58ce2cb","original_commit_id":"0b4d4bf5c894d3ccfbe29ee72f8f9077714edf09","user":{"login":"htorrex","id":4344204,"avatar_url":"https://avatars.githubusercontent.com/u/4344204?v=3","gravatar_id":"","url":"https://api.github.com/users/htorrex","html_url":"https://github.com/htorrex","followers_url":"https://api.github.com/users/htorrex/followers","following_url":"https://api.github.com/users/htorrex/following{/other_user}","gists_url":"https://api.github.com/users/htorrex/gists{/gist_id}","starred_url":"https://api.github.com/users/htorrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htorrex/subscriptions","organizations_url":"https://api.github.com/users/htorrex/orgs","repos_url":"https://api.github.com/users/htorrex/repos","events_url":"https://api.github.com/users/htorrex/events{/privacy}","received_events_url":"https://api.github.com/users/htorrex/received_events","type":"User","site_admin":false},"body":"Yes, so.. the think is when we call ActivityCompat.requestPermissions a small popup window appear and the user has to answer if they grant permissions or not, whatever they do after they answer we go back to out Activity and thats why i have to use that flag. in order to avoid ask again if the user already answer. That popup is by default we don't have directly control on that just onResultEvents. when i do other stuff.","created_at":"2016-06-18T06:49:32Z","updated_at":"2016-06-18T06:49:32Z","html_url":"https://github.com/manuelortiz28/yummysmile/pull/20#discussion_r67596940","pull_request_url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/comments/67596940"},"html":{"href":"https://github.com/manuelortiz28/yummysmile/pull/20#discussion_r67596940"},"pull_request":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20","id":74006406,"html_url":"https://github.com/manuelortiz28/yummysmile/pull/20","diff_url":"https://github.com/manuelortiz28/yummysmile/pull/20.diff","patch_url":"https://github.com/manuelortiz28/yummysmile/pull/20.patch","issue_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/20","number":20,"state":"open","locked":false,"title":"[YUM_ANDROID-006], [YUM_ANDROID-015],  upload photo part2","user":{"login":"htorrex","id":4344204,"avatar_url":"https://avatars.githubusercontent.com/u/4344204?v=3","gravatar_id":"","url":"https://api.github.com/users/htorrex","html_url":"https://github.com/htorrex","followers_url":"https://api.github.com/users/htorrex/followers","following_url":"https://api.github.com/users/htorrex/following{/other_user}","gists_url":"https://api.github.com/users/htorrex/gists{/gist_id}","starred_url":"https://api.github.com/users/htorrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htorrex/subscriptions","organizations_url":"https://api.github.com/users/htorrex/orgs","repos_url":"https://api.github.com/users/htorrex/repos","events_url":"https://api.github.com/users/htorrex/events{/privacy}","received_events_url":"https://api.github.com/users/htorrex/received_events","type":"User","site_admin":false},"body":"Grab a photo from gallery\r\nTake picture and upload\r\nPermissions Helper to unified whatever need permissions in the future.","created_at":"2016-06-16T00:35:47Z","updated_at":"2016-06-18T06:49:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0333d362115d35c873853cbc32d9cd2efd31ba27","assignee":{"login":"manuelortiz28","id":14357179,"avatar_url":"https://avatars.githubusercontent.com/u/14357179?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelortiz28","html_url":"https://github.com/manuelortiz28","followers_url":"https://api.github.com/users/manuelortiz28/followers","following_url":"https://api.github.com/users/manuelortiz28/following{/other_user}","gists_url":"https://api.github.com/users/manuelortiz28/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelortiz28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelortiz28/subscriptions","organizations_url":"https://api.github.com/users/manuelortiz28/orgs","repos_url":"https://api.github.com/users/manuelortiz28/repos","events_url":"https://api.github.com/users/manuelortiz28/events{/privacy}","received_events_url":"https://api.github.com/users/manuelortiz28/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/manuelortiz28/yummysmile/milestones/1","html_url":"https://github.com/manuelortiz28/yummysmile/milestones/1.0","labels_url":"https://api.github.com/repos/manuelortiz28/yummysmile/milestones/1/labels","id":1539114,"number":1,"title":"1.0","description":null,"creator":{"login":"manuelortiz28","id":14357179,"avatar_url":"https://avatars.githubusercontent.com/u/14357179?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelortiz28","html_url":"https://github.com/manuelortiz28","followers_url":"https://api.github.com/users/manuelortiz28/followers","following_url":"https://api.github.com/users/manuelortiz28/following{/other_user}","gists_url":"https://api.github.com/users/manuelortiz28/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelortiz28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelortiz28/subscriptions","organizations_url":"https://api.github.com/users/manuelortiz28/orgs","repos_url":"https://api.github.com/users/manuelortiz28/repos","events_url":"https://api.github.com/users/manuelortiz28/events{/privacy}","received_events_url":"https://api.github.com/users/manuelortiz28/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":9,"state":"open","created_at":"2016-01-24T05:57:26Z","updated_at":"2016-06-16T23:28:49Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20/commits","review_comments_url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20/comments","review_comment_url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/20/comments","statuses_url":"https://api.github.com/repos/manuelortiz28/yummysmile/statuses/22c741825a282c37fc37c86765dfd7f9b58ce2cb","head":{"label":"manuelortiz28:hetorres_upload_photo_part2","ref":"hetorres_upload_photo_part2","sha":"22c741825a282c37fc37c86765dfd7f9b58ce2cb","user":{"login":"manuelortiz28","id":14357179,"avatar_url":"https://avatars.githubusercontent.com/u/14357179?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelortiz28","html_url":"https://github.com/manuelortiz28","followers_url":"https://api.github.com/users/manuelortiz28/followers","following_url":"https://api.github.com/users/manuelortiz28/following{/other_user}","gists_url":"https://api.github.com/users/manuelortiz28/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelortiz28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelortiz28/subscriptions","organizations_url":"https://api.github.com/users/manuelortiz28/orgs","repos_url":"https://api.github.com/users/manuelortiz28/repos","events_url":"https://api.github.com/users/manuelortiz28/events{/privacy}","received_events_url":"https://api.github.com/users/manuelortiz28/received_events","type":"User","site_admin":false},"repo":{"id":42824916,"name":"yummysmile","full_name":"manuelortiz28/yummysmile","owner":{"login":"manuelortiz28","id":14357179,"avatar_url":"https://avatars.githubusercontent.com/u/14357179?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelortiz28","html_url":"https://github.com/manuelortiz28","followers_url":"https://api.github.com/users/manuelortiz28/followers","following_url":"https://api.github.com/users/manuelortiz28/following{/other_user}","gists_url":"https://api.github.com/users/manuelortiz28/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelortiz28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelortiz28/subscriptions","organizations_url":"https://api.github.com/users/manuelortiz28/orgs","repos_url":"https://api.github.com/users/manuelortiz28/repos","events_url":"https://api.github.com/users/manuelortiz28/events{/privacy}","received_events_url":"https://api.github.com/users/manuelortiz28/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manuelortiz28/yummysmile","description":"Android native project of yummy smile","fork":false,"url":"https://api.github.com/repos/manuelortiz28/yummysmile","forks_url":"https://api.github.com/repos/manuelortiz28/yummysmile/forks","keys_url":"https://api.github.com/repos/manuelortiz28/yummysmile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manuelortiz28/yummysmile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manuelortiz28/yummysmile/teams","hooks_url":"https://api.github.com/repos/manuelortiz28/yummysmile/hooks","issue_events_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/events{/number}","events_url":"https://api.github.com/repos/manuelortiz28/yummysmile/events","assignees_url":"https://api.github.com/repos/manuelortiz28/yummysmile/assignees{/user}","branches_url":"https://api.github.com/repos/manuelortiz28/yummysmile/branches{/branch}","tags_url":"https://api.github.com/repos/manuelortiz28/yummysmile/tags","blobs_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/refs{/sha}","trees_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manuelortiz28/yummysmile/statuses/{sha}","languages_url":"https://api.github.com/repos/manuelortiz28/yummysmile/languages","stargazers_url":"https://api.github.com/repos/manuelortiz28/yummysmile/stargazers","contributors_url":"https://api.github.com/repos/manuelortiz28/yummysmile/contributors","subscribers_url":"https://api.github.com/repos/manuelortiz28/yummysmile/subscribers","subscription_url":"https://api.github.com/repos/manuelortiz28/yummysmile/subscription","commits_url":"https://api.github.com/repos/manuelortiz28/yummysmile/commits{/sha}","git_commits_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/commits{/sha}","comments_url":"https://api.github.com/repos/manuelortiz28/yummysmile/comments{/number}","issue_comment_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/comments{/number}","contents_url":"https://api.github.com/repos/manuelortiz28/yummysmile/contents/{+path}","compare_url":"https://api.github.com/repos/manuelortiz28/yummysmile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manuelortiz28/yummysmile/merges","archive_url":"https://api.github.com/repos/manuelortiz28/yummysmile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manuelortiz28/yummysmile/downloads","issues_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues{/number}","pulls_url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls{/number}","milestones_url":"https://api.github.com/repos/manuelortiz28/yummysmile/milestones{/number}","notifications_url":"https://api.github.com/repos/manuelortiz28/yummysmile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manuelortiz28/yummysmile/labels{/name}","releases_url":"https://api.github.com/repos/manuelortiz28/yummysmile/releases{/id}","deployments_url":"https://api.github.com/repos/manuelortiz28/yummysmile/deployments","created_at":"2015-09-20T18:47:40Z","updated_at":"2016-02-11T18:08:40Z","pushed_at":"2016-06-18T06:30:35Z","git_url":"git://github.com/manuelortiz28/yummysmile.git","ssh_url":"git@github.com:manuelortiz28/yummysmile.git","clone_url":"https://github.com/manuelortiz28/yummysmile.git","svn_url":"https://github.com/manuelortiz28/yummysmile","homepage":"","size":329,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"manuelortiz28:develop","ref":"develop","sha":"7f82fe6c29c36c1cd8b6a4f5ff7725898927aa92","user":{"login":"manuelortiz28","id":14357179,"avatar_url":"https://avatars.githubusercontent.com/u/14357179?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelortiz28","html_url":"https://github.com/manuelortiz28","followers_url":"https://api.github.com/users/manuelortiz28/followers","following_url":"https://api.github.com/users/manuelortiz28/following{/other_user}","gists_url":"https://api.github.com/users/manuelortiz28/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelortiz28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelortiz28/subscriptions","organizations_url":"https://api.github.com/users/manuelortiz28/orgs","repos_url":"https://api.github.com/users/manuelortiz28/repos","events_url":"https://api.github.com/users/manuelortiz28/events{/privacy}","received_events_url":"https://api.github.com/users/manuelortiz28/received_events","type":"User","site_admin":false},"repo":{"id":42824916,"name":"yummysmile","full_name":"manuelortiz28/yummysmile","owner":{"login":"manuelortiz28","id":14357179,"avatar_url":"https://avatars.githubusercontent.com/u/14357179?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelortiz28","html_url":"https://github.com/manuelortiz28","followers_url":"https://api.github.com/users/manuelortiz28/followers","following_url":"https://api.github.com/users/manuelortiz28/following{/other_user}","gists_url":"https://api.github.com/users/manuelortiz28/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelortiz28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelortiz28/subscriptions","organizations_url":"https://api.github.com/users/manuelortiz28/orgs","repos_url":"https://api.github.com/users/manuelortiz28/repos","events_url":"https://api.github.com/users/manuelortiz28/events{/privacy}","received_events_url":"https://api.github.com/users/manuelortiz28/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manuelortiz28/yummysmile","description":"Android native project of yummy smile","fork":false,"url":"https://api.github.com/repos/manuelortiz28/yummysmile","forks_url":"https://api.github.com/repos/manuelortiz28/yummysmile/forks","keys_url":"https://api.github.com/repos/manuelortiz28/yummysmile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manuelortiz28/yummysmile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manuelortiz28/yummysmile/teams","hooks_url":"https://api.github.com/repos/manuelortiz28/yummysmile/hooks","issue_events_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/events{/number}","events_url":"https://api.github.com/repos/manuelortiz28/yummysmile/events","assignees_url":"https://api.github.com/repos/manuelortiz28/yummysmile/assignees{/user}","branches_url":"https://api.github.com/repos/manuelortiz28/yummysmile/branches{/branch}","tags_url":"https://api.github.com/repos/manuelortiz28/yummysmile/tags","blobs_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/refs{/sha}","trees_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manuelortiz28/yummysmile/statuses/{sha}","languages_url":"https://api.github.com/repos/manuelortiz28/yummysmile/languages","stargazers_url":"https://api.github.com/repos/manuelortiz28/yummysmile/stargazers","contributors_url":"https://api.github.com/repos/manuelortiz28/yummysmile/contributors","subscribers_url":"https://api.github.com/repos/manuelortiz28/yummysmile/subscribers","subscription_url":"https://api.github.com/repos/manuelortiz28/yummysmile/subscription","commits_url":"https://api.github.com/repos/manuelortiz28/yummysmile/commits{/sha}","git_commits_url":"https://api.github.com/repos/manuelortiz28/yummysmile/git/commits{/sha}","comments_url":"https://api.github.com/repos/manuelortiz28/yummysmile/comments{/number}","issue_comment_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/comments{/number}","contents_url":"https://api.github.com/repos/manuelortiz28/yummysmile/contents/{+path}","compare_url":"https://api.github.com/repos/manuelortiz28/yummysmile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manuelortiz28/yummysmile/merges","archive_url":"https://api.github.com/repos/manuelortiz28/yummysmile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manuelortiz28/yummysmile/downloads","issues_url":"https://api.github.com/repos/manuelortiz28/yummysmile/issues{/number}","pulls_url":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls{/number}","milestones_url":"https://api.github.com/repos/manuelortiz28/yummysmile/milestones{/number}","notifications_url":"https://api.github.com/repos/manuelortiz28/yummysmile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manuelortiz28/yummysmile/labels{/name}","releases_url":"https://api.github.com/repos/manuelortiz28/yummysmile/releases{/id}","deployments_url":"https://api.github.com/repos/manuelortiz28/yummysmile/deployments","created_at":"2015-09-20T18:47:40Z","updated_at":"2016-02-11T18:08:40Z","pushed_at":"2016-06-18T06:30:35Z","git_url":"git://github.com/manuelortiz28/yummysmile.git","ssh_url":"git@github.com:manuelortiz28/yummysmile.git","clone_url":"https://github.com/manuelortiz28/yummysmile.git","svn_url":"https://github.com/manuelortiz28/yummysmile","homepage":"","size":329,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20"},"html":{"href":"https://github.com/manuelortiz28/yummysmile/pull/20"},"issue":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/20"},"comments":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/manuelortiz28/yummysmile/statuses/22c741825a282c37fc37c86765dfd7f9b58ce2cb"}}}}
{"actor":{"display_login":"htorrex"}}