-
Notifications
You must be signed in to change notification settings - Fork 168
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
Separate paywalls into a different package #919
Conversation
# Remove purchases_flutter_ui so it's not included in the release of the main SDK | ||
# Can't use .pubignore because it causes files to not be found when trying to | ||
# deploy purchases_flutter_ui | ||
sh('rm', '-rf', 'purchases_flutter_ui') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal... But didn't want to modify the whole repo architecture right now. We can revisit later.
Dir.chdir('..') do | ||
sh('flutter', 'pub', 'publish', '--dry-run') | ||
end | ||
github_release(version: current_version_number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separated this into its own job
Dangerfile | ||
Gemfile | ||
Gemfile.lock | ||
pubspec.lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were including a bunch of things on the published package that weren't needed... This file removes most of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing
@@ -0,0 +1 @@ | |||
../CHANGELOG.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reusing the top-level changelog.
d0a1152
to
042e8a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working locally for me now and passes the publish dry run. Next would be to actually publish the library.
environment: | ||
# TODO: Check constraints are ok | ||
sdk: '>=3.2.3 <4.0.0' | ||
flutter: '>=3.3.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were the defaults when creating a new plugin. I think it's ok to keep them, but lmk if you think otherwise
@@ -3,6 +3,7 @@ import 'dart:async'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter/services.dart'; | |||
import 'package:purchases_flutter/purchases_flutter.dart'; | |||
import 'package:purchases_flutter_ui/purchases_flutter_ui.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new import, but the class is called RevenueCatUI
. I thought it was ok, but lmk if you would prefer to rename the package as well.
|
||
import 'package:flutter/services.dart'; | ||
|
||
class RevenueCatUI { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified the generated code from the wizard to resemble more closely what we do in the existing plugin. The generated code changed things so everything wasn't all static methods and better supported different communication systems with the platform (other than methodchannel). But it felt more complex so I simplified it like this.
|
||
private lateinit var channel : MethodChannel | ||
|
||
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the existing plugin we also have the registerWith
static method. That seems to be used for very old flutter versions, but we are not supporting those so I think it's ok to just have this.
# Examples | ||
Our examples are located at [revenuecat_examples](https://github.com/RevenueCat/purchases-flutter/tree/main/revenuecat_examples). | ||
|
||
### [Purchase Tester](https://github.com/RevenueCat/purchases-flutter/tree/main/revenuecat_examples/purchase_tester) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add MagicWeather here since it's not using paywalls at the moment.
Note that I'm not reverting the minSdkVersion changes in the |
Dangerfile | ||
Gemfile | ||
Gemfile.lock | ||
pubspec.lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing
...r_ui/android/src/main/kotlin/com/revenuecat/purchases_flutter_ui/PurchasesFlutterUiPlugin.kt
Outdated
Show resolved
Hide resolved
} | ||
|
||
private fun presentPaywall(result: Result, requiredEntitlementIdentifier: String?) { | ||
val activity = getActivityFragment() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an activity
or a fragment
? Because the function is presentPaywallFromFragment(activity,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that function name could be confusing... This is an activity. Basically, we are presenting the paywall from the PaywallFragment
, but we need the activity as a parameter to present the PaywallFragment
.
purchases_flutter_ui
packageThis renames the `purchases_flutter_ui` package added in #919 to `purchases_ui_flutter`
### New features * 📱 Initial support for cross-platform RevenueCat Paywalls 🐾 🧱 (#852) #### Instructions: - For Android, you need to change your `MainActivity` to subclass `FlutterFragmentActivity` instead of `FlutterActivity`. Also, the min sdk version of the new package is `24`. Please make sure your app's `android/build.gradle` minSdkVersion has that or a higher version. - Add `purchases-ui-flutter` in your `pubspec.yaml`: ```yaml dependencies: purchases_ui_flutter: 6.15.0-beta.4 ``` #### Usage: ```dart import 'package:purchases_ui_flutter/purchases_ui_flutter.dart'; await RevenueCatUI.presentPaywallIfNeeded("pro"); ``` #### Limitations: - Currently only full screen paywalls are supported - There is no way to detect paywall events other than using `addCustomerInfoUpdateListener` #### Breaking changes from previous beta: - Paywalls functionality has been extracted into a new dependency called purchases_ui_flutter. Add purchases_ui_flutter to your pubspec.yaml. Before this release, it was part of the main RevenueCat SDK `purchases_flutter`. - A new import is required to use this functionality: `import 'package:purchases_ui_flutter/purchases_ui_flutter.dart';` - Usage has changed the class from `Purchases.presentPaywall` to `RevenueCatUI.presentPaywall`. - `presentPaywall` and `presentPaywallIfNeeded` now don't return a result. To detect purchases, please use `Purchases.getCustomerInfo` from the `purchases_flutter` SDK. A return value will be added in future releases. ### Other Changes * Fix pub score for `purchases-ui-flutter` (#924) via Toni Rico (@tonidero) * Update `paywalls` to latest `main` (#923) via Toni Rico (@tonidero) * Rename `purchases_flutter_ui` to `purchases_ui_flutter` (#921) via Toni Rico (@tonidero) * Separate paywalls into a different package (#919) via Toni Rico (@tonidero) * Remove result from presentPaywall methods (#916) via Toni Rico (@tonidero) * Update to use PHC PaywallHelpers instead of custom activity (#903) via Toni Rico (@tonidero)
Creates
purchases_flutter_ui
flutter package in a folder with the functionality topresentPaywall
/presentPaywallIfNeeded
and removes it from the main sdkpurchases_flutter
.This allows to keep the min sdk version of the main sdk lower, while still requiring a higher minSdk version for the new library.