Created
February 22, 2023 17:02
-
-
Save tdcolvin/f7ce1112eb6b35920de7e8addeb967d5 to your computer and use it in GitHub Desktop.
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
fun signInWithSavedCredential(activity: Activity) { | |
viewModelScope.launch { | |
try { | |
val passwordCredential = getCredential(activity) ?: return@launch | |
val signInSuccess = true | |
//Run your app's sign in logic using the returned password credential | |
// signInSuccess = doSomeSignInWork(username, password) | |
//then if successful... | |
if (signInSuccess) { | |
//Indicate to the UI that we're now signed in. | |
signedInPasswordCredential.value = passwordCredential | |
} | |
} | |
catch (e: Exception) { | |
Log.e("CredentialTest", "Error getting credential", e) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment