Sync update: 2026-05-19 23:27:14
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user