{"action":"created","comment":{"url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/comments/184184067","pull_request_review_id":115322099,"id":184184067,"diff_hunk":"@@ -0,0 +1,105 @@\n+package com.itis.android.firebasesimple.activity\n+\n+import android.content.Intent\n+import android.os.Bundle\n+import android.support.v7.app.AppCompatActivity\n+import android.text.InputType\n+import android.util.Log\n+import android.widget.Button\n+import android.widget.EditText\n+import android.widget.Toast\n+\n+import com.afollestad.materialdialogs.MaterialDialog\n+import com.google.firebase.FirebaseException\n+import com.google.firebase.auth.FirebaseAuth\n+import com.google.firebase.auth.PhoneAuthCredential\n+import com.google.firebase.auth.PhoneAuthProvider\n+import com.itis.android.firebasesimple.R\n+\n+import java.util.concurrent.TimeUnit\n+\n+class SignInViaPhoneNumberActivity : AppCompatActivity() {\n+\n+    private var etPhoneNumber: EditText? = null\n+    private var btnSignUp: Button? = null\n+    private var btnBack: Button? = null\n+\n+    private var firebaseAuth: FirebaseAuth? = null\n+\n+    private var verificationId: String? = null\n+    private var token: PhoneAuthProvider.ForceResendingToken? = null\n+\n+    override fun onCreate(savedInstanceState: Bundle?) {\n+        super.onCreate(savedInstanceState)\n+        setContentView(R.layout.activity_sign_in_via_phone_number)\n+\n+        firebaseAuth = FirebaseAuth.getInstance()\n+\n+        initFields()\n+        initClickListeners()\n+\n+    }\n+\n+    private fun initClickListeners() {\n+        btnBack!!.setOnClickListener { v -> finish() }\n+\n+        btnSignUp!!.setOnClickListener { v ->\n+            val phoneNumber = etPhoneNumber!!.text.toString()\n+            Log.d(\"Alm\", \"number: $phoneNumber\")\n+            PhoneAuthProvider.getInstance().verifyPhoneNumber(\n+                    phoneNumber,\n+                    60,\n+                    TimeUnit.SECONDS,\n+                    this,\n+                    object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {\n+                        override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential) {\n+                            Log.d(\"Alm\", \"onVerificationCompleted\")\n+                        }\n+\n+                        override fun onVerificationFailed(e: FirebaseException) {\n+                            Log.e(\"Alm\", \"onVerificationFailed\")\n+                            Log.e(\"Alm\", e.toString())\n+                        }\n+\n+                        override fun onCodeSent(s: String?, forceResendingToken: PhoneAuthProvider.ForceResendingToken?) {\n+                            super.onCodeSent(s, forceResendingToken)\n+                            Log.d(\"Alm\", \"onCodeSent to $phoneNumber\")\n+                            verificationId = s\n+                            token = forceResendingToken\n+                            MaterialDialog.Builder(this@SignInViaPhoneNumberActivity)\n+                                    .title(R.string.write_code)\n+                                    .inputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD)\n+                                    .input(R.string.verification_code, R.string.empty) { dialog, input ->\n+                                        Log.d(\"Alm\", \"onInput\")\n+                                        val credential = PhoneAuthProvider\n+                                                .getCredential(verificationId!!, input.toString())\n+                                        signInWithPhoneAuthCredential(credential)\n+                                    }.show()\n+                        }\n+                    })\n+        }\n+    }\n+\n+    private fun signInWithPhoneAuthCredential(credential: PhoneAuthCredential) {\n+        firebaseAuth!!.signInWithCredential(credential)\n+                .addOnCompleteListener(this) { task ->","path":"app/src/main/java/com/itis/android/firebasesimple/activity/SignInViaPhoneNumberActivity.kt","position":85,"original_position":85,"commit_id":"b38bffc01b623a3a2e79e0540477f2386a64c11e","original_commit_id":"b38bffc01b623a3a2e79e0540477f2386a64c11e","user":{"login":"NailShaykhrazievItis","id":36369179,"avatar_url":"https://avatars0.githubusercontent.com/u/36369179?v=4","gravatar_id":"","url":"https://api.github.com/users/NailShaykhrazievItis","html_url":"https://github.com/NailShaykhrazievItis","followers_url":"https://api.github.com/users/NailShaykhrazievItis/followers","following_url":"https://api.github.com/users/NailShaykhrazievItis/following{/other_user}","gists_url":"https://api.github.com/users/NailShaykhrazievItis/gists{/gist_id}","starred_url":"https://api.github.com/users/NailShaykhrazievItis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NailShaykhrazievItis/subscriptions","organizations_url":"https://api.github.com/users/NailShaykhrazievItis/orgs","repos_url":"https://api.github.com/users/NailShaykhrazievItis/repos","events_url":"https://api.github.com/users/NailShaykhrazievItis/events{/privacy}","received_events_url":"https://api.github.com/users/NailShaykhrazievItis/received_events","type":"User","site_admin":false},"body":"it","created_at":"2018-04-25T19:45:20Z","updated_at":"2018-04-25T19:52:27Z","html_url":"https://github.com/NailShaykhrazievItis/firabase-sample/pull/7#discussion_r184184067","pull_request_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/comments/184184067"},"html":{"href":"https://github.com/NailShaykhrazievItis/firabase-sample/pull/7#discussion_r184184067"},"pull_request":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7","id":183547684,"html_url":"https://github.com/NailShaykhrazievItis/firabase-sample/pull/7","diff_url":"https://github.com/NailShaykhrazievItis/firabase-sample/pull/7.diff","patch_url":"https://github.com/NailShaykhrazievItis/firabase-sample/pull/7.patch","issue_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/issues/7","number":7,"state":"open","locked":false,"title":"HW8 Шакиров и Хайрутдинов ","user":{"login":"Alm7z","id":22294597,"avatar_url":"https://avatars1.githubusercontent.com/u/22294597?v=4","gravatar_id":"","url":"https://api.github.com/users/Alm7z","html_url":"https://github.com/Alm7z","followers_url":"https://api.github.com/users/Alm7z/followers","following_url":"https://api.github.com/users/Alm7z/following{/other_user}","gists_url":"https://api.github.com/users/Alm7z/gists{/gist_id}","starred_url":"https://api.github.com/users/Alm7z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alm7z/subscriptions","organizations_url":"https://api.github.com/users/Alm7z/orgs","repos_url":"https://api.github.com/users/Alm7z/repos","events_url":"https://api.github.com/users/Alm7z/events{/privacy}","received_events_url":"https://api.github.com/users/Alm7z/received_events","type":"User","site_admin":false},"body":"Kotlin","created_at":"2018-04-23T20:26:34Z","updated_at":"2018-04-25T19:52:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54de1df3c8cf821ddd7cc85e1016aafdd0c7e724","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7/commits","review_comments_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7/comments","review_comment_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/issues/7/comments","statuses_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/statuses/b38bffc01b623a3a2e79e0540477f2386a64c11e","head":{"label":"Alm7z:master","ref":"master","sha":"b38bffc01b623a3a2e79e0540477f2386a64c11e","user":{"login":"Alm7z","id":22294597,"avatar_url":"https://avatars1.githubusercontent.com/u/22294597?v=4","gravatar_id":"","url":"https://api.github.com/users/Alm7z","html_url":"https://github.com/Alm7z","followers_url":"https://api.github.com/users/Alm7z/followers","following_url":"https://api.github.com/users/Alm7z/following{/other_user}","gists_url":"https://api.github.com/users/Alm7z/gists{/gist_id}","starred_url":"https://api.github.com/users/Alm7z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alm7z/subscriptions","organizations_url":"https://api.github.com/users/Alm7z/orgs","repos_url":"https://api.github.com/users/Alm7z/repos","events_url":"https://api.github.com/users/Alm7z/events{/privacy}","received_events_url":"https://api.github.com/users/Alm7z/received_events","type":"User","site_admin":false},"repo":{"id":128652244,"name":"firabase-sample","full_name":"Alm7z/firabase-sample","owner":{"login":"Alm7z","id":22294597,"avatar_url":"https://avatars1.githubusercontent.com/u/22294597?v=4","gravatar_id":"","url":"https://api.github.com/users/Alm7z","html_url":"https://github.com/Alm7z","followers_url":"https://api.github.com/users/Alm7z/followers","following_url":"https://api.github.com/users/Alm7z/following{/other_user}","gists_url":"https://api.github.com/users/Alm7z/gists{/gist_id}","starred_url":"https://api.github.com/users/Alm7z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alm7z/subscriptions","organizations_url":"https://api.github.com/users/Alm7z/orgs","repos_url":"https://api.github.com/users/Alm7z/repos","events_url":"https://api.github.com/users/Alm7z/events{/privacy}","received_events_url":"https://api.github.com/users/Alm7z/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Alm7z/firabase-sample","description":null,"fork":true,"url":"https://api.github.com/repos/Alm7z/firabase-sample","forks_url":"https://api.github.com/repos/Alm7z/firabase-sample/forks","keys_url":"https://api.github.com/repos/Alm7z/firabase-sample/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alm7z/firabase-sample/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alm7z/firabase-sample/teams","hooks_url":"https://api.github.com/repos/Alm7z/firabase-sample/hooks","issue_events_url":"https://api.github.com/repos/Alm7z/firabase-sample/issues/events{/number}","events_url":"https://api.github.com/repos/Alm7z/firabase-sample/events","assignees_url":"https://api.github.com/repos/Alm7z/firabase-sample/assignees{/user}","branches_url":"https://api.github.com/repos/Alm7z/firabase-sample/branches{/branch}","tags_url":"https://api.github.com/repos/Alm7z/firabase-sample/tags","blobs_url":"https://api.github.com/repos/Alm7z/firabase-sample/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alm7z/firabase-sample/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alm7z/firabase-sample/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alm7z/firabase-sample/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alm7z/firabase-sample/statuses/{sha}","languages_url":"https://api.github.com/repos/Alm7z/firabase-sample/languages","stargazers_url":"https://api.github.com/repos/Alm7z/firabase-sample/stargazers","contributors_url":"https://api.github.com/repos/Alm7z/firabase-sample/contributors","subscribers_url":"https://api.github.com/repos/Alm7z/firabase-sample/subscribers","subscription_url":"https://api.github.com/repos/Alm7z/firabase-sample/subscription","commits_url":"https://api.github.com/repos/Alm7z/firabase-sample/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alm7z/firabase-sample/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alm7z/firabase-sample/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alm7z/firabase-sample/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alm7z/firabase-sample/contents/{+path}","compare_url":"https://api.github.com/repos/Alm7z/firabase-sample/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alm7z/firabase-sample/merges","archive_url":"https://api.github.com/repos/Alm7z/firabase-sample/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alm7z/firabase-sample/downloads","issues_url":"https://api.github.com/repos/Alm7z/firabase-sample/issues{/number}","pulls_url":"https://api.github.com/repos/Alm7z/firabase-sample/pulls{/number}","milestones_url":"https://api.github.com/repos/Alm7z/firabase-sample/milestones{/number}","notifications_url":"https://api.github.com/repos/Alm7z/firabase-sample/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alm7z/firabase-sample/labels{/name}","releases_url":"https://api.github.com/repos/Alm7z/firabase-sample/releases{/id}","deployments_url":"https://api.github.com/repos/Alm7z/firabase-sample/deployments","created_at":"2018-04-08T14:56:52Z","updated_at":"2018-04-23T20:23:28Z","pushed_at":"2018-04-23T20:23:27Z","git_url":"git://github.com/Alm7z/firabase-sample.git","ssh_url":"git@github.com:Alm7z/firabase-sample.git","clone_url":"https://github.com/Alm7z/firabase-sample.git","svn_url":"https://github.com/Alm7z/firabase-sample","homepage":null,"size":169,"stargazers_count":0,"watchers_count":0,"language":"Kotlin","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NailShaykhrazievItis:master","ref":"master","sha":"33cc3f5ecdd496ad69931fb7f0de724303d71549","user":{"login":"NailShaykhrazievItis","id":36369179,"avatar_url":"https://avatars0.githubusercontent.com/u/36369179?v=4","gravatar_id":"","url":"https://api.github.com/users/NailShaykhrazievItis","html_url":"https://github.com/NailShaykhrazievItis","followers_url":"https://api.github.com/users/NailShaykhrazievItis/followers","following_url":"https://api.github.com/users/NailShaykhrazievItis/following{/other_user}","gists_url":"https://api.github.com/users/NailShaykhrazievItis/gists{/gist_id}","starred_url":"https://api.github.com/users/NailShaykhrazievItis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NailShaykhrazievItis/subscriptions","organizations_url":"https://api.github.com/users/NailShaykhrazievItis/orgs","repos_url":"https://api.github.com/users/NailShaykhrazievItis/repos","events_url":"https://api.github.com/users/NailShaykhrazievItis/events{/privacy}","received_events_url":"https://api.github.com/users/NailShaykhrazievItis/received_events","type":"User","site_admin":false},"repo":{"id":127764512,"name":"firabase-sample","full_name":"NailShaykhrazievItis/firabase-sample","owner":{"login":"NailShaykhrazievItis","id":36369179,"avatar_url":"https://avatars0.githubusercontent.com/u/36369179?v=4","gravatar_id":"","url":"https://api.github.com/users/NailShaykhrazievItis","html_url":"https://github.com/NailShaykhrazievItis","followers_url":"https://api.github.com/users/NailShaykhrazievItis/followers","following_url":"https://api.github.com/users/NailShaykhrazievItis/following{/other_user}","gists_url":"https://api.github.com/users/NailShaykhrazievItis/gists{/gist_id}","starred_url":"https://api.github.com/users/NailShaykhrazievItis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NailShaykhrazievItis/subscriptions","organizations_url":"https://api.github.com/users/NailShaykhrazievItis/orgs","repos_url":"https://api.github.com/users/NailShaykhrazievItis/repos","events_url":"https://api.github.com/users/NailShaykhrazievItis/events{/privacy}","received_events_url":"https://api.github.com/users/NailShaykhrazievItis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NailShaykhrazievItis/firabase-sample","description":null,"fork":false,"url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample","forks_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/forks","keys_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/teams","hooks_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/hooks","issue_events_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/issues/events{/number}","events_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/events","assignees_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/assignees{/user}","branches_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/branches{/branch}","tags_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/tags","blobs_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/git/refs{/sha}","trees_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/statuses/{sha}","languages_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/languages","stargazers_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/stargazers","contributors_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/contributors","subscribers_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/subscribers","subscription_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/subscription","commits_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/commits{/sha}","git_commits_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/git/commits{/sha}","comments_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/comments{/number}","issue_comment_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/issues/comments{/number}","contents_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/contents/{+path}","compare_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/merges","archive_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/downloads","issues_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/issues{/number}","pulls_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls{/number}","milestones_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/milestones{/number}","notifications_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/labels{/name}","releases_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/releases{/id}","deployments_url":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/deployments","created_at":"2018-04-02T14:05:38Z","updated_at":"2018-04-02T15:25:21Z","pushed_at":"2018-04-23T20:53:25Z","git_url":"git://github.com/NailShaykhrazievItis/firabase-sample.git","ssh_url":"git@github.com:NailShaykhrazievItis/firabase-sample.git","clone_url":"https://github.com/NailShaykhrazievItis/firabase-sample.git","svn_url":"https://github.com/NailShaykhrazievItis/firabase-sample","homepage":null,"size":150,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":7,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7"},"html":{"href":"https://github.com/NailShaykhrazievItis/firabase-sample/pull/7"},"issue":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/issues/7"},"comments":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/NailShaykhrazievItis/firabase-sample/statuses/b38bffc01b623a3a2e79e0540477f2386a64c11e"}},"author_association":"NONE"}}
{"actor":{"display_login":"NailShaykhrazievItis"}}