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

Different behaviour for placements between iOS and Android #1225

Open
10 of 11 tasks
lukyanov opened this issue Dec 14, 2024 · 4 comments
Open
10 of 11 tasks

Different behaviour for placements between iOS and Android #1225

lukyanov opened this issue Dec 14, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@lukyanov
Copy link

lukyanov commented Dec 14, 2024

‼️ Required data ‼️

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!

Environment

  • Output of flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.0, on macOS 15.1.1 24B91 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc4)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.95.0)
[✓] Connected device (7 available)
[✓] Network resources

• No issues found!
  • Version of purchases-flutter: 8.3.1
  • Testing device version e.g.: iOS 18.1, Android API 35
  • All Android customers in certain circumstances
  • Debug logs that reproduce the issue
  • Steps to reproduce, with a description of expected vs. actual behavior:
  1. Define a button that triggers final offering = await Purchases.getCurrentOfferingForPlacement()
  2. Remove all targetings from the RevenueCat Dashboard

The offering variable will be your current offering for iOS, but null for Android.

Describe the bug

I show the paywalls in my app with this code:

final offering = await Purchases.getCurrentOfferingForPlacement(placement);
if (offering == null) return PaywallResult.cancelled;
return await RevenueCatUI.presentPaywallIfNeeded(
          entitlement,
          offering: offering,
          displayCloseButton: true,
);

It works perfectly for both iOS and Android if I specify targeting that lists all the placements:
image

However, if I remove the targeting or remove placement definitions in the existing targeting, I would expect the SDK to fallback to the default offering. And it actually does for iOS. On Android though, the offering is null.

Additional context

I would consider the issue to be a bit "dangerous" as you can easily overlook it and end up with no paywall at all in production (which was actually the case for me).

@lukyanov lukyanov added the bug Something isn't working label Dec 14, 2024
@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!

@HaleyRevcat
Copy link

Hi, could you please provide me with the code you are using for placements as well as debug logs for Android when you are seeing the empty offering?

@lukyanov
Copy link
Author

Hi, could you please provide me with the code you are using for placements as well as debug logs for Android when you are seeing the empty offering?

Sure!

        final offering =
            await Purchases.getCurrentOfferingForPlacement(placement);
        print('offering: $offering');
        if (offering == null) return PaywallResult.cancelled;
        AnalyticsService.instance.logPaywallPresented(
          entitlement: entitlement,
          placement: placement,
          offeringId: offering.identifier,
        );
        final paywallResult = await RevenueCatUI.presentPaywallIfNeeded(
          entitlement,
          offering: offering,
          displayCloseButton: true,
        );
        logger.d('Paywall result: $paywallResult');
        return paywallResult;

@lukyanov
Copy link
Author

As for logs, it's just that print statement that outputs offering: null in the described cases :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants