Skip to content

Commit d9621b8

Browse files
rajveermalviyagnprice
authored andcommitted
reactions: Support adding arbitrary reactions
1 parent f32cc98 commit d9621b8

13 files changed

+552
-7
lines changed

assets/l10n/app_en.arb

+12
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@
362362
"@dialogContinue": {
363363
"description": "Button label in dialogs to proceed."
364364
},
365+
"dialogClose": "Close",
366+
"@dialogClose": {
367+
"description": "Button label in dialogs to close."
368+
},
365369
"errorDialogContinue": "OK",
366370
"@errorDialogContinue": {
367371
"description": "Button label in error dialogs to acknowledge the error and close the dialog."
@@ -643,5 +647,13 @@
643647
"errorReactionRemovingFailedTitle": "Removing reaction failed",
644648
"@errorReactionRemovingFailedTitle": {
645649
"description": "Error title when removing a message reaction fails"
650+
},
651+
"emojiReactionsMore": "more",
652+
"@emojiReactionsMore": {
653+
"description": "Label for a button opening the emoji picker."
654+
},
655+
"emojiPickerSearchEmoji": "Search emoji",
656+
"@emojiPickerSearchEmoji": {
657+
"description": "Hint text for the emoji picker search text field."
646658
}
647659
}

lib/generated/l10n/zulip_localizations.dart

+18
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,12 @@ abstract class ZulipLocalizations {
583583
/// **'Continue'**
584584
String get dialogContinue;
585585

586+
/// Button label in dialogs to close.
587+
///
588+
/// In en, this message translates to:
589+
/// **'Close'**
590+
String get dialogClose;
591+
586592
/// Button label in error dialogs to acknowledge the error and close the dialog.
587593
///
588594
/// In en, this message translates to:
@@ -960,6 +966,18 @@ abstract class ZulipLocalizations {
960966
/// In en, this message translates to:
961967
/// **'Removing reaction failed'**
962968
String get errorReactionRemovingFailedTitle;
969+
970+
/// Label for a button opening the emoji picker.
971+
///
972+
/// In en, this message translates to:
973+
/// **'more'**
974+
String get emojiReactionsMore;
975+
976+
/// Hint text for the emoji picker search text field.
977+
///
978+
/// In en, this message translates to:
979+
/// **'Search emoji'**
980+
String get emojiPickerSearchEmoji;
963981
}
964982

965983
class _ZulipLocalizationsDelegate extends LocalizationsDelegate<ZulipLocalizations> {

lib/generated/l10n/zulip_localizations_ar.dart

+9
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
284284
@override
285285
String get dialogContinue => 'Continue';
286286

287+
@override
288+
String get dialogClose => 'Close';
289+
287290
@override
288291
String get errorDialogContinue => 'OK';
289292

@@ -508,4 +511,10 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
508511

509512
@override
510513
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
514+
515+
@override
516+
String get emojiReactionsMore => 'more';
517+
518+
@override
519+
String get emojiPickerSearchEmoji => 'Search emoji';
511520
}

lib/generated/l10n/zulip_localizations_en.dart

+9
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
284284
@override
285285
String get dialogContinue => 'Continue';
286286

287+
@override
288+
String get dialogClose => 'Close';
289+
287290
@override
288291
String get errorDialogContinue => 'OK';
289292

@@ -508,4 +511,10 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
508511

509512
@override
510513
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
514+
515+
@override
516+
String get emojiReactionsMore => 'more';
517+
518+
@override
519+
String get emojiPickerSearchEmoji => 'Search emoji';
511520
}

lib/generated/l10n/zulip_localizations_fr.dart

+9
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
284284
@override
285285
String get dialogContinue => 'Continue';
286286

287+
@override
288+
String get dialogClose => 'Close';
289+
287290
@override
288291
String get errorDialogContinue => 'OK';
289292

@@ -508,4 +511,10 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
508511

509512
@override
510513
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
514+
515+
@override
516+
String get emojiReactionsMore => 'more';
517+
518+
@override
519+
String get emojiPickerSearchEmoji => 'Search emoji';
511520
}

lib/generated/l10n/zulip_localizations_ja.dart

+9
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
284284
@override
285285
String get dialogContinue => 'Continue';
286286

287+
@override
288+
String get dialogClose => 'Close';
289+
287290
@override
288291
String get errorDialogContinue => 'OK';
289292

@@ -508,4 +511,10 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
508511

509512
@override
510513
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
514+
515+
@override
516+
String get emojiReactionsMore => 'more';
517+
518+
@override
519+
String get emojiPickerSearchEmoji => 'Search emoji';
511520
}

lib/generated/l10n/zulip_localizations_pl.dart

