Skip to content

Commit

Permalink
Merge branch 'fix_unableToStartWebCheckoutSubsequently' of https://gi…
Browse files Browse the repository at this point in the history
…thub.com/paypal/paypal-android into fix_unableToStartWebCheckoutSubsequently
  • Loading branch information
warmkesselj committed Apr 23, 2024
2 parents d8cbcc2 + 01eb6b5 commit cb5d5b7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
* Add `returnUrl` property to `CardVaultRequest`
* Add `authChallenge` property to `CardVaultResult`
* Add `CardAuthChallenge` type
* Add `removeObservers` to `CardClient`
* FraudDetection
* Bump Magnes dependency to version 5.4.0
* PaymentButtons
* Update font typeface to "PayPalOpen" to meet brand guidelines
* PayPalWebPayments
* Add `removeObservers` to `PayPalWebCheckoutClient`

## 1.3.0 (2024-01-09)
* PaymentButtons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ class CardClient internal constructor(
cardVaultListener?.onVaultFailure(PayPalSDKError(1, "User Canceled"))
}

/**
* Call this method at the end of the card flow
*/
fun removeObservers() {
activityReference.get()?.let { it.lifecycle.removeObserver(lifeCycleObserver) }
approveOrderListener = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,9 @@ class PayPalWebVaultViewModel @Inject constructor(
override fun onPayPalWebVaultCanceled() {
vaultPayPalState = ActionState.Failure(Exception("USER CANCELED"))
}

override fun onCleared() {
super.onCleared()
paypalClient.removeObservers()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,9 @@ class VaultCardViewModel @Inject constructor(
}
cardClient.presentAuthChallenge(activity, authChallenge)
}

override fun onCleared() {
super.onCleared()
cardClient.removeObservers()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ class PayPalWebCheckoutClient internal constructor(
vaultListener?.onPayPalWebVaultCanceled()
}

/**
* Call this method at the end of the web checkout flow
*/
fun removeObservers() {
activityReference.get()?.let { it.lifecycle.removeObserver(observer) }
vaultListener = null
Expand Down

0 comments on commit cb5d5b7

Please sign in to comment.