Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Show which plan is popular and active in subscription screen

ashilknbebaa7608592
diff --git a/mobile/assets/2.0x/active_subscription.png b/mobile/assets/2.0x/active_subscription.png
new file mode 100644
index 0000000000..8175b5ea6a
Binary files /dev/null and b/mobile/assets/2.0x/active_subscription.png differ
diff --git a/mobile/assets/2.0x/popular_subscription.png b/mobile/assets/2.0x/popular_subscription.png
new file mode 100644
index 0000000000..62c008ee50
Binary files /dev/null and b/mobile/assets/2.0x/popular_subscription.png differ
diff --git a/mobile/assets/3.0x/active_subscription.png b/mobile/assets/3.0x/active_subscription.png
new file mode 100644
index 0000000000..7207692c80
Binary files /dev/null and b/mobile/assets/3.0x/active_subscription.png differ
diff --git a/mobile/assets/3.0x/popular_subscription.png b/mobile/assets/3.0x/popular_subscription.png
new file mode 100644
index 0000000000..6b7260731d
Binary files /dev/null and b/mobile/assets/3.0x/popular_subscription.png differ
diff --git a/mobile/assets/active_subscription.png b/mobile/assets/active_subscription.png
new file mode 100644
index 0000000000..2b6c028fac
Binary files /dev/null and b/mobile/assets/active_subscription.png differ
diff --git a/mobile/assets/popular_subscription.png b/mobile/assets/popular_subscription.png
new file mode 100644
index 0000000000..e0891b7bd5
Binary files /dev/null and b/mobile/assets/popular_subscription.png differ
diff --git a/mobile/lib/models/subscription.dart b/mobile/lib/models/subscription.dart
index 51fca19e3a..272e46cf32 100644
--- a/mobile/lib/models/subscription.dart
+++ b/mobile/lib/models/subscription.dart
@@ -1,6 +1,7 @@
import 'dart:convert';
const freeProductID = "free";
+const popularProductIDs = ["200gb_yearly", "200gb_monthly"];
const stripe = "stripe";
const appStore = "appstore";
const playStore = "playstore";
diff --git a/mobile/lib/ui/payment/stripe_subscription_page.dart b/mobile/lib/ui/payment/stripe_subscription_page.dart
index 97530a04b6..95274d8f05 100644
--- a/mobile/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/lib/ui/payment/stripe_subscription_page.dart
@@ -528,6 +528,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
price: plan.price,
period: plan.period,
isActive: isActive && !_hideCurrentPlanSelection,
+ isPopular: _isPopularPlan(plan),
),
),
),
@@ -544,6 +545,10 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
freeProductID == _currentSubscription!.productID;
}
+ bool _isPopularPlan(BillingPlan plan) {
+ return popularProductIDs.contains(plan.id);
+ }
+
void _addCurrentPlanWidget(List<Widget> planWidgets) {
// don't add current plan if it's monthly plan but UI is showing yearly plans
// and vice versa.
diff --git a/mobile/lib/ui/payment/subscription_plan_widget.dart b/mobile/lib/ui/payment/subscription_plan_widget.dart
index e7a1ea2fc3..b993abcaa8 100644
--- a/mobile/lib/ui/payment/subscription_plan_widget.dart
+++ b/mobile/lib/ui/payment/subscription_plan_widget.dart
@@ -12,12 +12,14 @@ class SubscriptionPlanWidget extends StatefulWidget {
required this.price,
required this.period,
this.isActive = false,
+ this.isPopular = false,
});
final int storage;
final String price;
final String period;
final bool isActive;
+ final bool isPopular;
@override
State<SubscriptionPlanWidget> createState() => _SubscriptionPlanWidgetState();
@@ -42,7 +44,6 @@ class _SubscriptionPlanWidgetState extends State<SubscriptionPlanWidget> {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: BoxDecoration(
color: backgroundElevated2Light,
borderRadius: BorderRadius.circular(8),
@@ -57,35 +58,65 @@ class _SubscriptionPlanWidgetState extends State<SubscriptionPlanWidget> {
width: 1,
),
),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ child: Stack(
children: [
- RichText(
- text: TextSpan(
- children: [
- TextSpan(
- text: storageValue,
- style: const TextStyle(
- fontSize: 40,
- fontWeight: FontWeight.w600,
- color: textBaseLight,
+ widget.isActive
+ ? Positioned(
+ top: 0,
+ right: 0,
+ child: ClipRRect(
+ borderRadius: const BorderRadius.only(
+ topRight: Radius.circular(8),
+ ),
+ child: Image.asset(
+ "assets/active_subscription.png",
+ ),
),
- ),
- WidgetSpan(
- child: Transform.translate(
- offset: const Offset(2, -16),
- child: Text(
- storageUnit,
- style: getEnteTextTheme(context).h3.copyWith(
- color: textMutedLight,
+ )
+ : widget.isPopular
+ ? ClipRRect(
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(8),
+ ),
+ child: Image.asset(
+ "assets/popular_subscription.png",
+ ),
+ )
+ : const SizedBox.shrink(),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ RichText(
+ text: TextSpan(
+ children: [
+ TextSpan(
+ text: storageValue,
+ style: const TextStyle(
+ fontSize: 40,
+ fontWeight: FontWeight.w600,
+ color: textBaseLight,
+ ),
+ ),
+ WidgetSpan(
+ child: Transform.translate(
+ offset: const Offset(2, -16),
+ child: Text(
+ storageUnit,
+ style: getEnteTextTheme(context).h3.copyWith(
+ color: textMutedLight,
+ ),
),
- ),
+ ),
+ ),
+ ],
),
),
+ _Price(price: widget.price, period: widget.period),
],
),
),
- _Price(price: widget.price, period: widget.period),
],
),
),