Skip to content

Commit bc1cfb5

Browse files
rajveermalviyagnprice
authored andcommitted
reactions: Support adding arbitrary reactions
1 parent c3d38c3 commit bc1cfb5

13 files changed

+552
-7
lines changed

assets/l10n/app_en.arb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@
375375
"@dialogContinue": {
376376
"description": "Button label in dialogs to proceed."
377377
},
378+
"dialogClose": "Close",
379+
"@dialogClose": {
380+
"description": "Button label in dialogs to close."
381+
},
378382
"errorDialogContinue": "OK",
379383
"@errorDialogContinue": {
380384
"description": "Button label in error dialogs to acknowledge the error and close the dialog."
@@ -668,5 +672,13 @@
668672
"errorReactionRemovingFailedTitle": "Removing reaction failed",
669673
"@errorReactionRemovingFailedTitle": {
670674
"description": "Error title when removing a message reaction fails"
675+
},
676+
"emojiReactionsMore": "more",
677+
"@emojiReactionsMore": {
678+
"description": "Label for a button opening the emoji picker."
679+
},
680+
"emojiPickerSearchEmoji": "Search emoji",
681+
"@emojiPickerSearchEmoji": {
682+
"description": "Hint text for the emoji picker search text field."
671683
}
672684
}

lib/generated/l10n/zulip_localizations.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,12 @@ abstract class ZulipLocalizations {
601601
/// **'Continue'**
602602
String get dialogContinue;
603603

604+
/// Button label in dialogs to close.
605+
///
606+
/// In en, this message translates to:
607+
/// **'Close'**
608+
String get dialogClose;
609+
604610
/// Button label in error dialogs to acknowledge the error and close the dialog.
605611
///
606612
/// In en, this message translates to:
@@ -996,6 +1002,18 @@ abstract class ZulipLocalizations {
9961002
/// In en, this message translates to:
9971003
/// **'Removing reaction failed'**
9981004
String get errorReactionRemovingFailedTitle;
1005+
1006+
/// Label for a button opening the emoji picker.
1007+
///
1008+
/// In en, this message translates to:
1009+
/// **'more'**
1010+
String get emojiReactionsMore;
1011+
1012+
/// Hint text for the emoji picker search text field.
1013+
///
1014+
/// In en, this message translates to:
1015+
/// **'Search emoji'**
1016+
String get emojiPickerSearchEmoji;
9991017
}
10001018

10011019
class _ZulipLocalizationsDelegate extends LocalizationsDelegate<ZulipLocalizations> {

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
295295
@override
296296
String get dialogContinue => 'Continue';
297297

298+
@override
299+
String get dialogClose => 'Close';
300+
298301
@override
299302
String get errorDialogContinue => 'OK';
300303

@@ -528,4 +531,10 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
528531

529532
@override
530533
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
534+
535+
@override
536+
String get emojiReactionsMore => 'more';
537+
538+
@override
539+
String get emojiPickerSearchEmoji => 'Search emoji';
531540
}

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
295295
@override
296296
String get dialogContinue => 'Continue';
297297

298+
@override
299+
String get dialogClose => 'Close';
300+
298301
@override
299302
String get errorDialogContinue => 'OK';
300303

@@ -528,4 +531,10 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
528531

529532
@override
530533
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
534+
535+
@override
536+
String get emojiReactionsMore => 'more';
537+
538+
@override
539+
String get emojiPickerSearchEmoji => 'Search emoji';
531540
}

lib/generated/l10n/zulip_localizations_fr.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
295295
@override
296296
String get dialogContinue => 'Continue';
297297

298+
@override
299+
String get dialogClose => 'Close';
300+
298301
@override
299302
String get errorDialogContinue => 'OK';
300303

@@ -528,4 +531,10 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
528531

529532
@override
530533
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
534+
535+
@override
536+
String get emojiReactionsMore => 'more';
537+
538+
@override
539+
String get emojiPickerSearchEmoji => 'Search emoji';
531540
}

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
295295
@override
296296
String get dialogContinue => 'Continue';
297297

298+
@override
299+
String get dialogClose => 'Close';
300+
298301
@override
299302
String get errorDialogContinue => 'OK';
300303

@@ -528,4 +531,10 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
528531

529532
@override
530533
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
534+
535+
@override
536+
String get emojiReactionsMore => 'more';
537+
538+
@override
539+
String get emojiPickerSearchEmoji => 'Search emoji';
531540
}

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
295295
@override
296296
String get dialogContinue => 'Kontynuuj';
297297

298+
@override
299+
String get dialogClose => 'Close';
300+
298301
@override
299302
String get errorDialogContinue => 'OK';
300303

@@ -528,4 +531,10 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
528531

529532
@override
530533
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
534+
535+
@override
536+
String get emojiReactionsMore => 'more';
537+
538+
@override
539+
String get emojiPickerSearchEmoji => 'Search emoji';
531540
}

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
295295
@override
296296
String get dialogContinue => 'Continue';
297297

298+
@override
299+
String get dialogClose => 'Close';
300+
298301
@override
299302
String get errorDialogContinue => 'OK';
300303

@@ -528,4 +531,10 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
528531

529532
@override
530533
String get errorReactionRemovingFailedTitle => 'Removing reaction failed';
534+
535+
@override
536+
String get emojiReactionsMore => 'more';
537+
538+
@override
539+
String get emojiPickerSearchEmoji => 'Search emoji';
531540
}

lib/widgets/action_sheet.dart

Lines changed: 43 additions & 7 deletions
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

Lines changed: 1 addition & 0 deletions
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)