Skip to content

Conversation

@facumenzella
Copy link
Member

@facumenzella facumenzella commented Sep 26, 2025

Summary

🎯 New API Structure

The refactored API provides a clean, consistent interface that's easy to discover and use:

Static Presentation API

// Present a paywall
await RevenueCatUI.PaywallsPresenter.Present(options);

// Present paywall only if needed (user lacks entitlement)
await RevenueCatUI.PaywallsPresenter.PresentIfNeeded("premium", options);

// Check platform support
bool supported = RevenueCatUI.PaywallsPresenter.IsSupported();

Configuration & Results

// Configure paywall presentation
var options = new RevenueCatUI.PaywallOptions
{
    OfferingIdentifier = "premium",
    DisplayCloseButton = true
};

// Handle results
RevenueCatUI.PaywallResult result = await RevenueCatUI.PaywallsPresenter.Present(options);

switch (result.Result) 
{
    case RevenueCatUI.PaywallResultType.Purchased:
        // User completed a purchase! 🎉
        break;
    case RevenueCatUI.PaywallResultType.Cancelled:
        // User dismissed the paywall
        break;
    case RevenueCatUI.PaywallResultType.Error:
        // Something went wrong
        break;
    case RevenueCatUI.PaywallResultType.NotPresented:
        // Paywall wasn't shown (user already has entitlement)
        break;
}

MonoBehaviour API

// For scene-based usage
var behaviour = GetComponent<RevenueCatUI.PaywallsBehaviour>();
await behaviour.PresentPaywall(options);
await behaviour.PresentPaywallIfNeeded("premium", options);

🔧 What Changed

✅ Added

  • RevenueCatUI.PaywallsPresenter - Main static API class with clean method names
  • RevenueCatUI.PaywallsBehaviour - MonoBehaviour component for scene integration
  • Consistent naming - All classes follow Paywalls* convention

The new API delivers exactly what developers expect: clean, discoverable methods that do exactly what their names suggest, with no confusion about namespaces or redundant parameters. 🚀

@vegaro vegaro added the pr:other Changes to our CI configuration files and scripts label Oct 2, 2025
Base automatically changed from paywalls-android-poc to main October 3, 2025 07:51
@facumenzella facumenzella force-pushed the feat/revui-mono-nonmono branch from 295413b to b4b74b2 Compare October 3, 2025 10:42
@facumenzella facumenzella force-pushed the feat/revui-mono-nonmono branch from b4b74b2 to f2ce43a Compare October 3, 2025 10:44
@facumenzella facumenzella requested a review from vegaro October 3, 2025 12:16
@facumenzella facumenzella changed the title Introduce RevenueCat.UI and RevenueCat.UIBehaviour RefactorUI: Clean API Architecture Oct 3, 2025
using RevenueCatUI.Internal;

namespace RevenueCat.UI.Platforms
namespace RevenueCatUI.Internal.Platforms
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'l remove Internal

try
{
Debug.Log("[RevenueCatUI] Presenting paywall...");
Debug.Log("[RevenueCat.UI] Presenting paywall...");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be RevenueCatUI

using System;
using System.Threading.Tasks;
using UnityEngine;
using RevenueCatUI.Internal;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes for PaywallsPresenter

@vegaro vegaro merged commit 5833fa6 into main Oct 3, 2025
7 checks passed
@vegaro vegaro deleted the feat/revui-mono-nonmono branch October 3, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:changelog_ignore pr:other Changes to our CI configuration files and scripts pr:RevenueCatUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants