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

PaywallActivity doesn't implement all methods in PaywallListener #1503

Open
5 tasks done
Xendrez opened this issue Nov 27, 2023 · 6 comments
Open
5 tasks done

PaywallActivity doesn't implement all methods in PaywallListener #1503

Xendrez opened this issue Nov 27, 2023 · 6 comments

Comments

@Xendrez
Copy link

Xendrez commented Nov 27, 2023

Describe the bug
The current PaywallActivity (ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/activity/PaywallActivity.kt) does not implement all the methods in the PaywallListener (ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/PaywallListener.kt). The result is that if the user taps on 'restore', nothing happens. (And nothing can happen as I don't get a result from the Activity). The same is true for the PurchaseError when, for example the user already owns the product.

  1. Environment

    1. Platform: Android
    2. SDK version:
    3. OS version:
    4. Android Studio version:
    5. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue

  3. Steps to reproduce:

    1. Implement the paywall using the Activity as documented here: https://www.revenuecat.com/docs/displaying-paywalls#how-to-display-a-fullscreen-paywall-in-your-app-1
    2. Expect to get all results for PaywallListener like here: ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/PaywallListener.kt
    3. Instead, only get result when a successful new purchase is made.
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context
Add any other context about the problem here.

@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@tonidero
Copy link
Contributor

Hi @Xendrez. Thanks for reporting this!

Unfortunately, when presenting the paywall as an activity, there is no way to get a result back to the caller activity until the paywall is dismissed, whether after a successful purchase or after the user closes it. We offer that result by using the PaywallResultHandler you need to implement, whose possible values are: https://github.com/RevenueCat/purchases-android/blob/main/ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/activity/PaywallResult.kt#L13.

If you need access to those extra callbacks, currently the only way is to use the Paywall composable directly. If you're not using jetpack compose in your app, we would suggest wrapping our Paywall composable in your own Fragment/Activity, so you don't need to modify the rest of your app and you can add the PaywallListener there and handle these callbacks there.

Let us know if you have further questions or feedback, it would be greatly appreciated!

@tonidero
Copy link
Contributor

Hi again @Xendrez, we are studying our options for this. One of the main reasons this is not currently possible is that the caller activity will be paused once the paywall acitivity is displayed, so you can't change the UI once these callbacks are called until the paywall activity is called. Could you let us know what would be your use case for the restore callbacks when presenting the paywall as an activity? That might help inform us of missing functionality.

Aside from that, thanks to your feedback we also noticed that we currently don't auto-dismiss the paywall upon a restore if the requiredEntitlementIdentifier is granted after the restore. We will fix that on our end.

@Xendrez
Copy link
Author

Xendrez commented Feb 3, 2024

I haven't worked on the paywall for some time now. I will give further feedback when I'm back on it, which should be soon.

@angad305
Copy link

angad305 commented Mar 8, 2024

PaywallResultHandler

PaywallResultHandler works for Cancelled, Error and Purchased. But for Restored, it wont give a result back unless the Cancelled is called.

`override fun onActivityResult(result: PaywallResult) {
Log.d("Purchase_done", "Purchase Done. ${result}")
when (result) {

        is PaywallResult.Restored -> {
            Toast.makeText(
                requireContext(),
                "Purchase Restore complete.",
                Toast.LENGTH_SHORT
            ).show()
        }

`

@tonidero
Copy link
Contributor

tonidero commented Mar 8, 2024

Hi @angad305,

it wont give a result back unless the Cancelled is called.

I'm not sure I fully understand this. Do you mean that you're getting Cancelled instead of Restored? If that's the case, that's strange, I'm just testing it, and if the last operation before closing the paywall was a restore, it would return PaywallResult.Restored...

A few questions to try to debug this:

  • What version of the SDK are you using?
  • Are you starting a purchase AFTER restoring but BEFORE closing the paywall?
  • Could you provide debug logs reproducing this issue?

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

4 participants