+9
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
284284
@override
285285
String get dialogContinue => 'Kontynuuj';
286286

287+
@override
288+
String get dialogClose => 'Close';
289+
287290
@override
288291
String get errorDialogContinue => 'OK';
289292

@@ -508,4 +511,10 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
508511

509512
@override
510513
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
514+
515+
@override
516+
String get emojiReactionsMore => 'more';
517+
518+
@override
519+
String get emojiPickerSearchEmoji => 'Search emoji';
511520
}

lib/generated/l10n/zulip_localizations_ru.dart

+9
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
284284
@override
285285
String get dialogContinue => 'Continue';
286286

287+
@override
288+
String get dialogClose => 'Close';
289+
287290
@override
288291
String get errorDialogContinue => 'OK';
289292

@@ -508,4 +511,10 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
508511

509512
@override
510513
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
514+
515+
@override
516+
String get emojiReactionsMore => 'more';
517+
518+
@override
519+
String get emojiPickerSearchEmoji => 'Search emoji';
511520
}

lib/widgets/action_sheet.dart

+43-7
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,16 @@ class ReactionButtons extends StatelessWidget {
444444
: zulipLocalizations.errorReactionAddingFailedTitle);
445445
}
446446

447+
void _handleTapMore() {
448+
// TODO(design): have emoji picker slide in from right and push
449+
// action sheet off to the left
450+
451+
// Dismiss current action sheet before opening emoji picker sheet.
452+
Navigator.of(pageContext).pop();
453+
454+
showEmojiPickerSheet(pageContext: pageContext, message: message);
455+
}
456+
447457
Widget _buildButton({
448458
required BuildContext context,
449459
required EmojiCandidate emoji,
@@ -479,6 +489,7 @@ class ReactionButtons extends StatelessWidget {
479489
assert(EmojiStore.popularEmojiCandidates.every(
480490
(emoji) => emoji.emojiType == ReactionType.unicodeEmoji));
481491

492+
final zulipLocalizations = ZulipLocalizations.of(context);
482493
final store = PerAccountStoreWidget.of(pageContext);
483494
final designVariables = DesignVariables.of(context);
484495

@@ -493,13 +504,38 @@ class ReactionButtons extends StatelessWidget {
493504
return Container(
494505
decoration: BoxDecoration(
495506
color: designVariables.contextMenuItemBg.withFadedAlpha(0.12)),
496-
child: Row(spacing: 1, children: List.unmodifiable(
497-
EmojiStore.popularEmojiCandidates.mapIndexed((index, emoji) =>
498-
_buildButton(
499-
context: context,
500-
emoji: emoji,
501-
isSelfVoted: hasSelfVote(emoji),
502-
isFirst: index == 0)))));
507+
child: Row(children: [
508+
Flexible(child: Row(spacing: 1, children: List.unmodifiable(
509+
EmojiStore.popularEmojiCandidates.mapIndexed((index, emoji) =>
510+
_buildButton(
511+
context: context,
512+
emoji: emoji,
513+
isSelfVoted: hasSelfVote(emoji),
514+
isFirst: index == 0))))),
515+
InkWell(
516+
onTap: _handleTapMore,
517+
splashFactory: NoSplash.splashFactory,
518+
borderRadius: const BorderRadius.only(topRight: Radius.circular(7)),
519+
overlayColor: WidgetStateColor.resolveWith((states) =>
520+
states.any((e) => e == WidgetState.pressed)
521+
? designVariables.contextMenuItemBg.withFadedAlpha(0.20)
522+
: Colors.transparent),
523+
child: Padding(
524+
padding: const EdgeInsetsDirectional.fromSTEB(12, 12, 4, 12),
525+
child: Row(children: [
526+
Text(zulipLocalizations.emojiReactionsMore,
527+
textAlign: TextAlign.end,
528+
style: TextStyle(
529+
color: designVariables.contextMenuItemText,
530+
fontSize: 14,
531+
).merge(weightVariableTextStyle(context, wght: 600))),
532+
Icon(ZulipIcons.chevron_right,
533+
color: designVariables.contextMenuItemText,
534+
size: 24),
535+
]),
536+
)),
537+
]),
538+
);
503539
}
504540
}
505541

lib/widgets/autocomplete.dart

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class _EmojiAutocompleteItem extends StatelessWidget {
260260
final store = PerAccountStoreWidget.of(context);
261261
final candidate = option.candidate;
262262

263+
// TODO deduplicate this logic with [EmojiPickerListEntry]
263264
final emojiDisplay = candidate.emojiDisplay.resolve(store.userSettings);
264265
final Widget? glyph = switch (emojiDisplay) {
265266
ImageEmojiDisplay() =>

0 commit comments

Comments
 (0)