diff --git a/src/components/appMediaPlaybackController.ts b/src/components/appMediaPlaybackController.ts
index 43b510e4..4b7a103b 100644
--- a/src/components/appMediaPlaybackController.ts
+++ b/src/components/appMediaPlaybackController.ts
@@ -265,5 +265,5 @@ class AppMediaPlaybackController {
}
const appMediaPlaybackController = new AppMediaPlaybackController();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appMediaPlaybackController = appMediaPlaybackController);
+MOUNT_CLASS_TO.appMediaPlaybackController = appMediaPlaybackController;
export default appMediaPlaybackController;
diff --git a/src/components/appNavigationController.ts b/src/components/appNavigationController.ts
index ef514e53..d10b43aa 100644
--- a/src/components/appNavigationController.ts
+++ b/src/components/appNavigationController.ts
@@ -17,14 +17,23 @@ export class AppNavigationController {
private manual = false;
private log = logger('NC');
private debug = true;
+ private currentHash = window.location.hash;
+ public onHashChange: () => void;
constructor() {
let isPossibleSwipe = false;
window.addEventListener('popstate', (e) => {
this.debug && this.log('popstate', e, isPossibleSwipe);
+ if(window.location.hash !== this.currentHash) {
+ this.onHashChange && this.onHashChange();
+ this.replaceState();
+ return;
+ }
+ this.currentHash = window.location.hash;
+
const id: number = e.state;
- if(id !== this.id) {
+ if(id !== this.id/* && !this.navigations.length */) {
this.pushState();
return;
}
@@ -148,7 +157,7 @@ export class AppNavigationController {
}
public replaceState() {
- history.replaceState(this.id, '');
+ history.replaceState(this.id, '', location.origin + location.pathname);
}
public removeItem(item: NavigationItem) {
@@ -170,5 +179,5 @@ export class AppNavigationController {
}
const appNavigationController = new AppNavigationController();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appNavigationController = appNavigationController);
+MOUNT_CLASS_TO.appNavigationController = appNavigationController;
export default appNavigationController;
diff --git a/src/components/appSelectPeers.ts b/src/components/appSelectPeers.ts
index 31b1b378..47dca4c2 100644
--- a/src/components/appSelectPeers.ts
+++ b/src/components/appSelectPeers.ts
@@ -101,7 +101,7 @@ export default class AppSelectPeers {
if(this.placeholder) {
_i18n(this.input, this.placeholder, undefined, 'placeholder');
} else {
- _i18n(this.input, !this.peerType.includes('dialogs') ? 'SendMessageTo' : 'SelectChat', undefined, 'placeholder');
+ _i18n(this.input, 'SendMessageTo', undefined, 'placeholder');
}
this.input.type = 'text';
diff --git a/src/components/chat/bubbles.ts b/src/components/chat/bubbles.ts
index f934f86f..513e2884 100644
--- a/src/components/chat/bubbles.ts
+++ b/src/components/chat/bubbles.ts
@@ -2356,7 +2356,7 @@ export default class ChatBubbles {
default:
bubble.classList.remove('is-message-empty');
- messageDiv.innerHTML = 'unrecognized media type: ' + message.media._;
+ messageDiv.innerHTML = 'This message is currently not supported on Telegram Web. Try desktop.telegram.org';
messageDiv.append(timeSpan);
this.log.warn('unrecognized media type:', message.media._, message);
break;
diff --git a/src/components/emoticonsDropdown/index.ts b/src/components/emoticonsDropdown/index.ts
index dd8354e2..1736ff23 100644
--- a/src/components/emoticonsDropdown/index.ts
+++ b/src/components/emoticonsDropdown/index.ts
@@ -424,5 +424,5 @@ export class EmoticonsDropdown {
}
const emoticonsDropdown = new EmoticonsDropdown();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.emoticonsDropdown = emoticonsDropdown);
+MOUNT_CLASS_TO.emoticonsDropdown = emoticonsDropdown;
export default emoticonsDropdown;
diff --git a/src/components/misc.ts b/src/components/misc.ts
index a7df6881..19fa712a 100644
--- a/src/components/misc.ts
+++ b/src/components/misc.ts
@@ -77,7 +77,7 @@ export function putPreloader(elem: Element, returnDiv = false): HTMLElement {
return elem.lastElementChild as HTMLElement;
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.putPreloader = putPreloader);
+MOUNT_CLASS_TO.putPreloader = putPreloader;
export function setButtonLoader(elem: HTMLButtonElement, icon = 'check') {
elem.classList.remove('tgico-' + icon);
diff --git a/src/components/peerTitle.ts b/src/components/peerTitle.ts
index a92f056d..74b840bf 100644
--- a/src/components/peerTitle.ts
+++ b/src/components/peerTitle.ts
@@ -11,7 +11,7 @@ export type PeerTitleOptions = {
const weakMap: WeakMap = new WeakMap();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.peerTitleWeakMap = weakMap);
+MOUNT_CLASS_TO.peerTitleWeakMap = weakMap;
rootScope.on('peer_title_edit', (peerId) => {
const elements = Array.from(document.querySelectorAll(`.peer-title[data-peer-id="${peerId}"]`)) as HTMLElement[];
diff --git a/src/components/popups/newMedia.ts b/src/components/popups/newMedia.ts
index 219b2321..6e12edfa 100644
--- a/src/components/popups/newMedia.ts
+++ b/src/components/popups/newMedia.ts
@@ -238,11 +238,15 @@ export default class PopupNewMedia extends PopupElement {
const video = document.createElement('video');
const source = document.createElement('source');
source.src = params.objectURL = URL.createObjectURL(file);
- video.autoplay = false;
+ video.autoplay = true;
video.controls = false;
video.muted = true;
video.setAttribute('playsinline', 'true');
+ video.addEventListener('timeupdate', () => {
+ video.pause();
+ }, {once: true});
+
onVideoLoad(video).then(() => {
params.width = video.videoWidth;
params.height = video.videoHeight;
diff --git a/src/components/sidebarLeft/index.ts b/src/components/sidebarLeft/index.ts
index d646ccc4..03687ed8 100644
--- a/src/components/sidebarLeft/index.ts
+++ b/src/components/sidebarLeft/index.ts
@@ -499,5 +499,5 @@ export const generateSection = (appendTo: Scrollable, name?: LangPackKey, captio
};
const appSidebarLeft = new AppSidebarLeft();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appSidebarLeft = appSidebarLeft);
+MOUNT_CLASS_TO.appSidebarLeft = appSidebarLeft;
export default appSidebarLeft;
diff --git a/src/components/sidebarRight/index.ts b/src/components/sidebarRight/index.ts
index c6763980..ba97b55b 100644
--- a/src/components/sidebarRight/index.ts
+++ b/src/components/sidebarRight/index.ts
@@ -125,5 +125,5 @@ export class AppSidebarRight extends SidebarSlider {
}
const appSidebarRight = new AppSidebarRight();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appSidebarRight = appSidebarRight);
+MOUNT_CLASS_TO.appSidebarRight = appSidebarRight;
export default appSidebarRight;
diff --git a/src/components/wrappers.ts b/src/components/wrappers.ts
index e7421f12..76fe6a39 100644
--- a/src/components/wrappers.ts
+++ b/src/components/wrappers.ts
@@ -303,7 +303,7 @@ export function wrapVideo({doc, container, message, boxWidth, boxHeight, withTai
} else if(doc.supportsStreaming) {
if(noAutoDownload) {
loadPromise = Promise.reject();
- } else {
+ } else if(!doc.downloaded) { // * check for uploading video
preloader.attach(container, false, null);
video.addEventListener(isSafari ? 'timeupdate' : 'canplay', () => {
preloader.detach();
diff --git a/src/config/debug.ts b/src/config/debug.ts
index 3d62c9b1..5c716515 100644
--- a/src/config/debug.ts
+++ b/src/config/debug.ts
@@ -1,9 +1,24 @@
import Modes from "./modes";
export const DEBUG = process.env.NODE_ENV !== 'production' || Modes.debug;
-export const MOUNT_CLASS_TO: any = DEBUG ? (typeof(window) !== 'undefined' ? window : self) : null;
+const ctx: any = typeof(window) !== 'undefined' ? window : self;
+export const MOUNT_CLASS_TO: any = DEBUG/* && false */ ? ctx : {};
export default DEBUG;
+//let m = DEBUG;
+if(!DEBUG/* || true */) {
+ ctx.sandpitTurtle = () => {
+ //if(!m) {
+ for(let i in MOUNT_CLASS_TO) {
+ ctx[i] = MOUNT_CLASS_TO[i];
+ }
+ //m = true;
+ //}
+
+ //DEBUG = !DEBUG;
+ };
+}
+
/* export const superDebug = (object: any, key: string) => {
var d = object[key];
var beforeStr = '', afterStr = '';
@@ -32,4 +47,4 @@ export default DEBUG;
dada(key + '_' + 'after', afterStr);
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.superDebug = superDebug); */
+MOUNT_CLASS_TO.superDebug = superDebug; */
diff --git a/src/countries.ts b/src/countries.ts
index f9e10a59..7be90f41 100644
--- a/src/countries.ts
+++ b/src/countries.ts
@@ -39,7 +39,7 @@ arr.forEach((el, idx) => {
});
*/
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.Countries = Countries);
+MOUNT_CLASS_TO.Countries = Countries;
export default Countries;
export {PhoneCodesMain};
\ No newline at end of file
diff --git a/src/helpers/date.ts b/src/helpers/date.ts
index 9d644a4d..ef7c9a53 100644
--- a/src/helpers/date.ts
+++ b/src/helpers/date.ts
@@ -454,4 +454,4 @@ function getDayOfWeek(q: string) {
return -1;
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.fillTipDates = fillTipDates);
+MOUNT_CLASS_TO.fillTipDates = fillTipDates;
diff --git a/src/helpers/dom.ts b/src/helpers/dom.ts
index 84005967..6fea75f4 100644
--- a/src/helpers/dom.ts
+++ b/src/helpers/dom.ts
@@ -134,7 +134,7 @@ export function getRichValue(field: HTMLElement, entities?: MessageEntity[]) {
return value;
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.getRichValue = getRichValue);
+MOUNT_CLASS_TO.getRichValue = getRichValue;
export type MarkdownType = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'monospace' | 'link';
export type MarkdownTag = {
@@ -336,7 +336,7 @@ export function generatePathData(x: number, y: number, width: number, height: nu
return data.join(' ');
};
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.generatePathData = generatePathData);
+MOUNT_CLASS_TO.generatePathData = generatePathData;
//export function findUpClassName(el: any, className: string): T;
export function findUpClassName(el: any, className: string): HTMLElement {
@@ -442,7 +442,7 @@ export function calcImageInBox(imageW: number, imageH: number, boxW: number, box
return {w: boxedImageW, h: boxedImageH};
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.calcImageInBox = calcImageInBox);
+MOUNT_CLASS_TO.calcImageInBox = calcImageInBox;
export function positionElementByIndex(element: HTMLElement, container: HTMLElement, pos: number) {
const prevPos = element.parentElement === container ? whichChild(element) : -1;
@@ -651,7 +651,7 @@ export const getElementByPoint = (container: HTMLElement, verticalSide: 'top' |
return document.elementFromPoint(x, y) as any;
};
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.getElementByPoint = getElementByPoint);
+MOUNT_CLASS_TO.getElementByPoint = getElementByPoint;
export async function getFilesFromEvent(e: ClipboardEvent | DragEvent, onlyTypes = false): Promise {
const files: any[] = [];
diff --git a/src/helpers/eventListenerBase.ts b/src/helpers/eventListenerBase.ts
index 6603b037..94de0dc6 100644
--- a/src/helpers/eventListenerBase.ts
+++ b/src/helpers/eventListenerBase.ts
@@ -41,7 +41,7 @@ import type { ArgumentTypes, SuperReturnType } from "../types";
// console.log = () => {};
// const e = new EventSystem();
-// MOUNT_CLASS_TO && (MOUNT_CLASS_TO.e = e);
+// MOUNT_CLASS_TO.e = e;
/**
* Better not to remove listeners during setting
diff --git a/src/helpers/mediaSizes.ts b/src/helpers/mediaSizes.ts
index f56c3fd2..513cd7b5 100644
--- a/src/helpers/mediaSizes.ts
+++ b/src/helpers/mediaSizes.ts
@@ -126,5 +126,5 @@ class MediaSizes extends EventListenerBase<{
}
const mediaSizes = new MediaSizes();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.mediaSizes = mediaSizes);
+MOUNT_CLASS_TO.mediaSizes = mediaSizes;
export default mediaSizes;
diff --git a/src/lang.ts b/src/lang.ts
index 1a81fd96..de1321ac 100644
--- a/src/lang.ts
+++ b/src/lang.ts
@@ -83,13 +83,17 @@ const lang = {
"ActionInviteUser": "un1 joined the group via invite link",
"ActionPinnedNoText": "un1 pinned a message",
"ActionMigrateFromGroup": "This group was upgraded to a supergroup",
+ "ActionYouScored": "You scored %1$s",
+ "ActionUserScored": "un1 scored %1$s",
+ "ActionYouScoredInGame": "You scored %1$s in un2",
+ "ActionUserScoredInGame": "un1 scored %1$s in un2",
"AttachPhoto": "Photo",
"AttachVideo": "Video",
"AttachGif": "GIF",
"AttachLocation": "Location",
"AttachLiveLocation": "Live Location",
"AttachContact": "Contact",
- "AttachDocument": "File",
+ //"AttachDocument": "File",
"AttachSticker": "Sticker",
"AttachAudio": "Voice message",
"AttachRound": "Video message",
@@ -216,7 +220,7 @@ const lang = {
"LinkCopiedPrivateInfo": "This link will only work for members of this chat.",
"GroupAddMembers": "Add Members",
"SendMessageTo": "Add people...",
- "SelectChat": "Select Chat",
+ //"SelectChat": "Select Chat",
"JumpToDate": "Jump to Date",
"Caption": "Caption",
"Message": "Message",
diff --git a/src/lib/appManagers/apiUpdatesManager.ts b/src/lib/appManagers/apiUpdatesManager.ts
index a517e70d..b4380e99 100644
--- a/src/lib/appManagers/apiUpdatesManager.ts
+++ b/src/lib/appManagers/apiUpdatesManager.ts
@@ -632,5 +632,5 @@ export class ApiUpdatesManager {
}
const apiUpdatesManager = new ApiUpdatesManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.apiUpdatesManager = apiUpdatesManager);
+MOUNT_CLASS_TO.apiUpdatesManager = apiUpdatesManager;
export default apiUpdatesManager
diff --git a/src/lib/appManagers/appChatsManager.ts b/src/lib/appManagers/appChatsManager.ts
index 9dc242d3..10a90230 100644
--- a/src/lib/appManagers/appChatsManager.ts
+++ b/src/lib/appManagers/appChatsManager.ts
@@ -718,5 +718,5 @@ export class AppChatsManager {
}
const appChatsManager = new AppChatsManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appChatsManager = appChatsManager);
+MOUNT_CLASS_TO.appChatsManager = appChatsManager;
export default appChatsManager;
diff --git a/src/lib/appManagers/appDialogsManager.ts b/src/lib/appManagers/appDialogsManager.ts
index 31310c82..c8ac4c05 100644
--- a/src/lib/appManagers/appDialogsManager.ts
+++ b/src/lib/appManagers/appDialogsManager.ts
@@ -1397,5 +1397,5 @@ export class AppDialogsManager {
}
const appDialogsManager = new AppDialogsManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appDialogsManager = appDialogsManager);
+MOUNT_CLASS_TO.appDialogsManager = appDialogsManager;
export default appDialogsManager;
diff --git a/src/lib/appManagers/appDocsManager.ts b/src/lib/appManagers/appDocsManager.ts
index c0857ef2..455a9e7d 100644
--- a/src/lib/appManagers/appDocsManager.ts
+++ b/src/lib/appManagers/appDocsManager.ts
@@ -395,5 +395,5 @@ export class AppDocsManager {
}
const appDocsManager = new AppDocsManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appDocsManager = appDocsManager);
+MOUNT_CLASS_TO.appDocsManager = appDocsManager;
export default appDocsManager;
diff --git a/src/lib/appManagers/appDraftsManager.ts b/src/lib/appManagers/appDraftsManager.ts
index 238e9868..dadd23f9 100644
--- a/src/lib/appManagers/appDraftsManager.ts
+++ b/src/lib/appManagers/appDraftsManager.ts
@@ -221,5 +221,5 @@ export class AppDraftsManager {
}
const appDraftsManager = new AppDraftsManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appDraftsManager = appDraftsManager);
+MOUNT_CLASS_TO.appDraftsManager = appDraftsManager;
export default appDraftsManager;
diff --git a/src/lib/appManagers/appImManager.ts b/src/lib/appManagers/appImManager.ts
index 945422d3..6d8b2bd3 100644
--- a/src/lib/appManagers/appImManager.ts
+++ b/src/lib/appManagers/appImManager.ts
@@ -118,47 +118,8 @@ export class AppImManager {
this.createNewChat();
this.chatsSelectTab(this.chat.container);
- window.addEventListener('hashchange', (e) => {
- const hash = location.hash;
- const splitted = hash.split('?');
-
- if(!splitted[1]) {
- return;
- }
-
- const params: any = {};
- splitted[1].split('&').forEach(item => {
- params[item.split('=')[0]] = decodeURIComponent(item.split('=')[1]);
- });
-
- this.log('hashchange', hash, splitted[0], params);
-
- switch(splitted[0]) {
- case '#/im': {
- const p = params.p;
- let postId = params.post !== undefined ? appMessagesManager.generateMessageId(+params.post) : undefined;
-
- switch(p[0]) {
- case '@': {
- appUsersManager.resolveUsername(p).then(peer => {
- const isUser = peer._ === 'user';
- const peerId = isUser ? peer.id : -peer.id;
-
- this.setInnerPeer(peerId, postId);
- });
- break;
- }
-
- default: { // peerId
- this.setInnerPeer(postId ? -+p : +p, postId);
- break;
- }
- }
- }
- }
-
- location.hash = '';
- });
+ appNavigationController.onHashChange = this.onHashChange;
+ //window.addEventListener('hashchange', this.onHashChange);
this.setSettings();
rootScope.on('settings_updated', this.setSettings);
@@ -205,6 +166,49 @@ export class AppImManager {
}); */
}
+ private onHashChange = () => {
+ const hash = location.hash;
+ const splitted = hash.split('?');
+
+ if(!splitted[1]) {
+ return;
+ }
+
+ const params: any = {};
+ splitted[1].split('&').forEach(item => {
+ params[item.split('=')[0]] = decodeURIComponent(item.split('=')[1]);
+ });
+
+ this.log('hashchange', hash, splitted[0], params);
+
+ switch(splitted[0]) {
+ case '#/im': {
+ const p = params.p;
+ let postId = params.post !== undefined ? appMessagesManager.generateMessageId(+params.post) : undefined;
+
+ switch(p[0]) {
+ case '@': {
+ appUsersManager.resolveUsername(p).then(peer => {
+ const isUser = peer._ === 'user';
+ const peerId = isUser ? peer.id : -peer.id;
+
+ this.setInnerPeer(peerId, postId);
+ });
+ break;
+ }
+
+ default: { // peerId
+ this.setInnerPeer(postId ? -+p : +p, postId);
+ break;
+ }
+ }
+ }
+ }
+
+ //appNavigationController.replaceState();
+ //location.hash = '';
+ };
+
public setBackground(url: string, broadcastEvent = true): Promise {
const promises = this.chats.map(chat => chat.setBackground(url));
return promises[promises.length - 1].then(() => {
@@ -594,14 +598,20 @@ export class AppImManager {
this.chats.push(chat);
}
- private spliceChats(fromIndex: number, justReturn = true, animate?: boolean) {
+ private spliceChats(fromIndex: number, justReturn = true, animate?: boolean, spliced?: Chat[]) {
if(fromIndex >= this.chats.length) return;
if(this.chats.length > 1 && justReturn) {
rootScope.broadcast('peer_changing', this.chat);
}
- const spliced = this.chats.splice(fromIndex, this.chats.length - fromIndex);
+ if(!spliced) {
+ spliced = this.chats.splice(fromIndex, this.chats.length - fromIndex);
+ }
+
+ for(let i = 0; i < spliced.length; ++i) {
+ appNavigationController.removeByType('chat', true);
+ }
// * fix middle chat z-index on animation
if(spliced.length > 1) {
@@ -655,8 +665,20 @@ export class AppImManager {
return;
}
} else if(chatIndex > 0 && chat.peerId && chat.peerId !== peerId) {
- this.spliceChats(1, false, animate);
- return this.setPeer(peerId, lastMsgId);
+ // const firstChat = this.chats[0];
+ // if(firstChat.peerId !== chat.peerId) {
+ /* // * slice idx > 0, set background and slice first, so new one will be the first
+ const spliced = this.chats.splice(1, this.chats.length - 1);
+ this.createNewChat();
+ this.chats.splice(0, 1); */
+ const spliced = this.chats.splice(1, this.chats.length - 1);
+ const ret = this.setPeer(peerId, lastMsgId);
+ this.spliceChats(0, false, false, spliced);
+ // } else {
+ // this.spliceChats(1, false, animate);
+ // }
+
+ return ret;
}
// * don't reset peer if returning
diff --git a/src/lib/appManagers/appMessagesManager.ts b/src/lib/appManagers/appMessagesManager.ts
index db28602c..b0f0686f 100644
--- a/src/lib/appManagers/appMessagesManager.ts
+++ b/src/lib/appManagers/appMessagesManager.ts
@@ -2375,9 +2375,6 @@ export class AppMessagesManager {
case 'messageMediaInvoice':
message.media = {_: 'messageMediaUnsupportedWeb'};
break;
- case 'messageMediaGeoLive':
- message.media._ = 'messageMediaGeo';
- break;
}
}
@@ -2504,7 +2501,11 @@ export class AppMessagesManager {
public wrapMessageForReply(message: any, text: string = message.message, usingMids?: number[], plain?: boolean, highlightWord?: string): DocumentFragment | string {
const parts: (HTMLElement | string)[] = [];
- const addPart = (part: string | HTMLElement, text?: string) => {
+ const addPart = (langKey: LangPackKey, part?: string | HTMLElement, text?: string) => {
+ if(langKey) {
+ part = plain ? I18n.format(langKey, true) : i18n(langKey);
+ }
+
if(plain) {
parts.push(part);
} else {
@@ -2538,7 +2539,7 @@ export class AppMessagesManager {
if(usingFullAlbum) {
text = this.getAlbumText(message.grouped_id).message;
- addPart(i18n('AttachAlbum'), text);
+ addPart('AttachAlbum', undefined, text);
}
} else {
usingFullAlbum = false;
@@ -2548,36 +2549,50 @@ export class AppMessagesManager {
const media = message.media;
switch(media._) {
case 'messageMediaPhoto':
- addPart(i18n('AttachPhoto'), message.message);
+ addPart('AttachPhoto', undefined, message.message);
break;
case 'messageMediaDice':
- addPart(plain ? media.emoticon : RichTextProcessor.wrapEmojiText(media.emoticon));
+ addPart(undefined, plain ? media.emoticon : RichTextProcessor.wrapEmojiText(media.emoticon));
+ break;
+ case 'messageMediaVenue': {
+ const text = plain ? media.title : RichTextProcessor.wrapEmojiText(media.title);
+ addPart('AttachLocation', undefined, text);
+ parts.push(htmlToDocumentFragment(text) as any);
break;
+ }
case 'messageMediaGeo':
- addPart(i18n('AttachLiveLocation'));
+ addPart('AttachLocation');
+ break;
+ case 'messageMediaGeoLive':
+ addPart('AttachLiveLocation');
break;
case 'messageMediaPoll':
- addPart(plain ? '📊' + ' ' + (media.poll.question || 'poll') : media.poll.rReply);
+ addPart(undefined, plain ? '📊' + ' ' + (media.poll.question || 'poll') : media.poll.rReply);
break;
case 'messageMediaContact':
- addPart(i18n('AttachContact'));
+ addPart('AttachContact');
break;
+ case 'messageMediaGame': {
+ const prefix = '🎮' + ' ';
+ addPart(undefined, plain ? prefix + media.game.title : RichTextProcessor.wrapEmojiText(prefix + media.game.title));
+ break;
+ }
case 'messageMediaDocument':
let document = media.document;
if(document.type === 'video') {
- addPart(i18n('AttachVideo'), message.message);
+ addPart('AttachVideo', undefined, message.message);
} else if(document.type === 'voice') {
- addPart(i18n('AttachAudio'), message.message);
+ addPart('AttachAudio', undefined, message.message);
} else if(document.type === 'gif') {
- addPart(i18n('AttachGif'), message.message);
+ addPart('AttachGif', undefined, message.message);
} else if(document.type === 'round') {
- addPart(i18n('AttachRound'), message.message);
+ addPart('AttachRound', undefined, message.message);
} else if(document.type === 'sticker') {
- addPart(((plain ? document.stickerEmojiRaw : document.stickerEmoji) || '') + 'Sticker');
+ addPart(undefined, ((plain ? document.stickerEmojiRaw : document.stickerEmoji) || '') + 'Sticker');
text = '';
} else {
- addPart(document.file_name, message.message);
+ addPart(document.file_name, undefined, message.message);
}
break;
@@ -2593,7 +2608,7 @@ export class AppMessagesManager {
if(message.action) {
const actionWrapped = this.wrapMessageActionTextNew(message, plain);
if(actionWrapped) {
- addPart(actionWrapped);
+ addPart(undefined, actionWrapped);
}
}
@@ -2699,6 +2714,7 @@ export class AppMessagesManager {
case 'messageActionPinMessage':
case 'messageActionContactSignUp':
+ case 'messageActionChatReturn':
case 'messageActionChatLeave':
case 'messageActionChatJoined':
case 'messageActionChatCreate':
@@ -4305,16 +4321,16 @@ export class AppMessagesManager {
case 'updateChannelReadMessagesContents':
case 'updateReadMessagesContents': {
const channelId = (update as Update.updateChannelReadMessagesContents).channel_id;
- const peerId = channelId ? -channelId : this.getMessageById(update.messages[0]).peerId;
- const messages: number[] = update.messages;
- for(const messageId of messages) {
- const message = this.getMessageByPeer(peerId, messageId);
+ const mids = (update as Update.updateReadMessagesContents).messages.map(id => this.generateMessageId(id));
+ const peerId = channelId ? -channelId : this.getMessageById(mids[0]).peerId;
+ for(const mid of mids) {
+ const message = this.getMessageByPeer(peerId, mid);
if(!message.deleted) {
delete message.pFlags.media_unread;
}
}
- rootScope.broadcast('messages_media_read', {peerId, mids: messages.map(id => this.generateMessageId(id))});
+ rootScope.broadcast('messages_media_read', {peerId, mids});
break;
}
@@ -5289,5 +5305,5 @@ export class AppMessagesManager {
}
const appMessagesManager = new AppMessagesManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appMessagesManager = appMessagesManager);
+MOUNT_CLASS_TO.appMessagesManager = appMessagesManager;
export default appMessagesManager;
diff --git a/src/lib/appManagers/appNotificationsManager.ts b/src/lib/appManagers/appNotificationsManager.ts
index 03c13d32..6e6f7739 100644
--- a/src/lib/appManagers/appNotificationsManager.ts
+++ b/src/lib/appManagers/appNotificationsManager.ts
@@ -717,5 +717,5 @@ export class AppNotificationsManager {
}
const appNotificationsManager = new AppNotificationsManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appNotificationsManager = appNotificationsManager);
+MOUNT_CLASS_TO.appNotificationsManager = appNotificationsManager;
export default appNotificationsManager;
diff --git a/src/lib/appManagers/appPeersManager.ts b/src/lib/appManagers/appPeersManager.ts
index 6db6f870..14e6c8ba 100644
--- a/src/lib/appManagers/appPeersManager.ts
+++ b/src/lib/appManagers/appPeersManager.ts
@@ -288,5 +288,5 @@ export class AppPeersManager {
}
const appPeersManager = new AppPeersManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appPeersManager = appPeersManager);
+MOUNT_CLASS_TO.appPeersManager = appPeersManager;
export default appPeersManager;
diff --git a/src/lib/appManagers/appPhotosManager.ts b/src/lib/appManagers/appPhotosManager.ts
index 4a50cfc8..20f73217 100644
--- a/src/lib/appManagers/appPhotosManager.ts
+++ b/src/lib/appManagers/appPhotosManager.ts
@@ -397,5 +397,5 @@ export class AppPhotosManager {
}
const appPhotosManager = new AppPhotosManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appPhotosManager = appPhotosManager);
+MOUNT_CLASS_TO.appPhotosManager = appPhotosManager;
export default appPhotosManager;
diff --git a/src/lib/appManagers/appPollsManager.ts b/src/lib/appManagers/appPollsManager.ts
index 1c3c84e2..82bf8eba 100644
--- a/src/lib/appManagers/appPollsManager.ts
+++ b/src/lib/appManagers/appPollsManager.ts
@@ -239,5 +239,5 @@ export class AppPollsManager {
}
const appPollsManager = new AppPollsManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appPollsManager = appPollsManager);
+MOUNT_CLASS_TO.appPollsManager = appPollsManager;
export default appPollsManager;
diff --git a/src/lib/appManagers/appPrivacyManager.ts b/src/lib/appManagers/appPrivacyManager.ts
index c5528b7a..b2d953c9 100644
--- a/src/lib/appManagers/appPrivacyManager.ts
+++ b/src/lib/appManagers/appPrivacyManager.ts
@@ -124,5 +124,5 @@ export class AppPrivacyManager {
}
const appPrivacyManager = new AppPrivacyManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appPrivacyManager = appPrivacyManager);
+MOUNT_CLASS_TO.appPrivacyManager = appPrivacyManager;
export default appPrivacyManager;
diff --git a/src/lib/appManagers/appStateManager.ts b/src/lib/appManagers/appStateManager.ts
index cd59e282..7bfd05de 100644
--- a/src/lib/appManagers/appStateManager.ts
+++ b/src/lib/appManagers/appStateManager.ts
@@ -281,5 +281,5 @@ export class AppStateManager extends EventListenerBase<{
//console.trace('appStateManager include');
const appStateManager = new AppStateManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appStateManager = appStateManager);
+MOUNT_CLASS_TO.appStateManager = appStateManager;
export default appStateManager;
\ No newline at end of file
diff --git a/src/lib/appManagers/appStickersManager.ts b/src/lib/appManagers/appStickersManager.ts
index 36a75a51..0d571629 100644
--- a/src/lib/appManagers/appStickersManager.ts
+++ b/src/lib/appManagers/appStickersManager.ts
@@ -280,5 +280,5 @@ export class AppStickersManager {
}
const appStickersManager = new AppStickersManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appStickersManager = appStickersManager);
+MOUNT_CLASS_TO.appStickersManager = appStickersManager;
export default appStickersManager;
diff --git a/src/lib/appManagers/appUsersManager.ts b/src/lib/appManagers/appUsersManager.ts
index c5db910c..8ba4ea45 100644
--- a/src/lib/appManagers/appUsersManager.ts
+++ b/src/lib/appManagers/appUsersManager.ts
@@ -794,5 +794,5 @@ export class AppUsersManager {
}
const appUsersManager = new AppUsersManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appUsersManager = appUsersManager);
+MOUNT_CLASS_TO.appUsersManager = appUsersManager;
export default appUsersManager
diff --git a/src/lib/cacheStorage.ts b/src/lib/cacheStorage.ts
index 7fcac2a5..351fd7ee 100644
--- a/src/lib/cacheStorage.ts
+++ b/src/lib/cacheStorage.ts
@@ -117,5 +117,5 @@ export default class CacheStorageController {
}
//const cacheStorage = new CacheStorageController();
-//MOUNT_CLASS_TO && (MOUNT_CLASS_TO.cacheStorage = cacheStorage);
+//MOUNT_CLASS_TO.cacheStorage = cacheStorage;
//export default cacheStorage;
diff --git a/src/lib/config.ts b/src/lib/config.ts
index 69689fce..b4a464f0 100644
--- a/src/lib/config.ts
+++ b/src/lib/config.ts
@@ -20,5 +20,5 @@ const Config = {
TLD,
MediaSizes: mediaSizes
};
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.Config = Config);
+MOUNT_CLASS_TO.Config = Config;
export default Config;
\ No newline at end of file
diff --git a/src/lib/crypto/cryptoworker.ts b/src/lib/crypto/cryptoworker.ts
index e896908a..b902d21b 100644
--- a/src/lib/crypto/cryptoworker.ts
+++ b/src/lib/crypto/cryptoworker.ts
@@ -125,5 +125,5 @@ class CryptoWorker extends CryptoWorkerMethods {
}
const cryptoWorker = new CryptoWorker();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.CryptoWorker = cryptoWorker);
+MOUNT_CLASS_TO.CryptoWorker = cryptoWorker;
export default cryptoWorker;
diff --git a/src/lib/langPack.ts b/src/lib/langPack.ts
index 3e7f390c..3ccf0383 100644
--- a/src/lib/langPack.ts
+++ b/src/lib/langPack.ts
@@ -330,4 +330,4 @@ export function join(elements: HTMLElement[], useLast = true) {
return arr;
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.I18n = I18n);
+MOUNT_CLASS_TO.I18n = I18n;
diff --git a/src/lib/lottieLoader.ts b/src/lib/lottieLoader.ts
index 266071bb..0984c0df 100644
--- a/src/lib/lottieLoader.ts
+++ b/src/lib/lottieLoader.ts
@@ -748,5 +748,5 @@ class LottieLoader {
}
const lottieLoader = new LottieLoader();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.lottieLoader = lottieLoader);
+MOUNT_CLASS_TO.lottieLoader = lottieLoader;
export default lottieLoader;
diff --git a/src/lib/mtproto/apiFileManager.ts b/src/lib/mtproto/apiFileManager.ts
index 55014f6c..47dd25be 100644
--- a/src/lib/mtproto/apiFileManager.ts
+++ b/src/lib/mtproto/apiFileManager.ts
@@ -574,5 +574,5 @@ export class ApiFileManager {
}
const apiFileManager = new ApiFileManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.apiFileManager = apiFileManager);
+MOUNT_CLASS_TO.apiFileManager = apiFileManager;
export default apiFileManager;
diff --git a/src/lib/mtproto/apiManager.ts b/src/lib/mtproto/apiManager.ts
index 97e98ed1..52c37482 100644
--- a/src/lib/mtproto/apiManager.ts
+++ b/src/lib/mtproto/apiManager.ts
@@ -12,7 +12,7 @@ import type { MethodDeclMap } from '../../layer';
import { CancellablePromise, deferredPromise } from '../../helpers/cancellablePromise';
import { bytesFromHex, bytesToHex } from '../../helpers/bytes';
//import { clamp } from '../../helpers/number';
-import { isSafari } from '../../helpers/userAgent';
+import { ctx, isSafari } from '../../helpers/userAgent';
import App from '../../config/app';
import { MOUNT_CLASS_TO } from '../../config/debug';
@@ -275,7 +275,7 @@ export class ApiManager {
});
const startTime = Date.now();
- const interval = MOUNT_CLASS_TO.setInterval(() => {
+ const interval = ctx.setInterval(() => {
this.log.error('Request is still processing:', method, params, options, 'time:', (Date.now() - startTime) / 1000);
//this.cachedUploadNetworkers[2].requestMessageStatus();
}, 5e3);
@@ -426,5 +426,5 @@ export class ApiManager {
}
const apiManager = new ApiManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.apiManager = apiManager);
+MOUNT_CLASS_TO.apiManager = apiManager;
export default apiManager;
diff --git a/src/lib/mtproto/mtproto.service.ts b/src/lib/mtproto/mtproto.service.ts
index 99e84495..4752e04e 100644
--- a/src/lib/mtproto/mtproto.service.ts
+++ b/src/lib/mtproto/mtproto.service.ts
@@ -239,4 +239,4 @@ function alignLimit(limit: number) {
//export default () => {};
-//MOUNT_CLASS_TO && (MOUNT_CLASS_TO.onFetch = onFetch);
+//MOUNT_CLASS_TO.onFetch = onFetch;
diff --git a/src/lib/mtproto/mtprotoworker.ts b/src/lib/mtproto/mtprotoworker.ts
index e0cf6f89..37611af7 100644
--- a/src/lib/mtproto/mtprotoworker.ts
+++ b/src/lib/mtproto/mtprotoworker.ts
@@ -475,5 +475,5 @@ export class ApiManagerProxy extends CryptoWorkerMethods {
}
const apiManagerProxy = new ApiManagerProxy();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.apiManagerProxy = apiManagerProxy);
+MOUNT_CLASS_TO.apiManagerProxy = apiManagerProxy;
export default apiManagerProxy;
diff --git a/src/lib/mtproto/passwordManager.ts b/src/lib/mtproto/passwordManager.ts
index d149ced3..cb55bc8b 100644
--- a/src/lib/mtproto/passwordManager.ts
+++ b/src/lib/mtproto/passwordManager.ts
@@ -104,5 +104,5 @@ export class PasswordManager {
}
const passwordManager = new PasswordManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.passwordManager = passwordManager);
+MOUNT_CLASS_TO.passwordManager = passwordManager;
export default passwordManager;
diff --git a/src/lib/mtproto/referenceDatabase.ts b/src/lib/mtproto/referenceDatabase.ts
index 865220a0..049bff58 100644
--- a/src/lib/mtproto/referenceDatabase.ts
+++ b/src/lib/mtproto/referenceDatabase.ts
@@ -115,5 +115,5 @@ class ReferenceDatabase {
}
const referenceDatabase = new ReferenceDatabase();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.referenceDatabase = referenceDatabase);
+MOUNT_CLASS_TO.referenceDatabase = referenceDatabase;
export default referenceDatabase;
\ No newline at end of file
diff --git a/src/lib/mtproto/timeManager.ts b/src/lib/mtproto/timeManager.ts
index 74c7afad..deb8efb7 100644
--- a/src/lib/mtproto/timeManager.ts
+++ b/src/lib/mtproto/timeManager.ts
@@ -66,5 +66,5 @@ export class TimeManager {
}
const timeManager = new TimeManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.timeManager = timeManager);
+MOUNT_CLASS_TO.timeManager = timeManager;
export default timeManager;
diff --git a/src/lib/mtproto/tl_utils.ts b/src/lib/mtproto/tl_utils.ts
index 9800cc59..5face43a 100644
--- a/src/lib/mtproto/tl_utils.ts
+++ b/src/lib/mtproto/tl_utils.ts
@@ -811,6 +811,6 @@ class TLDeserialization {
}
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.TLDeserialization = TLDeserialization);
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.TLSerialization = TLSerialization);
+MOUNT_CLASS_TO.TLDeserialization = TLDeserialization;
+MOUNT_CLASS_TO.TLSerialization = TLSerialization;
export { TLDeserialization, TLSerialization };
diff --git a/src/lib/opusDecodeController.ts b/src/lib/opusDecodeController.ts
index b5e62324..708ba3aa 100644
--- a/src/lib/opusDecodeController.ts
+++ b/src/lib/opusDecodeController.ts
@@ -173,5 +173,5 @@ export class OpusDecodeController {
}
const opusDecodeController = new OpusDecodeController();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.opusDecodeController = opusDecodeController);
+MOUNT_CLASS_TO.opusDecodeController = opusDecodeController;
export default opusDecodeController;
\ No newline at end of file
diff --git a/src/lib/richtextprocessor.ts b/src/lib/richtextprocessor.ts
index c3273a14..2d5d0fad 100644
--- a/src/lib/richtextprocessor.ts
+++ b/src/lib/richtextprocessor.ts
@@ -747,7 +747,7 @@ namespace RichTextProcessor {
}
}
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.RichTextProcessor = RichTextProcessor);
+MOUNT_CLASS_TO.RichTextProcessor = RichTextProcessor;
export {RichTextProcessor};
export default RichTextProcessor;
diff --git a/src/lib/rootScope.ts b/src/lib/rootScope.ts
index d07126df..5ce26428 100644
--- a/src/lib/rootScope.ts
+++ b/src/lib/rootScope.ts
@@ -159,5 +159,5 @@ class RootScope extends EventListenerBase {
}
const rootScope = new RootScope();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.rootScope = rootScope);
+MOUNT_CLASS_TO.rootScope = rootScope;
export default rootScope;
diff --git a/src/lib/sessionStorage.ts b/src/lib/sessionStorage.ts
index b992aaae..1d8472ef 100644
--- a/src/lib/sessionStorage.ts
+++ b/src/lib/sessionStorage.ts
@@ -24,5 +24,5 @@ const sessionStorage = new AppStorage<{
} & State>({
storeName: 'session'
});
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.appStorage = sessionStorage);
+MOUNT_CLASS_TO.appStorage = sessionStorage;
export default sessionStorage;
diff --git a/src/lib/webp/webpWorkerController.ts b/src/lib/webp/webpWorkerController.ts
index 3513c1f7..8e907f95 100644
--- a/src/lib/webp/webpWorkerController.ts
+++ b/src/lib/webp/webpWorkerController.ts
@@ -66,5 +66,5 @@ export class WebpWorkerController {
}
const webpWorkerController = new WebpWorkerController();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.webpWorkerController = webpWorkerController);
+MOUNT_CLASS_TO.webpWorkerController = webpWorkerController;
export default webpWorkerController;
\ No newline at end of file
diff --git a/src/pages/pagesManager.ts b/src/pages/pagesManager.ts
index 743c1b25..f609b534 100644
--- a/src/pages/pagesManager.ts
+++ b/src/pages/pagesManager.ts
@@ -46,5 +46,5 @@ class PagesManager {
}
const pagesManager = new PagesManager();
-MOUNT_CLASS_TO && (MOUNT_CLASS_TO.pagesManager = pagesManager);
+MOUNT_CLASS_TO.pagesManager = pagesManager;
export default pagesManager;
diff --git a/src/scss/partials/_chat.scss b/src/scss/partials/_chat.scss
index 58f00bbe..bd025702 100644
--- a/src/scss/partials/_chat.scss
+++ b/src/scss/partials/_chat.scss
@@ -1065,7 +1065,13 @@ $chat-helper-size: 39px;
}
@include respond-to(handhelds) {
- padding: 0 .75rem 0 .5rem;
+ padding: 0 .5rem;
+
+ .is-out {
+ .bubble-content-wrapper {
+ margin-right: .25rem;
+ }
+ }
html.is-mac & {
-webkit-user-select: none;