Temp
This commit is contained in:
parent
7728d82fa2
commit
a4b023a247
@ -1618,17 +1618,33 @@ export default class ChatBubbles {
|
|||||||
|
|
||||||
this.chat.dispatchEvent('setPeer', lastMsgId, !isJump);
|
this.chat.dispatchEvent('setPeer', lastMsgId, !isJump);
|
||||||
|
|
||||||
// warning
|
const isFetchIntervalNeeded = () => peerId < 0 && !this.appChatsManager.isInChat(peerId);
|
||||||
if((!lastMsgId && !savedPosition) || this.bubbles[topMessage] || lastMsgId === topMessage) {
|
const needFetchInterval = isFetchIntervalNeeded();
|
||||||
this.scrollable.loadedAll.bottom = true;
|
const needFetchNew = savedPosition || needFetchInterval;
|
||||||
}
|
if(!needFetchNew) {
|
||||||
|
// warning
|
||||||
if(savedPosition) {
|
if(!lastMsgId || this.bubbles[topMessage] || lastMsgId === topMessage) {
|
||||||
|
this.scrollable.loadedAll.bottom = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Promise.all([setPeerPromise, getHeavyAnimationPromise()]).then(() => {
|
Promise.all([setPeerPromise, getHeavyAnimationPromise()]).then(() => {
|
||||||
this.scrollable.checkForTriggers();
|
this.scrollable.checkForTriggers();
|
||||||
|
|
||||||
|
if(needFetchInterval) {
|
||||||
|
const middleware = this.getMiddleware();
|
||||||
|
const interval = window.setInterval(() => {
|
||||||
|
if(!middleware() || !isFetchIntervalNeeded()) {
|
||||||
|
clearInterval(interval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.scrollable.loadedAll.bottom = false;
|
||||||
|
this.loadMoreHistory(false);
|
||||||
|
}, 30e3);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.log('scrolledAllDown:', this.scrollable.loadedAll.bottom);
|
this.log('scrolledAllDown:', this.scrollable.loadedAll.bottom);
|
||||||
|
|
||||||
//if(!this.unreaded.length && dialog) { // lol
|
//if(!this.unreaded.length && dialog) { // lol
|
||||||
|
@ -393,6 +393,21 @@ export class AppChatsManager {
|
|||||||
return this.isChannel(id) && !this.isMegagroup(id);
|
return this.isChannel(id) && !this.isMegagroup(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isInChat(id: number) {
|
||||||
|
let good = true;
|
||||||
|
const chat: Chat = this.getChat(id);
|
||||||
|
if(chat._ === 'channelForbidden'
|
||||||
|
|| chat._ === 'chatForbidden'
|
||||||
|
|| chat._ === 'chatEmpty'
|
||||||
|
|| (chat as Chat.chat).pFlags.left
|
||||||
|
|| (chat as Chat.chat).pFlags.kicked
|
||||||
|
|| (chat as Chat.chat).pFlags.deactivated) {
|
||||||
|
good = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return good;
|
||||||
|
}
|
||||||
|
|
||||||
public getChannelInput(id: number): InputChannel {
|
public getChannelInput(id: number): InputChannel {
|
||||||
if(id < 0) id = -id;
|
if(id < 0) id = -id;
|
||||||
const chat: Chat = this.getChat(id);
|
const chat: Chat = this.getChat(id);
|
||||||
|
@ -3652,14 +3652,7 @@ export class AppMessagesManager {
|
|||||||
if(!dialog && !isLocalThreadUpdate) {
|
if(!dialog && !isLocalThreadUpdate) {
|
||||||
let good = true;
|
let good = true;
|
||||||
if(peerId < 0) {
|
if(peerId < 0) {
|
||||||
const chat = appChatsManager.getChat(-peerId);
|
good = appChatsManager.isInChat(-peerId);
|
||||||
if(chat._ === 'channelForbidden'
|
|
||||||
|| chat._ === 'chatForbidden'
|
|
||||||
|| (chat as Chat.chat).pFlags.left
|
|
||||||
|| (chat as Chat.chat).pFlags.kicked
|
|
||||||
|| (chat as Chat.chat).pFlags.deactivated) {
|
|
||||||
good = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(good) {
|
if(good) {
|
||||||
@ -4034,7 +4027,7 @@ export class AppMessagesManager {
|
|||||||
const peerId = -channelId;
|
const peerId = -channelId;
|
||||||
const channel = appChatsManager.getChat(channelId);
|
const channel = appChatsManager.getChat(channelId);
|
||||||
|
|
||||||
const needDialog = channel._ === 'channel' && (!channel.pFlags.left && !channel.pFlags.kicked);
|
const needDialog = channel._ === 'channel' && appChatsManager.isInChat(channelId);
|
||||||
const dialog = this.getDialogOnly(peerId);
|
const dialog = this.getDialogOnly(peerId);
|
||||||
|
|
||||||
const canViewHistory = channel._ === 'channel' && (channel.username || !channel.pFlags.left && !channel.pFlags.kicked);
|
const canViewHistory = channel._ === 'channel' && (channel.username || !channel.pFlags.left && !channel.pFlags.kicked);
|
||||||
|
@ -35,7 +35,7 @@ export type IDBOptions = {
|
|||||||
version?: number
|
version?: number
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEBUG = true;
|
const DEBUG = false;
|
||||||
|
|
||||||
export default class IDBStorage {
|
export default class IDBStorage {
|
||||||
private static STORAGES: IDBStorage[] = [];
|
private static STORAGES: IDBStorage[] = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user