diff --git a/lib/helpers/extensions/build_event_options.dart b/lib/helpers/extensions/build_event_options.dart index c8d313e..441e3c4 100644 --- a/lib/helpers/extensions/build_event_options.dart +++ b/lib/helpers/extensions/build_event_options.dart @@ -36,15 +36,6 @@ extension BuildEventOptions on Event { .watch(PinnedIdsController.provider(roomId)) .contains(eventId); - Future 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({ required String title, required String description, @@ -116,9 +107,17 @@ extension BuildEventOptions on Event { }.take(4)) IconButton( icon: Text(emoji), - onPressed: () { + onPressed: () async { 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( @@ -133,7 +132,10 @@ extension BuildEventOptions on Event { allowFreeText: true, onSelection: (emoji) { Navigator.of(context).pop(); - sendReaction(emoji); + ref + .watch(notifier) + .sendReaction(emoji, this) + .onError(showError); }, ), ); diff --git a/lib/widgets/emoji_picker.dart b/lib/widgets/emoji_picker.dart index a0c691a..453213a 100644 --- a/lib/widgets/emoji_picker.dart +++ b/lib/widgets/emoji_picker.dart @@ -21,12 +21,15 @@ class const EmojiPicker({ .watch(upstream.EmojiController.provider) .betterWhen( data: (categories) => upstream.EmojiPicker( - onSelection: (emoji) async { + onSelection: (emoji, isFreeText) async { await onSelection(emoji); - await ref - .watch(RecentEmojiController.provider.notifier) - .add(emoji) - .onError(showError); + + if (!isFreeText) { + await ref + .watch(RecentEmojiController.provider.notifier) + .add(emoji) + .onError(showError); + } }, allowFreeText: allowFreeText, prependCategories: .new([ diff --git a/pubspec.lock b/pubspec.lock index 88f6306..a0e58e4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -898,10 +898,10 @@ packages: dependency: "direct main" description: name: material_emoji_picker - sha256: "0468b616b9dc837caf31b3c260f26b31f91ddd21fa5125c1521481e037852657" + sha256: "738e70a8d2f592be05dd9889037cc6098a63e0d8c48723125848865ab305f138" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0" material_ui: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index ac1ae66..7f99ba3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -92,7 +92,7 @@ dependencies: unifiedpush: 6.2.0 unifiedpush_storage_shared_preferences: 1.0.0 flutter_local_notifications: 22.3.1 - material_emoji_picker: 1.1.2 + material_emoji_picker: 1.2.0 xdg_desktop_portal: git: url: https://github.com/Henry-Hiles/xdg_desktop_portal.dart