Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
morethanwords committed Nov 18, 2022
1 parent 3135aa2 commit f746a66
Show file tree
Hide file tree
Showing 81 changed files with 612 additions and 406 deletions.
2 changes: 1 addition & 1 deletion src/components/chat/autocompletePeerHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class AutocompletePeerHelper extends AutocompleteHelper {
this.container.classList.add(AutocompletePeerHelper.BASE_CLASS, className);
}

protected init() {
public init() {
this.list = document.createElement('div');
this.list.classList.add(AutocompletePeerHelper.BASE_CLASS + '-list', this.className + '-list');

Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/emojiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class EmojiHelper extends AutocompleteHelper {
this.container.classList.add('emoji-helper');
}

protected init() {
public init() {
this.list = document.createElement('div');
this.list.classList.add('emoji-helper-emojis', 'super-emojis');

Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/inlineHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export default class InlineHelper extends AutocompleteHelper {
return {user: peer, renderPromise};
};

protected init() {
public init() {
this.list = document.createElement('div');
this.list.classList.add('inline-helper-results');

Expand Down
11 changes: 9 additions & 2 deletions src/components/chat/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1512,10 +1512,17 @@ export default class ChatInput {
});

if(IS_TOUCH_SUPPORTED) {
attachClickEvent(this.messageInput, () => {
attachClickEvent(this.messageInput, (e) => {
if(emoticonsDropdown.isActive()) {
emoticonsDropdown.toggle(false);
blurActiveElement();
cancelEvent(e);
// this.messageInput.focus();
return;
}

this.appImManager.selectTab(1); // * set chat tab for album orientation
// this.saveScroll();
emoticonsDropdown.toggle(false);
}, {listenerSetter: this.listenerSetter});

/* this.listenerSetter.add(window)('resize', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/replyKeyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class ReplyKeyboard extends DropdownHover {
});
}

protected init() {
public init() {
this.appendTo.append(this.element);

this.listenerSetter.add(this)('open', async() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/stickersHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default class StickersHelper extends AutocompleteHelper {
});
}

protected init() {
public init() {
this.list = document.createElement('div');
this.list.classList.add('stickers-helper-stickers', 'super-stickers');

Expand Down
2 changes: 1 addition & 1 deletion src/components/emoticonsDropdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class EmoticonsDropdown extends DropdownHover {
return this.tabs[this.tabId];
}

protected init() {
public init() {
this.managers = rootScope.managers;
this.emojiTab = new EmojiTab(this.managers);
this.stickersTab = new StickersTab(this.managers);
Expand Down
2 changes: 1 addition & 1 deletion src/components/lazyLoadQueueBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import throttle from '../helpers/schedulers/throttle';
import {logger, LogTypes} from '../lib/logger';

const PARALLEL_LIMIT = 8;
const IGNORE_ERRORS: Set<ErrorType> = new Set(['NO_ENTRY_FOUND', 'STORAGE_OFFLINE', 'MIDDLEWARE']);
const IGNORE_ERRORS: Set<ErrorType> = new Set(['NO_ENTRY_FOUND', 'STORAGE_OFFLINE', 'MIDDLEWARE', 'NO_AUTO_DOWNLOAD']);

export type LazyLoadElementBase = {
load: () => Promise<any>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/2fa/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class AppTwoStepVerificationEmailTab extends SliderSuperTab {
public hint: string;
public isFirst = false;

protected init() {
public init() {
this.container.classList.add('two-step-verification', 'two-step-verification-email');
this.setTitle('RecoveryEmailTitle');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/2fa/emailConfirmation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class AppTwoStepVerificationEmailConfirmationTab extends SliderSu
public length: number;
public isFirst = false;

protected init() {
public init() {
this.container.classList.add('two-step-verification', 'two-step-verification-email-confirmation');
this.setTitle('TwoStepAuth.RecoveryTitle');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/2fa/enterPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class AppTwoStepVerificationEnterPasswordTab extends SliderSuperT
public plainPassword: string;
public isFirst = true;

protected init() {
public init() {
const isNew = !this.state.pFlags.has_password || this.plainPassword;
this.container.classList.add('two-step-verification', 'two-step-verification-enter-password');
this.setTitle(isNew ? 'PleaseEnterFirstPassword' : 'PleaseEnterCurrentPassword');
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/2fa/hint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class AppTwoStepVerificationHintTab extends SliderSuperTab {
public plainPassword: string;
public newPassword: string;

protected init() {
public init() {
this.container.classList.add('two-step-verification', 'two-step-verification-hint');
this.setTitle('TwoStepAuth.SetupHintTitle');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/2fa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class AppTwoStepVerificationTab extends SliderSuperTab {
public state: AccountPassword;
public plainPassword: string;

protected init() {
public init() {
this.container.classList.add('two-step-verification', 'two-step-verification-main');
this.setTitle('TwoStepVerificationTitle');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/2fa/passwordSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import wrapStickerEmoji from '../../../wrappers/stickerEmoji';
import AppSettingsTab from '../settings';

export default class AppTwoStepVerificationSetTab extends SliderSuperTab {
protected init() {
public init() {
this.container.classList.add('two-step-verification', 'two-step-verification-set');
this.setTitle('TwoStepVerificationPasswordSet');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/2fa/reEnterPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class AppTwoStepVerificationReEnterPasswordTab extends SliderSupe
public plainPassword: string;
public newPassword: string;

protected init() {
public init() {
this.container.classList.add('two-step-verification', 'two-step-verification-enter-password', 'two-step-verification-re-enter-password');
this.setTitle('PleaseReEnterPassword');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/activeSessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class AppActiveSessionsTab extends SliderSuperTabEventable {
public authorizations: Authorization.authorization[];
private menuElement: HTMLElement;

protected init() {
public init() {
this.header.classList.add('with-border');
this.container.classList.add('active-sessions-container');
this.setTitle('SessionsTitle');
Expand Down
43 changes: 19 additions & 24 deletions src/components/sidebarLeft/tabs/addMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ export default class AppAddMembersTab extends SliderSuperTab {
private takeOut: (peerIds: PeerId[]) => Promise<any> | false | void;
private skippable: boolean;

protected init() {
public init(options: {
title: LangPackKey,
placeholder: LangPackKey,
type: AppAddMembersTab['peerType'],
takeOut?: AppAddMembersTab['takeOut'],
skippable: boolean,
selectedPeerIds?: PeerId[]
}) {
this.container.classList.add('add-members-container');
this.nextBtn = ButtonCorner({icon: 'arrow_next'});
this.content.append(this.nextBtn);
Expand All @@ -39,28 +46,8 @@ export default class AppAddMembersTab extends SliderSuperTab {
}
}
});
}

public attachToPromise(promise: Promise<any>) {
const removeLoader = setButtonLoader(this.nextBtn, 'arrow_next');

promise.then(() => {
this.close();
}, () => {
removeLoader();
});
}

public open(options: {
title: LangPackKey,
placeholder: LangPackKey,
type: AppAddMembersTab['peerType'],
takeOut?: AppAddMembersTab['takeOut'],
skippable: boolean,
selectedPeerIds?: PeerId[]
}) {
const ret = super.open();

//
this.setTitle(options.title);
this.peerType = options.type;
this.takeOut = options.takeOut;
Expand All @@ -87,7 +74,15 @@ export default class AppAddMembersTab extends SliderSuperTab {
this.nextBtn.innerHTML = '';
this.nextBtn.disabled = false;
this.nextBtn.classList.toggle('is-visible', this.skippable);
}

return ret;
public attachToPromise(promise: Promise<any>) {
const removeLoader = setButtonLoader(this.nextBtn, 'arrow_next');

promise.then(() => {
this.close();
}, () => {
removeLoader();
});
}
}
}
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/archivedTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class AppArchivedTab extends SliderSuperTab {
private static filterId: REAL_FOLDER_ID = FOLDER_ID_ARCHIVE;
private wasFilterId: number;

protected init() {
public init() {
this.wasFilterId = appDialogsManager.filterId;

this.container.id = 'chats-archived-container';
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/autoDownload/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {RangeSettingSelector} from '../generalSettings';
import {autoDownloadPeerTypeSection} from './photo';

export default class AppAutoDownloadFileTab extends SliderSuperTabEventable {
protected init() {
public init() {
this.header.classList.add('with-border');
this.setTitle('AutoDownloadFiles');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/autoDownload/photo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function autoDownloadPeerTypeSection(type: 'photo' | 'video' | 'file', ti
}

export default class AppAutoDownloadPhotoTab extends SliderSuperTabEventable {
protected init() {
public init() {
this.header.classList.add('with-border');
this.setTitle('AutoDownloadPhotos');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/autoDownload/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {SliderSuperTabEventable} from '../../../sliderTab';
import {autoDownloadPeerTypeSection} from './photo';

export default class AppAutoDownloadVideoTab extends SliderSuperTabEventable {
protected init() {
public init() {
this.header.classList.add('with-border');
this.setTitle('AutoDownloadVideos');

Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/blockedUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class AppBlockedUsersTab extends SliderSuperTab {
public peerIds: PeerId[];
private menuElement: HTMLElement;

protected init() {
public init() {
this.header.classList.add('with-border');
this.container.classList.add('blocked-users-container');
this.setTitle('BlockedUsers');
Expand Down
26 changes: 17 additions & 9 deletions src/components/sidebarLeft/tabs/chatFolders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default class AppChatFoldersTab extends SliderSuperTab {
private filtersRendered: {[filterId: number]: Row} = {};
private loadAnimationPromise: ReturnType<LottieLoader['waitForFirstFrame']>;

public static getInitArgs() {
return lottieLoader.loadAnimationFromURLManually('Folders_1');
}

private async renderFolder(
dialogFilter: DialogFilterSuggested | MyDialogFilter,
container?: HTMLElement,
Expand Down Expand Up @@ -129,7 +133,7 @@ export default class AppChatFoldersTab extends SliderSuperTab {
return row;
}

protected async init() {
public init(p: ReturnType<typeof AppChatFoldersTab['getInitArgs']> = AppChatFoldersTab.getInitArgs()) {
this.container.classList.add('chat-folders-container');
this.setTitle('ChatList.Filter.List.Title');

Expand Down Expand Up @@ -227,19 +231,21 @@ export default class AppChatFoldersTab extends SliderSuperTab {
this.toggleAllChats();
});

this.loadAnimationPromise = lottieLoader.loadAnimationAsAsset({
container: this.stickerContainer,
loop: false,
autoplay: false,
width: 86,
height: 86
}, 'Folders_1').then((player) => {
this.loadAnimationPromise = p.then(async(cb) => {
const player = await cb({
container: this.stickerContainer,
loop: false,
autoplay: false,
width: 86,
height: 86
});

this.animation = player;

return lottieLoader.waitForFirstFrame(player);
});

this.getSuggestedFilters()
this.getSuggestedFilters();

/* return Promise.all([
this.loadAnimationPromise
Expand All @@ -252,6 +258,8 @@ export default class AppChatFoldersTab extends SliderSuperTab {
this.animation.autoplay = true;
this.animation.play();
});

return super.onOpenAfterTimeout();
}

private toggleAllChats() {
Expand Down
14 changes: 3 additions & 11 deletions src/components/sidebarLeft/tabs/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class AppContactsTab extends SliderSuperTab {
private middleware: ReturnType<typeof getMiddleware>;
private sortedUserList: SortedUserList;

protected init() {
public init() {
this.container.id = 'contacts-container';

// this.list = appDialogsManager.createChatList(/* {avatarSize: 48, handheldsSize: 66} */);
Expand All @@ -53,6 +53,8 @@ export default class AppContactsTab extends SliderSuperTab {

this.middleware = getMiddleware();

this.openContacts();

// preload contacts
// appUsersManager.getContacts();
}
Expand Down Expand Up @@ -83,11 +85,6 @@ export default class AppContactsTab extends SliderSuperTab {
}

public openContacts(query?: string) {
if(this.init) {
this.init();
this.init = null;
}

this.middleware.clean();
const middleware = this.middleware.get();
this.scrollable.onScrolledBottom = null;
Expand Down Expand Up @@ -126,9 +123,4 @@ export default class AppContactsTab extends SliderSuperTab {
replaceContent(this.scrollable.container, sortedUserList.list);
});
}

public open() {
this.openContacts();
return super.open();
}
}
2 changes: 1 addition & 1 deletion src/components/sidebarLeft/tabs/dataAndStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const AUTO_DOWNLOAD_FOR_KEYS: {[k in keyof AutoDownloadPeerTypeSettings]: LangPa
};

export default class AppDataAndStorageTab extends SliderSuperTabEventable {
protected async init() {
public async init() {
this.header.classList.add('with-border');
this.setTitle('DataSettings');

Expand Down
3 changes: 2 additions & 1 deletion src/components/sidebarLeft/tabs/editFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class AppEditFolderTab extends SliderSuperTab {
private type: 'edit' | 'create';
private loadAnimationPromise: ReturnType<LottieLoader['waitForFirstFrame']>;

protected init() {
public init() {
this.container.classList.add('edit-folder-container');
this.caption = document.createElement('div');
this.caption.classList.add('caption');
Expand Down Expand Up @@ -390,6 +390,7 @@ export default class AppEditFolderTab extends SliderSuperTab {
this.type = 'edit';
}

// @ts-ignore
return super.open().then(() => {
if(this.type === 'edit') {
this.setFilter(this.originalFilter, true);
Expand Down
Loading

0 comments on commit f746a66

Please sign in to comment.