-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1632 from Adyen/fix/restore-3ds2-state
Restore 3DS2 state after process death
- Loading branch information
Showing
5 changed files
with
181 additions
and
45 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/SharedChallengeStatusHandler.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2024 Adyen N.V. | ||
* | ||
* This file is open source and available under the MIT license. See the LICENSE file for more info. | ||
* | ||
* Created by oscars on 21/5/2024. | ||
*/ | ||
|
||
package com.adyen.checkout.adyen3ds2.internal.ui | ||
|
||
import androidx.annotation.VisibleForTesting | ||
import com.adyen.threeds2.ChallengeResult | ||
import com.adyen.threeds2.ChallengeStatusHandler | ||
|
||
internal object SharedChallengeStatusHandler : ChallengeStatusHandler { | ||
|
||
var onCompletionListener: ChallengeStatusHandler? = null | ||
set(value) { | ||
field = value | ||
queuedResult?.let { onCompletion(it) } | ||
} | ||
|
||
private var queuedResult: ChallengeResult? = null | ||
|
||
override fun onCompletion(result: ChallengeResult) { | ||
onCompletionListener | ||
?.onCompletion(result) | ||
?.also { | ||
queuedResult = null | ||
} ?: run { | ||
queuedResult = result | ||
} | ||
} | ||
|
||
@VisibleForTesting | ||
internal fun reset() { | ||
onCompletionListener = null | ||
queuedResult = null | ||
} | ||
} |
Oops, something went wrong.