Skip to content

Instantly share code, notes, and snippets.

@nanlabsweb
Created February 5, 2018 13:22
Show Gist options
  • Save nanlabsweb/7e9a5f6edb3664af553c66ec258a6dd1 to your computer and use it in GitHub Desktop.
Save nanlabsweb/7e9a5f6edb3664af553c66ec258a6dd1 to your computer and use it in GitHub Desktop.
Activity does everything. No collaborators.
class MainActivity : AppCompatActivity() {
private val firebaseAuth by inject<FirebaseAuth>()
var providers = Arrays.asList(
AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
createContentButton.setOnClickListener({
val intent = if (firebaseAuth.currentUser != null) {
Intent(this, NewContentActivity::class.java)
} else {
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build()
}
startActivity(intent)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment