|
|
@ -1,6 +1,6 @@ |
|
|
|
import { horizontalMenu, formatPhoneNumber } from "../../components/misc"; |
|
|
|
import { horizontalMenu, formatPhoneNumber, putPreloader } from "../../components/misc"; |
|
|
|
import Scrollable from '../../components/scrollable'; |
|
|
|
import Scrollable from '../../components/scrollable'; |
|
|
|
import { isElementInViewport, $rootScope } from "../utils"; |
|
|
|
import { $rootScope } from "../utils"; |
|
|
|
import appMessagesManager from "./appMessagesManager"; |
|
|
|
import appMessagesManager from "./appMessagesManager"; |
|
|
|
import appPhotosManager from "./appPhotosManager"; |
|
|
|
import appPhotosManager from "./appPhotosManager"; |
|
|
|
import appPeersManager from "./appPeersManager"; |
|
|
|
import appPeersManager from "./appPeersManager"; |
|
|
@ -38,13 +38,13 @@ class AppSidebarRight { |
|
|
|
contentLinks: this.profileContentEl.querySelector('#content-links') as HTMLDivElement, |
|
|
|
contentLinks: this.profileContentEl.querySelector('#content-links') as HTMLDivElement, |
|
|
|
contentAudio: this.profileContentEl.querySelector('#content-audio') as HTMLDivElement, |
|
|
|
contentAudio: this.profileContentEl.querySelector('#content-audio') as HTMLDivElement, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
public lastSharedMediaDiv: HTMLDivElement = null; |
|
|
|
public lastSharedMediaDiv: HTMLDivElement = null; |
|
|
|
|
|
|
|
|
|
|
|
private loadSidebarMediaPromises: { |
|
|
|
private loadSidebarMediaPromises: { |
|
|
|
[type: string]: Promise<void> |
|
|
|
[type: string]: Promise<void> |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
|
|
public sharedMediaTypes = [ |
|
|
|
public sharedMediaTypes = [ |
|
|
|
'inputMessagesFilterContacts', |
|
|
|
'inputMessagesFilterContacts', |
|
|
|
'inputMessagesFilterPhotoVideo', |
|
|
|
'inputMessagesFilterPhotoVideo', |
|
|
@ -54,7 +54,7 @@ class AppSidebarRight { |
|
|
|
]; |
|
|
|
]; |
|
|
|
public sharedMediaType: string = ''; |
|
|
|
public sharedMediaType: string = ''; |
|
|
|
private sharedMediaSelected: HTMLDivElement = null; |
|
|
|
private sharedMediaSelected: HTMLDivElement = null; |
|
|
|
|
|
|
|
|
|
|
|
private lazyLoadQueueSidebar = new LazyLoadQueue(5); |
|
|
|
private lazyLoadQueueSidebar = new LazyLoadQueue(5); |
|
|
|
/* public minMediaID: { |
|
|
|
/* public minMediaID: { |
|
|
|
[type: string]: number |
|
|
|
[type: string]: number |
|
|
@ -62,17 +62,17 @@ class AppSidebarRight { |
|
|
|
public cleared: { |
|
|
|
public cleared: { |
|
|
|
[type: string]: boolean |
|
|
|
[type: string]: boolean |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
|
|
public historiesStorage: { |
|
|
|
public historiesStorage: { |
|
|
|
[peerID: number]: { |
|
|
|
[peerID: number]: { |
|
|
|
[type: string]: number[] |
|
|
|
[type: string]: number[] |
|
|
|
} |
|
|
|
} |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
|
|
private log = logger('SR'); |
|
|
|
private log = logger('SR'); |
|
|
|
|
|
|
|
|
|
|
|
private peerID = 0; |
|
|
|
private peerID = 0; |
|
|
|
|
|
|
|
|
|
|
|
public sidebarScroll: Scrollable = null; |
|
|
|
public sidebarScroll: Scrollable = null; |
|
|
|
private savedVirtualStates: { |
|
|
|
private savedVirtualStates: { |
|
|
|
[id: number]: { |
|
|
|
[id: number]: { |
|
|
@ -80,25 +80,37 @@ class AppSidebarRight { |
|
|
|
paddings: any |
|
|
|
paddings: any |
|
|
|
} |
|
|
|
} |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
|
|
private profileTabs: HTMLUListElement; |
|
|
|
private profileTabs: HTMLUListElement; |
|
|
|
private prevTabID = -1; |
|
|
|
private prevTabID = -1; |
|
|
|
|
|
|
|
|
|
|
|
private mediaDivsByIDs: { |
|
|
|
private mediaDivsByIDs: { |
|
|
|
[mid: number]: HTMLDivElement |
|
|
|
[mid: number]: HTMLDivElement |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
|
|
constructor() { |
|
|
|
constructor() { |
|
|
|
let container = this.profileContentEl.querySelector('.profile-tabs-content') as HTMLDivElement; |
|
|
|
let container = this.profileContentEl.querySelector('.profile-tabs-content') as HTMLDivElement; |
|
|
|
this.profileTabs = this.profileContentEl.querySelector('.profile-tabs') as HTMLUListElement; |
|
|
|
this.profileTabs = this.profileContentEl.querySelector('.profile-tabs') as HTMLUListElement; |
|
|
|
|
|
|
|
|
|
|
|
this.sidebarScroll = new Scrollable(this.sidebarEl, false, true, 500, 'SR'); |
|
|
|
this.sidebarScroll = new Scrollable(this.sidebarEl, false, true, 500, 'SR'); |
|
|
|
this.sidebarScroll.container.addEventListener('scroll', this.onSidebarScroll.bind(this)); |
|
|
|
this.sidebarScroll.container.addEventListener('scroll', this.onSidebarScroll.bind(this)); |
|
|
|
|
|
|
|
this.sidebarScroll.onScrolledBottom = () => { |
|
|
|
|
|
|
|
if(this.sharedMediaSelected && !this.sidebarScroll.hiddenElements.down.length |
|
|
|
|
|
|
|
&& this.sharedMediaSelected.childElementCount/* && false */) { |
|
|
|
|
|
|
|
this.loadSidebarMedia(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
horizontalMenu(this.profileTabs, container, (id, tabContent) => { |
|
|
|
horizontalMenu(this.profileTabs, container, (id, tabContent) => { |
|
|
|
|
|
|
|
if(this.prevTabID == id) return; |
|
|
|
|
|
|
|
|
|
|
|
this.sharedMediaType = this.sharedMediaTypes[id]; |
|
|
|
this.sharedMediaType = this.sharedMediaTypes[id]; |
|
|
|
this.sharedMediaSelected = tabContent.firstElementChild as HTMLDivElement; |
|
|
|
this.sharedMediaSelected = tabContent.firstElementChild as HTMLDivElement; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.prevTabID != -1 && !this.sharedMediaSelected.childElementCount) { // quick brown fix
|
|
|
|
|
|
|
|
this.loadSidebarMedia(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.prevTabID != -1) { |
|
|
|
if(this.prevTabID != -1) { |
|
|
|
this.savedVirtualStates[this.prevTabID] = { |
|
|
|
this.savedVirtualStates[this.prevTabID] = { |
|
|
|
hiddenElements: { |
|
|
|
hiddenElements: { |
|
|
@ -111,254 +123,248 @@ class AppSidebarRight { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.prevTabID = id; |
|
|
|
this.prevTabID = id; |
|
|
|
|
|
|
|
|
|
|
|
//this.log('setVirtualContainer', id, this.sharedMediaSelected);
|
|
|
|
this.log('setVirtualContainer', id, this.sharedMediaSelected); |
|
|
|
this.sidebarScroll.setVirtualContainer(this.sharedMediaSelected); |
|
|
|
this.sidebarScroll.setVirtualContainer(this.sharedMediaSelected); |
|
|
|
|
|
|
|
|
|
|
|
if(this.savedVirtualStates[id]) { |
|
|
|
if(this.savedVirtualStates[id]) { |
|
|
|
this.log(this.savedVirtualStates[id]); |
|
|
|
this.log(this.savedVirtualStates[id]); |
|
|
|
this.sidebarScroll.hiddenElements = this.savedVirtualStates[id].hiddenElements; |
|
|
|
this.sidebarScroll.hiddenElements = this.savedVirtualStates[id].hiddenElements; |
|
|
|
this.sidebarScroll.paddings = this.savedVirtualStates[id].paddings; |
|
|
|
this.sidebarScroll.paddings = this.savedVirtualStates[id].paddings; |
|
|
|
} |
|
|
|
} |
|
|
|
}, this.onSidebarScroll.bind(this)); |
|
|
|
}, this.onSidebarScroll.bind(this)); |
|
|
|
|
|
|
|
|
|
|
|
//(this.profileTabs.children[1] as HTMLLIElement).click(); // set media
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let sidebarCloseBtn = this.sidebarEl.querySelector('.sidebar-close-button') as HTMLButtonElement; |
|
|
|
let sidebarCloseBtn = this.sidebarEl.querySelector('.sidebar-close-button') as HTMLButtonElement; |
|
|
|
sidebarCloseBtn.addEventListener('click', () => { |
|
|
|
sidebarCloseBtn.addEventListener('click', () => { |
|
|
|
this.toggleSidebar(false); |
|
|
|
this.toggleSidebar(false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.sharedMedia.contentMedia.addEventListener('click', (e) => { |
|
|
|
this.sharedMedia.contentMedia.addEventListener('click', (e) => { |
|
|
|
let target = e.target as HTMLDivElement; |
|
|
|
let target = e.target as HTMLDivElement; |
|
|
|
|
|
|
|
|
|
|
|
let messageID = +target.getAttribute('message-id'); |
|
|
|
let messageID = +target.getAttribute('message-id'); |
|
|
|
if(!messageID) { |
|
|
|
if(!messageID) { |
|
|
|
this.log.warn('no messageID by click on target:', target); |
|
|
|
this.log.warn('no messageID by click on target:', target); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let message = appMessagesManager.getMessage(messageID); |
|
|
|
let message = appMessagesManager.getMessage(messageID); |
|
|
|
|
|
|
|
|
|
|
|
let ids = Object.keys(this.mediaDivsByIDs).map(k => +k).sort(); |
|
|
|
let ids = Object.keys(this.mediaDivsByIDs).map(k => +k).sort(); |
|
|
|
let idx = ids.findIndex(i => i == messageID); |
|
|
|
let idx = ids.findIndex(i => i == messageID); |
|
|
|
|
|
|
|
|
|
|
|
let prev = ids[idx + 1] || null; |
|
|
|
let prev = ids[idx + 1] || null; |
|
|
|
let next = ids[idx - 1] || null; |
|
|
|
let next = ids[idx - 1] || null; |
|
|
|
|
|
|
|
|
|
|
|
appMediaViewer.openMedia(message, target, this.mediaDivsByIDs[prev] || null, this.mediaDivsByIDs[next] || null); |
|
|
|
appMediaViewer.openMedia(message, target, this.mediaDivsByIDs[prev] || null, this.mediaDivsByIDs[next] || null); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.profileElements.notificationsCheckbox.addEventListener('change', () => { |
|
|
|
this.profileElements.notificationsCheckbox.addEventListener('change', () => { |
|
|
|
let checked = this.profileElements.notificationsCheckbox.checked; |
|
|
|
//let checked = this.profileElements.notificationsCheckbox.checked;
|
|
|
|
appImManager.mutePeer(); |
|
|
|
appImManager.mutePeer(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('resize', () => { |
|
|
|
window.addEventListener('resize', () => { |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.sidebarScroll.onScroll(); |
|
|
|
this.sidebarScroll.onScroll(); |
|
|
|
this.onSidebarScroll(); |
|
|
|
this.onSidebarScroll(); |
|
|
|
}, 0); |
|
|
|
}, 0); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if(testScroll) { |
|
|
|
if(testScroll) { |
|
|
|
let div = document.createElement('div'); |
|
|
|
let div = document.createElement('div'); |
|
|
|
for(let i = 0; i < 500; ++i) { |
|
|
|
for(let i = 0; i < 500; ++i) { |
|
|
|
//div.insertAdjacentHTML('beforeend', `<div message-id="0" style="background-image: url(assets/img/camomile.jpg);"></div>`);
|
|
|
|
//div.insertAdjacentHTML('beforeend', `<div message-id="0" style="background-image: url(assets/img/camomile.jpg);"></div>`);
|
|
|
|
div.insertAdjacentHTML('beforeend', `<div data-id="${i / 3 | 0}">${i / 3 | 0}</div>`); |
|
|
|
div.insertAdjacentHTML('beforeend', `<div data-id="${i / 3 | 0}">${i / 3 | 0}</div>`); |
|
|
|
|
|
|
|
|
|
|
|
if((i + 1) % 3 == 0) { |
|
|
|
if((i + 1) % 3 == 0) { |
|
|
|
this.sharedMedia.contentMedia.append(div); |
|
|
|
this.sharedMedia.contentMedia.append(div); |
|
|
|
div = document.createElement('div'); |
|
|
|
div = document.createElement('div'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
div.dataset.id = '' + (i / 3 | 0); |
|
|
|
div.dataset.id = '' + (i / 3 | 0); |
|
|
|
} |
|
|
|
} |
|
|
|
this.sharedMedia.contentMedia.append(div); |
|
|
|
this.sharedMedia.contentMedia.append(div); |
|
|
|
(this.profileTabs.children[1] as HTMLLIElement).click(); // set media
|
|
|
|
(this.profileTabs.children[1] as HTMLLIElement).click(); // set media
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public onSidebarScroll() { |
|
|
|
public onSidebarScroll() { |
|
|
|
this.lazyLoadQueueSidebar.check(); |
|
|
|
this.lazyLoadQueueSidebar.check(); |
|
|
|
|
|
|
|
|
|
|
|
if(this.sharedMediaSelected && !this.sidebarScroll.hiddenElements.down.length/* && false */) { |
|
|
|
|
|
|
|
let media = Array.from(this.sharedMediaSelected.childNodes).slice(-15); |
|
|
|
|
|
|
|
for(let div of media) { |
|
|
|
|
|
|
|
if(isElementInViewport(div)) { |
|
|
|
|
|
|
|
//this.log('Will load more media');
|
|
|
|
|
|
|
|
this.loadSidebarMedia(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
|
|
|
|
this.sidebarEl.style.display = enable ? 'block' : 'none'; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.sidebarEl.style.display = isElementInViewport(this.sidebarEl) ? 'none' : 'block'; */ |
|
|
|
|
|
|
|
if(enable !== undefined) { |
|
|
|
if(enable !== undefined) { |
|
|
|
this.sidebarEl.style.width = enable ? '25%' : '0%'; |
|
|
|
if(enable) this.sidebarEl.classList.add('active'); |
|
|
|
|
|
|
|
else this.sidebarEl.classList.remove('active'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.sidebarEl.style.width = isElementInViewport(this.sidebarEl) ? '0%' : '25%'; |
|
|
|
if(this.sidebarEl.classList.contains('active')) { |
|
|
|
|
|
|
|
this.sidebarEl.classList.remove('active'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.sidebarEl.classList.add('active'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public loadSidebarMedia(single = false) { |
|
|
|
public loadSidebarMedia(single = false) { |
|
|
|
if(testScroll) { |
|
|
|
if(testScroll /* || 1 == 1 */) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//this.log('loadSidebarMedia', single, this.peerID);
|
|
|
|
|
|
|
|
|
|
|
|
let peerID = this.peerID; |
|
|
|
let peerID = this.peerID; |
|
|
|
|
|
|
|
|
|
|
|
let typesToLoad = single ? [this.sharedMediaType] : this.sharedMediaTypes; |
|
|
|
let typesToLoad = single ? [this.sharedMediaType] : this.sharedMediaTypes; |
|
|
|
|
|
|
|
|
|
|
|
if(!this.historiesStorage[peerID]) this.historiesStorage[peerID] = {}; |
|
|
|
if(!this.historiesStorage[peerID]) this.historiesStorage[peerID] = {}; |
|
|
|
let historyStorage = this.historiesStorage[peerID]; |
|
|
|
let historyStorage = this.historiesStorage[peerID]; |
|
|
|
|
|
|
|
|
|
|
|
let promises = typesToLoad.map(type => { |
|
|
|
let promises = typesToLoad.map(type => { |
|
|
|
if(this.loadSidebarMediaPromises[type]) return this.loadSidebarMediaPromises[type]; |
|
|
|
if(this.loadSidebarMediaPromises[type]) return this.loadSidebarMediaPromises[type]; |
|
|
|
|
|
|
|
|
|
|
|
if(!historyStorage[type]) historyStorage[type] = []; |
|
|
|
if(!historyStorage[type]) historyStorage[type] = []; |
|
|
|
let history = historyStorage[type]; |
|
|
|
let history = historyStorage[type]; |
|
|
|
|
|
|
|
|
|
|
|
// заливать новую картинку сюда только после полной отправки!
|
|
|
|
// заливать новую картинку сюда только после полной отправки!
|
|
|
|
//let maxID = this.minMediaID[type] || 0;
|
|
|
|
//let maxID = this.minMediaID[type] || 0;
|
|
|
|
let maxID = history[history.length - 1] || 0; |
|
|
|
let maxID = history[history.length - 1] || 0; |
|
|
|
|
|
|
|
|
|
|
|
let ids = !maxID && appMessagesManager.historiesStorage[peerID] |
|
|
|
let ids = !maxID && appMessagesManager.historiesStorage[peerID] |
|
|
|
? appMessagesManager.historiesStorage[peerID].history.slice() : []; |
|
|
|
? appMessagesManager.historiesStorage[peerID].history.slice() : []; |
|
|
|
|
|
|
|
|
|
|
|
maxID = !maxID && ids.length ? ids[ids.length - 1] : maxID; |
|
|
|
maxID = !maxID && ids.length ? ids[ids.length - 1] : maxID; |
|
|
|
//this.log('search house of glass pre', type, ids, maxID);
|
|
|
|
//this.log('search house of glass pre', type, ids, maxID);
|
|
|
|
|
|
|
|
|
|
|
|
return this.loadSidebarMediaPromises[type] = appMessagesManager.getSearch(peerID, '', {_: type}, maxID, 50) |
|
|
|
return this.loadSidebarMediaPromises[type] = appMessagesManager.getSearch(peerID, '', {_: type}, maxID, history.length ? 50 : 15) |
|
|
|
.then(value => { |
|
|
|
.then(value => { |
|
|
|
ids = ids.concat(value.history); |
|
|
|
ids = ids.concat(value.history); |
|
|
|
history.push(...ids); |
|
|
|
history.push(...ids); |
|
|
|
|
|
|
|
|
|
|
|
//this.log('search house of glass', type, value, ids, this.cleared);
|
|
|
|
//this.log('search house of glass', type, value, ids, this.cleared);
|
|
|
|
|
|
|
|
|
|
|
|
if($rootScope.selectedPeerID != peerID) { |
|
|
|
if($rootScope.selectedPeerID != peerID) { |
|
|
|
this.log.warn('peer changed'); |
|
|
|
this.log.warn('peer changed'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.cleared[type]) { |
|
|
|
if(this.cleared[type]) { |
|
|
|
ids = history; |
|
|
|
ids = history; |
|
|
|
delete this.cleared[type]; |
|
|
|
delete this.cleared[type]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ids.forEach(mid => { |
|
|
|
let sharedMediaDiv: HTMLDivElement; |
|
|
|
//this.minMediaID[type] = mid;
|
|
|
|
let messages: any[] = []; |
|
|
|
|
|
|
|
for(let mid of ids) { |
|
|
|
let message = appMessagesManager.getMessage(mid); |
|
|
|
let message = appMessagesManager.getMessage(mid); |
|
|
|
if(!message.media) return; |
|
|
|
if(message.media) messages.push(message); |
|
|
|
|
|
|
|
} |
|
|
|
/*'inputMessagesFilterContacts', |
|
|
|
|
|
|
|
'inputMessagesFilterPhotoVideo', |
|
|
|
/*'inputMessagesFilterContacts', |
|
|
|
'inputMessagesFilterDocument', |
|
|
|
'inputMessagesFilterPhotoVideo', |
|
|
|
'inputMessagesFilterUrl', |
|
|
|
'inputMessagesFilterDocument', |
|
|
|
'inputMessagesFilterVoice'*/ |
|
|
|
'inputMessagesFilterUrl', |
|
|
|
switch(type) { |
|
|
|
'inputMessagesFilterVoice'*/ |
|
|
|
case 'inputMessagesFilterPhotoVideo': { |
|
|
|
switch(type) { |
|
|
|
/* if(!(message.media.photo || message.media.document || message.media.webpage.document)) { |
|
|
|
case 'inputMessagesFilterPhotoVideo': { |
|
|
|
this.log.error('no media!', message); |
|
|
|
sharedMediaDiv = this.sharedMedia.contentMedia; |
|
|
|
break; |
|
|
|
|
|
|
|
} */ |
|
|
|
for(let message of messages) { |
|
|
|
|
|
|
|
|
|
|
|
let media = message.media.photo || message.media.document || (message.media.webpage && message.media.webpage.document); |
|
|
|
let media = message.media.photo || message.media.document || (message.media.webpage && message.media.webpage.document); |
|
|
|
|
|
|
|
|
|
|
|
if(!media) { |
|
|
|
if(!media) { |
|
|
|
//this.log('no media!', message);
|
|
|
|
//this.log('no media!', message);
|
|
|
|
break; |
|
|
|
continue;; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(media._ == 'document' && media.type != 'video'/* && media.type != 'gif' */) { |
|
|
|
if(media._ == 'document' && media.type != 'video'/* && media.type != 'gif' */) { |
|
|
|
//this.log('broken video', media);
|
|
|
|
//this.log('broken video', media);
|
|
|
|
break; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let div = document.createElement('div'); |
|
|
|
let div = document.createElement('div'); |
|
|
|
//console.log(message, photo);
|
|
|
|
//console.log(message, photo);
|
|
|
|
|
|
|
|
|
|
|
|
let sizes = media.sizes || media.thumbs; |
|
|
|
let sizes = media.sizes || media.thumbs; |
|
|
|
if(sizes && sizes[0].bytes) { |
|
|
|
if(sizes && sizes[0].bytes) { |
|
|
|
appPhotosManager.setAttachmentPreview(sizes[0].bytes, div, false, true); |
|
|
|
appPhotosManager.setAttachmentPreview(sizes[0].bytes, div, false, true); |
|
|
|
} /* else { |
|
|
|
} /* else { |
|
|
|
this.log('no stripped size', message, media); |
|
|
|
this.log('no stripped size', message, media); |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
//this.log('inputMessagesFilterPhotoVideo', message, media);
|
|
|
|
//this.log('inputMessagesFilterPhotoVideo', message, media);
|
|
|
|
|
|
|
|
|
|
|
|
let load = () => appPhotosManager.preloadPhoto(media, appPhotosManager.choosePhotoSize(media, 380, 0)) |
|
|
|
let load = () => appPhotosManager.preloadPhoto(media, appPhotosManager.choosePhotoSize(media, 380, 0)) |
|
|
|
.then((blob) => { |
|
|
|
.then((blob) => { |
|
|
|
if($rootScope.selectedPeerID != peerID) { |
|
|
|
if($rootScope.selectedPeerID != peerID) { |
|
|
|
this.log.warn('peer changed'); |
|
|
|
this.log.warn('peer changed'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
div.style.backgroundImage = 'url(' + URL.createObjectURL(blob) + ')'; |
|
|
|
div.style.backgroundImage = 'url(' + URL.createObjectURL(blob) + ')'; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
div.setAttribute('message-id', '' + mid); |
|
|
|
div.setAttribute('message-id', '' + message.mid); |
|
|
|
|
|
|
|
|
|
|
|
this.lazyLoadQueueSidebar.push({div, load}); |
|
|
|
this.lazyLoadQueueSidebar.push({div, load}); |
|
|
|
|
|
|
|
|
|
|
|
this.lastSharedMediaDiv.append(div); |
|
|
|
this.lastSharedMediaDiv.append(div); |
|
|
|
if(this.lastSharedMediaDiv.childElementCount == 3) { |
|
|
|
if(this.lastSharedMediaDiv.childElementCount == 3) { |
|
|
|
this.sharedMedia.contentMedia.append(this.lastSharedMediaDiv); |
|
|
|
this.sidebarScroll.append(this.lastSharedMediaDiv); |
|
|
|
this.lastSharedMediaDiv = document.createElement('div'); |
|
|
|
this.lastSharedMediaDiv = document.createElement('div'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.mediaDivsByIDs[mid] = div; |
|
|
|
this.mediaDivsByIDs[message.mid] = div; |
|
|
|
|
|
|
|
|
|
|
|
//this.sharedMedia.contentMedia.append(div);
|
|
|
|
//sharedMediaDiv.append(div);
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case 'inputMessagesFilterDocument': { |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'inputMessagesFilterDocument': { |
|
|
|
|
|
|
|
sharedMediaDiv = this.sharedMedia.contentDocuments; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let message of messages) { |
|
|
|
if(!message.media.document || message.media.document.type == 'voice') { |
|
|
|
if(!message.media.document || message.media.document.type == 'voice') { |
|
|
|
break; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let doc = message.media.document; |
|
|
|
let doc = message.media.document; |
|
|
|
if(doc.attributes) { |
|
|
|
if(doc.attributes) { |
|
|
|
if(doc.attributes.find((a: any) => a._ == "documentAttributeSticker")) { |
|
|
|
if(doc.attributes.find((a: any) => a._ == "documentAttributeSticker")) { |
|
|
|
break; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//this.log('come back down to my knees', message);
|
|
|
|
//this.log('come back down to my knees', message);
|
|
|
|
|
|
|
|
|
|
|
|
let div = wrapDocument(message.media.document, true); |
|
|
|
let div = wrapDocument(message.media.document, true); |
|
|
|
this.sharedMedia.contentDocuments.append(div); |
|
|
|
this.sidebarScroll.append(div); |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'inputMessagesFilterUrl': { |
|
|
|
|
|
|
|
sharedMediaDiv = this.sharedMedia.contentLinks; |
|
|
|
|
|
|
|
|
|
|
|
case 'inputMessagesFilterUrl': { |
|
|
|
for(let message of messages) { |
|
|
|
if(!message.media.webpage || message.media.webpage._ == 'webPageEmpty') { |
|
|
|
if(!message.media.webpage || message.media.webpage._ == 'webPageEmpty') { |
|
|
|
break; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let webpage = message.media.webpage; |
|
|
|
let webpage = message.media.webpage; |
|
|
|
let div = document.createElement('div'); |
|
|
|
let div = document.createElement('div'); |
|
|
|
|
|
|
|
|
|
|
|
let previewDiv = document.createElement('div'); |
|
|
|
let previewDiv = document.createElement('div'); |
|
|
|
previewDiv.classList.add('preview'); |
|
|
|
previewDiv.classList.add('preview'); |
|
|
|
|
|
|
|
|
|
|
|
//this.log('wrapping webpage', webpage);
|
|
|
|
//this.log('wrapping webpage', webpage);
|
|
|
|
|
|
|
|
|
|
|
|
if(webpage.photo) { |
|
|
|
if(webpage.photo) { |
|
|
|
let load = () => appPhotosManager.preloadPhoto(webpage.photo.id, appPhotosManager.choosePhotoSize(webpage.photo, 380, 0)) |
|
|
|
let load = () => appPhotosManager.preloadPhoto(webpage.photo.id, appPhotosManager.choosePhotoSize(webpage.photo, 380, 0)) |
|
|
|
.then((blob) => { |
|
|
|
.then((blob) => { |
|
|
@ -366,61 +372,69 @@ class AppSidebarRight { |
|
|
|
this.log.warn('peer changed'); |
|
|
|
this.log.warn('peer changed'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
previewDiv.style.backgroundImage = 'url(' + URL.createObjectURL(blob) + ')'; |
|
|
|
previewDiv.style.backgroundImage = 'url(' + URL.createObjectURL(blob) + ')'; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.lazyLoadQueueSidebar.push({div: previewDiv, load}); |
|
|
|
this.lazyLoadQueueSidebar.push({div: previewDiv, load}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
previewDiv.innerText = (webpage.title || webpage.description || webpage.url || webpage.display_url).slice(0, 1); |
|
|
|
previewDiv.innerText = (webpage.title || webpage.description || webpage.url || webpage.display_url).slice(0, 1); |
|
|
|
previewDiv.classList.add('empty'); |
|
|
|
previewDiv.classList.add('empty'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let title = webpage.rTitle || ''; |
|
|
|
let title = webpage.rTitle || ''; |
|
|
|
let subtitle = webpage.rDescription || ''; |
|
|
|
let subtitle = webpage.rDescription || ''; |
|
|
|
let url = RichTextProcessor.wrapRichText(webpage.url || ''); |
|
|
|
let url = RichTextProcessor.wrapRichText(webpage.url || ''); |
|
|
|
|
|
|
|
|
|
|
|
if(!title) { |
|
|
|
if(!title) { |
|
|
|
//title = new URL(webpage.url).hostname;
|
|
|
|
//title = new URL(webpage.url).hostname;
|
|
|
|
title = webpage.display_url.split('/', 1)[0]; |
|
|
|
title = webpage.display_url.split('/', 1)[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
div.append(previewDiv); |
|
|
|
div.append(previewDiv); |
|
|
|
div.insertAdjacentHTML('beforeend', ` |
|
|
|
div.insertAdjacentHTML('beforeend', ` |
|
|
|
<div class="title">${title}</div> |
|
|
|
<div class="title">${title}</div> |
|
|
|
<div class="subtitle">${subtitle}</div> |
|
|
|
<div class="subtitle">${subtitle}</div> |
|
|
|
<div class="url">${url}</div> |
|
|
|
<div class="url">${url}</div> |
|
|
|
`);
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
|
|
|
if(div.innerText.trim().length) { |
|
|
|
if(div.innerText.trim().length) { |
|
|
|
this.sharedMedia.contentLinks.append(div); |
|
|
|
this.sidebarScroll.append(div); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* case 'inputMessagesFilterVoice': { |
|
|
|
|
|
|
|
//this.log('wrapping audio', message.media);
|
|
|
|
|
|
|
|
if(!message.media || !message.media.document || message.media.document.type != 'voice') { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let doc = message.media.document; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.log('wrapping audio', doc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let audioDiv = wrapAudio(doc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.sharedMedia.contentAudio.append(audioDiv); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
//console.warn('death is my friend', message);
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* case 'inputMessagesFilterVoice': { |
|
|
|
|
|
|
|
//this.log('wrapping audio', message.media);
|
|
|
|
|
|
|
|
if(!message.media || !message.media.document || message.media.document.type != 'voice') { |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let doc = message.media.document; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.log('wrapping audio', doc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let audioDiv = wrapAudio(doc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.sharedMedia.contentAudio.append(audioDiv); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
//console.warn('death is my friend', message);
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(sharedMediaDiv) { |
|
|
|
|
|
|
|
let parent = sharedMediaDiv.parentElement; |
|
|
|
|
|
|
|
if(parent.lastElementChild.classList.contains('preloader')) { |
|
|
|
|
|
|
|
parent.lastElementChild.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.onSidebarScroll(); |
|
|
|
this.onSidebarScroll(); |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
@ -430,26 +444,17 @@ class AppSidebarRight { |
|
|
|
this.loadSidebarMediaPromises[type] = null; |
|
|
|
this.loadSidebarMediaPromises[type] = null; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return promises; |
|
|
|
return promises; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public fillProfileElements() { |
|
|
|
public fillProfileElements() { |
|
|
|
let peerID = this.peerID = $rootScope.selectedPeerID; |
|
|
|
let peerID = this.peerID = $rootScope.selectedPeerID; |
|
|
|
this.loadSidebarMediaPromises = {}; |
|
|
|
this.loadSidebarMediaPromises = {}; |
|
|
|
this.lastSharedMediaDiv = document.createElement('div'); |
|
|
|
this.lastSharedMediaDiv = document.createElement('div'); |
|
|
|
|
|
|
|
|
|
|
|
//this.log('fillProfileElements');
|
|
|
|
//this.log('fillProfileElements');
|
|
|
|
|
|
|
|
|
|
|
|
this.savedVirtualStates = {}; |
|
|
|
|
|
|
|
this.prevTabID = -1; |
|
|
|
|
|
|
|
this.sidebarScroll.setVirtualContainer(null); |
|
|
|
|
|
|
|
(this.profileTabs.children[1] as HTMLLIElement).click(); // set media
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.sharedMediaSelected) { |
|
|
|
|
|
|
|
//this.sidebarScroll.setVirtualContainer(this.sharedMediaSelected);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.profileContentEl.parentElement.scrollTop = 0; |
|
|
|
this.profileContentEl.parentElement.scrollTop = 0; |
|
|
|
this.profileElements.bio.style.display = 'none'; |
|
|
|
this.profileElements.bio.style.display = 'none'; |
|
|
|
this.profileElements.phone.style.display = 'none'; |
|
|
|
this.profileElements.phone.style.display = 'none'; |
|
|
@ -457,40 +462,48 @@ class AppSidebarRight { |
|
|
|
this.profileElements.notificationsRow.style.display = ''; |
|
|
|
this.profileElements.notificationsRow.style.display = ''; |
|
|
|
this.profileElements.notificationsCheckbox.checked = true; |
|
|
|
this.profileElements.notificationsCheckbox.checked = true; |
|
|
|
this.profileElements.notificationsStatus.innerText = 'Enabled'; |
|
|
|
this.profileElements.notificationsStatus.innerText = 'Enabled'; |
|
|
|
|
|
|
|
|
|
|
|
this.mediaDivsByIDs = {}; |
|
|
|
this.mediaDivsByIDs = {}; |
|
|
|
|
|
|
|
|
|
|
|
this.lazyLoadQueueSidebar.clear(); |
|
|
|
this.lazyLoadQueueSidebar.clear(); |
|
|
|
|
|
|
|
|
|
|
|
Object.keys(this.sharedMedia).forEach(key => { |
|
|
|
Object.keys(this.sharedMedia).forEach(key => { |
|
|
|
this.sharedMedia[key].innerHTML = ''; |
|
|
|
this.sharedMedia[key].innerHTML = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let parent = this.sharedMedia[key].parentElement; |
|
|
|
|
|
|
|
if(!parent.querySelector('.preloader')) { |
|
|
|
|
|
|
|
putPreloader(parent, true); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.sharedMediaTypes.forEach(type => { |
|
|
|
this.sharedMediaTypes.forEach(type => { |
|
|
|
//this.minMediaID[type] = 0;
|
|
|
|
//this.minMediaID[type] = 0;
|
|
|
|
this.cleared[type] = true; |
|
|
|
this.cleared[type] = true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.savedVirtualStates = {}; |
|
|
|
|
|
|
|
this.prevTabID = -1; |
|
|
|
|
|
|
|
this.sidebarScroll.setVirtualContainer(null); |
|
|
|
|
|
|
|
(this.profileTabs.children[1] as HTMLLIElement).click(); // set media
|
|
|
|
|
|
|
|
|
|
|
|
let setText = (text: string, el: HTMLDivElement) => { |
|
|
|
let setText = (text: string, el: HTMLDivElement) => { |
|
|
|
el.style.display = ''; |
|
|
|
el.style.display = ''; |
|
|
|
if(el.childElementCount > 1) { |
|
|
|
if(el.childElementCount > 1) { |
|
|
|
el.firstElementChild.remove(); |
|
|
|
el.firstElementChild.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let p = document.createElement('p'); |
|
|
|
let p = document.createElement('p'); |
|
|
|
p.innerHTML = text; |
|
|
|
p.innerHTML = text; |
|
|
|
el.prepend(p); |
|
|
|
el.prepend(p); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// username
|
|
|
|
// username
|
|
|
|
if(peerID != appImManager.myID) { |
|
|
|
if(peerID != appImManager.myID) { |
|
|
|
let username = appPeersManager.getPeerUsername(peerID); |
|
|
|
let username = appPeersManager.getPeerUsername(peerID); |
|
|
|
if(username) { |
|
|
|
if(username) { |
|
|
|
setText(appPeersManager.getPeerUsername(peerID), this.profileElements.username); |
|
|
|
setText(appPeersManager.getPeerUsername(peerID), this.profileElements.username); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(peerID != appImManager.myID) { |
|
|
|
|
|
|
|
let dialog: any = appMessagesManager.getDialogByPeerID(peerID); |
|
|
|
let dialog: any = appMessagesManager.getDialogByPeerID(peerID); |
|
|
|
if(dialog.length) { |
|
|
|
if(dialog.length) { |
|
|
|
dialog = dialog[0]; |
|
|
|
dialog = dialog[0]; |
|
|
@ -498,57 +511,57 @@ class AppSidebarRight { |
|
|
|
if(dialog.notify_settings && dialog.notify_settings.mute_until) { |
|
|
|
if(dialog.notify_settings && dialog.notify_settings.mute_until) { |
|
|
|
muted = new Date(dialog.notify_settings.mute_until * 1000) > new Date(); |
|
|
|
muted = new Date(dialog.notify_settings.mute_until * 1000) > new Date(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
appImManager.setMutedState(muted); |
|
|
|
appImManager.setMutedState(muted); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.profileElements.notificationsRow.style.display = 'none'; |
|
|
|
this.profileElements.notificationsRow.style.display = 'none'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(peerID > 0) { |
|
|
|
if(peerID > 0) { |
|
|
|
let user = appUsersManager.getUser(peerID); |
|
|
|
let user = appUsersManager.getUser(peerID); |
|
|
|
if(user.phone && peerID != appImManager.myID) { |
|
|
|
if(user.phone && peerID != appImManager.myID) { |
|
|
|
setText('+' + formatPhoneNumber(user.phone).formatted, this.profileElements.phone); |
|
|
|
setText('+' + formatPhoneNumber(user.phone).formatted, this.profileElements.phone); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
appProfileManager.getProfile(peerID, true).then(userFull => { |
|
|
|
appProfileManager.getProfile(peerID, true).then(userFull => { |
|
|
|
if(this.peerID != peerID) { |
|
|
|
if(this.peerID != peerID) { |
|
|
|
this.log.warn('peer changed'); |
|
|
|
this.log.warn('peer changed'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(userFull.rAbout && peerID != appImManager.myID) { |
|
|
|
if(userFull.rAbout && peerID != appImManager.myID) { |
|
|
|
setText(userFull.rAbout, this.profileElements.bio); |
|
|
|
setText(userFull.rAbout, this.profileElements.bio); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//this.log('userFull', userFull);
|
|
|
|
//this.log('userFull', userFull);
|
|
|
|
|
|
|
|
|
|
|
|
if(userFull.pinned_msg_id) { // request pinned message
|
|
|
|
if(userFull.pinned_msg_id) { // request pinned message
|
|
|
|
appImManager.pinnedMsgID = userFull.pinned_msg_id; |
|
|
|
appImManager.pinnedMsgID = userFull.pinned_msg_id; |
|
|
|
appMessagesManager.wrapSingleMessage(userFull.pinned_msg_id); |
|
|
|
appMessagesManager.wrapSingleMessage(userFull.pinned_msg_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.sidebarScroll.getScrollTopOffset(); |
|
|
|
this.sidebarScroll.getScrollTopOffset(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
let chat = appPeersManager.getPeer(peerID); |
|
|
|
let chat = appPeersManager.getPeer(peerID); |
|
|
|
|
|
|
|
|
|
|
|
appProfileManager.getChatFull(chat.id).then((chatFull: any) => { |
|
|
|
appProfileManager.getChatFull(chat.id).then((chatFull: any) => { |
|
|
|
if(this.peerID != peerID) { |
|
|
|
if(this.peerID != peerID) { |
|
|
|
this.log.warn('peer changed'); |
|
|
|
this.log.warn('peer changed'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//this.log('chatInfo res 2:', chatFull);
|
|
|
|
//this.log('chatInfo res 2:', chatFull);
|
|
|
|
|
|
|
|
|
|
|
|
if(chatFull.about) { |
|
|
|
if(chatFull.about) { |
|
|
|
setText(RichTextProcessor.wrapRichText(chatFull.about), this.profileElements.bio); |
|
|
|
setText(RichTextProcessor.wrapRichText(chatFull.about), this.profileElements.bio); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.sidebarScroll.getScrollTopOffset(); |
|
|
|
this.sidebarScroll.getScrollTopOffset(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.sidebarScroll.getScrollTopOffset(); |
|
|
|
this.sidebarScroll.getScrollTopOffset(); |
|
|
|
//this.loadSidebarMedia();
|
|
|
|
//this.loadSidebarMedia();
|
|
|
|
} |
|
|
|
} |
|
|
|