File tree Expand file tree Collapse file tree
app/src/main/java/com/nextcloud/talk/chat/data/network Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -697,15 +697,14 @@ class OfflineFirstChatRepository @Inject constructor(
697697 try {
698698 val currentTimeMillis = System .currentTimeMillis()
699699
700- // Use the first 15 hex chars so the value always fits in a signed Long.
701700 // Use referenceId.hashCode() as the placeholder id so that:
702701 // 1. It is unique per file even when multiple files are selected simultaneously
703702 // 2. It fits in an Int, so it survives the Long→Int cast in ChatMessageUi.id without
704703 // truncation, keeping DB lookups consistent when the message is tapped.
705- // 3. It is always positive, because getMessagesEqualOrNewerThan expects it to be larger
706- // than oldestMessageId
704+ // 3. It is always negative -> sending the lastReadMessage to server checks "-1 < messageId"
705+ // to avoid temporary/placeholder messages (see createChatMessageEntity)
707706 @Suppress(" MagicNumber" )
708- val placeholderId = (referenceId.hashCode().toLong() and 0x7FFF_FFFFL )
707+ val placeholderId = - (referenceId.hashCode().toLong() and 0x7FFF_FFFFL )
709708
710709 Log .d(
711710 TAG ,
You can’t perform that action at this time.
0 commit comments