SHA256
Исправить UI статусы DM
This commit is contained in:
+2
-2
@@ -1,2 +1,2 @@
|
||||
client.version=1.2.302
|
||||
server.version=1.2.281
|
||||
client.version=1.2.303
|
||||
server.version=1.2.282
|
||||
|
||||
+14
-1
@@ -892,6 +892,15 @@ function refreshToolbarOnly() {
|
||||
refreshConnectionUi();
|
||||
}
|
||||
|
||||
function refreshUnreadUi() {
|
||||
const pageId = getRoute().pageId || '';
|
||||
if (pageId === 'messages-list') {
|
||||
renderApp();
|
||||
return;
|
||||
}
|
||||
refreshToolbarOnly();
|
||||
}
|
||||
|
||||
async function tryAutoLogin() {
|
||||
if (!state.session.login || !state.session.sessionId) return;
|
||||
try {
|
||||
@@ -1151,7 +1160,9 @@ async function init() {
|
||||
if (messageType === 3) {
|
||||
markOutgoingReadByBaseKey(refBaseKey);
|
||||
} else {
|
||||
markIncomingReadByBaseKey(refBaseKey);
|
||||
if (markIncomingReadByBaseKey(refBaseKey)) {
|
||||
shouldRefreshToolbarUnread = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
addAppLogEntry({
|
||||
@@ -1214,6 +1225,8 @@ async function init() {
|
||||
try { await handleIncomingCallInvite(evt); } catch {}
|
||||
});
|
||||
|
||||
window.addEventListener('shine-unread-state-updated', refreshUnreadUi);
|
||||
|
||||
authService.onEvent('IncomingCallSignal', async (evt) => {
|
||||
try { await handleIncomingCallSignal(evt); } catch {}
|
||||
});
|
||||
|
||||
@@ -619,11 +619,19 @@ export function render({ navigate, route }) {
|
||||
revisionTimeMs: Number(parsed?.revisionTimeMs || 0),
|
||||
deleted: Boolean(parsed?.deleted),
|
||||
});
|
||||
return true;
|
||||
} catch {
|
||||
// ignore local parse failure; server backlog/realtime will reconcile later
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const notifyUnreadStateUpdated = () => {
|
||||
window.dispatchEvent(new CustomEvent('shine-unread-state-updated', {
|
||||
detail: { chatId },
|
||||
}));
|
||||
};
|
||||
|
||||
const sendDeleteRevision = async (msg) => {
|
||||
const base = parseBaseKey(msg?.baseKey);
|
||||
if (!base) return;
|
||||
@@ -681,7 +689,7 @@ export function render({ navigate, route }) {
|
||||
});
|
||||
}
|
||||
|
||||
void applyLocalRevision({
|
||||
const localRevisionApplied = await applyLocalRevision({
|
||||
localOutgoingBlobB64: result?.localOutgoingBlobB64 || '',
|
||||
fallbackMessageKey: result?.outgoingKey || '',
|
||||
fallbackBaseKey: result?.baseKey || result?.localBaseKey || '',
|
||||
@@ -692,6 +700,9 @@ export function render({ navigate, route }) {
|
||||
}
|
||||
|
||||
renderLog(log, chatId, { onOpenActions: handleOpenActions });
|
||||
if (localRevisionApplied) {
|
||||
notifyUnreadStateUpdated();
|
||||
}
|
||||
scrollToLatestMessageSmart(log, { smoothIfNearBottom: true });
|
||||
window.requestAnimationFrame(() => scrollToLatestMessageSmart(log, { smoothIfNearBottom: true }));
|
||||
window.setTimeout(() => scrollToLatestMessageSmart(log, { smoothIfNearBottom: true }), 220);
|
||||
@@ -841,7 +852,11 @@ export function render({ navigate, route }) {
|
||||
window.requestAnimationFrame(() => scrollToLatestMessage(log));
|
||||
window.setTimeout(() => scrollToLatestMessage(log), 180);
|
||||
}
|
||||
window.setTimeout(() => markChatRead(chatId), 220);
|
||||
window.setTimeout(() => {
|
||||
if (markChatRead(chatId) > 0) {
|
||||
notifyUnreadStateUpdated();
|
||||
}
|
||||
}, 220);
|
||||
void sendReadReceiptsForVisible(chatId);
|
||||
screen.cleanup = () => {
|
||||
setChatKeyboardOpen(false);
|
||||
|
||||
@@ -577,6 +577,7 @@ export function markOutgoingReadByBaseKey(baseKey) {
|
||||
} else {
|
||||
state.pendingOutgoingReadByBaseKey[baseKey] = true;
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
|
||||
export function markIncomingReadByBaseKey(baseKey) {
|
||||
@@ -600,6 +601,7 @@ export function markIncomingReadByBaseKey(baseKey) {
|
||||
} else {
|
||||
state.pendingIncomingReadByBaseKey[baseKey] = true;
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
|
||||
export function markReadReceiptSentByBaseKey(baseKey) {
|
||||
@@ -727,12 +729,15 @@ export function deleteConversationMessagesBefore(chatId, boundaryTimeMs) {
|
||||
export function markChatRead(chatId) {
|
||||
const normalizedChatId = normalizeDmChatId(chatId);
|
||||
const list = getChatMessages(normalizedChatId);
|
||||
let changed = 0;
|
||||
list.forEach((row) => {
|
||||
if (row?.from === 'in') {
|
||||
if (row?.from === 'in' && row?.unread) {
|
||||
row.unread = false;
|
||||
persistMessageRecord(normalizedChatId, row);
|
||||
changed += 1;
|
||||
}
|
||||
});
|
||||
return changed;
|
||||
}
|
||||
|
||||
export function setContacts(list) {
|
||||
|
||||
Reference in New Issue
Block a user