Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Fix on tap not working on free plan when onboarding

ashilkn088cec271698
diff --git a/mobile/lib/ui/payment/store_subscription_page.dart b/mobile/lib/ui/payment/store_subscription_page.dart
index 6dc9d02fc9..fc7fa5adeb 100644
--- a/mobile/lib/ui/payment/store_subscription_page.dart
+++ b/mobile/lib/ui/payment/store_subscription_page.dart
@@ -487,12 +487,35 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
_currentSubscription!.productID == freeProductID) {
foundActivePlan = true;
planWidgets.add(
- SubscriptionPlanWidget(
- storage: _freePlan.storage,
- price: "",
- period: S.of(context).freeTrial,
- isActive: true,
- isOnboarding: widget.isOnboarding,
+ GestureDetector(
+ onTap: () {
+ if (_currentSubscription!.isFreePlan() && widget.isOnboarding) {
+ Bus.instance.fire(SubscriptionPurchasedEvent());
+ // ignore: unawaited_futures
+ Navigator.of(context).pushAndRemoveUntil(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return const HomeWidget();
+ },
+ ),
+ (route) => false,
+ );
+ unawaited(
+ BillingService.instance.verifySubscription(
+ freeProductID,
+ "",
+ paymentProvider: "ente",
+ ),
+ );
+ }
+ },
+ child: SubscriptionPlanWidget(
+ storage: _freePlan.storage,
+ price: "",
+ period: S.of(context).freeTrial,
+ isActive: true,
+ isOnboarding: widget.isOnboarding,
+ ),
),
);
}
@@ -590,7 +613,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
activePlanIndex,
GestureDetector(
onTap: () {
- if (_currentSubscription!.isFreePlan()) {
+ if (_currentSubscription!.isFreePlan() & widget.isOnboarding) {
Bus.instance.fire(SubscriptionPurchasedEvent());
// ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
diff --git a/mobile/lib/ui/payment/stripe_subscription_page.dart b/mobile/lib/ui/payment/stripe_subscription_page.dart
index 0f912f58e9..7ab1a0f9cc 100644
--- a/mobile/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/lib/ui/payment/stripe_subscription_page.dart
@@ -599,7 +599,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
activePlanIndex,
GestureDetector(
onTap: () {
- if (_currentSubscription!.isFreePlan()) {
+ if (_currentSubscription!.isFreePlan() && widget.isOnboarding) {
Bus.instance.fire(SubscriptionPurchasedEvent());
// ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(