Skip to content

Commit

Permalink
TW-2151: Add a toast message when copying a phone number (linagora#2192)
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored Dec 20, 2024
1 parent a6f3ef2 commit 12fc0e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3100,6 +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",
"phoneNumberCopiedToClipboard": "Phone number copied to clipboard",
"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?"
Expand Down
11 changes: 11 additions & 0 deletions lib/presentation/mixins/linkify_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:fluffychat/pages/chat/phone_number_context_menu_actions.dart';
import 'package:fluffychat/utils/extension/build_context_extension.dart';
import 'package:fluffychat/utils/extension/value_notifier_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/twake_snackbar.dart';
import 'package:fluffychat/utils/url_launcher.dart';
import 'package:fluffychat/widgets/context_menu/context_menu_action.dart';
import 'package:fluffychat/widgets/context_menu/twake_context_menu.dart';
Expand Down Expand Up @@ -57,6 +58,7 @@ mixin LinkifyMixin {
);
if (selectedActionIndex != null && selectedActionIndex is int) {
_handleClickOnContextMenuItem(
context: context,
action: phoneNumberContextMenuOnWeb[selectedActionIndex],
number: number,
);
Expand Down Expand Up @@ -89,13 +91,18 @@ mixin LinkifyMixin {
}

void _handleClickOnContextMenuItem({
required BuildContext context,
required PhoneNumberContextMenuActions action,
required String number,
}) async {
switch (action) {
case PhoneNumberContextMenuActions.copy:
Logs().i('LinkifyMixin: handleContextMenuAction: copyNumber $number');
await Clipboard.setData(ClipboardData(text: number));
TwakeSnackBar.show(
context,
L10n.of(context)!.phoneNumberCopiedToClipboard,
);
break;
default:
break;
Expand Down Expand Up @@ -133,6 +140,10 @@ mixin LinkifyMixin {
await Clipboard.setData(
ClipboardData(text: number),
);
TwakeSnackBar.show(
context,
L10n.of(context)!.phoneNumberCopiedToClipboard,
);
},
icon: Icons.content_copy_outlined,
),
Expand Down

0 comments on commit 12fc0e8

Please sign in to comment.