Skip to content

Commit

Permalink
TF-2831 Custom message for Forwards
Browse files Browse the repository at this point in the history
(cherry picked from commit 7dd4631)
  • Loading branch information
dab246 authored and hoangdat committed May 3, 2024
1 parent 498d3cb commit 63a7fb8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
3 changes: 2 additions & 1 deletion env.file
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ WEB_OIDC_CLIENT_ID=teammail-web
OIDC_SCOPES=openid,profile,email,offline_access
APP_GRID_AVAILABLE=supported
FCM_AVAILABLE=supported
IOS_FCM=supported
IOS_FCM=supported
FORWARD_WARNING_MESSAGE=
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import 'package:tmail_ui_user/features/contact/presentation/widgets/contact_sugg
import 'package:tmail_ui_user/features/email/presentation/utils/email_utils.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:tmail_ui_user/main/utils/app_config.dart';
import 'package:tmail_ui_user/main/utils/app_utils.dart';

typedef OnSuggestionContactCallbackAction = Future<List<EmailAddress>> Function(String query);
Expand Down Expand Up @@ -365,7 +366,7 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
context,
AppLocalizations.of(context).doYouWantToProceed,
AppLocalizations.of(context).yes,
title: AppLocalizations.of(context).messageWarningDialogForForwardsToOtherDomains,
title: AppConfig.getForwardWarningMessage(context),
cancelTitle: AppLocalizations.of(context).no,
alignCenter: true,
onConfirmAction: confirmAction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:core/presentation/resources/image_paths.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:tmail_ui_user/main/utils/app_config.dart';

class ForwardWarningBanner extends StatelessWidget {

Expand All @@ -29,7 +29,7 @@ class ForwardWarningBanner extends StatelessWidget {
const SizedBox(width: 12),
Expanded(
child: Text(
AppLocalizations.of(context).messageWarningDialogForForwardsToOtherDomains,
AppConfig.getForwardWarningMessage(context),
style: Theme.of(context).textTheme.labelSmall?.copyWith(
fontSize: 15,
color: Colors.black
Expand Down
14 changes: 14 additions & 0 deletions lib/main/utils/app_config.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:tmail_ui_user/features/login/data/network/config/oidc_constant.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';

class AppConfig {
static const int limitCharToStartSearch = 3;
Expand Down Expand Up @@ -46,4 +48,16 @@ class AppConfig {
return OIDCConstant.oidcScope;
}
}

static String getForwardWarningMessage(BuildContext context) {
final forwardWarningMessage = dotenv.get(
'FORWARD_WARNING_MESSAGE',
fallback: AppLocalizations.of(context).messageWarningDialogForForwardsToOtherDomains);

if (forwardWarningMessage.trim().isEmpty) {
return AppLocalizations.of(context).messageWarningDialogForForwardsToOtherDomains;
}

return forwardWarningMessage;
}
}

0 comments on commit 63a7fb8

Please sign in to comment.