Untitled

mail@pastecode.io avatar
unknown
kotlin
a year ago
1.1 kB
2
Indexable
Never
class MainActivity : AppCompatActivity() {

    private  lateinit var mAuth : FirebaseAuth
    private lateinit var googleSignInOptions: GoogleSignInOptions
    private lateinit var googleSignInClient: GoogleSignInClient
    private lateinit var _binding : ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(_binding.root)
        supportActionBar?.hide()
        mAuth = FirebaseAuth.getInstance()
        _binding.btnSignOut.setOnClickListener {
            mAuth.signOut()
            googleSignInOptions = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build()
            googleSignInClient = GoogleSignIn.getClient(this,googleSignInOptions)
            googleSignInClient.signOut().addOnCompleteListener {
                Navigation.findNavController(this, R.id.start_nav).navigate(R.id.loginScreen)
            }

        }
    }

}