SHA256
Уточнить уведомления и карточку звонка
This commit is contained in:
+3
-2
@@ -1211,13 +1211,14 @@ async function init() {
|
||||
if (added && isIncomingForCurrent && !payload.backlog) {
|
||||
const parsedText = parseDmTechBlocks(text);
|
||||
const displayText = String(parsedText.displayText || '');
|
||||
const suppressHiddenNotification = parsedText.callSummary?.status === 'completed';
|
||||
if (document.visibilityState === 'visible') {
|
||||
void playDmSignal({ extended: false });
|
||||
} else if (Notification.permission === 'granted') {
|
||||
} else if (Notification.permission === 'granted' && !suppressHiddenNotification) {
|
||||
try {
|
||||
void notifyHiddenIncomingMessage(fromLogin, displayText || '');
|
||||
} catch {}
|
||||
} else {
|
||||
} else if (!suppressHiddenNotification) {
|
||||
void playDmSignal({ extended: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,12 +440,12 @@ function buildCallStatusText(callSummary) {
|
||||
return `Длительность: ${formatCallDurationCompact(callSummary.durationSec)}`;
|
||||
}
|
||||
const reason = String(callSummary.reason || '').trim().toLowerCase();
|
||||
if (reason === 'offline') return 'Не дозвонился: абонент не в сети';
|
||||
if (reason === 'no_answer') return 'Не дозвонился: нет ответа';
|
||||
if (reason === 'connect_failed') return 'Не дозвонился: не удалось установить соединение';
|
||||
if (reason === 'busy') return 'Не дозвонился: абонент занят';
|
||||
if (reason === 'declined') return 'Не дозвонился: звонок отклонён';
|
||||
return 'Не дозвонился';
|
||||
if (reason === 'offline') return 'Абонент не в сети';
|
||||
if (reason === 'no_answer') return 'Нет ответа';
|
||||
if (reason === 'connect_failed') return 'Не удалось установить соединение';
|
||||
if (reason === 'busy') return 'Абонент занят';
|
||||
if (reason === 'declined') return 'Звонок отклонён';
|
||||
return 'Звонок не завершён';
|
||||
}
|
||||
|
||||
function resolveEffectiveReadState(messages, msg) {
|
||||
@@ -594,20 +594,34 @@ function renderLog(list, chatId, { onOpenActions, markAsRead = true, scrollMode
|
||||
|
||||
const callIcon = document.createElement('span');
|
||||
callIcon.className = 'bubble-call-icon';
|
||||
callIcon.textContent = '☎';
|
||||
callIcon.classList.add(msg?.from === 'out' ? 'bubble-call-icon--outgoing' : 'bubble-call-icon--incoming');
|
||||
|
||||
const callIconPhone = document.createElement('span');
|
||||
callIconPhone.className = 'bubble-call-icon-phone';
|
||||
callIconPhone.textContent = '✆';
|
||||
|
||||
const callIconArrow = document.createElement('span');
|
||||
callIconArrow.className = 'bubble-call-icon-arrow';
|
||||
callIconArrow.textContent = msg?.from === 'out' ? '↑' : '↓';
|
||||
|
||||
callIcon.append(callIconPhone, callIconArrow);
|
||||
|
||||
const callTitle = document.createElement('span');
|
||||
callTitle.className = 'bubble-call-title';
|
||||
callTitle.textContent = msg?.from === 'out' ? 'Исходящий звонок' : 'Входящий звонок';
|
||||
callTitle.textContent = 'Звонок';
|
||||
|
||||
callHead.append(callIcon, callTitle);
|
||||
|
||||
const callMetaLine = document.createElement('div');
|
||||
callMetaLine.className = 'bubble-call-line bubble-call-line--muted';
|
||||
const callMetaLine = document.createElement('span');
|
||||
callMetaLine.className = 'bubble-call-line';
|
||||
callMetaLine.classList.add(
|
||||
parsedText.callSummary.status === 'completed'
|
||||
? 'bubble-call-line--success'
|
||||
: 'bubble-call-line--plain',
|
||||
);
|
||||
const callStatus = buildCallStatusText(parsedText.callSummary);
|
||||
callMetaLine.textContent = callStatus;
|
||||
|
||||
callCard.append(callHead, callMetaLine);
|
||||
callHead.append(callIcon, callTitle, callMetaLine);
|
||||
callCard.append(callHead);
|
||||
bubble.append(callCard);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,12 +47,12 @@ function buildCallDisplayText(callSummary) {
|
||||
return `Звонок: ${formatCallDuration(callSummary.durationSec)}`;
|
||||
}
|
||||
const reason = String(callSummary.reason || '').trim().toLowerCase();
|
||||
if (reason === 'offline') return 'Звонил, но недозвонился: абонент не в сети';
|
||||
if (reason === 'no_answer') return 'Звонил, но недозвонился: нет ответа';
|
||||
if (reason === 'connect_failed') return 'Звонил, но недозвонился: не удалось установить соединение';
|
||||
if (reason === 'busy') return 'Звонил, но недозвонился: абонент занят';
|
||||
if (reason === 'declined') return 'Звонил, но недозвонился: звонок отклонён';
|
||||
return 'Звонил, но недозвонился';
|
||||
if (reason === 'offline') return 'Абонент не в сети';
|
||||
if (reason === 'no_answer') return 'Нет ответа';
|
||||
if (reason === 'connect_failed') return 'Не удалось установить соединение';
|
||||
if (reason === 'busy') return 'Абонент занят';
|
||||
if (reason === 'declined') return 'Звонок отклонён';
|
||||
return 'Звонок не завершён';
|
||||
}
|
||||
|
||||
export function sanitizeUserDmTextForSend(rawText = '') {
|
||||
|
||||
Reference in New Issue
Block a user