Extracted setupFlickerCodeTanView() and setupImageTanView()
This commit is contained in:
parent
7424688b33
commit
117bb2e5e0
|
@ -145,27 +145,10 @@ open class EnterTanDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tanChallenge is FlickerCodeTanChallenge) {
|
if (tanChallenge is FlickerCodeTanChallenge) {
|
||||||
val flickerCodeView = rootView.flickerCodeView
|
setupFlickerCodeTanView(rootView)
|
||||||
flickerCodeView.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
val flickerCode = (tanChallenge as FlickerCodeTanChallenge).flickerCode
|
|
||||||
if (flickerCode.decodingSuccessful) {
|
|
||||||
flickerCodeView.setCode(flickerCode, presenter.appSettings.flickerCodeSettings)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
showDecodingTanChallengeFailedErrorDelayed(flickerCode.decodingError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (tanChallenge is ImageTanChallenge) {
|
else if (tanChallenge is ImageTanChallenge) {
|
||||||
rootView.tanImageView.visibility = View.VISIBLE
|
setupImageTanView(rootView)
|
||||||
|
|
||||||
val decodedImage = (tanChallenge as ImageTanChallenge).image
|
|
||||||
if (decodedImage.decodingSuccessful) {
|
|
||||||
rootView.tanImageView.setImage(tanChallenge as ImageTanChallenge, if (isQrTan(tanChallenge)) presenter.appSettings.qrCodeSettings else presenter.appSettings.photoTanSettings)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
showDecodingTanChallengeFailedErrorDelayed(decodedImage.decodingError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER // TODO: is this always true that TAN is a number?
|
rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER // TODO: is this always true that TAN is a number?
|
||||||
|
@ -180,6 +163,31 @@ open class EnterTanDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun setupFlickerCodeTanView(rootView: View) {
|
||||||
|
val flickerCodeView = rootView.flickerCodeView
|
||||||
|
flickerCodeView.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
val flickerCode = (tanChallenge as FlickerCodeTanChallenge).flickerCode
|
||||||
|
if (flickerCode.decodingSuccessful) {
|
||||||
|
flickerCodeView.setCode(flickerCode, presenter.appSettings.flickerCodeSettings)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
showDecodingTanChallengeFailedErrorDelayed(flickerCode.decodingError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open fun setupImageTanView(rootView: View) {
|
||||||
|
rootView.tanImageView.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
val decodedImage = (tanChallenge as ImageTanChallenge).image
|
||||||
|
if (decodedImage.decodingSuccessful) {
|
||||||
|
rootView.tanImageView.setImage(tanChallenge as ImageTanChallenge, if (isQrTan(tanChallenge)) presenter.appSettings.qrCodeSettings else presenter.appSettings.photoTanSettings)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
showDecodingTanChallengeFailedErrorDelayed(decodedImage.decodingError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method gets called right on start up before dialog is shown -> Alert would get displayed before dialog and
|
* This method gets called right on start up before dialog is shown -> Alert would get displayed before dialog and
|
||||||
|
|
Loading…
Reference in New Issue