Created
April 18, 2018 19:58
-
-
Save adrianhall/5b3d8d3351fdabc7b19a84ce87b8c555 to your computer and use it in GitHub Desktop.
getMFACode callback
This file contains hidden or 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
@Suppress("InflateParams") | |
override fun getMFACode(continuation: MultiFactorAuthenticationContinuation?) { | |
runOnUiThread { | |
val mfaPromptDialog = layoutInflater.inflate(R.layout.dialog_mfa_prompt, null) | |
val mfaInput = mfaPromptDialog.find(R.id.mfapromptdialog_code) as MFAEditText | |
continuation?.let { | |
val mfaInstructions = mfaPromptDialog.find(R.id.mfapromptdialog_instructions) as TextView | |
mfaInstructions.text = "Enter the code we just sent to ${it.parameters.deliveryMedium}:${it.parameters.destination}" | |
} | |
alert { | |
title = "Multi-factor Code Required" | |
customView = mfaPromptDialog | |
positiveButton("OK") { | |
continuation?.let { | |
Log.i(TAG, "getMFACode: new code = ${mfaInput.getContent()}") | |
it.setMfaCode(mfaInput.getContent()) | |
thread(start = true) { it.continueTask() } | |
} | |
} | |
}.show() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment