Skip to content

armgit / ente

Public Imported from GitHub
0

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

update leave family page

AmanRajSinghMourya9a948827aa8b
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 887d9a8ab5..523fad90be 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -795,6 +795,26 @@
"youAreOnAFamilyPlan": "You are on a family plan!",
"contactFamilyAdmin": "Please contact <green>{familyAdminEmail}</green> to manage your subscription",
"leaveFamily": "Leave family",
+ "youAreOnAFamilyPlanSubtitle": "You are on a family plan.",
+ "@youAreOnAFamilyPlanSubtitle": {
+ "description": "Subtitle shown on family member subscription screen",
+ "type": "text"
+ },
+ "familyAdminManagesPlanSuffix": " manages this plan.\nReach out to them for any changes.",
+ "@familyAdminManagesPlanSuffix": {
+ "description": "Text shown after family admin email on family member subscription screen",
+ "type": "text"
+ },
+ "leaveFamilyPlan": "Leave family plan",
+ "@leaveFamilyPlan": {
+ "description": "Button label for leaving family plan",
+ "type": "text"
+ },
+ "needHelpContact": "Need help? Contact ",
+ "@needHelpContact": {
+ "description": "Prefix text before support email on family member subscription screen",
+ "type": "text"
+ },
"areYouSureThatYouWantToLeaveTheFamily": "Are you sure that you want to leave the family plan?",
"leave": "Leave",
"rateTheApp": "Rate the app",
diff --git a/mobile/apps/photos/lib/ui/payment/child_subscription_widget.dart b/mobile/apps/photos/lib/ui/payment/child_subscription_widget.dart
index ebdf4ebd91..d7714c0bf0 100644
--- a/mobile/apps/photos/lib/ui/payment/child_subscription_widget.dart
+++ b/mobile/apps/photos/lib/ui/payment/child_subscription_widget.dart
@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
+import 'package:photos/core/constants.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/user_details.dart';
import 'package:photos/services/account/user_service.dart';
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/components/buttons/button_widget.dart';
+import 'package:photos/ui/components/buttons/button_widget_v2.dart';
import 'package:photos/utils/dialog_util.dart';
-import "package:styled_text/styled_text.dart";
class ChildSubscriptionWidget extends StatelessWidget {
const ChildSubscriptionWidget({
@@ -18,87 +19,82 @@ class ChildSubscriptionWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
final String familyAdmin = userDetails.familyData!.members!
.firstWhere((element) => element.isAdmin)
.email;
- return Padding(
- padding: const EdgeInsets.symmetric(vertical: 32),
+ return SingleChildScrollView(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Center(
- child: Text(
- AppLocalizations.of(context).youAreOnAFamilyPlan,
- style: Theme.of(context).textTheme.bodyLarge,
+ Text(
+ AppLocalizations.of(context).subscription,
+ style: textTheme.h3Bold.copyWith(
+ color: colorScheme.content,
),
),
- const Padding(
- padding: EdgeInsets.symmetric(vertical: 8),
+ const SizedBox(height: 12),
+ Text(
+ AppLocalizations.of(context).youAreOnAFamilyPlanSubtitle,
+ style: textTheme.small.copyWith(
+ color: colorScheme.contentLight,
+ ),
),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: StyledText(
- text: AppLocalizations.of(context)
- .contactFamilyAdmin(familyAdminEmail: familyAdmin),
- style: Theme.of(context).textTheme.bodyLarge,
- tags: {
- 'green': StyledTextTag(
- style: TextStyle(
- color: getEnteColorScheme(context).primary500,
+ const SizedBox(height: 6),
+ Text.rich(
+ TextSpan(
+ children: [
+ TextSpan(
+ text: familyAdmin,
+ style: textTheme.small.copyWith(
+ color: colorScheme.greenBase,
),
),
- },
+ TextSpan(
+ text:
+ AppLocalizations.of(context).familyAdminManagesPlanSuffix,
+ style: textTheme.small.copyWith(
+ color: colorScheme.contentLight,
+ ),
+ ),
+ ],
),
),
- const Padding(
- padding: EdgeInsets.symmetric(vertical: 8),
- ),
- Image.asset(
- "assets/family_plan_leave.png",
- height: 256,
- ),
- const Padding(
- padding: EdgeInsets.symmetric(vertical: 0),
- ),
- InkWell(
- child: OutlinedButton(
- style: OutlinedButton.styleFrom(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10),
- ),
- padding:
- const EdgeInsets.symmetric(vertical: 18, horizontal: 100),
- backgroundColor: Colors.red[500],
- ),
- child: Text(
- AppLocalizations.of(context).leaveFamily,
- style: const TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 18,
- color: Colors.white, // same for both themes
- ),
- textAlign: TextAlign.center,
- ),
- onPressed: () async => {await _leaveFamilyPlan(context)},
+ const SizedBox(height: 20),
+ Center(
+ child: Image.asset(
+ "assets/family_plan_leave.png",
+ width: 182,
+ fit: BoxFit.contain,
),
),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: Padding(
- padding: const EdgeInsets.all(20),
- child: RichText(
- textAlign: TextAlign.center,
- text: TextSpan(
- children: [
- TextSpan(
- text: AppLocalizations.of(context)
- .pleaseContactSupportAndWeWillBeHappyToHelp,
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- ],
+ const SizedBox(height: 20),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.critical,
+ labelText: AppLocalizations.of(context).leaveFamilyPlan,
+ onTap: () async => _leaveFamilyPlan(context),
+ ),
+ const SizedBox(height: 20),
+ Center(
+ child: Text.rich(
+ textAlign: TextAlign.center,
+ TextSpan(
+ children: [
+ TextSpan(
+ text: AppLocalizations.of(context).needHelpContact,
+ style: textTheme.small.copyWith(
+ color: colorScheme.contentLight,
+ ),
),
- ),
+ TextSpan(
+ text: supportEmail,
+ style: textTheme.small.copyWith(
+ color: colorScheme.greenBase,
+ ),
+ ),
+ ],
),
),
),
@@ -122,7 +118,10 @@ class ChildSubscriptionWidget extends StatelessWidget {
}
},
);
- if (choice!.action == ButtonAction.error) {
+ if (choice == null) {
+ return;
+ }
+ if (choice.action == ButtonAction.error) {
await showGenericErrorDialog(context: context, error: choice.exception);
}
}
diff --git a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
index dddcd94eda..660facd21f 100644
--- a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
@@ -159,6 +159,9 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
Widget build(BuildContext context) {
final textTheme = getEnteTextTheme(context);
colorScheme = getEnteColorScheme(context);
+ final bool isFamilyChildUser = _hasLoadedData &&
+ _userDetails.isPartOfFamily() &&
+ !_userDetails.isFamilyAdmin();
if (!_isLoading) {
_isLoading = true;
_fetchSubData();
@@ -180,13 +183,15 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
Navigator.of(context).pop();
},
),
- title: Text(
- widget.isOnboarding
- ? AppLocalizations.of(context).selectYourPlan
- : "${AppLocalizations.of(context).subscription}${kDebugMode ? ' Store' : ''}",
- style: textTheme.largeBold,
- ),
- centerTitle: true,
+ title: isFamilyChildUser
+ ? null
+ : Text(
+ widget.isOnboarding
+ ? AppLocalizations.of(context).selectYourPlan
+ : "${AppLocalizations.of(context).subscription}${kDebugMode ? ' Store' : ''}",
+ style: textTheme.largeBold,
+ ),
+ centerTitle: !isFamilyChildUser,
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
diff --git a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
index f892cf020b..f1937c3590 100644
--- a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
@@ -128,6 +128,9 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Widget build(BuildContext context) {
colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final bool isFamilyChildUser = _hasLoadedData &&
+ _userDetails.isPartOfFamily() &&
+ !_userDetails.isFamilyAdmin();
return Scaffold(
backgroundColor: colorScheme.backgroundColour,
@@ -141,13 +144,15 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Navigator.of(context).pop();
},
),
- title: Text(
- widget.isOnboarding
- ? AppLocalizations.of(context).selectYourPlan
- : AppLocalizations.of(context).subscription,
- style: textTheme.largeBold,
- ),
- centerTitle: true,
+ title: isFamilyChildUser
+ ? null
+ : Text(
+ widget.isOnboarding
+ ? AppLocalizations.of(context).selectYourPlan
+ : AppLocalizations.of(context).subscription,
+ style: textTheme.largeBold,
+ ),
+ centerTitle: !isFamilyChildUser,
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
diff --git a/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart b/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart
index 149bd62f50..9f67a371c9 100644
--- a/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart
@@ -154,74 +154,63 @@ class _MachineLearningSettingsPageState
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- return PopScope(
- onPopInvokedWithResult: (didPop, _) {
- if (!didPop) {
- return;
- }
- unawaited(_handleDisabledScreenExit());
- },
- child: Scaffold(
+ return Scaffold(
+ backgroundColor: colorScheme.backgroundColour,
+ appBar: AppBar(
+ elevation: 0,
+ scrolledUnderElevation: 0,
backgroundColor: colorScheme.backgroundColour,
- appBar: AppBar(
- elevation: 0,
- scrolledUnderElevation: 0,
- backgroundColor: colorScheme.backgroundColour,
- leading: IconButton(
- icon: Icon(Icons.arrow_back, color: colorScheme.strokeBase),
- onPressed: () async {
- await _handleDisabledScreenExit();
- if (context.mounted) {
- Navigator.of(context).pop();
- }
- },
- ),
+ leading: IconButton(
+ icon: Icon(Icons.arrow_back, color: colorScheme.strokeBase),
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
),
- body: SafeArea(
- child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- AppLocalizations.of(context).mlConsent,
- style: textTheme.h3Bold,
- ),
- const SizedBox(height: 12),
- _buildDisabledMLDescription(context),
- const SizedBox(height: 20),
- Center(
- child: Image.asset(
- "assets/ducky_ml.png",
- height: 150,
- fit: BoxFit.contain,
- ),
- ),
- const SizedBox(height: 18),
- _buildDisabledConsentAckRow(context),
- const SizedBox(height: 20),
- ButtonWidgetV2(
- buttonType: ButtonTypeV2.primary,
- labelText: AppLocalizations.of(context).mlConsent,
- isDisabled: !_hasAcknowledgedMLConsent,
- onTap: () async {
- if (!_hasAcknowledgedMLConsent) return;
- await toggleMlConsent();
- },
- ),
- const SizedBox(height: 12),
- ButtonWidgetV2(
- buttonType: ButtonTypeV2.secondary,
- labelText: AppLocalizations.of(context).cancel,
- onTap: () async {
- await _handleDisabledScreenExit();
- if (context.mounted) {
- Navigator.of(context).pop();
- }
- },
+ ),
+ body: SafeArea(
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ AppLocalizations.of(context).mlConsent,
+ style: textTheme.h3Bold,
+ ),
+ const SizedBox(height: 12),
+ _buildDisabledMLDescription(context),
+ const SizedBox(height: 20),
+ Center(
+ child: Image.asset(
+ "assets/ducky_ml.png",
+ height: 150,
+ fit: BoxFit.contain,
),
- ],
- ),
+ ),
+ const SizedBox(height: 18),
+ _buildDisabledConsentAckRow(context),
+ const SizedBox(height: 20),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.primary,
+ labelText: AppLocalizations.of(context).mlConsent,
+ isDisabled: !_hasAcknowledgedMLConsent,
+ onTap: () async {
+ if (!_hasAcknowledgedMLConsent) return;
+ await toggleMlConsent();
+ },
+ ),
+ const SizedBox(height: 12),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.secondary,
+ labelText: AppLocalizations.of(context).cancel,
+ onTap: () async {
+ await _handleDisabledScreenExit();
+ if (context.mounted) {
+ Navigator.of(context).pop();
+ }
+ },
+ ),
+ ],
),
),
),