From 57f56f753fec5914f505aa0da21a58b223ef32ce Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Sun, 15 Dec 2024 22:48:43 +0700 Subject: [PATCH] fixup! TW-2181: Fix apple reject 10 Dec --- assets/l10n/intl_en.arb | 4 +- .../settings_dashboard/settings/settings.dart | 16 +++++-- .../settings/settings_view_style.dart | 2 + lib/utils/dialog/twake_dialog.dart | 46 ++++++++++++++----- 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 5ba31e9f5..3fe674e8e 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -3100,5 +3100,7 @@ "callViaCarrier": "Call via Carrier", "scanQrCodeToJoin": "Installation of the mobile application will allow you to contact people from your phone's address book, your chats will be synchronised between devices", "thisFieldCannotBeBlank": "This field cannot be blank", - "deleteAccountMessage": "Are you sure you want to delete your account? This action cannot be undone, and all your data will be permanently removed." + "deleteAccountMessage": "Groups chats that you have created will remain unadministered unless you have given another user administrator rights. Users will still have a history of messages with you. Deleting the account won't help.", + "deleteLater": "Delete later", + "areYouSureYouWantToDeleteAccount": "Are you sure you want to delete account?" } diff --git a/lib/pages/settings_dashboard/settings/settings.dart b/lib/pages/settings_dashboard/settings/settings.dart index 24c086865..b4f40067c 100644 --- a/lib/pages/settings_dashboard/settings/settings.dart +++ b/lib/pages/settings_dashboard/settings/settings.dart @@ -5,6 +5,7 @@ import 'package:fluffychat/di/global/get_it_initializer.dart'; import 'package:fluffychat/domain/repository/tom_configurations_repository.dart'; import 'package:fluffychat/event/twake_inapp_event_types.dart'; import 'package:fluffychat/pages/bootstrap/bootstrap_dialog.dart'; +import 'package:fluffychat/pages/settings_dashboard/settings/settings_view_style.dart'; import 'package:fluffychat/presentation/mixins/connect_page_mixin.dart'; import 'package:fluffychat/presentation/enum/settings/settings_enum.dart'; import 'package:fluffychat/presentation/extensions/client_extension.dart'; @@ -20,6 +21,7 @@ import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:go_router/go_router.dart'; +import 'package:linagora_design_flutter/linagora_design_flutter.dart'; import 'package:matrix/matrix.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -268,12 +270,16 @@ class SettingsController extends State with ConnectPageMixin { useRootNavigator: false, context: context, responsiveUtils: _responsiveUtils, - title: L10n.of(context)!.deleteAccount, - titleColor: Theme.of(context).colorScheme.error, + title: L10n.of(context)!.areYouSureYouWantToDeleteAccount, message: L10n.of(context)!.deleteAccountMessage, - okLabel: L10n.of(context)!.next, - cancelLabel: L10n.of(context)!.cancel, - maxLinesMessage: 5, + okLabel: L10n.of(context)!.continueProcess, + okLabelButtonColor: Colors.transparent, + okTextColor: LinagoraSysColors.material().primary, + cancelLabel: L10n.of(context)!.deleteLater, + cancelLabelButtonColor: LinagoraSysColors.material().primary, + cancelTextColor: LinagoraSysColors.material().onPrimary, + maxWidthCancelButton: SettingsViewStyle.maxWidthCancelButton, + maxLinesMessage: 7, ) == ConfirmResult.cancel) { return; diff --git a/lib/pages/settings_dashboard/settings/settings_view_style.dart b/lib/pages/settings_dashboard/settings/settings_view_style.dart index fb9233074..d83ddf3ad 100644 --- a/lib/pages/settings_dashboard/settings/settings_view_style.dart +++ b/lib/pages/settings_dashboard/settings/settings_view_style.dart @@ -45,4 +45,6 @@ class SettingsViewStyle { right: responsiveUtils.isMobile(context) ? 0 : 16.0, ); static const double settingsItemHeight = 80; + + static const double maxWidthCancelButton = 127; } diff --git a/lib/utils/dialog/twake_dialog.dart b/lib/utils/dialog/twake_dialog.dart index 47a505c63..20caf2fdc 100644 --- a/lib/utils/dialog/twake_dialog.dart +++ b/lib/utils/dialog/twake_dialog.dart @@ -29,6 +29,8 @@ class TwakeDialog { static const double maxWidthDialogButtonWeb = 128; + static const int defaultMaxLinesMessage = 3; + static void hideLoadingDialog(BuildContext context) { if (PlatformInfos.isWeb) { if (TwakeApp.routerKey.currentContext != null) { @@ -296,6 +298,12 @@ Future showConfirmAlertDialog({ String? cancelLabel, int? maxLinesMessage, void Function()? onClose, + Color? okLabelButtonColor, + Color? cancelLabelButtonColor, + Color? okTextColor, + Color? cancelTextColor, + double? maxWidthOkButton, + double? maxWidthCancelButton, }) async { final result = await showModal( context: context, @@ -414,7 +422,8 @@ Future showConfirmAlertDialog({ color: LinagoraSysColors.material() .onSurfaceVariant, ), - maxLines: maxLinesMessage, + maxLines: maxLinesMessage ?? + TwakeDialog.defaultMaxLinesMessage, overflow: TextOverflow.ellipsis, ), SizedBox( @@ -427,18 +436,28 @@ Future showConfirmAlertDialog({ margin: const EdgeInsetsDirectional.symmetric( horizontal: 24.0, ), + buttonDecoration: BoxDecoration( + color: cancelLabelButtonColor ?? + LinagoraSysColors.material().onPrimary, + borderRadius: const BorderRadius.all( + Radius.circular(100), + ), + ), message: cancelLabel ?? L10n.of(context)!.cancel, constraints: BoxConstraints( - maxWidth: responsiveUtils.isMobile(context) - ? TwakeDialog.maxWidthDialogButtonMobile - : TwakeDialog.maxWidthDialogButtonWeb, + maxWidth: maxWidthCancelButton ?? + (responsiveUtils.isMobile(context) + ? TwakeDialog + .maxWidthDialogButtonMobile + : TwakeDialog + .maxWidthDialogButtonWeb), ), styleMessage: Theme.of(context) .textTheme .labelLarge ?.copyWith( - color: + color: cancelTextColor ?? Theme.of(context).colorScheme.primary, ), hoverColor: Colors.transparent, @@ -451,15 +470,19 @@ Future showConfirmAlertDialog({ const SizedBox(width: 8), TwakeTextButton( buttonDecoration: BoxDecoration( - color: LinagoraSysColors.material().primary, + color: okLabelButtonColor ?? + LinagoraSysColors.material().primary, borderRadius: const BorderRadius.all( Radius.circular(100), ), ), constraints: BoxConstraints( - maxWidth: responsiveUtils.isMobile(context) - ? TwakeDialog.maxWidthDialogButtonMobile - : TwakeDialog.maxWidthDialogButtonWeb, + maxWidth: maxWidthOkButton ?? + (responsiveUtils.isMobile(context) + ? TwakeDialog + .maxWidthDialogButtonMobile + : TwakeDialog + .maxWidthDialogButtonWeb), ), margin: const EdgeInsetsDirectional.symmetric( horizontal: 24.0, @@ -469,8 +492,9 @@ Future showConfirmAlertDialog({ .textTheme .labelLarge ?.copyWith( - color: LinagoraSysColors.material() - .onPrimary, + color: okTextColor ?? + LinagoraSysColors.material() + .onPrimary, ), hoverColor: Colors.transparent, onTap: () {