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

Add PaywallView listeners #995

Merged
merged 14 commits into from
Mar 8, 2024

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Feb 29, 2024

Added listeners that can be used like:

return Scaffold(
      body: Center(
        child: PaywallView(
          onPurchaseStarted: (Package rcPackage) {
            print('Purchase started for package: ${rcPackage.identifier}');
          },
          onPurchaseCompleted:
              (CustomerInfo customerInfo, StoreTransaction storeTransaction) {
            print('Purchase completed for customerInfo:\n $customerInfo\n '
                'and storeTransaction:\n $storeTransaction');
          },
          onPurchaseError: (PurchasesError error) {
            print('Purchase error: $error');
          },
          onRestoreCompleted: (CustomerInfo customerInfo) {
            print('Restore completed for customerInfo:\n $customerInfo');
          },
          onRestoreError: (PurchasesError error) {
            print('Restore error: $error');
          },
        ),
      ),
    );

@vegaro vegaro added the pr:feat A new feature label Feb 29, 2024
@vegaro vegaro force-pushed the sdk-3339-add-listener-functions-to-full-screen branch 2 times, most recently from 608ae03 to b9696b4 Compare March 6, 2024 18:29
@vegaro vegaro force-pushed the sdk-3339-add-listener-functions-to-full-screen branch from efc9e1d to f647a3f Compare March 6, 2024 18:39
@vegaro vegaro marked this pull request as ready for review March 6, 2024 18:40
@vegaro vegaro requested a review from a team March 6, 2024 18:40
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

Nice! Left a few comments about some missing listeners, but I think we can add those in a different PR as well

methodChannel.invokeMethod("onPurchaseError", error)
}

override fun onRestoreCompleted(customerInfo: Map<String, Any?>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add onRestoreStarted as well?

)
}

