Browse Source

last

master
Eduard Kuzmenko 5 years ago
parent
commit
a687186550
  1. BIN
      .DS_Store
  2. BIN
      TWEB#2 (fixed webp).zip
  3. 4
      src/components/emoticonsDropdown.ts
  4. 8
      src/components/misc.ts
  5. 6
      src/components/pageIm.ts
  6. 14
      src/components/wrappers.ts
  7. 8
      src/lib/appManagers/appDialogsManager.ts
  8. 88
      src/lib/appManagers/appImManager.ts
  9. 18
      src/lib/appManagers/appMediaViewer.ts
  10. 16
      src/lib/appManagers/appMessagesManager.ts
  11. 22
      src/lib/appManagers/appSidebarLeft.ts
  12. 2
      src/lib/appManagers/appSidebarRight.ts
  13. 2
      src/lib/appManagers/appUsersManager.ts
  14. 49
      src/lib/appManagers/appWebpManager.ts
  15. 2
      src/lib/bin_utils.ts
  16. 2
      src/lib/ckin.js
  17. 2
      src/lib/crypto/cryptoworker.ts
  18. 2
      src/lib/lottieLoader.ts
  19. 10
      src/lib/mtproto/apiFileManager.ts
  20. 2
      src/lib/mtproto/apiManager.ts
  21. 2
      src/lib/mtproto/mtproto.ts
  22. 12
      src/lib/mtproto/networker.ts
  23. 4
      src/lib/services.ts
  24. 2
      src/lib/tl_utils.ts
  25. 2
      src/lib/utils.js
  26. 6
      src/scss/partials/_chat.scss
  27. 3
      src/scss/partials/_sidebar.scss
  28. 6
      src/scss/style.scss
  29. 21229
      stats.json
  30. 2
      webpack.common.js
  31. 2
      webpack.prod.js

BIN
.DS_Store vendored

Binary file not shown.

BIN
TWEB#2 (fixed webp).zip

Binary file not shown.

4
src/components/emoticonsDropdown.ts

@ -111,7 +111,7 @@ const initEmoticonsDropdown = (pageEl: HTMLDivElement, @@ -111,7 +111,7 @@ const initEmoticonsDropdown = (pageEl: HTMLDivElement,
categories.pop();
delete sorted["Skin Tones"];
console.time('emojiParse');
//console.time('emojiParse');
for(let category in sorted) {
let div = document.createElement('div');
div.classList.add('emoji-category');
@ -141,7 +141,7 @@ const initEmoticonsDropdown = (pageEl: HTMLDivElement, @@ -141,7 +141,7 @@ const initEmoticonsDropdown = (pageEl: HTMLDivElement,
divs[category] = div;
}
console.timeEnd('emojiParse');
//console.timeEnd('emojiParse');
let heights: number[] = [0];

8
src/components/misc.ts

@ -74,7 +74,7 @@ export function horizontalMenu(tabs: HTMLUListElement, content: HTMLDivElement, @@ -74,7 +74,7 @@ export function horizontalMenu(tabs: HTMLUListElement, content: HTMLDivElement,
target = findUpTag(target, 'LI');
}
console.log('tabs click:', target);
///////console.log('tabs click:', target);
if(!target || target.classList.contains('active')) return false;
@ -90,14 +90,14 @@ export function horizontalMenu(tabs: HTMLUListElement, content: HTMLDivElement, @@ -90,14 +90,14 @@ export function horizontalMenu(tabs: HTMLUListElement, content: HTMLDivElement,
let tabContent = content.children[id] as HTMLDivElement;
tabContent.classList.add('active');
console.log('mambo rap', prevId, id);
/////console.log('mambo rap', prevId, id);
//content.style.marginLeft = id > 0 ? (-id * 100) + '%' : '';
let toRight = prevId < id;
if(prevId != -1) {
content.style.width = '200%';
console.log('mambo rap setting', toRight);
//////console.log('mambo rap setting', toRight);
content.classList.remove('animated');
@ -159,7 +159,7 @@ export function formatPhoneNumber(str: string) { @@ -159,7 +159,7 @@ export function formatPhoneNumber(str: string) {
str = str.replace(/\D/g, '');
let phoneCode = str.slice(0, 6);
console.log('str', str, phoneCode);
////console.log('str', str, phoneCode);
let sortedCountries = Config.Countries.slice().sort((a, b) => b.phoneCode.length - a.phoneCode.length);

6
src/components/pageIm.ts

@ -13,7 +13,7 @@ import appSidebarLeft from "../lib/appManagers/appSidebarLeft"; @@ -13,7 +13,7 @@ import appSidebarLeft from "../lib/appManagers/appSidebarLeft";
} */
export default () => import('../lib/services').then(services => {
console.log('included services', services);
//console.log('included services', services);
let {appImManager, appMessagesManager, appDialogsManager, apiUpdatesManager, appUsersManager} = services;
//export default () => {
@ -68,7 +68,7 @@ export default () => import('../lib/services').then(services => { @@ -68,7 +68,7 @@ export default () => import('../lib/services').then(services => {
for(let id in dialogs) {
let dialog = dialogs[id];
console.log('updating dialog:', dialog);
/////console.log('updating dialog:', dialog);
++performed;
@ -81,7 +81,7 @@ export default () => import('../lib/services').then(services => { @@ -81,7 +81,7 @@ export default () => import('../lib/services').then(services => {
}
if(performed) {
console.log('will sortDom');
/////////console.log('will sortDom');
appDialogsManager.sortDom();
appDialogsManager.sortDom(true);
}

14
src/components/wrappers.ts

@ -79,7 +79,7 @@ export function wrapVideo(this: any, doc: MTDocument, container: HTMLDivElement, @@ -79,7 +79,7 @@ export function wrapVideo(this: any, doc: MTDocument, container: HTMLDivElement,
return;
}
console.log('loaded doc:', doc, blob, container);
///////console.log('loaded doc:', doc, blob, container);
let video = document.createElement('video');
/* video.loop = controls;
@ -249,7 +249,7 @@ export function wrapAudio(doc: MTDocument, withTime = false): HTMLDivElement { @@ -249,7 +249,7 @@ export function wrapAudio(doc: MTDocument, withTime = false): HTMLDivElement {
<div class="audio-time">${durationStr}</div>
`;
console.log('wrapping audio', doc, doc.attributes[0].waveform);
//////console.log('wrapping audio', doc, doc.attributes[0].waveform);
let timeDiv = div.lastElementChild as HTMLDivElement;
@ -303,6 +303,8 @@ export function wrapAudio(doc: MTDocument, withTime = false): HTMLDivElement { @@ -303,6 +303,8 @@ export function wrapAudio(doc: MTDocument, withTime = false): HTMLDivElement {
let source = document.createElement('source');
source.src = URL.createObjectURL(blob);
source.type = doc.mime_type;
audio.volume = 1;
div.removeEventListener('click', onClick);
let toggle = div.querySelector('.audio-toggle') as HTMLDivElement;
@ -359,6 +361,8 @@ export function wrapAudio(doc: MTDocument, withTime = false): HTMLDivElement { @@ -359,6 +361,8 @@ export function wrapAudio(doc: MTDocument, withTime = false): HTMLDivElement {
});
audio.append(source);
audio.style.display = 'none';
div.append(audio);
});
downloadDiv.classList.add('downloading');
@ -411,7 +415,7 @@ export function wrapPhoto(this: AppImManager, photo: any, message: any, containe @@ -411,7 +415,7 @@ export function wrapPhoto(this: AppImManager, photo: any, message: any, containe
});
};
console.log('wrapPhoto', load, container, image);
/////////console.log('wrapPhoto', load, container, image);
return this.loadMediaQueue ? this.loadMediaQueuePush(load) : load();
}
@ -423,7 +427,7 @@ export function wrapSticker(doc: MTDocument, div: HTMLDivElement, middleware?: ( @@ -423,7 +427,7 @@ export function wrapSticker(doc: MTDocument, div: HTMLDivElement, middleware?: (
console.error('wrong doc for wrapSticker!', doc, div);
}
console.log('wrap sticker', doc);
///////console.log('wrap sticker', doc);
if(doc.thumbs && !div.firstElementChild) {
let thumb = doc.thumbs[0];
@ -579,7 +583,7 @@ export function wrapReply(title: string, subtitle: string, media?: any) { @@ -579,7 +583,7 @@ export function wrapReply(title: string, subtitle: string, media?: any) {
replyContent.append(replyTitle, replySubtitle);
div.append(replyBorder, replyContent);
console.log('wrapReply', title, subtitle, media);
/////////console.log('wrapReply', title, subtitle, media);
return div;
}

8
src/lib/appManagers/appDialogsManager.ts

@ -236,7 +236,7 @@ export class AppDialogsManager { @@ -236,7 +236,7 @@ export class AppDialogsManager {
//this.chatList.append(dom.listEl);
});
console.log('sortDom', sorted.length, inUpper.length, chatList.childElementCount, inBottom.length);
//////console.log('sortDom', sorted.length, inUpper.length, chatList.childElementCount, inBottom.length);
chatsHidden.up = inUpper;
chatsHidden.down = inBottom;
@ -247,7 +247,7 @@ export class AppDialogsManager { @@ -247,7 +247,7 @@ export class AppDialogsManager {
lastMessage = appMessagesManager.getMessage(dialog.top_message);
}
console.log('setlastMessage:', lastMessage);
///////console.log('setlastMessage:', lastMessage);
if(lastMessage._ == 'messageEmpty') return;
@ -313,7 +313,7 @@ export class AppDialogsManager { @@ -313,7 +313,7 @@ export class AppDialogsManager {
}
default:
console.warn('Got unknown lastMessage.media type!', lastMessage);
///////console.warn('Got unknown lastMessage.media type!', lastMessage);
break;
}
}
@ -342,7 +342,7 @@ export class AppDialogsManager { @@ -342,7 +342,7 @@ export class AppDialogsManager {
senderBold.innerText = str + ': ';
//console.log(sender, senderBold.innerText);
dom.lastMessageSpan.prepend(senderBold);
} else console.log('no sender', lastMessage, peerID);
} //////// else console.log('no sender', lastMessage, peerID);
}
}

88
src/lib/appManagers/appImManager.ts

@ -672,13 +672,13 @@ export class AppImManager { @@ -672,13 +672,13 @@ export class AppImManager {
$rootScope.$on('message_sent', (e: CustomEvent) => {
let {tempID, mid} = e.detail;
this.log('message_sent', e.detail);
////this.log('message_sent', e.detail);
let bubble = this.bubbles[tempID];
if(bubble) {
this.bubbles[mid] = bubble;
this.log('message_sent', bubble);
/////this.log('message_sent', bubble);
let media = bubble.querySelector('img, video');
if(media) {
@ -719,7 +719,7 @@ export class AppImManager { @@ -719,7 +719,7 @@ export class AppImManager {
mids.forEach(mid => {
if(this.pinnedMsgID == mid) {
let message = appMessagesManager.getMessage(mid);
this.log('setting pinned message', message);
/////this.log('setting pinned message', message);
this.pinnedMessageContainer.dataset.mid = '' + mid;
this.pinnedMessageContainer.style.display = '';
this.pinnedMessageContent.innerHTML = RichTextProcessor.wrapEmojiText(message.message);
@ -803,7 +803,7 @@ export class AppImManager { @@ -803,7 +803,7 @@ export class AppImManager {
let splitted = savedFrom.split('_');
let peerID = +splitted[0];
let msgID = +splitted[1];
this.log('savedFrom', peerID, msgID);
////this.log('savedFrom', peerID, msgID);
this.setPeer(peerID, msgID, true);
return;
} else if(target.classList.contains('user-avatar') || target.classList.contains('name')) {
@ -858,7 +858,7 @@ export class AppImManager { @@ -858,7 +858,7 @@ export class AppImManager {
let prevTarget = this.bubbles[prev] ? this.bubbles[prev].querySelector('img, video') as HTMLElement : null;
let nextTarget = this.bubbles[next] ? this.bubbles[next].querySelector('img, video') as HTMLElement : null;
this.log('ids', ids, idx, this.bubbles[prev], this.bubbles[next]);
/////this.log('ids', ids, idx, this.bubbles[prev], this.bubbles[next]);
appMediaViewer.openMedia(message, target, nextTarget, prevTarget);
@ -977,7 +977,7 @@ export class AppImManager { @@ -977,7 +977,7 @@ export class AppImManager {
//this.contextMenu.classList.add('active');
openBtnMenu(this.contextMenu);
this.log('contextmenu', e, bubble, msgID, side);
/////this.log('contextmenu', e, bubble, msgID, side);
}
});
@ -1041,7 +1041,7 @@ export class AppImManager { @@ -1041,7 +1041,7 @@ export class AppImManager {
peer: appPeersManager.getInputPeerByID(this.peerID),
id: this.contextMenuMsgID
}).then(updates => {
this.log('pinned updates:', updates);
/////this.log('pinned updates:', updates);
apiUpdatesManager.processUpdateMessage(updates);
});
});
@ -1082,7 +1082,7 @@ export class AppImManager { @@ -1082,7 +1082,7 @@ export class AppImManager {
revoke: revoke,
id: ids
}).then((affectedMessages: any) => {
this.log('deleted messages:', affectedMessages);
/////this.log('deleted messages:', affectedMessages);
apiUpdatesManager.processUpdateMessage({
_: 'updateShort',
@ -1143,7 +1143,7 @@ export class AppImManager { @@ -1143,7 +1143,7 @@ export class AppImManager {
let woo = this.loadMediaQueue.splice(-5, 5).reverse().map(f => f());
if(woo.length) {
this.log('Will load more media:', woo.length);
///this.log('Will load more media:', woo.length);
woo.forEach(async(promise) => {
try {
@ -1276,7 +1276,7 @@ export class AppImManager { @@ -1276,7 +1276,7 @@ export class AppImManager {
if(isElementInViewport(bubble)) {
willLoad = true;
this.log('Will load more (up) history by id:', history[0], 'maxID:', history[history.length - 1], history, bubble);
////this.log('Will load more (up) history by id:', history[0], 'maxID:', history[history.length - 1], history, bubble);
/* false && */!testScroll && this.getHistory(history[0], true).then(() => { // uncomment
this.onScroll();
}).catch(err => {
@ -1305,7 +1305,7 @@ export class AppImManager { @@ -1305,7 +1305,7 @@ export class AppImManager {
if(isElementInViewport(bubble)) {
willLoad = true;
this.log('Will load more (down) history by maxID:', lastMsgIDs[lastMsgIDs.length - 1], lastMsgIDs, bubble);
////this.log('Will load more (down) history by maxID:', lastMsgIDs[lastMsgIDs.length - 1], lastMsgIDs, bubble);
/* false && */!testScroll && this.getHistory(lastMsgIDs[lastMsgIDs.length - 1], false, true).then(() => { // uncomment
this.onScroll();
}).catch(err => {
@ -1339,7 +1339,7 @@ export class AppImManager { @@ -1339,7 +1339,7 @@ export class AppImManager {
let chat = appPeersManager.getPeer(this.peerID);
let isChannel = appPeersManager.isChannel(this.peerID) && !appPeersManager.isMegagroup(this.peerID);
this.log('setPeerStatus', chat);
///////this.log('setPeerStatus', chat);
Promise.all([
appPeersManager.isMegagroup(this.peerID) ? apiManager.invokeApi('messages.getOnlines', {
@ -1352,7 +1352,7 @@ export class AppImManager { @@ -1352,7 +1352,7 @@ export class AppImManager {
let onlines = chatOnlines ? chatOnlines.onlines : 1;
this.log('chatInfo res:', chatInfo);
///////////this.log('chatInfo res:', chatInfo);
if(chatInfo.pinned_msg_id) { // request pinned message
this.pinnedMsgID = chatInfo.pinned_msg_id;
@ -1502,7 +1502,7 @@ export class AppImManager { @@ -1502,7 +1502,7 @@ export class AppImManager {
this.preloader.attach(this.chatInner);
let dialog = appMessagesManager.getDialogByPeerID(this.peerID)[0] || null;
this.log('setPeer peerID:', this.peerID, dialog, lastMsgID);
//////this.log('setPeer peerID:', this.peerID, dialog, lastMsgID);
appDialogsManager.loadDialogPhoto(this.avatarEl, this.peerID);
appDialogsManager.loadDialogPhoto(appSidebarRight.profileElements.avatar, this.peerID);
if(!samePeer && appDialogsManager.lastActiveListElement) {
@ -1538,12 +1538,12 @@ export class AppImManager { @@ -1538,12 +1538,12 @@ export class AppImManager {
return this.setPeerPromise = Promise.all([
this.getHistory(forwarding ? lastMsgID + 1 : lastMsgID).then(() => {
this.log('setPeer removing preloader');
////this.log('setPeer removing preloader');
if(lastMsgID) {
if(!forwarding) {
let message = appMessagesManager.getMessage(lastMsgID);
this.log('setPeer render last message:', message, lastMsgID);
//////this.log('setPeer render last message:', message, lastMsgID);
this.renderMessage(message);
}
@ -1609,7 +1609,7 @@ export class AppImManager { @@ -1609,7 +1609,7 @@ export class AppImManager {
public updateUnreadByDialog(dialog: any) {
let maxID = this.peerID == this.myID ? dialog.read_inbox_max_id : dialog.read_outbox_max_id;
this.log('updateUnreadByDialog', maxID, dialog, this.unreadOut);
///////this.log('updateUnreadByDialog', maxID, dialog, this.unreadOut);
let length = this.unreadOut.length;
for(let i = length - 1; i >= 0; --i) {
@ -1629,7 +1629,7 @@ export class AppImManager { @@ -1629,7 +1629,7 @@ export class AppImManager {
let dialog = appMessagesManager.getDialogByPeerID(this.peerID)[0];
if(dialog) {
this.log('setting firstTopMsgID after delete:', id, dialog.top_message, dialog);
///////this.log('setting firstTopMsgID after delete:', id, dialog.top_message, dialog);
this.firstTopMsgID = dialog.top_message;
}
}
@ -1651,14 +1651,14 @@ export class AppImManager { @@ -1651,14 +1651,14 @@ export class AppImManager {
public renderMessagesByIDs(msgIDs: number[]) {
if(!this.bubbles[this.firstTopMsgID] && Object.keys(this.bubbles).length) { // seems search active
this.log('seems search is active, skipping render:', msgIDs);
//////this.log('seems search is active, skipping render:', msgIDs);
return;
}
msgIDs.forEach((msgID: number) => {
let message = appMessagesManager.getMessage(msgID);
this.log('got new message to append:', message);
/////////this.log('got new message to append:', message);
//this.unreaded.push(msgID);
this.renderMessage(message);
@ -1666,7 +1666,7 @@ export class AppImManager { @@ -1666,7 +1666,7 @@ export class AppImManager {
}
public renderMessage(message: any, reverse = false, multipleRender?: boolean, bubble: HTMLDivElement = null, updatePosition = true) {
this.log('message to render:', message);
/////this.log('message to render:', message);
if(message.deleted) return;
let peerID = this.peerID;
@ -1817,7 +1817,7 @@ export class AppImManager { @@ -1817,7 +1817,7 @@ export class AppImManager {
case 'messageMediaPhoto': {
let photo = message.media.photo;
this.log('messageMediaPhoto', photo);
////////this.log('messageMediaPhoto', photo);
bubble.classList.add('hide-name', 'photo');
@ -1829,7 +1829,7 @@ export class AppImManager { @@ -1829,7 +1829,7 @@ export class AppImManager {
processingWebPage = true;
let webpage = message.media.webpage;
this.log('messageMediaWebPage', webpage);
////////this.log('messageMediaWebPage', webpage);
if(webpage._ == 'webPageEmpty') {
break;
}
@ -1911,7 +1911,7 @@ export class AppImManager { @@ -1911,7 +1911,7 @@ export class AppImManager {
break;
} */
this.log('messageMediaDocument', doc);
////////this.log('messageMediaDocument', doc);
if(doc.sticker && doc.size <= 1e6) {
bubble.classList.add('sticker');
@ -1942,7 +1942,7 @@ export class AppImManager { @@ -1942,7 +1942,7 @@ export class AppImManager {
break;
} else if(doc.mime_type == 'video/mp4' && doc.size <= 20e6) {
this.log('never get free 2', doc);
////////this.log('never get free 2', doc);
if(doc.type == 'round') {
bubble.classList.add('round');
@ -1981,7 +1981,7 @@ export class AppImManager { @@ -1981,7 +1981,7 @@ export class AppImManager {
let isHidden = message.fwd_from && !message.fwd_from.from_id && !message.fwd_from.channel_id;
if(isHidden) {
this.log('message to render hidden', message);
///////this.log('message to render hidden', message);
title = message.fwd_from.from_name;
bubble.classList.add('hidden-profile');
}
@ -2018,11 +2018,11 @@ export class AppImManager { @@ -2018,11 +2018,11 @@ export class AppImManager {
let originalMessage = appMessagesManager.getMessage(message.reply_to_mid);
let originalPeerTitle = appPeersManager.getPeerTitle(originalMessage.fromID, true) || '';
this.log('message to render reply', originalMessage, originalPeerTitle, bubble, message);
/////////this.log('message to render reply', originalMessage, originalPeerTitle, bubble, message);
// need to download separately
if(originalMessage._ == 'messageEmpty') {
this.log('message to render reply empty, need download', message, message.reply_to_mid);
//////////this.log('message to render reply empty, need download', message, message.reply_to_mid);
appMessagesManager.wrapSingleMessage(message.reply_to_mid);
this.needUpdate.push({replyMid: message.reply_to_mid, mid: message.mid});
@ -2063,7 +2063,7 @@ export class AppImManager { @@ -2063,7 +2063,7 @@ export class AppImManager {
let avatarDiv = document.createElement('div');
avatarDiv.classList.add('user-avatar');
this.log('exec loadDialogPhoto', message);
/////////this.log('exec loadDialogPhoto', message);
if(message.fromID) { // if no - user hidden
appDialogsManager.loadDialogPhoto(avatarDiv, message.fromID);
} else if(!title && message.fwd_from && message.fwd_from.from_name) {
@ -2091,8 +2091,12 @@ export class AppImManager { @@ -2091,8 +2091,12 @@ export class AppImManager {
name.dataset.peerID = message.fromID;
name.innerHTML = title;
let _ = action._;
if(_ == "messageActionPhoneCall") {
_ += '.' + action.type;
}
// @ts-ignore
let str = name.outerHTML + ' ' + langPack[action._];
let str = (name.innerText ? name.outerHTML + ' ' : '') + langPack[_];
bubble.innerHTML = `<div class="service-msg">${str}</div>`;
}
@ -2153,7 +2157,7 @@ export class AppImManager { @@ -2153,7 +2157,7 @@ export class AppImManager {
let div = document.createElement('div');
div.classList.add('service');
div.innerHTML = `<div class="service-msg">${str}</div>`;
this.log('need to render date message', dateTimestamp, str);
////////this.log('need to render date message', dateTimestamp, str);
this.dateMessages[dateTimestamp] = {
div,
@ -2203,8 +2207,8 @@ export class AppImManager { @@ -2203,8 +2207,8 @@ export class AppImManager {
return Promise.resolve(true);
}
console.time('render getHistory');
console.time('render history total');
//console.time('render getHistory');
//console.time('render history total');
let backLimit = 0;
if(isBackLimit) {
@ -2215,18 +2219,18 @@ export class AppImManager { @@ -2215,18 +2219,18 @@ export class AppImManager {
return this.getHistoryPromise = appMessagesManager.getHistory(this.peerID, maxID, loadCount, backLimit)
.then((result: any) => {
this.log('getHistory result by maxID:', maxID, reverse, isBackLimit, result);
///////this.log('getHistory result by maxID:', maxID, reverse, isBackLimit, result);
console.timeEnd('render getHistory');
//console.timeEnd('render getHistory');
if(this.peerID != peerID) {
this.log.warn('peer changed');
console.timeEnd('render history total');
//console.timeEnd('render history total');
return Promise.reject();
}
if(!result || !result.history) {
console.timeEnd('render history total');
//console.timeEnd('render history total');
return true;
}
@ -2245,7 +2249,7 @@ export class AppImManager { @@ -2245,7 +2249,7 @@ export class AppImManager {
if(reverse) history.reverse();
console.time('render history');
//console.time('render history');
if(!isBackLimit) {
this.scrollPosition.prepareFor(reverse ? 'up' : 'down');
@ -2264,11 +2268,11 @@ export class AppImManager { @@ -2264,11 +2268,11 @@ export class AppImManager {
this.scrollPosition.restore();
}
console.timeEnd('render history');
//console.timeEnd('render history');
this.getHistoryPromise = undefined;
console.timeEnd('render history total');
//console.timeEnd('render history total');
return true;
});
@ -2412,7 +2416,7 @@ export class AppImManager { @@ -2412,7 +2416,7 @@ export class AppImManager {
this.setMutedState(muted);
}
this.log('updateNotifySettings', peerID, notify_settings);
/////this.log('updateNotifySettings', peerID, notify_settings);
break;
}
@ -2420,7 +2424,7 @@ export class AppImManager { @@ -2420,7 +2424,7 @@ export class AppImManager {
case 'updateUserPinnedMessage': {
let {id} = update;
this.log('updateUserPinnedMessage', update);
/////this.log('updateUserPinnedMessage', update);
this.pinnedMsgID = id;
// hz nado li tut appMessagesIDsManager.getFullMessageID(update.max_id, channelID);

18
src/lib/appManagers/appMediaViewer.ts

@ -146,7 +146,7 @@ export class AppMediaViewer { @@ -146,7 +146,7 @@ export class AppMediaViewer {
mover = this.setNewMover();
} */
this.log('setMoverToTarget', target, closing, wasActive, fromRight);
///////this.log('setMoverToTarget', target, closing, wasActive, fromRight);
let rect = target.getBoundingClientRect();
let containerRect = this.content.container.getBoundingClientRect();
@ -182,9 +182,9 @@ export class AppMediaViewer { @@ -182,9 +182,9 @@ export class AppMediaViewer {
mover.style.transform = transform;
if(wasActive) {
/* if(wasActive) {
this.log('setMoverToTarget', mover.style.transform);
}
} */
if(!closing) {
let img: HTMLImageElement;
@ -268,14 +268,14 @@ export class AppMediaViewer { @@ -268,14 +268,14 @@ export class AppMediaViewer {
let rect = mover.getBoundingClientRect();
let newTransform = mover.style.transform.replace(/translate\((.+?),/, /* 'translate(-' + windowW + 'px,', */ (match, p1) => {
this.log('replace func', match, p1);
/////////this.log('replace func', match, p1);
let x = +p1.slice(0, -2);
x = toLeft ? -rect.width : windowW;
return match.replace(p1, x + 'px');
});
this.log('set newTransform:', newTransform, mover.style.transform, toLeft);
////////this.log('set newTransform:', newTransform, mover.style.transform, toLeft);
mover.style.transform = newTransform;
setTimeout(() => {
@ -296,7 +296,7 @@ export class AppMediaViewer { @@ -296,7 +296,7 @@ export class AppMediaViewer {
}
public openMedia(message: any, target?: HTMLElement, prevTarget?: HTMLElement, nextTarget?: HTMLElement) {
this.log('openMedia doc:', message, prevTarget, nextTarget);
////////this.log('openMedia doc:', message, prevTarget, nextTarget);
let media = message.media.photo || message.media.document || message.media.webpage.document || message.media.webpage.photo;
let isVideo = media.mime_type == 'video/mp4';
@ -351,7 +351,7 @@ export class AppMediaViewer { @@ -351,7 +351,7 @@ export class AppMediaViewer {
this.overlaysDiv.classList.add('active');
}
this.log('wasActive:', wasActive);
////////this.log('wasActive:', wasActive);
let mover = this.content.mover;
@ -360,7 +360,7 @@ export class AppMediaViewer { @@ -360,7 +360,7 @@ export class AppMediaViewer {
if(isVideo) {
let size = appPhotosManager.setAttachmentSize(media, container, maxWidth, maxHeight);
this.log('will wrap video', media, size);
////////this.log('will wrap video', media, size);
let afterTimeout = this.setMoverToTarget(target, false, fromRight);
//if(wasActive) return;
@ -390,7 +390,7 @@ export class AppMediaViewer { @@ -390,7 +390,7 @@ export class AppMediaViewer {
return;
}
this.log('indochina', blob);
///////this.log('indochina', blob);
let image = mover.firstElementChild as HTMLImageElement || new Image();
image.src = URL.createObjectURL(blob);

16
src/lib/appManagers/appMessagesManager.ts

@ -901,7 +901,7 @@ export class AppMessagesManager { @@ -901,7 +901,7 @@ export class AppMessagesManager {
}, {
timeout: 300
}).then((dialogsResult: any) => {
console.log('messages.getDialogs result:', dialogsResult);
///////console.log('messages.getDialogs result:', dialogsResult);
if(!offsetDate) {
telegramMeWebService.setAuthorized(true);
@ -1834,7 +1834,7 @@ export class AppMessagesManager { @@ -1834,7 +1834,7 @@ export class AppMessagesManager {
this.lastSearchResults = [];
}
console.log(dT(), 'search', useSearchCache, sameSearchCache, this.lastSearchResults, maxID);
//console.log(dT(), 'search', useSearchCache, sameSearchCache, this.lastSearchResults, maxID);
if(peerID && !maxID && !query) {
var historyStorage = this.historiesStorage[peerID];
@ -1991,7 +1991,7 @@ export class AppMessagesManager { @@ -1991,7 +1991,7 @@ export class AppMessagesManager {
appChatsManager.saveApiChats(searchResult.chats);
this.saveMessages(searchResult.messages);
console.log('messages.search result:', searchResult);
///////////console.log('messages.search result:', searchResult);
var foundCount: number = searchResult.count || searchResult.messages.length;
@ -2140,11 +2140,11 @@ export class AppMessagesManager { @@ -2140,11 +2140,11 @@ export class AppMessagesManager {
}
foundDialog.unread_count = index == -1 ? 0 : index;
console.log('readHistory set unread_count to:', foundDialog.unread_count, foundDialog);
////////console.log('readHistory set unread_count to:', foundDialog.unread_count, foundDialog);
$rootScope.$broadcast('dialog_unread', {peerID: peerID, count: foundDialog.unread_count});
$rootScope.$broadcast('messages_read');
if(historyStorage && historyStorage.history.length) {
console.warn('readPromise:', index, historyStorage.history[index != -1 ? index : 0]);
////////console.warn('readPromise:', index, historyStorage.history[index != -1 ? index : 0]);
foundDialog.read_inbox_max_id = historyStorage.history[index != -1 ? index : 0];
}
@ -2233,7 +2233,7 @@ export class AppMessagesManager { @@ -2233,7 +2233,7 @@ export class AppMessagesManager {
}
public handleUpdate(update: any) {
console.log('AMM: handleUpdate:', update._);
//console.log('AMM: handleUpdate:', update._);
switch(update._) {
case 'updateMessageID': {
var randomID = update.random_id;
@ -2588,7 +2588,7 @@ export class AppMessagesManager { @@ -2588,7 +2588,7 @@ export class AppMessagesManager {
// need be commented for read out messages
//if(newUnreadCount != 0 || !isOut) { // fix 16.11.2019 (maybe not)
console.warn(dT(), 'cnt', peerID, newUnreadCount, isOut, foundDialog, update, foundAffected);
//////////console.warn(dT(), 'cnt', peerID, newUnreadCount, isOut, foundDialog, update, foundAffected);
$rootScope.$broadcast('dialog_unread', {peerID: peerID, count: newUnreadCount});
//}
@ -3266,7 +3266,7 @@ export class AppMessagesManager { @@ -3266,7 +3266,7 @@ export class AppMessagesManager {
timeout: 300,
noErrorBox: true
}).then((historyResult: any) => {
console.log('requestHistory result:', historyResult);
///console.log('requestHistory result:', historyResult);
appUsersManager.saveApiUsers(historyResult.users);
appChatsManager.saveApiChats(historyResult.chats);

22
src/lib/appManagers/appSidebarLeft.ts

@ -108,7 +108,7 @@ class AppSidebarLeft { @@ -108,7 +108,7 @@ class AppSidebarLeft {
}
this.savedBtn.addEventListener('click', (e) => {
this.log('savedbtn click');
///////this.log('savedbtn click');
setTimeout(() => { // menu doesn't close if no timeout (lol)
let dom = appDialogsManager.getDialogDom(appImManager.myID);
if(dom) {
@ -158,7 +158,7 @@ class AppSidebarLeft { @@ -158,7 +158,7 @@ class AppSidebarLeft {
this.toolsBtn.classList.add('active');
this.backBtn.classList.remove('active');
this.searchContainer.classList.remove('active');
this.backBtn.click();
/* setTimeout(() => {
//this.toolsBtn.click();
@ -175,9 +175,10 @@ class AppSidebarLeft { @@ -175,9 +175,10 @@ class AppSidebarLeft {
this.searchInput.addEventListener('input', (e) => {
//console.log('messageInput input', this.innerText, serializeNodes(Array.from(messageInput.childNodes)));
let value = this.searchInput.value;
this.log('input', value);
////////this.log('input', value);
if(!value.trim()) {
//this.peerID = 0;
return;
}
@ -199,6 +200,9 @@ class AppSidebarLeft { @@ -199,6 +200,9 @@ class AppSidebarLeft {
this.chatsArchivedContainer.classList.remove('active');
this.toolsBtn.classList.add('active');
this.backBtn.classList.remove('active');
this.searchInput.value = '';
this.searchContainer.classList.remove('active');
this.peerID = 0;
});
window.addEventListener('resize', () => {
@ -249,7 +253,7 @@ class AppSidebarLeft { @@ -249,7 +253,7 @@ class AppSidebarLeft {
this.archivedCount.innerText = '' + count;
} */
this.log('loaded ' + this.chatsLoadCount + ' dialogs by offset:', offset, result, this.scroll.hiddenElements);
/////this.log('loaded ' + this.chatsLoadCount + ' dialogs by offset:', offset, result, this.scroll.hiddenElements);
this.scroll.onScroll();
} catch(err) {
this.log.error(err);
@ -340,7 +344,7 @@ class AppSidebarLeft { @@ -340,7 +344,7 @@ class AppSidebarLeft {
return;
}
this.log('input search contacts result:', contacts);
///////this.log('input search contacts result:', contacts);
let setResults = (results: any, group: SearchGroup, showMembersCount = false) => {
results.forEach((inputPeer: any) => {
@ -348,10 +352,10 @@ class AppSidebarLeft { @@ -348,10 +352,10 @@ class AppSidebarLeft {
let peer = appPeersManager.getPeer(peerID);
let originalDialog = appMessagesManager.getDialogByPeerID(peerID)[0];
this.log('contacts peer', peer);
//////////this.log('contacts peer', peer);
if(!originalDialog) {
this.log('no original dialog by peerID:', peerID);
/////////this.log('no original dialog by peerID:', peerID);
originalDialog = {
peerID: peerID,
@ -399,7 +403,7 @@ class AppSidebarLeft { @@ -399,7 +403,7 @@ class AppSidebarLeft {
return;
}
this.log('input search result:', this.peerID, query, null, maxID, 20, res);
/////////this.log('input search result:', this.peerID, query, null, maxID, 20, res);
let {count, history, next_rate} = res;
@ -415,7 +419,7 @@ class AppSidebarLeft { @@ -415,7 +419,7 @@ class AppSidebarLeft {
let originalDialog = appMessagesManager.getDialogByPeerID(message.peerID)[0];
if(!originalDialog) {
this.log('no original dialog by message:', message);
////////this.log('no original dialog by message:', message);
originalDialog = {
peerID: message.peerID,

2
src/lib/appManagers/appSidebarRight.ts

@ -179,7 +179,7 @@ class AppSidebarRight { @@ -179,7 +179,7 @@ class AppSidebarRight {
}
public toggleSidebar(enable?: boolean) {
this.log('sidebarEl', this.sidebarEl, enable, isElementInViewport(this.sidebarEl));
/////this.log('sidebarEl', this.sidebarEl, enable, isElementInViewport(this.sidebarEl));
/* if(enable !== undefined) {
this.sidebarEl.style.display = enable ? 'block' : 'none';

2
src/lib/appManagers/appUsersManager.ts

@ -49,7 +49,7 @@ export class AppUsersManager { @@ -49,7 +49,7 @@ export class AppUsersManager {
user.sortStatus = this.getUserStatusForSort(user.status);
$rootScope.$broadcast('user_update', userID);
} else console.warn('No user by id:', userID);
} //////else console.warn('No user by id:', userID);
break;
case 'updateUserPhoto':

49
src/lib/appManagers/appWebpManager.ts

@ -18,24 +18,31 @@ class AppWebpManager { @@ -18,24 +18,31 @@ class AppWebpManager {
}); */
this.webpSupported().then(res => {
this.loaded = new Promise((resolve, reject) => {
if(!res) {
(window as any).webpLoaded = () => {
console.log('webpHero loaded');
this.webpMachine = new (window as any).WebpMachine();
resolve();
};
let sc = document.createElement('script');
sc.src = 'webp.bundle.js';
sc.async = true;
sc.onload = (window as any).webpLoaded;
document.body.appendChild(sc);
} else {
});
}
public loadWebpHero() {
if(this.loaded) return this.loaded;
this.loaded = new Promise(async(resolve, reject) => {
let res = await this.webpSupported();
if(!res) {
(window as any).webpLoaded = () => {
console.log('webpHero loaded');
this.webpMachine = new (window as any).WebpMachine();
resolve();
}
});
};
let sc = document.createElement('script');
sc.src = 'npm.webp-hero.chunk.js';
sc.async = true;
sc.onload = (window as any).webpLoaded;
document.body.appendChild(sc);
} else {
resolve();
}
});
}
@ -47,8 +54,14 @@ class AppWebpManager { @@ -47,8 +54,14 @@ class AppWebpManager {
async processQueue() {
if(this.busyPromise) return;
this.busyPromise = Promise.resolve('');
let {img, bytes} = this.queue.pop();
if(!this.loaded) {
this.loadWebpHero();
}
await this.loaded;
this.busyPromise = this.convert(bytes);
@ -62,6 +75,8 @@ class AppWebpManager { @@ -62,6 +75,8 @@ class AppWebpManager {
}
webpSupported() {
if(this.webpSupport) return this.webpSupport;
return this.webpSupport = new Promise((resolve, reject) => {
var webP = new Image();
webP.src = 'data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMw' +

2
src/lib/bin_utils.ts

@ -331,7 +331,7 @@ export function addPadding(bytes: any, blockSize: number = 16, zeroes?: boolean, @@ -331,7 +331,7 @@ export function addPadding(bytes: any, blockSize: number = 16, zeroes?: boolean,
let len = bytes.byteLength || bytes.length;
let needPadding = blockSize - (len % blockSize);
if(needPadding > 0 && (needPadding < blockSize || full)) {
console.log('addPadding()', len, blockSize, needPadding);
////console.log('addPadding()', len, blockSize, needPadding);
let padding = new Array(needPadding);
if(zeroes) {
for(let i = 0; i < needPadding; i++) {

2
src/lib/ckin.js

@ -267,7 +267,7 @@ function buildControls(skin) { @@ -267,7 +267,7 @@ function buildControls(skin) {
}
function attachSkin(skin) {
console.log("skin: " + skin);
//console.log("skin: " + skin);
if (typeof skin != 'undefined' && skin != '') {
return skin;
} else {

2
src/lib/crypto/cryptoworker.ts

@ -32,7 +32,7 @@ class CryptoWorker { @@ -32,7 +32,7 @@ class CryptoWorker {
if(window.Worker/* && 1 == 2 */) {
import('./crypto.worker.js').then((CryptoWebWorker: any) => {
console.log(CryptoWebWorker);
//console.log(CryptoWebWorker);
var tmpWorker = new CryptoWebWorker.default();
//var tmpWorker = new Worker();
tmpWorker.onmessage = (e: any) => {

2
src/lib/lottieLoader.ts

@ -122,6 +122,6 @@ class LottieLoader { @@ -122,6 +122,6 @@ class LottieLoader {
const lottieLoader = new LottieLoader();
(window as any).LottieLoader = lottieLoader;
//(window as any).LottieLoader = lottieLoader;
export default lottieLoader;

10
src/lib/mtproto/apiFileManager.ts

@ -396,7 +396,7 @@ export class ApiFileManager { @@ -396,7 +396,7 @@ export class ApiFileManager {
fileWriter.seek(startOffset);
deferred.notify({done: startOffset, total: size});
this.log('deferred notify 1:', {done: startOffset, total: size});
/////this.log('deferred notify 1:', {done: startOffset, total: size});
}
for(offset = startOffset; offset < size; offset += limit) {
@ -408,7 +408,7 @@ export class ApiFileManager { @@ -408,7 +408,7 @@ export class ApiFileManager {
});
Object.assign(writeFileDeferred, writeFileDeferredHelper);
this.log('offset:', startOffset);
////this.log('offset:', startOffset);
;((isFinal, offset, writeFileDeferred, writeFilePromise) => {
return this.downloadRequest(dcID, () => {
@ -445,7 +445,7 @@ export class ApiFileManager { @@ -445,7 +445,7 @@ export class ApiFileManager {
deferred.resolve(this.cachedDownloads[fileName] = fileWriter.finalize());
}
} else {
this.log('deferred notify 2:', {done: offset + limit, total: size}, deferred);
////this.log('deferred notify 2:', {done: offset + limit, total: size}, deferred);
deferred.notify({done: offset + limit, total: size});
}
});
@ -584,7 +584,7 @@ export class ApiFileManager { @@ -584,7 +584,7 @@ export class ApiFileManager {
return;
}
this.log('Starting to upload file, isBig:', isBigFile, fileID, part, e.target.result);
//////this.log('Starting to upload file, isBig:', isBigFile, fileID, part, e.target.result);
apiManager.invokeApi(method, {
file_id: fileID,
@ -599,7 +599,7 @@ export class ApiFileManager { @@ -599,7 +599,7 @@ export class ApiFileManager {
doneParts++;
uploadResolve();
this.log('Progress', doneParts * partSize / fileSize);
//////this.log('Progress', doneParts * partSize / fileSize);
if(doneParts >= totalParts) {
deferred.resolve(resultInputFile);
resolved = true;

2
src/lib/mtproto/apiManager.ts

@ -199,7 +199,7 @@ export class ApiManager { @@ -199,7 +199,7 @@ export class ApiManager {
stopTime?: number,
rawError?: any
} = {}) {
this.log('Invoke api', method, params, options);
///////this.log('Invoke api', method, params, options);
return new Promise((resolve, reject) => {
let rejectPromise = (error: any) => {

2
src/lib/mtproto/mtproto.ts

@ -73,4 +73,4 @@ export namespace MTProto { @@ -73,4 +73,4 @@ export namespace MTProto {
export const serverTimeManager = ServerTimeManager;
}
(window as any).MTProto = MTProto;
//(window as any).MTProto = MTProto;

12
src/lib/mtproto/networker.ts

@ -249,7 +249,7 @@ class MTPNetworker { @@ -249,7 +249,7 @@ class MTPNetworker {
let serializer = new TLSerialization(options);
if(!this.connectionInited) { // this will call once for each new session
this.log('Wrap api call !this.connectionInited');
///////this.log('Wrap api call !this.connectionInited');
let invokeWithLayer = Config.Schema.API.methods.find((m: any) => m.method == 'invokeWithLayer');
if(!invokeWithLayer) throw new Error('no invokeWithLayer!');
@ -291,9 +291,9 @@ class MTPNetworker { @@ -291,9 +291,9 @@ class MTPNetworker {
options.resultType = serializer.storeMethod(method, params);
if(method == 'account.updateNotifySettings') {
/* if(method == 'account.updateNotifySettings') {
this.log('api call body:', serializer.getBytes(true));
}
} */
var messageID = timeManager.generateID();
var seqNo = this.generateSeqNo();
@ -304,10 +304,10 @@ class MTPNetworker { @@ -304,10 +304,10 @@ class MTPNetworker {
isAPI: true
};
if(Config.Modes.debug || true) {
if(Config.Modes.debug/* || true */) {
this.log('Api call', method, message, params, options);
} else {
this.log('Api call', method);
//////this.log('Api call', method);
}
return this.pushMessage(message, options);
@ -1209,7 +1209,7 @@ class MTPNetworker { @@ -1209,7 +1209,7 @@ class MTPNetworker {
if(sentMessage.isAPI && !this.connectionInited) {
this.connectionInited = true;
this.log('Rpc set connectionInited to:', this.connectionInited, this);
////this.log('Rpc set connectionInited to:', this.connectionInited);
}
}

4
src/lib/services.ts

@ -32,7 +32,7 @@ export const appDocsManager = AppDocsManager; @@ -32,7 +32,7 @@ export const appDocsManager = AppDocsManager;
export const appSidebarRight = AppSidebarRight;
export const appSidebarLeft = AppSidebarLeft;
(window as any).Services = {
/* (window as any).Services = {
appUsersManager,
appChatsManager,
apiUpdatesManager,
@ -48,4 +48,4 @@ export const appSidebarLeft = AppSidebarLeft; @@ -48,4 +48,4 @@ export const appSidebarLeft = AppSidebarLeft;
appSidebarRight,
appSidebarLeft
//appSharedMediaManager
};
}; */

2
src/lib/tl_utils.ts

@ -68,7 +68,7 @@ class TLSerialization { @@ -68,7 +68,7 @@ class TLSerialization {
return;
}
console.trace('Increase buffer', this.offset, needBytes, this.maxLength);
///console.trace('Increase buffer', this.offset, needBytes, this.maxLength);
this.maxLength = Math.ceil(Math.max(this.maxLength * 2, this.offset + needBytes + 16) / 4) * 4;
var previousBuffer = this.buffer;
var previousArray = new Int32Array(previousBuffer);

2
src/lib/utils.js

@ -297,7 +297,7 @@ export function getSelectedText() { @@ -297,7 +297,7 @@ export function getSelectedText() {
export const $rootScope = {
$broadcast: (name/* : string */, detail/*? : any */) => {
console.log(dT(), 'Broadcasting ' + name + ' event, with args:', detail);
////console.log(dT(), 'Broadcasting ' + name + ' event, with args:', detail);
//console.trace();
let myCustomEvent = new CustomEvent(name, {detail});
document.dispatchEvent(myCustomEvent);

6
src/scss/partials/_chat.scss

@ -1427,6 +1427,12 @@ @@ -1427,6 +1427,12 @@
/* #content-stickers {
padding: 0;
} */
.emoji-padding {
.menu-horizontal > li {
font-size: 1.65rem;
}
}
.stickers-padding {
.menu-wrapper {

3
src/scss/partials/_sidebar.scss

@ -191,7 +191,7 @@ @@ -191,7 +191,7 @@
}
#content-links {
padding: 0 15px 15px 15px;
padding: 0 30px 15px 15px;
> div {
display: flex;
@ -243,7 +243,6 @@ @@ -243,7 +243,6 @@
.subtitle {
font-size: 14px;
max-width: 300px;
}
}

6
src/scss/style.scss

@ -453,7 +453,7 @@ input { @@ -453,7 +453,7 @@ input {
}
&-download {
z-index: 3;
z-index: 2;
align-items: center;
font-size: 24px;
cursor: pointer;
@ -1318,11 +1318,13 @@ div.scrollable::-webkit-scrollbar-thumb { @@ -1318,11 +1318,13 @@ div.scrollable::-webkit-scrollbar-thumb {
&.scrollable-x {
overflow-x: auto;
scrollbar-width: none;
-ms-overflow-style: none;
}
&.scrollable-y {
overflow-y: auto;
scrollbar-width: none;
-ms-overflow-style: none;
}
&.scrollable-x ~ .scrollbar-thumb {
@ -1378,11 +1380,11 @@ div.scrollable::-webkit-scrollbar-thumb { @@ -1378,11 +1380,11 @@ div.scrollable::-webkit-scrollbar-thumb {
text-align: center;
flex: 1;
user-select: none;
font-size: 16px;
&.active {
position: relative;
color: $blue;
font-size: 16px;
&:after {
content: '';

21229
stats.json

File diff suppressed because one or more lines are too long

2
webpack.common.js

@ -93,7 +93,7 @@ module.exports = { @@ -93,7 +93,7 @@ module.exports = {
minifyURLs: true
}, */
chunks: "all",
excludeChunks: ['webp']
excludeChunks: ['npm.webp-hero']
})
],
};

2
webpack.prod.js

@ -12,7 +12,7 @@ module.exports = merge(common, { @@ -12,7 +12,7 @@ module.exports = merge(common, {
mode: 'production',
optimization: {
runtimeChunk: 'single',
//runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,

Loading…
Cancel
Save