Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Created March 23, 2018 22:24
Show Gist options
  • Save adrianhall/e339d98a6cbe833e7cb78c349e4f4602 to your computer and use it in GitHub Desktop.
Save adrianhall/e339d98a6cbe833e7cb78c349e4f4602 to your computer and use it in GitHub Desktop.
onClick handler for an authentication event
fun onLockClicked(caller: View) {
Log.d(TAG, "Lock clicked - caller=${caller.id}")
if (AWSProvider.identityManager.isUserSignedIn) {
AWSProvider.identityManager.signOut()
mainToolbarLockIcon.setImageResource(R.drawable.ic_unlocked_24dp)
this.toast("Signed out of Amazon Cognito")
} else {
val intent = Intent(this, AuthenticatorActivity::class.java)
startActivity(intent)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment