Created
February 5, 2018 13:22
-
-
Save nanlabsweb/7e9a5f6edb3664af553c66ec258a6dd1 to your computer and use it in GitHub Desktop.
Activity does everything. No collaborators.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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