Browse Source

some fixes

master
Eduard Kuzmenko 3 years ago
parent
commit
4782a02a3c
  1. 9
      src/components/appSearchSuper..ts
  2. 1
      src/components/chat/bubbles.ts
  3. 9
      src/components/sidebarRight/tabs/sharedMedia.ts
  4. 2
      src/lib/mtproto/apiManager.ts
  5. 5
      src/lib/mtproto/dcConfigurator.ts
  6. 10
      src/lib/mtproto/networker.ts

9
src/components/appSearchSuper..ts

@ -55,6 +55,7 @@ import safeAssign from "../helpers/object/safeAssign";
import escapeRegExp from "../helpers/string/escapeRegExp"; import escapeRegExp from "../helpers/string/escapeRegExp";
import limitSymbols from "../helpers/string/limitSymbols"; import limitSymbols from "../helpers/string/limitSymbols";
import findAndSplice from "../helpers/array/findAndSplice"; import findAndSplice from "../helpers/array/findAndSplice";
import { ScrollStartCallbackDimensions } from "../helpers/fastSmoothScroll";
//const testScroll = false; //const testScroll = false;
@ -297,6 +298,8 @@ export default class AppSearchSuper {
private searchContextMenu: SearchContextMenu; private searchContextMenu: SearchContextMenu;
public selection: SearchSelection; public selection: SearchSelection;
public scrollStartCallback: (dimensions: ScrollStartCallbackDimensions) => void;
constructor(options: Pick<AppSearchSuper, 'mediaTabs' | 'scrollable' | 'searchGroups' | 'asChatList' | 'groupByMonth' | 'hideEmptyTabs' | 'onChangeTab' | 'showSender'>) { constructor(options: Pick<AppSearchSuper, 'mediaTabs' | 'scrollable' | 'searchGroups' | 'asChatList' | 'groupByMonth' | 'hideEmptyTabs' | 'onChangeTab' | 'showSender'>) {
safeAssign(this, options); safeAssign(this, options);
@ -407,7 +410,8 @@ export default class AppSearchSuper {
if(this.prevTabId === id && !this.skipScroll) { if(this.prevTabId === id && !this.skipScroll) {
this.scrollable.scrollIntoViewNew({ this.scrollable.scrollIntoViewNew({
element: this.container, element: this.container,
position: 'start' position: 'start',
startCallback: this.scrollStartCallback
}); });
return; return;
} }
@ -432,7 +436,8 @@ export default class AppSearchSuper {
if(scrollTop < offsetTop) { if(scrollTop < offsetTop) {
this.scrollable.scrollIntoViewNew({ this.scrollable.scrollIntoViewNew({
element: this.container, element: this.container,
position: 'start' position: 'start',
startCallback: this.scrollStartCallback
}); });
scrollTop = offsetTop; scrollTop = offsetTop;
} }

1
src/components/chat/bubbles.ts

@ -2377,6 +2377,7 @@ export default class ChatBubbles {
if(!peerId) { if(!peerId) {
this.cleanup(true); this.cleanup(true);
this.peerId = peerId; this.peerId = peerId;
this.preloader.detach();
return null; return null;
} }

9
src/components/sidebarRight/tabs/sharedMedia.ts

@ -98,7 +98,10 @@ export default class AppSharedMediaTab extends SliderSuperTab {
if(!rect.width) return; if(!rect.width) return;
const top = rect.top - 1; const top = rect.top - 1;
const isSharedMedia = top <= HEADER_HEIGHT; setIsSharedMedia(top <= HEADER_HEIGHT);
};
const setIsSharedMedia = (isSharedMedia: boolean) => {
animatedCloseIcon.classList.toggle('state-back', isSharedMedia); animatedCloseIcon.classList.toggle('state-back', isSharedMedia);
this.searchSuper.container.classList.toggle('is-full-viewport', isSharedMedia); this.searchSuper.container.classList.toggle('is-full-viewport', isSharedMedia);
transition(+isSharedMedia); transition(+isSharedMedia);
@ -208,6 +211,10 @@ export default class AppSharedMediaTab extends SliderSuperTab {
} }
}); });
this.searchSuper.scrollStartCallback = () => {
setIsSharedMedia(true);
};
this.profile.element.append(this.searchSuper.container); this.profile.element.append(this.searchSuper.container);
const btnAddMembers = ButtonCorner({icon: 'addmember_filled'}); const btnAddMembers = ButtonCorner({icon: 'addmember_filled'});

2
src/lib/mtproto/apiManager.ts

@ -32,6 +32,7 @@ import Modes from '../../config/modes';
import bytesFromHex from '../../helpers/bytes/bytesFromHex'; import bytesFromHex from '../../helpers/bytes/bytesFromHex';
import bytesToHex from '../../helpers/bytes/bytesToHex'; import bytesToHex from '../../helpers/bytes/bytesToHex';
import isObject from '../../helpers/object/isObject'; import isObject from '../../helpers/object/isObject';
import { pause } from '../../helpers/schedulers/pause';
/// #if !MTPROTO_WORKER /// #if !MTPROTO_WORKER
import rootScope from '../rootScope'; import rootScope from '../rootScope';
@ -40,7 +41,6 @@ import rootScope from '../rootScope';
/// #if MTPROTO_AUTO /// #if MTPROTO_AUTO
import transportController from './transports/controller'; import transportController from './transports/controller';
import MTTransport from './transports/transport'; import MTTransport from './transports/transport';
import { pause } from '../../helpers/schedulers/pause';
/// #endif /// #endif
/* var networker = apiManager.cachedNetworkers.websocket.upload[2]; /* var networker = apiManager.cachedNetworkers.websocket.upload[2];

5
src/lib/mtproto/dcConfigurator.ts

@ -13,6 +13,7 @@ import MTTransport, { MTConnectionConstructable } from './transports/transport';
import Modes from '../../config/modes'; import Modes from '../../config/modes';
import App from '../../config/app'; import App from '../../config/app';
import indexOfAndSplice from '../../helpers/array/indexOfAndSplice'; import indexOfAndSplice from '../../helpers/array/indexOfAndSplice';
import { MOUNT_CLASS_TO } from '../../config/debug';
/// #if MTPROTO_HAS_HTTP /// #if MTPROTO_HAS_HTTP
import HTTP from './transports/http'; import HTTP from './transports/http';
@ -162,4 +163,6 @@ export class DcConfigurator {
} }
} }
export default new DcConfigurator(); const dcConfigurator = new DcConfigurator();
MOUNT_CLASS_TO && (MOUNT_CLASS_TO.dcConfigurator = dcConfigurator);
export default dcConfigurator;

10
src/lib/mtproto/networker.ts

@ -1644,7 +1644,9 @@ export default class MTPNetworker {
} */ } */
private applyServerTime(messageId: string) { private applyServerTime(messageId: string) {
return timeManager.applyServerTime(bigInt(messageId).shiftRight(32).toJSNumber()); const serverTime = bigInt(messageId).shiftRight(32).toJSNumber();
this.log('applying server time', serverTime);
return timeManager.applyServerTime(serverTime);
} }
// * https://core.telegram.org/mtproto/service_messages_about_messages#notice-of-ignored-error-message // * https://core.telegram.org/mtproto/service_messages_about_messages#notice-of-ignored-error-message
@ -1717,7 +1719,11 @@ export default class MTPNetworker {
case 32: // * msg_seqno too low case 32: // * msg_seqno too low
case 33: // * msg_seqno too high case 33: // * msg_seqno too high
case 64: { // * invalid container case 64: { // * invalid container
if(message.error_code === 17 || changedTimeOffset) { if(changedTimeOffset === undefined) {
this.applyServerTime(messageId);
}
if(message.error_code === 17) {
this.log('Update session'); this.log('Update session');
this.updateSession(); this.updateSession();
} }

Loading…
Cancel
Save