fixes
This commit is contained in:
parent
bd1e8d35a6
commit
6a47b10ade
@ -525,10 +525,8 @@ export default class ChatBubbles {
|
||||
this.listenerSetter.add(rootScope)('history_delete', (e) => {
|
||||
const {peerId, msgs} = e;
|
||||
|
||||
const mids = Object.keys(msgs).map(s => +s);
|
||||
|
||||
if(peerId === this.peerId) {
|
||||
this.deleteMessagesByIds(mids);
|
||||
this.deleteMessagesByIds(Array.from(msgs));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -73,10 +73,10 @@ import debounce from '../../helpers/schedulers/debounce';
|
||||
import noop from '../../helpers/noop';
|
||||
import { putPreloader } from '../misc';
|
||||
import SetTransition from '../singleTransition';
|
||||
import replaceContent from '../../helpers/dom/replaceContent';
|
||||
import PeerTitle from '../peerTitle';
|
||||
import { fastRaf } from '../../helpers/schedulers';
|
||||
import PopupDeleteMessages from '../popups/deleteMessages';
|
||||
import fixSafariStickyInputFocusing, { IS_STICKY_INPUT_BUGGED } from '../../helpers/dom/fixSafariStickyInputFocusing';
|
||||
|
||||
const RECORD_MIN_TIME = 500;
|
||||
const POSTING_MEDIA_NOT_ALLOWED = 'Posting media content isn\'t allowed in this group.';
|
||||
@ -495,11 +495,11 @@ export default class ChatInput {
|
||||
} else {
|
||||
this.listenerSetter.add(rootScope)('history_delete', ({peerId, msgs}) => {
|
||||
if(this.chat.peerId === peerId) {
|
||||
if(msgs[this.editMsgId]) {
|
||||
if(msgs.has(this.editMsgId)) {
|
||||
this.onMessageSent();
|
||||
}
|
||||
|
||||
if(this.replyToMsgId && msgs[this.replyToMsgId]) {
|
||||
if(this.replyToMsgId && msgs.has(this.replyToMsgId)) {
|
||||
this.clearHelper('reply');
|
||||
}
|
||||
}
|
||||
@ -836,6 +836,10 @@ export default class ChatInput {
|
||||
this.messageInput.classList.add('no-scrollbar');
|
||||
this.attachMessageInputListeners();
|
||||
|
||||
if(IS_STICKY_INPUT_BUGGED) {
|
||||
fixSafariStickyInputFocusing(this.messageInput);
|
||||
}
|
||||
|
||||
if(oldInputField) {
|
||||
oldInputField.input.replaceWith(this.messageInputField.input);
|
||||
oldInputField.inputFake.replaceWith(this.messageInputField.inputFake);
|
||||
@ -1061,7 +1065,7 @@ export default class ChatInput {
|
||||
|
||||
if(good) {
|
||||
// * костыльчик
|
||||
if(key === 'K') {
|
||||
if(key === 'K' && this.appImManager.markupTooltip) {
|
||||
this.appImManager.markupTooltip.showLinkEditor();
|
||||
cancelEvent(e);
|
||||
break;
|
||||
@ -1185,7 +1189,9 @@ export default class ChatInput {
|
||||
this.appMessagesManager.setTyping(this.chat.peerId, {_: 'sendMessageCancelAction'});
|
||||
}
|
||||
|
||||
this.appImManager.markupTooltip.hide();
|
||||
if(this.appImManager.markupTooltip) {
|
||||
this.appImManager.markupTooltip.hide();
|
||||
}
|
||||
} else {
|
||||
const time = Date.now();
|
||||
if(time - this.lastTimeType >= 6000) {
|
||||
|
112
src/helpers/dom/fixSafariStickyInputFocusing.ts
Normal file
112
src/helpers/dom/fixSafariStickyInputFocusing.ts
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* https://github.com/morethanwords/tweb
|
||||
* Copyright (C) 2019-2021 Eduard Kuzmenko
|
||||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
import { isTouchSupported } from "../touchSupport";
|
||||
import { isMobile, isSafari } from "../userAgent";
|
||||
import findUpClassName from "./findUpClassName";
|
||||
import fixSafariStickyInput from "./fixSafariStickyInput";
|
||||
|
||||
export const IS_STICKY_INPUT_BUGGED = isSafari && isMobile && isTouchSupported;
|
||||
|
||||
if(IS_STICKY_INPUT_BUGGED) {
|
||||
let key: 'clientY' | 'pageY' = 'clientY';
|
||||
let startY = 0;
|
||||
const o = {capture: true, passive: false};
|
||||
const onTouchMove = (e: TouchEvent) => {
|
||||
const touch = e.touches[0];
|
||||
|
||||
//console.log('touchmove y', touch[key], startY);
|
||||
|
||||
const scrollable = findUpClassName(touch.target, 'scrollable-y');
|
||||
if(scrollable) {
|
||||
const y = touch[key];
|
||||
const scrolled = startY - y;
|
||||
|
||||
/* if(y < startY) {
|
||||
startY = y;
|
||||
} */
|
||||
|
||||
const scrollTop = scrollable.scrollTop;
|
||||
const scrollHeight = scrollable.scrollHeight;
|
||||
const clientHeight = scrollable.clientHeight;
|
||||
const nextScrollTop = scrollTop ? Math.round(scrollTop + scrollable.clientHeight + scrolled) : scrollTop + scrolled;
|
||||
//const needCancel = scrollHeight !== clientHeight ? (scrollTop && diff <= 1) || (scrollTop - diff) < 0 : true;
|
||||
const needCancel = scrollHeight === clientHeight || nextScrollTop >= scrollHeight || nextScrollTop <= 0;
|
||||
if(needCancel) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
//console.log('touchmove with scrollable', scrollTop, startY, scrolled, nextScrollTop, needCancel, e.cancelable);
|
||||
} else {
|
||||
e.preventDefault();
|
||||
|
||||
//console.log('touchmove no scrollable', e, touch);
|
||||
}
|
||||
|
||||
//if(e.target === document.documentElement || e.target === document.body) e.preventDefault();
|
||||
};
|
||||
|
||||
// let el = document.createElement('div');
|
||||
// document.body.prepend(el);
|
||||
// let a = 0;
|
||||
|
||||
// let hasFocus = false;
|
||||
let lastFocusOutTimeStamp = 0;
|
||||
document.addEventListener('focusin', (e) => {
|
||||
if((e.timeStamp - lastFocusOutTimeStamp) < 50/* && document.activeElement === input */) {
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log('focusin', e, e.timeStamp);
|
||||
|
||||
// hasFocus = true;
|
||||
// document.body.classList.add('is-keyboard-opened');
|
||||
|
||||
// el.innerText = 'focusin ' + ++a;
|
||||
|
||||
/* a < 2 && */fixSafariStickyInput(e.target as HTMLElement);
|
||||
|
||||
document.addEventListener('touchmove', onTouchMove, o);
|
||||
document.addEventListener('touchstart', (e) => {
|
||||
if(e.touches.length > 1) return;
|
||||
const touchStart = e.touches[0];
|
||||
|
||||
startY = touchStart[key];
|
||||
});
|
||||
}, {passive: true});
|
||||
|
||||
document.addEventListener('focusout', (e) => {
|
||||
// console.log('focusout', e, e.timeStamp);
|
||||
document.removeEventListener('touchmove', onTouchMove, o);
|
||||
|
||||
lastFocusOutTimeStamp = e.timeStamp;
|
||||
|
||||
// el.innerText = 'focusout ' + ++a;
|
||||
|
||||
// if(hasFocus) {
|
||||
// hasFocus = false;
|
||||
// document.body.classList.remove('is-keyboard-opened');
|
||||
// }
|
||||
}, {passive: true});
|
||||
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
// console.log('window visibilitychange');
|
||||
if(document.activeElement &&
|
||||
document.activeElement.classList.contains('is-sticky-input-bugged') &&
|
||||
(document.activeElement as HTMLElement).blur) {
|
||||
fixSafariStickyInput(document.activeElement as HTMLElement);
|
||||
}
|
||||
|
||||
/* blurActiveElement();
|
||||
window.scrollTo(0, 0);
|
||||
setVH(); */
|
||||
}, {passive: true});
|
||||
}
|
||||
|
||||
export default function fixSafariStickyInputFocusing(input: HTMLElement) {
|
||||
if(!IS_STICKY_INPUT_BUGGED) return;
|
||||
input.classList.add('is-sticky-input-bugged');
|
||||
}
|
83
src/index.ts
83
src/index.ts
@ -7,8 +7,8 @@
|
||||
import App from './config/app';
|
||||
import blurActiveElement from './helpers/dom/blurActiveElement';
|
||||
import { cancelEvent } from './helpers/dom/cancelEvent';
|
||||
import findUpClassName from './helpers/dom/findUpClassName';
|
||||
import fixSafariStickyInput from './helpers/dom/fixSafariStickyInput';
|
||||
import { IS_STICKY_INPUT_BUGGED } from './helpers/dom/fixSafariStickyInputFocusing';
|
||||
import loadFonts from './helpers/dom/loadFonts';
|
||||
import IS_EMOJI_SUPPORTED from './helpers/emojiSupport';
|
||||
import { isMobileSafari } from './helpers/userAgent';
|
||||
@ -116,7 +116,7 @@ console.timeEnd('get storage1'); */
|
||||
//console.log(new Uint8Array([255, 200, 145]).hex);
|
||||
|
||||
const toggleResizeMode = () => {
|
||||
setViewportVH = tabId === 1 && userAgent.isSafari && touchSupport.isTouchSupported && !rootScope.default.isOverlayActive;
|
||||
setViewportVH = tabId === 1 && IS_STICKY_INPUT_BUGGED && !rootScope.default.isOverlayActive;
|
||||
setVH();
|
||||
|
||||
if(w !== window) {
|
||||
@ -165,85 +165,6 @@ console.timeEnd('get storage1'); */
|
||||
if(userAgent.isApple) {
|
||||
if(userAgent.isSafari) {
|
||||
document.documentElement.classList.add('is-safari');
|
||||
|
||||
if(userAgent.isMobile && touchSupport.isTouchSupported) {
|
||||
let key: 'clientY' | 'pageY' = 'clientY';
|
||||
let startY = 0;
|
||||
const o = {capture: true, passive: false};
|
||||
const onTouchMove = (e: TouchEvent) => {
|
||||
const touch = e.touches[0];
|
||||
|
||||
//console.log('touchmove y', touch[key], startY);
|
||||
|
||||
const scrollable = findUpClassName(touch.target, 'scrollable-y');
|
||||
if(scrollable) {
|
||||
const y = touch[key];
|
||||
const scrolled = startY - y;
|
||||
|
||||
/* if(y < startY) {
|
||||
startY = y;
|
||||
} */
|
||||
|
||||
const scrollTop = scrollable.scrollTop;
|
||||
const scrollHeight = scrollable.scrollHeight;
|
||||
const clientHeight = scrollable.clientHeight;
|
||||
const nextScrollTop = scrollTop ? Math.round(scrollTop + scrollable.clientHeight + scrolled) : scrollTop + scrolled;
|
||||
//const needCancel = scrollHeight !== clientHeight ? (scrollTop && diff <= 1) || (scrollTop - diff) < 0 : true;
|
||||
const needCancel = scrollHeight === clientHeight || nextScrollTop >= scrollHeight || nextScrollTop <= 0;
|
||||
if(needCancel) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
//console.log('touchmove with scrollable', scrollTop, startY, scrolled, nextScrollTop, needCancel, e.cancelable);
|
||||
} else {
|
||||
e.preventDefault();
|
||||
|
||||
//console.log('touchmove no scrollable', e, touch);
|
||||
}
|
||||
|
||||
//if(e.target === document.documentElement || e.target === document.body) e.preventDefault();
|
||||
};
|
||||
|
||||
// let isOpened = false;
|
||||
document.addEventListener('focusin', (e) => {
|
||||
if(!setViewportVH) return;
|
||||
//console.log('focusin');
|
||||
|
||||
// isOpened = true;
|
||||
// document.body.classList.add('is-keyboard-opened');
|
||||
|
||||
fixSafariStickyInput(e.target as HTMLElement);
|
||||
|
||||
document.addEventListener('touchmove', onTouchMove, o);
|
||||
document.addEventListener('touchstart', (e) => {
|
||||
if(e.touches.length > 1) return;
|
||||
const touchStart = e.touches[0];
|
||||
|
||||
startY = touchStart[key];
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('focusout', () => {
|
||||
document.removeEventListener('touchmove', onTouchMove, o);
|
||||
|
||||
// if(isOpened) {
|
||||
// isOpened = false;
|
||||
// document.body.classList.remove('is-keyboard-opened');
|
||||
// }
|
||||
});
|
||||
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if(!setViewportVH) return;
|
||||
//console.log('window visibilitychange');
|
||||
if(document.activeElement && (document.activeElement as HTMLElement).blur) {
|
||||
fixSafariStickyInput(document.activeElement as HTMLElement);
|
||||
}
|
||||
|
||||
/* blurActiveElement();
|
||||
window.scrollTo(0, 0);
|
||||
setVH(); */
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
document.documentElement.classList.add('is-mac', 'emoji-supported');
|
||||
|
@ -21,6 +21,7 @@ import appChatsManager from "./appChatsManager";
|
||||
import appPeersManager from "./appPeersManager";
|
||||
import appStateManager from './appStateManager';
|
||||
import serverTimeManager from '../mtproto/serverTimeManager';
|
||||
import assumeType from '../../helpers/assumeType';
|
||||
|
||||
type UpdatesState = {
|
||||
pendingPtsUpdates: (Update & {pts: number, pts_count: number})[],
|
||||
@ -197,12 +198,13 @@ export class ApiUpdatesManager {
|
||||
|
||||
case 'updateShortMessage':
|
||||
case 'updateShortChatMessage': {
|
||||
assumeType<Updates.updateShortChatMessage | Updates.updateShortMessage>(updateMessage);
|
||||
this.debug && this.log.debug('updateShortMessage | updateShortChatMessage', {...updateMessage});
|
||||
const isOut = updateMessage.pFlags.out;
|
||||
const fromId = updateMessage.from_id || (isOut ? rootScope.myId : updateMessage.user_id);
|
||||
const toId = updateMessage.chat_id
|
||||
? -updateMessage.chat_id
|
||||
: (updateMessage.user_id || rootScope.myId);
|
||||
const fromId = (updateMessage as Updates.updateShortChatMessage).from_id || (isOut ? rootScope.myId : (updateMessage as Updates.updateShortMessage).user_id);
|
||||
const toId = (updateMessage as Updates.updateShortChatMessage).chat_id
|
||||
? -(updateMessage as Updates.updateShortChatMessage).chat_id
|
||||
: ((updateMessage as Updates.updateShortMessage).user_id || rootScope.myId);
|
||||
|
||||
this.processUpdate({
|
||||
_: 'updateNewMessage',
|
||||
|
@ -1240,29 +1240,29 @@ export class AppDialogsManager {
|
||||
return;
|
||||
}
|
||||
|
||||
let peer = dialog.peer;
|
||||
let peerId = dialog.peerId;
|
||||
const peer = dialog.peer;
|
||||
const peerId = dialog.peerId;
|
||||
//let peerId = appMessagesManager.getMessagePeer(lastMessage);
|
||||
|
||||
//console.log('setting last message:', lastMessage);
|
||||
|
||||
/* if(!dom.lastMessageSpan.classList.contains('user-typing')) */ {
|
||||
|
||||
dom.lastMessageSpan.textContent = '';
|
||||
let fragment: DocumentFragment;
|
||||
if(highlightWord && lastMessage.message) {
|
||||
dom.lastMessageSpan.append(appMessagesManager.wrapMessageForReply(lastMessage, undefined, undefined, false, highlightWord));
|
||||
fragment = appMessagesManager.wrapMessageForReply(lastMessage, undefined, undefined, false, highlightWord);
|
||||
} else if(draftMessage) {
|
||||
dom.lastMessageSpan.append(appMessagesManager.wrapMessageForReply(draftMessage));
|
||||
fragment = appMessagesManager.wrapMessageForReply(draftMessage);
|
||||
} else if(!lastMessage.deleted) {
|
||||
dom.lastMessageSpan.append(appMessagesManager.wrapMessageForReply(lastMessage));
|
||||
fragment = appMessagesManager.wrapMessageForReply(lastMessage);
|
||||
}
|
||||
replaceContent(dom.lastMessageSpan, fragment);
|
||||
|
||||
/* if(lastMessage.from_id === auth.id) { // You: */
|
||||
if(draftMessage) {
|
||||
const bold = document.createElement('b');
|
||||
bold.classList.add('danger');
|
||||
bold.append(i18n('Draft'));
|
||||
bold.append(': ');
|
||||
bold.append(i18n('Draft'), ': ');
|
||||
dom.lastMessageSpan.prepend(bold);
|
||||
} else if(peer._ !== 'peerUser' && peerId !== lastMessage.fromId && !lastMessage.action) {
|
||||
const sender = appPeersManager.getPeer(lastMessage.fromId);
|
||||
@ -1288,8 +1288,7 @@ export class AppDialogsManager {
|
||||
|
||||
if(!lastMessage.deleted || draftMessage/* && lastMessage._ !== 'draftMessage' */) {
|
||||
const date = draftMessage ? Math.max(draftMessage.date, lastMessage.date || 0) : lastMessage.date;
|
||||
dom.lastTimeSpan.textContent = '';
|
||||
dom.lastTimeSpan.append(formatDateAccordingToTodayNew(new Date(date * 1000)));
|
||||
replaceContent(dom.lastTimeSpan, formatDateAccordingToTodayNew(new Date(date * 1000)));
|
||||
} else dom.lastTimeSpan.textContent = '';
|
||||
|
||||
if(this.doms[peerId] === dom) {
|
||||
@ -1317,18 +1316,15 @@ export class AppDialogsManager {
|
||||
SetTransition(dom.listEl, 'is-muted', isMuted, 200);
|
||||
}
|
||||
|
||||
const lastMessage = dialog.draft && dialog.draft._ === 'draftMessage' ?
|
||||
const lastMessage = dialog.draft?._ === 'draftMessage' ?
|
||||
dialog.draft :
|
||||
appMessagesManager.getMessageByPeer(dialog.peerId, dialog.top_message);
|
||||
if(lastMessage._ !== 'messageEmpty' && !lastMessage.deleted &&
|
||||
lastMessage.pFlags.out && lastMessage.peerId !== rootScope.myId/* &&
|
||||
if(!lastMessage.deleted && lastMessage.pFlags.out && lastMessage.peerId !== rootScope.myId/* &&
|
||||
dialog.read_outbox_max_id */) { // maybe comment, 06.20.2020
|
||||
const outgoing = (lastMessage.pFlags && lastMessage.pFlags.unread)
|
||||
const isUnread = (lastMessage.pFlags && lastMessage.pFlags.unread)
|
||||
/* && dialog.read_outbox_max_id !== 0 */; // maybe uncomment, 31.01.2020
|
||||
|
||||
//console.log('outgoing', outgoing, lastMessage);
|
||||
|
||||
if(outgoing) {
|
||||
if(isUnread) {
|
||||
dom.statusSpan.classList.remove('tgico-checks');
|
||||
dom.statusSpan.classList.add('tgico-check');
|
||||
} else {
|
||||
@ -1337,12 +1333,10 @@ export class AppDialogsManager {
|
||||
}
|
||||
} else dom.statusSpan.classList.remove('tgico-check', 'tgico-checks');
|
||||
|
||||
dom.unreadMessagesSpan.innerText = '';
|
||||
|
||||
const filter = appMessagesManager.filtersStorage.filters[this.filterId];
|
||||
let isPinned: boolean;
|
||||
if(filter) {
|
||||
isPinned = filter.pinned_peers.findIndex(peerId => peerId === dialog.peerId) !== -1;
|
||||
isPinned = filter.pinned_peers.indexOf(dialog.peerId) !== -1;
|
||||
} else {
|
||||
isPinned = !!dialog.pFlags.pinned;
|
||||
}
|
||||
@ -1358,6 +1352,7 @@ export class AppDialogsManager {
|
||||
dom.unreadMessagesSpan.innerText = '' + (dialog.unread_count || ' ');
|
||||
dom.unreadMessagesSpan.classList.add('unread');
|
||||
} else {
|
||||
dom.unreadMessagesSpan.innerText = '';
|
||||
dom.unreadMessagesSpan.classList.remove('unread');
|
||||
}
|
||||
}
|
||||
|
@ -865,8 +865,7 @@ export class AppImManager {
|
||||
rootScope.addEventListener('history_delete', (e) => {
|
||||
const {peerId, msgs} = e;
|
||||
|
||||
const mids = Object.keys(msgs).map(s => +s);
|
||||
appSidebarRight.sharedMediaTab.deleteDeletedMessages(peerId, mids);
|
||||
appSidebarRight.sharedMediaTab.deleteDeletedMessages(peerId, Array.from(msgs));
|
||||
});
|
||||
|
||||
// Calls when message successfully sent and we have an id
|
||||
|
@ -3946,10 +3946,15 @@ export class AppMessagesManager {
|
||||
|
||||
const inboxUnread = !message.pFlags.out && message.pFlags.unread;
|
||||
if(dialog) {
|
||||
this.setDialogTopMessage(message, dialog);
|
||||
if(inboxUnread) {
|
||||
dialog.unread_count++;
|
||||
++dialog.unread_count;
|
||||
|
||||
if(message.pFlags.mentioned) {
|
||||
++dialog.unread_mentions_count;
|
||||
}
|
||||
}
|
||||
|
||||
this.setDialogTopMessage(message, dialog);
|
||||
}
|
||||
|
||||
if(inboxUnread/* && ($rootScope.selectedPeerID != peerID || $rootScope.idle.isIDLE) */) {
|
||||
@ -4052,6 +4057,7 @@ export class AppMessagesManager {
|
||||
const foundDialog = this.getDialogOnly(peerId);
|
||||
const stillUnreadCount = (update as Update.updateReadChannelInbox).still_unread_count;
|
||||
let newUnreadCount = 0;
|
||||
let newUnreadMentionsCount = 0;
|
||||
let foundAffected = false;
|
||||
|
||||
//this.log.warn(dT(), 'read', peerId, isOut ? 'out' : 'in', maxId)
|
||||
@ -4076,7 +4082,7 @@ export class AppMessagesManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
const message = storage[messageId];
|
||||
const message: MyMessage = storage[messageId];
|
||||
|
||||
if(message.pFlags.out !== isOut) {
|
||||
continue;
|
||||
@ -4087,7 +4093,7 @@ export class AppMessagesManager {
|
||||
}
|
||||
|
||||
if(threadId) {
|
||||
const replyTo = message.reply_to as MessageReplyHeader;
|
||||
const replyTo = message.reply_to;
|
||||
if(!replyTo || (replyTo.reply_to_top_id || replyTo.reply_to_msg_id) !== threadId) {
|
||||
continue;
|
||||
}
|
||||
@ -4100,8 +4106,14 @@ export class AppMessagesManager {
|
||||
foundAffected = true;
|
||||
}
|
||||
|
||||
if(!message.pFlags.out && !threadId && foundDialog && stillUnreadCount === undefined) {
|
||||
newUnreadCount = --foundDialog.unread_count;
|
||||
if(!message.pFlags.out && !threadId && foundDialog) {
|
||||
if(stillUnreadCount === undefined) {
|
||||
newUnreadCount = --foundDialog.unread_count;
|
||||
}
|
||||
|
||||
if(message.pFlags.mentioned) {
|
||||
newUnreadMentionsCount = --foundDialog.unread_mentions_count;
|
||||
}
|
||||
}
|
||||
|
||||
appNotificationsManager.cancel('msg' + messageId);
|
||||
@ -4116,7 +4128,9 @@ export class AppMessagesManager {
|
||||
else foundDialog.read_inbox_max_id = maxId;
|
||||
|
||||
if(!isOut) {
|
||||
if(newUnreadCount < 0 || !this.getReadMaxIdIfUnread(peerId)) {
|
||||
if(stillUnreadCount !== undefined) {
|
||||
foundDialog.unread_count = stillUnreadCount;
|
||||
} else if(newUnreadCount < 0 || !this.getReadMaxIdIfUnread(peerId)) {
|
||||
foundDialog.unread_count = 0;
|
||||
} else if(newUnreadCount && foundDialog.top_message > maxId) {
|
||||
foundDialog.unread_count = newUnreadCount;
|
||||
@ -4147,7 +4161,7 @@ export class AppMessagesManager {
|
||||
const mids = (update as Update.updateReadMessagesContents).messages.map(id => appMessagesIdsManager.generateMessageId(id));
|
||||
const peerId = channelId ? -channelId : this.getMessageById(mids[0]).peerId;
|
||||
for(const mid of mids) {
|
||||
const message = this.getMessageByPeer(peerId, mid);
|
||||
const message: MyMessage = this.getMessageByPeer(peerId, mid);
|
||||
if(!message.deleted) {
|
||||
delete message.pFlags.media_unread;
|
||||
this.setDialogToStateIfMessageIsTop(message);
|
||||
@ -4222,13 +4236,17 @@ export class AppMessagesManager {
|
||||
|
||||
const foundDialog = this.getDialogOnly(peerId);
|
||||
if(foundDialog) {
|
||||
if(historyUpdated.unreadMentions) {
|
||||
foundDialog.unread_mentions_count -= historyUpdated.unreadMentions;
|
||||
}
|
||||
|
||||
if(historyUpdated.unread) {
|
||||
foundDialog.unread_count -= historyUpdated.unread;
|
||||
|
||||
rootScope.dispatchEvent('dialog_unread', {peerId});
|
||||
}
|
||||
|
||||
if(historyUpdated.msgs[foundDialog.top_message]) {
|
||||
if(historyUpdated.msgs.has(foundDialog.top_message)) {
|
||||
this.reloadConversation(peerId);
|
||||
}
|
||||
}
|
||||
@ -5156,9 +5174,15 @@ export class AppMessagesManager {
|
||||
const history: {
|
||||
count: number,
|
||||
unread: number,
|
||||
msgs: {[mid: number]: true},
|
||||
unreadMentions: number,
|
||||
msgs: Set<number>,
|
||||
albums?: {[groupId: string]: Set<number>},
|
||||
} = {count: 0, unread: 0, msgs: {}};
|
||||
} = {
|
||||
count: 0,
|
||||
unread: 0,
|
||||
unreadMentions: 0,
|
||||
msgs: new Set()
|
||||
};
|
||||
|
||||
for(const mid of messages) {
|
||||
const message: MyMessage = this.getMessageFromStorage(storage, mid);
|
||||
@ -5169,11 +5193,16 @@ export class AppMessagesManager {
|
||||
this.updateMessageRepliesIfNeeded(message);
|
||||
|
||||
if(!message.pFlags.out && !message.pFlags.is_outgoing && message.pFlags.unread) {
|
||||
history.unread++;
|
||||
++history.unread;
|
||||
appNotificationsManager.cancel('msg' + mid);
|
||||
|
||||
if(message.pFlags.mentioned) {
|
||||
++history.unreadMentions;
|
||||
}
|
||||
}
|
||||
history.count++;
|
||||
history.msgs[mid] = true;
|
||||
|
||||
++history.count;
|
||||
history.msgs.add(mid);
|
||||
|
||||
message.deleted = true;
|
||||
|
||||
|
@ -50,7 +50,7 @@ export type BroadcastEvents = {
|
||||
'history_update': {storage: MessagesStorage, peerId: number, mid: number},
|
||||
'history_reply_markup': {peerId: number},
|
||||
'history_multiappend': AppMessagesManager['newMessagesToHandle'],
|
||||
'history_delete': {peerId: number, msgs: {[mid: number]: true}},
|
||||
'history_delete': {peerId: number, msgs: Set<number>},
|
||||
'history_forbidden': number,
|
||||
'history_reload': number,
|
||||
'history_focus': {peerId: number, threadId?: number, mid?: number},
|
||||
|
@ -280,8 +280,18 @@ $chat-helper-size: 36px;
|
||||
&.record .tgico-microphone,
|
||||
&.edit .tgico-check,
|
||||
&.schedule .tgico-schedule {
|
||||
animation: grow-icon .4s forwards ease-in-out !important;
|
||||
visibility: visible !important;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@include animation-level(2) {
|
||||
&.send .tgico-send,
|
||||
&.record .tgico-microphone,
|
||||
&.edit .tgico-check,
|
||||
&.schedule .tgico-schedule {
|
||||
animation: grow-icon .4s forwards ease-in-out !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,10 +381,16 @@
|
||||
.btn-corner {
|
||||
&:not(.menu-open) .tgico-newchat_filled,
|
||||
&.menu-open .tgico-close {
|
||||
animation: grow-icon .4s forwards ease-in-out !important;
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
||||
@include animation-level(2) {
|
||||
&:not(.menu-open) .tgico-newchat_filled,
|
||||
&.menu-open .tgico-close {
|
||||
animation: grow-icon .4s forwards ease-in-out !important;
|
||||
}
|
||||
}
|
||||
|
||||
@include respond-to(handhelds) {
|
||||
--size: 54px;
|
||||
bottom: 14px;
|
||||
|
Loading…
Reference in New Issue
Block a user