twonly-app/lib/src/services/api/server_messages/reaction.server_message.dart
2025-10-19 02:45:17 +02:00

25 lines
612 B
Dart

import 'package:twonly/globals.dart';
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart';
Future<void> handleReaction(
int fromUserId,
String groupId,
EncryptedContent_Reaction reaction,
) async {
if (reaction.hasRemove()) {
if (reaction.remove) {
await twonlyDB.reactionsDao
.updateReaction(fromUserId, reaction.targetMessageId, groupId, null);
}
return;
}
if (reaction.hasEmoji()) {
await twonlyDB.reactionsDao.updateReaction(
fromUserId,
reaction.targetMessageId,
groupId,
reaction.emoji,
);
return;
}
}