Extracted clearUserApprovedDecoupledTanCallbacks() and clearing callbacks also when user did not enter TAN or requested to change TAN method or medium to avoid memory leaks
This commit is contained in:
parent
cb34c86665
commit
59b8213163
|
@ -32,18 +32,24 @@ open class TanChallenge(
|
|||
this.enterTanResult = EnterTanResult(null, true, responseAfterApprovingDecoupledTan)
|
||||
|
||||
userApprovedDecoupledTanCallbacks.forEach { it.invoke() }
|
||||
userApprovedDecoupledTanCallbacks.clear()
|
||||
clearUserApprovedDecoupledTanCallbacks()
|
||||
}
|
||||
|
||||
fun userDidNotEnterTan() {
|
||||
clearUserApprovedDecoupledTanCallbacks()
|
||||
|
||||
this.enterTanResult = EnterTanResult(null)
|
||||
}
|
||||
|
||||
fun userAsksToChangeTanMethod(changeTanMethodTo: TanMethod) {
|
||||
clearUserApprovedDecoupledTanCallbacks()
|
||||
|
||||
this.enterTanResult = EnterTanResult(null, changeTanMethodTo = changeTanMethodTo)
|
||||
}
|
||||
|
||||
fun userAsksToChangeTanMedium(changeTanMediumTo: TanMedium, changeTanMediumResultCallback: ((FinTsClientResponse) -> Unit)?) {
|
||||
clearUserApprovedDecoupledTanCallbacks()
|
||||
|
||||
this.enterTanResult = EnterTanResult(null, changeTanMediumTo = changeTanMediumTo, changeTanMediumResultCallback = changeTanMediumResultCallback)
|
||||
}
|
||||
|
||||
|
@ -56,6 +62,10 @@ open class TanChallenge(
|
|||
}
|
||||
}
|
||||
|
||||
protected open fun clearUserApprovedDecoupledTanCallbacks() {
|
||||
userApprovedDecoupledTanCallbacks.clear()
|
||||
}
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
return "$tanMethod (medium: $tanMediaIdentifier): $messageToShowToUser"
|
||||
|
|
Loading…
Reference in New Issue