fix emoji reaction

This commit is contained in:
otsmr 2025-07-18 10:06:17 +02:00
parent 7e680c99a3
commit 90d6b048f3
2 changed files with 4 additions and 2 deletions

View file

@ -10,7 +10,6 @@ import 'package:twonly/src/database/twonly_database.dart';
import 'package:twonly/src/model/json/message.dart'; import 'package:twonly/src/model/json/message.dart';
import 'package:twonly/src/model/protobuf/push_notification/push_notification.pbserver.dart'; import 'package:twonly/src/model/protobuf/push_notification/push_notification.pbserver.dart';
import 'package:twonly/src/services/api/messages.dart'; import 'package:twonly/src/services/api/messages.dart';
import 'package:twonly/src/utils/log.dart';
import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/utils/misc.dart';
import 'package:twonly/src/views/camera/image_editor/data/layer.dart'; import 'package:twonly/src/views/camera/image_editor/data/layer.dart';
import 'package:twonly/src/views/camera/image_editor/modules/all_emojis.dart'; import 'package:twonly/src/views/camera/image_editor/modules/all_emojis.dart';
@ -48,7 +47,6 @@ class MessageContextMenu extends StatelessWidget {
}, },
) as EmojiLayerData?; ) as EmojiLayerData?;
if (layer == null) return; if (layer == null) return;
Log.info(layer.text);
await sendTextMessage( await sendTextMessage(
message.contactId, message.contactId,

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart'; import 'package:lottie/lottie.dart';
import 'package:twonly/src/views/camera/image_editor/data/data.dart';
// animations from: https://googlefonts.github.io/noto-emoji-animation/ // animations from: https://googlefonts.github.io/noto-emoji-animation/
// from https://github.com/eitanliu/emoji_regex/tree/master // from https://github.com/eitanliu/emoji_regex/tree/master
@ -9,6 +10,9 @@ RegExp emojiRegex() => RegExp(
bool isEmoji(String character) { bool isEmoji(String character) {
final matches = emojiRegex().allMatches(character); final matches = emojiRegex().allMatches(character);
if (emojis.contains(character)) {
return true;
}
if (matches.length == 1) { if (matches.length == 1) {
final match = matches.first; final match = matches.first;
return match.start == 0 && match.end == character.length; return match.start == 0 && match.end == character.length;