Skip to content

Instantly share code, notes, and snippets.

@tdcolvin
Created February 22, 2023 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdcolvin/7561dcaade7656557e6e83ea771472a0 to your computer and use it in GitHub Desktop.
Save tdcolvin/7561dcaade7656557e6e83ea771472a0 to your computer and use it in GitHub Desktop.
fun signInOrSignUpWithEnteredCredential(activity: Activity, username: String, password: String) {
viewModelScope.launch {
val signInSuccess = true
//do some sign in or sign up logic here
// signInSuccess = doSomeSignInOrSignUpWork(username, password)
//then if successful...
if (signInSuccess) {
//Set signedInPasswordCredential - this is a flag to indicate to the UI that we're now
//signed in.
signedInPasswordCredential.value = PasswordCredential(username, password)
//...And offer to the user to save the credential to the store.
saveCredential(activity, username, password)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment