Guest User

Untitled

a guest
Jul 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. class Authentication: Fragment(){
  2.  
  3. private lateinit var mCallbacks: PhoneAuthProvider.OnVerificationStateChangedCallbacks
  4.  
  5. override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
  6. return inflater.inflate(R.layout.auth,container,false)
  7.  
  8.  
  9.  
  10. }
  11. override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
  12. super.onViewCreated(view, savedInstanceState)
  13. authBtn.setOnClickListener{
  14. progressBar.setVisibility(View.VISIBLE)
  15. edt_number.setEnabled(false)
  16. authBtn.setEnabled(false)
  17.  
  18. val phone = edt_number.text.toString()
  19.  
  20. PhoneAuthProvider.getInstance().verifyPhoneNumber(
  21. phone, // Phone number to verify
  22. 60, // Timeout duration
  23. TimeUnit.SECONDS, // Unit of timeout
  24. activity!!, // Activity (for callback binding)
  25. mCallbacks)
  26. mCallbacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
  27. override fun onVerificationCompleted(p0: PhoneAuthCredential?) {
  28.  
  29. }
  30.  
  31. override fun onVerificationFailed(p0: FirebaseException?) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
  32. }
  33. }
  34. }
  35. }
  36.  
  37. mCallbacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
  38. override fun onVerificationCompleted(p0: PhoneAuthCredential?) {
  39.  
  40. }
  41. override fun onVerificationFailed(p0: FirebaseException?) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
  42. }
  43. }
  44. PhoneAuthProvider.getInstance().verifyPhoneNumber(
  45. phone, // Phone number to verify
  46. 60, // Timeout duration
  47. TimeUnit.SECONDS, // Unit of timeout
  48. activity!!, // Activity (for callback binding)
  49. mCallbacks)
Add Comment
Please, Sign In to add comment