only add non-free text reactions to recent

This commit is contained in:
Henry Hiles 2026-09-29 21:40:08 -04:00
commit 93b832839b
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
4 changed files with 25 additions and 20 deletions

View file

@ -36,15 +36,6 @@ extension BuildEventOptions on Event {
.watch(PinnedIdsController.provider(roomId)) .watch(PinnedIdsController.provider(roomId))
.contains(eventId); .contains(eventId);
Future<void> sendReaction(String emoji) async {
await ref.watch(notifier).sendReaction(emoji, this).onError(showError);
await ref
.read(RecentEmojiController.provider.notifier)
.add(emoji)
.onError(showError);
}
void showReasonDialog({ void showReasonDialog({
required String title, required String title,
required String description, required String description,
@ -116,9 +107,17 @@ extension BuildEventOptions on Event {
}.take(4)) }.take(4))
IconButton( IconButton(
icon: Text(emoji), icon: Text(emoji),
onPressed: () { onPressed: () async {
Navigator.of(context).pop(); Navigator.of(context).pop();
sendReaction(emoji); await ref
.watch(notifier)
.sendReaction(emoji, this)
.onError(showError);
await ref
.read(RecentEmojiController.provider.notifier)
.add(emoji)
.onError(showError);
}, },
), ),
IconButton( IconButton(
@ -133,7 +132,10 @@ extension BuildEventOptions on Event {
allowFreeText: true, allowFreeText: true,
onSelection: (emoji) { onSelection: (emoji) {
Navigator.of(context).pop(); Navigator.of(context).pop();
sendReaction(emoji); ref
.watch(notifier)
.sendReaction(emoji, this)
.onError(showError);
}, },
), ),
); );

View file

@ -21,12 +21,15 @@ class const EmojiPicker({
.watch(upstream.EmojiController.provider) .watch(upstream.EmojiController.provider)
.betterWhen( .betterWhen(
data: (categories) => upstream.EmojiPicker( data: (categories) => upstream.EmojiPicker(
onSelection: (emoji) async { onSelection: (emoji, isFreeText) async {
await onSelection(emoji); await onSelection(emoji);
if (!isFreeText) {
await ref await ref
.watch(RecentEmojiController.provider.notifier) .watch(RecentEmojiController.provider.notifier)
.add(emoji) .add(emoji)
.onError(showError); .onError(showError);
}
}, },
allowFreeText: allowFreeText, allowFreeText: allowFreeText,
prependCategories: .new([ prependCategories: .new([

View file

@ -898,10 +898,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: material_emoji_picker name: material_emoji_picker
sha256: "0468b616b9dc837caf31b3c260f26b31f91ddd21fa5125c1521481e037852657" sha256: "738e70a8d2f592be05dd9889037cc6098a63e0d8c48723125848865ab305f138"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.2" version: "1.2.0"
material_ui: material_ui:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -92,7 +92,7 @@ dependencies:
unifiedpush: 6.2.0 unifiedpush: 6.2.0
unifiedpush_storage_shared_preferences: 1.0.0 unifiedpush_storage_shared_preferences: 1.0.0
flutter_local_notifications: 22.3.1 flutter_local_notifications: 22.3.1
material_emoji_picker: 1.1.2 material_emoji_picker: 1.2.0
xdg_desktop_portal: xdg_desktop_portal:
git: git:
url: https://github.com/Henry-Hiles/xdg_desktop_portal.dart url: https://github.com/Henry-Hiles/xdg_desktop_portal.dart