override fun onPurchaseError(error: Map<String, Any?>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In RN, we split the onPurchaseCancelled callback. Not sure if we want to do the same here?

child: Center(
child: PaywallView(offering: widget.offering,),
body: SafeArea(
child: Center(
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation here seems wrong?

@vegaro vegaro enabled auto-merge (squash) March 7, 2024 14:52
@vegaro
Copy link
Contributor Author

vegaro commented Mar 7, 2024

going to merge this for the sake of shipping, and will add more in other PRs

vegaro added a commit that referenced this pull request Mar 7, 2024
I wasn't sure what was going on in #995 but there was some issues
importing a newly added model. The problem is that we were depending on
version ^6.0.0 of purchases_flutter.

I made some changes to the pubspec.yaml, so now we use the local plugin.

According to [the docs](https://dart.dev/tools/pub/dependencies), "As a
result, if you publish a package to pub.dev, keep in mind that your
package's dependency overrides are ignored by all users of your
package.". So we should be fine to publish it like this.
@vegaro vegaro merged commit 7af9858 into main Mar 8, 2024
8 checks passed
@vegaro vegaro deleted the sdk-3339-add-listener-functions-to-full-screen branch March 8, 2024 09:15
tonidero added a commit that referenced this pull request Mar 14, 2024
This PR adds initial listeners to the `PaywallFooterView`. Follow up
from #995
tonidero added a commit that referenced this pull request Mar 14, 2024
**This is an automatic release.**

### New Features
* Add `onDismiss` handler and `displayCloseButton` to `PaywallView` and
`PaywallFooterView` (#1009) via Toni Rico (@tonidero)
* Add `PaywallFooterView` listeners (#1012) via Toni Rico (@tonidero)
* Add `PaywallView` listeners (#995) via Cesar de la Vega (@vegaro)
### Bugfixes
* Fix footer sizing issues in iOS (#1018) via Toni Rico (@tonidero)
### Dependency Updates
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.2.0 (#1020) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.7.2](https://github.com/RevenueCat/purchases-android/releases/tag/7.7.2)
* [iOS
4.39.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.39.0)
* [iOS
4.38.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.1)
* [iOS
4.38.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.0)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.1.0 (#1013) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.7.2](https://github.com/RevenueCat/purchases-android/releases/tag/7.7.2)
* [iOS
4.39.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.39.0)
* [iOS
4.38.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.1)
* [iOS
4.38.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.0)
### Other Changes
* Add 5.8.2 to changelog (#1011) via Cesar de la Vega (@vegaro)
* Add dependency_overrides to purchases_flutter_ui (#1007) via Cesar de
la Vega (@vegaro)

---------

Co-authored-by: Toni Rico <[email protected]>
Jethro87 pushed a commit to Jethro87/purchases-flutter that referenced this pull request Jan 4, 2025
I wasn't sure what was going on in RevenueCat#995 but there was some issues
importing a newly added model. The problem is that we were depending on
version ^6.0.0 of purchases_flutter.

I made some changes to the pubspec.yaml, so now we use the local plugin.

According to [the docs](https://dart.dev/tools/pub/dependencies), "As a
result, if you publish a package to pub.dev, keep in mind that your
package's dependency overrides are ignored by all users of your
package.". So we should be fine to publish it like this.
Jethro87 pushed a commit to Jethro87/purchases-flutter that referenced this pull request Jan 4, 2025
Added listeners that can be used like:

```
return Scaffold(
      body: Center(
        child: PaywallView(
          onPurchaseStarted: (Package rcPackage) {
            print('Purchase started for package: ${rcPackage.identifier}');
          },
          onPurchaseCompleted:
              (CustomerInfo customerInfo, StoreTransaction storeTransaction) {
            print('Purchase completed for customerInfo:\n $customerInfo\n '
                'and storeTransaction:\n $storeTransaction');
          },
          onPurchaseError: (PurchasesError error) {
            print('Purchase error: $error');
          },
          onRestoreCompleted: (CustomerInfo customerInfo) {
            print('Restore completed for customerInfo:\n $customerInfo');
          },
          onRestoreError: (PurchasesError error) {
            print('Restore error: $error');
          },
        ),
      ),
    );
 ```
Jethro87 pushed a commit to Jethro87/purchases-flutter that referenced this pull request Jan 4, 2025
This PR adds initial listeners to the `PaywallFooterView`. Follow up
from RevenueCat#995
Jethro87 pushed a commit to Jethro87/purchases-flutter that referenced this pull request Jan 4, 2025
**This is an automatic release.**

### New Features
* Add `onDismiss` handler and `displayCloseButton` to `PaywallView` and
`PaywallFooterView` (RevenueCat#1009) via Toni Rico (@tonidero)
* Add `PaywallFooterView` listeners (RevenueCat#1012) via Toni Rico (@tonidero)
* Add `PaywallView` listeners (RevenueCat#995) via Cesar de la Vega (@vegaro)
### Bugfixes
* Fix footer sizing issues in iOS (RevenueCat#1018) via Toni Rico (@tonidero)
### Dependency Updates
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.2.0 (RevenueCat#1020) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.7.2](https://github.com/RevenueCat/purchases-android/releases/tag/7.7.2)
* [iOS
4.39.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.39.0)
* [iOS
4.38.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.1)
* [iOS
4.38.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.0)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.1.0 (RevenueCat#1013) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.7.2](https://github.com/RevenueCat/purchases-android/releases/tag/7.7.2)
* [iOS
4.39.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.39.0)
* [iOS
4.38.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.1)
* [iOS
4.38.0](https://github.com/RevenueCat/purchases-ios/releases/tag/4.38.0)
### Other Changes
* Add 5.8.2 to changelog (RevenueCat#1011) via Cesar de la Vega (@vegaro)
* Add dependency_overrides to purchases_flutter_ui (RevenueCat#1007) via Cesar de
la Vega (@vegaro)

---------

Co-authored-by: Toni Rico <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:feat A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants