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

8
src/components/misc.ts

@ -74,7 +74,7 @@ export function horizontalMenu(tabs: HTMLUListElement, content: HTMLDivElement,
target = findUpTag(target, 'LI'); target = findUpTag(target, 'LI');
} }
console.log('tabs click:', target); ///////console.log('tabs click:', target);
if(!target || target.classList.contains('active')) return false; if(!target || target.classList.contains('active')) return false;
@ -90,14 +90,14 @@ export function horizontalMenu(tabs: HTMLUListElement, content: HTMLDivElement,
let tabContent = content.children[id] as HTMLDivElement; let tabContent = content.children[id] as HTMLDivElement;
tabContent.classList.add('active'); tabContent.classList.add('active');
console.log('mambo rap', prevId, id); /////console.log('mambo rap', prevId, id);
//content.style.marginLeft = id > 0 ? (-id * 100) + '%' : ''; //content.style.marginLeft = id > 0 ? (-id * 100) + '%' : '';
let toRight = prevId < id; let toRight = prevId < id;
if(prevId != -1) { if(prevId != -1) {
content.style.width = '200%'; content.style.width = '200%';
console.log('mambo rap setting', toRight); //////console.log('mambo rap setting', toRight);
content.classList.remove('animated'); content.classList.remove('animated');
@ -159,7 +159,7 @@ export function formatPhoneNumber(str: string) {
str = str.replace(/\D/g, ''); str = str.replace(/\D/g, '');
let phoneCode = str.slice(0, 6); 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); 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";
} */ } */
export default () => import('../lib/services').then(services => { export default () => import('../lib/services').then(services => {
console.log('included services', services); //console.log('included services', services);
let {appImManager, appMessagesManager, appDialogsManager, apiUpdatesManager, appUsersManager} = services; let {appImManager, appMessagesManager, appDialogsManager, apiUpdatesManager, appUsersManager} = services;
//export default () => { //export default () => {
@ -68,7 +68,7 @@ export default () => import('../lib/services').then(services => {
for(let id in dialogs) { for(let id in dialogs) {
let dialog = dialogs[id]; let dialog = dialogs[id];
console.log('updating dialog:', dialog); /////console.log('updating dialog:', dialog);
++performed; ++performed;
@ -81,7 +81,7 @@ export default () => import('../lib/services').then(services => {
} }
if(performed) { if(performed) {
console.log('will sortDom'); /////////console.log('will sortDom');
appDialogsManager.sortDom(); appDialogsManager.sortDom();
appDialogsManager.sortDom(true); appDialogsManager.sortDom(true);
} }

14
src/components/wrappers.ts

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

8
src/lib/appManagers/appDialogsManager.ts

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

18
src/lib/appManagers/appMediaViewer.ts

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

16
src/lib/appManagers/appMessagesManager.ts

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

22
src/lib/appManagers/appSidebarLeft.ts

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

2
src/lib/appManagers/appSidebarRight.ts

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

2
src/lib/appManagers/appUsersManager.ts

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

49
src/lib/appManagers/appWebpManager.ts

@ -18,24 +18,31 @@ class AppWebpManager {
}); */ }); */
this.webpSupported().then(res => { this.webpSupported().then(res => {
this.loaded = new Promise((resolve, reject) => { });
if(!res) { }
(window as any).webpLoaded = () => {
console.log('webpHero loaded'); public loadWebpHero() {
this.webpMachine = new (window as any).WebpMachine(); if(this.loaded) return this.loaded;
resolve();
}; this.loaded = new Promise(async(resolve, reject) => {
let res = await this.webpSupported();
let sc = document.createElement('script');
sc.src = 'webp.bundle.js'; if(!res) {
sc.async = true; (window as any).webpLoaded = () => {
sc.onload = (window as any).webpLoaded; console.log('webpHero loaded');
this.webpMachine = new (window as any).WebpMachine();
document.body.appendChild(sc);
} else {
resolve(); 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 {
async processQueue() { async processQueue() {
if(this.busyPromise) return; if(this.busyPromise) return;
this.busyPromise = Promise.resolve('');
let {img, bytes} = this.queue.pop(); let {img, bytes} = this.queue.pop();
if(!this.loaded) {
this.loadWebpHero();
}
await this.loaded; await this.loaded;
this.busyPromise = this.convert(bytes); this.busyPromise = this.convert(bytes);
@ -62,6 +75,8 @@ class AppWebpManager {
} }
webpSupported() { webpSupported() {
if(this.webpSupport) return this.webpSupport;
return this.webpSupport = new Promise((resolve, reject) => { return this.webpSupport = new Promise((resolve, reject) => {
var webP = new Image(); var webP = new Image();
webP.src = 'data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMw' + 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,
let len = bytes.byteLength || bytes.length; let len = bytes.byteLength || bytes.length;
let needPadding = blockSize - (len % blockSize); let needPadding = blockSize - (len % blockSize);
if(needPadding > 0 && (needPadding < blockSize || full)) { if(needPadding > 0 && (needPadding < blockSize || full)) {
console.log('addPadding()', len, blockSize, needPadding); ////console.log('addPadding()', len, blockSize, needPadding);
let padding = new Array(needPadding); let padding = new Array(needPadding);
if(zeroes) { if(zeroes) {
for(let i = 0; i < needPadding; i++) { for(let i = 0; i < needPadding; i++) {

2
src/lib/ckin.js

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

2
src/lib/crypto/cryptoworker.ts

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

2
src/lib/lottieLoader.ts

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

10
src/lib/mtproto/apiFileManager.ts

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

2
src/lib/mtproto/apiManager.ts

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

2
src/lib/mtproto/mtproto.ts

@ -73,4 +73,4 @@ export namespace MTProto {
export const serverTimeManager = ServerTimeManager; 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 {
let serializer = new TLSerialization(options); let serializer = new TLSerialization(options);
if(!this.connectionInited) { // this will call once for each new session 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'); let invokeWithLayer = Config.Schema.API.methods.find((m: any) => m.method == 'invokeWithLayer');
if(!invokeWithLayer) throw new Error('no invokeWithLayer!'); if(!invokeWithLayer) throw new Error('no invokeWithLayer!');
@ -291,9 +291,9 @@ class MTPNetworker {
options.resultType = serializer.storeMethod(method, params); options.resultType = serializer.storeMethod(method, params);
if(method == 'account.updateNotifySettings') { /* if(method == 'account.updateNotifySettings') {
this.log('api call body:', serializer.getBytes(true)); this.log('api call body:', serializer.getBytes(true));
} } */
var messageID = timeManager.generateID(); var messageID = timeManager.generateID();
var seqNo = this.generateSeqNo(); var seqNo = this.generateSeqNo();
@ -304,10 +304,10 @@ class MTPNetworker {
isAPI: true isAPI: true
}; };
if(Config.Modes.debug || true) { if(Config.Modes.debug/* || true */) {
this.log('Api call', method, message, params, options); this.log('Api call', method, message, params, options);
} else { } else {
this.log('Api call', method); //////this.log('Api call', method);
} }
return this.pushMessage(message, options); return this.pushMessage(message, options);
@ -1209,7 +1209,7 @@ class MTPNetworker {
if(sentMessage.isAPI && !this.connectionInited) { if(sentMessage.isAPI && !this.connectionInited) {
this.connectionInited = true; 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;
export const appSidebarRight = AppSidebarRight; export const appSidebarRight = AppSidebarRight;
export const appSidebarLeft = AppSidebarLeft; export const appSidebarLeft = AppSidebarLeft;
(window as any).Services = { /* (window as any).Services = {
appUsersManager, appUsersManager,
appChatsManager, appChatsManager,
apiUpdatesManager, apiUpdatesManager,
@ -48,4 +48,4 @@ export const appSidebarLeft = AppSidebarLeft;
appSidebarRight, appSidebarRight,
appSidebarLeft appSidebarLeft
//appSharedMediaManager //appSharedMediaManager
}; }; */

2
src/lib/tl_utils.ts

@ -68,7 +68,7 @@ class TLSerialization {
return; 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; this.maxLength = Math.ceil(Math.max(this.maxLength * 2, this.offset + needBytes + 16) / 4) * 4;
var previousBuffer = this.buffer; var previousBuffer = this.buffer;
var previousArray = new Int32Array(previousBuffer); var previousArray = new Int32Array(previousBuffer);

2
src/lib/utils.js

@ -297,7 +297,7 @@ export function getSelectedText() {
export const $rootScope = { export const $rootScope = {
$broadcast: (name/* : string */, detail/*? : any */) => { $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(); //console.trace();
let myCustomEvent = new CustomEvent(name, {detail}); let myCustomEvent = new CustomEvent(name, {detail});
document.dispatchEvent(myCustomEvent); document.dispatchEvent(myCustomEvent);

6
src/scss/partials/_chat.scss

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

3
src/scss/partials/_sidebar.scss

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

6
src/scss/style.scss

@ -453,7 +453,7 @@ input {
} }
&-download { &-download {
z-index: 3; z-index: 2;
align-items: center; align-items: center;
font-size: 24px; font-size: 24px;
cursor: pointer; cursor: pointer;
@ -1318,11 +1318,13 @@ div.scrollable::-webkit-scrollbar-thumb {
&.scrollable-x { &.scrollable-x {
overflow-x: auto; overflow-x: auto;
scrollbar-width: none; scrollbar-width: none;
-ms-overflow-style: none;
} }
&.scrollable-y { &.scrollable-y {
overflow-y: auto; overflow-y: auto;
scrollbar-width: none; scrollbar-width: none;
-ms-overflow-style: none;
} }
&.scrollable-x ~ .scrollbar-thumb { &.scrollable-x ~ .scrollbar-thumb {
@ -1378,11 +1380,11 @@ div.scrollable::-webkit-scrollbar-thumb {
text-align: center; text-align: center;
flex: 1; flex: 1;
user-select: none; user-select: none;
font-size: 16px;
&.active { &.active {
position: relative; position: relative;
color: $blue; color: $blue;
font-size: 16px;
&:after { &:after {
content: ''; 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 = {
minifyURLs: true minifyURLs: true
}, */ }, */
chunks: "all", chunks: "all",
excludeChunks: ['webp'] excludeChunks: ['npm.webp-hero']
}) })
], ],
}; };

2
webpack.prod.js

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

Loading…
Cancel
Save