Skip to content

Commit

Permalink
fixup! TW-2181: Fix apple reject 10 Dec
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev committed Dec 15, 2024
1 parent 5e9acf8 commit 57f56f7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 17 deletions.
4 changes: 3 additions & 1 deletion assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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?"
}
16 changes: 11 additions & 5 deletions lib/pages/settings_dashboard/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';

Expand Down Expand Up @@ -268,12 +270,16 @@ class SettingsController extends State<Settings> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ class SettingsViewStyle {
right: responsiveUtils.isMobile(context) ? 0 : 16.0,
);
static const double settingsItemHeight = 80;

static const double maxWidthCancelButton = 127;
}
46 changes: 35 additions & 11 deletions lib/utils/dialog/twake_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -296,6 +298,12 @@ Future<ConfirmResult> 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<ConfirmResult>(
context: context,
Expand Down Expand Up @@ -414,7 +422,8 @@ Future<ConfirmResult> showConfirmAlertDialog({
color: LinagoraSysColors.material()
.onSurfaceVariant,
),
maxLines: maxLinesMessage,
maxLines: maxLinesMessage ??
TwakeDialog.defaultMaxLinesMessage,
overflow: TextOverflow.ellipsis,
),
SizedBox(
Expand All @@ -427,18 +436,28 @@ Future<ConfirmResult> 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,
Expand All @@ -451,15 +470,19 @@ Future<ConfirmResult> 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,
Expand All @@ -469,8 +492,9 @@ Future<ConfirmResult> showConfirmAlertDialog({
.textTheme
.labelLarge
?.copyWith(
color: LinagoraSysColors.material()
.onPrimary,
color: okTextColor ??
LinagoraSysColors.material()
.onPrimary,
),
hoverColor: Colors.transparent,
onTap: () {
Expand Down

0 comments on commit 57f56f7

Please sign in to comment.