Sync update: 2026-05-19 23:27:14

This commit is contained in:
Hamza-Ayed
2026-05-19 23:27:14 +03:00
parent 1eec712c58
commit 22f1bba6ac
11 changed files with 1090 additions and 593 deletions

View File

@@ -181,13 +181,23 @@ class ChatController extends GetxController {
case 'message_ack':
final messageId = event['messageId'] as String?;
final chatId = event['chatId'] as String?;
final ack = event['ack'] as int?;
// ack can arrive as int or double from JSON — handle both
final rawAck = event['ack'];
final ack = rawAck is int
? rawAck
: rawAck is double
? rawAck.toInt()
: null;
if (chatId == null || messageId == null || ack == null) return;
if (chatId == conversation.id) {
final index = messages.indexWhere((m) => m.id == messageId);
if (index != -1) {
messages[index] = messages[index].copyWith(ack: ack);
// Force a list rebuild so Obx re-renders the bubble
final updated = messages[index].copyWith(ack: ack);
final newList = List<MessageModel>.from(messages);
newList[index] = updated;
messages.assignAll(newList);
}
}
break;

View File

@@ -166,6 +166,7 @@ class ConversationsController extends GetxController {
timestamp: msgData['timestamp'] ?? 0,
fromMe: msgData['fromMe'] ?? false,
hasMedia: msgData['hasMedia'] ?? false,
ack: msgData['ack'] ?? 0,
);
// Find existing conversation and update it