Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The oom memory has been going up #273

Open
yytangsheng opened this issue Aug 23, 2024 · 1 comment
Open

The oom memory has been going up #273

yytangsheng opened this issue Aug 23, 2024 · 1 comment

Comments

@yytangsheng
Copy link

PayPal Android SDK Version

1.5.0

Environment

Sandbox

Android Version & Device

OPPO R17 android 10

PayPal dependencies

implementation "com.paypal.android:paypal-web-payments:1.5.0"

Describe the bug

oom

To reproduce

Pay, jump to the system browser, silent state app memory keeps rising

Expected behavior

Demo:

open class PayPalWebViewModel : BaseViewModel() {

private val TAG = "PayPalWebViewModel"

private var paypalClient: PayPalWebCheckoutClient? = null
var paypalSDKPayStateLiveData = MutableLiveData<PayPalCallback?>()

fun startWebCheckout(activity: AppCompatActivity, orderId: String) {
    viewModelScope.launch {
        startWebCheckoutWithOrderId(activity, orderId)
    }
}

private suspend fun startWebCheckoutWithOrderId(activity: AppCompatActivity, orderId: String) {
    val coreConfig = CoreConfig(orderId, environment = Environment.SANDBOX)

    if (paypalClient == null) {
        paypalClient =
            PayPalWebCheckoutClient(activity, coreConfig, activity.packageName)
    }

    paypalClient?.listener = object : PayPalWebCheckoutListener {
        override fun onPayPalWebCanceled() {
            WPTLogger.e("tag", "onPayPalWebCanceled")
            paypalSDKPayStateLiveData.value = PayPalWebCanceled()
        }

        override fun onPayPalWebFailure(error: PayPalSDKError) {
            WPTLogger.e("tag", "onPayPalWebFailure = ${error.toString()}")
            paypalSDKPayStateLiveData.value = PayPalWebFailure()
        }

        override fun onPayPalWebSuccess(result: PayPalWebCheckoutResult) {
            WPTLogger.e("tag", "onPayPalWebSuccess  result = ${result.toString()}")
            paypalSDKPayStateLiveData.value = PayPalWebSuccess()
        }

    }

    paypalClient?.start(PayPalWebCheckoutRequest(orderId, fundingSource = PayPalWebCheckoutFundingSource.PAYPAL))
}


override fun onCleared() {
    super.onCleared()
    paypalClient?.removeObservers()
}


sealed class PayPalCallback()

class PayPalWebCanceled() : PayPalCallback()
class PayPalWebFailure : PayPalCallback()
class PayPalWebSuccess : PayPalCallback()

}

viewModel.startWebCheckout(mContext,""orderId)

Screenshots

No response

@sshropshire
Copy link
Collaborator

Hi @yytangsheng thanks for this. We'll look into it and provide a fix once we determine the root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants