Browse Source

Some fixes

master
Eduard Kuzmenko 2 years ago
parent
commit
b83982b8b9
  1. 3
      src/components/emoticonsDropdown/index.ts
  2. 4
      src/components/poll.ts
  3. 6
      src/components/sidebarLeft/index.ts
  4. 6
      src/lib/appManagers/appDialogsManager.ts
  5. 20
      src/lib/appManagers/appImManager.ts
  6. 1
      src/lib/mediaPlayer.ts

3
src/components/emoticonsDropdown/index.ts

@ -29,6 +29,7 @@ import pause from "../../helpers/schedulers/pause"; @@ -29,6 +29,7 @@ import pause from "../../helpers/schedulers/pause";
import { IS_APPLE_MOBILE } from "../../environment/userAgent";
import { AppManagers } from "../../lib/appManagers/managers";
import type LazyLoadQueueIntersector from "../lazyLoadQueueIntersector";
import { simulateClickEvent } from "../../helpers/dom/clickEvent";
export const EMOTICONSSTICKERGROUP = 'emoticons-dropdown';
@ -176,7 +177,7 @@ export class EmoticonsDropdown extends DropdownHover { @@ -176,7 +177,7 @@ export class EmoticonsDropdown extends DropdownHover {
(this.tabsEl.children[1] as HTMLElement).classList.add('hide');
}
(this.tabsEl.children[INIT_TAB_ID + 1] as HTMLLIElement).click(); // set emoji tab
simulateClickEvent(this.tabsEl.children[INIT_TAB_ID + 1] as HTMLElement); // set emoji tab
if(this.tabs[INIT_TAB_ID].init) {
this.tabs[INIT_TAB_ID].init(); // onTransitionEnd не вызовется, т.к. это первая открытая вкладка
}

4
src/components/poll.ts

@ -16,7 +16,7 @@ import { fastRaf } from "../helpers/schedulers"; @@ -16,7 +16,7 @@ import { fastRaf } from "../helpers/schedulers";
import SetTransition from "./singleTransition";
import findUpClassName from "../helpers/dom/findUpClassName";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent";
import { attachClickEvent, detachClickEvent, simulateClickEvent } from "../helpers/dom/clickEvent";
import replaceContent from "../helpers/dom/replaceContent";
import windowSize from "../helpers/windowSize";
import { Message, MessageMedia, Poll, PollResults } from "../layer";
@ -470,7 +470,7 @@ export default class PollElement extends HTMLElement { @@ -470,7 +470,7 @@ export default class PollElement extends HTMLElement {
if(this.sentVote) {
const correctResult = results.results.find((r) => r.pFlags.correct);
if(correctResult && !correctResult.pFlags.chosen) {
toggleHint.click();
simulateClickEvent(toggleHint);
}
}
}

6
src/components/sidebarLeft/index.ts

@ -34,7 +34,7 @@ import App from "../../config/app"; @@ -34,7 +34,7 @@ import App from "../../config/app";
import ButtonMenuToggle from "../buttonMenuToggle";
import replaceContent from "../../helpers/dom/replaceContent";
import sessionStorage from "../../lib/sessionStorage";
import { attachClickEvent, CLICK_EVENT_NAME } from "../../helpers/dom/clickEvent";
import { attachClickEvent, CLICK_EVENT_NAME, simulateClickEvent } from "../../helpers/dom/clickEvent";
import ButtonIcon from "../buttonIcon";
import confirmationPopup from "../confirmationPopup";
import IS_GEOLOCATION_SUPPORTED from "../../environment/geolocationSupport";
@ -359,7 +359,7 @@ export class AppSidebarLeft extends SidebarSlider { @@ -359,7 +359,7 @@ export class AppSidebarLeft extends SidebarSlider {
const close = () => {
//setTimeout(() => {
this.backBtn.click();
simulateClickEvent(this.backBtn);
//}, 0);
};
@ -632,7 +632,7 @@ export class AppSidebarLeft extends SidebarSlider { @@ -632,7 +632,7 @@ export class AppSidebarLeft extends SidebarSlider {
this.inputSearch.input.addEventListener('focus', onFocus);
onFocus();
this.backBtn.addEventListener('click', (e) => {
attachClickEvent(this.backBtn, (e) => {
this.toolsBtn.classList.add(activeClassName);
this.backBtn.classList.remove(activeClassName);
this.toolsBtn.parentElement.firstElementChild.classList.toggle('state-back', false);

6
src/lib/appManagers/appDialogsManager.ts

@ -31,7 +31,7 @@ import lottieLoader from "../rlottie/lottieLoader"; @@ -31,7 +31,7 @@ import lottieLoader from "../rlottie/lottieLoader";
import { wrapPhoto } from "../../components/wrappers";
import AppEditFolderTab from "../../components/sidebarLeft/tabs/editFolder";
import appSidebarLeft, { SettingSection } from "../../components/sidebarLeft";
import { attachClickEvent } from "../../helpers/dom/clickEvent";
import { attachClickEvent, simulateClickEvent } from "../../helpers/dom/clickEvent";
import positionElementByIndex from "../../helpers/dom/positionElementByIndex";
import replaceContent from "../../helpers/dom/replaceContent";
import ConnectionStatusComponent from "../../components/connectionStatus";
@ -419,7 +419,7 @@ export class AppDialogsManager { @@ -419,7 +419,7 @@ export class AppDialogsManager {
this.scroll = this.scrollables[this.filterId];
//selectTab(0);
(this.folders.menu.firstElementChild as HTMLElement).click();
simulateClickEvent(this.folders.menu.firstElementChild as HTMLElement);
}
public get chatList() {
@ -573,7 +573,7 @@ export class AppDialogsManager { @@ -573,7 +573,7 @@ export class AppDialogsManager {
// set tab
//(this.folders.menu.firstElementChild.children[Math.max(0, filter.id - 2)] as HTMLElement).click();
(this.folders.menu.firstElementChild as HTMLElement).click();
simulateClickEvent(this.folders.menu.firstElementChild as HTMLElement);
elements.container.remove();
elements.menu.remove();

20
src/lib/appManagers/appImManager.ts

@ -409,13 +409,7 @@ export class AppImManager extends EventListenerBase<{ @@ -409,13 +409,7 @@ export class AppImManager extends EventListenerBase<{
this.addEventListener('peer_changed', async(peerId) => {
document.body.classList.toggle('has-chat', !!peerId);
let str: string;
if(peerId) {
const username = await this.managers.appPeersManager.getPeerUsername(peerId);
str = username ? '@' + username : '' + peerId;
}
appNavigationController.overrideHash(str);
this.overrideHash(peerId);
apiManagerProxy.updateTabState('chatPeerIds', this.chats.map((chat) => chat.peerId).filter(Boolean));
});
@ -1512,6 +1506,16 @@ export class AppImManager extends EventListenerBase<{ @@ -1512,6 +1506,16 @@ export class AppImManager extends EventListenerBase<{
}
};
private async overrideHash(peerId?: PeerId) {
let str: string;
if(peerId) {
const username = await this.managers.appPeersManager.getPeerUsername(peerId);
str = username ? '@' + username : '' + peerId;
}
appNavigationController.overrideHash(str);
}
public selectTab(id: number, animate?: boolean) {
if(animate === false) { // * will be used for Safari iOS history swipe
disableTransition([appSidebarLeft.sidebarEl, this.columnEl, appSidebarRight.sidebarEl]);
@ -1519,6 +1523,8 @@ export class AppImManager extends EventListenerBase<{ @@ -1519,6 +1523,8 @@ export class AppImManager extends EventListenerBase<{
document.body.classList.toggle(LEFT_COLUMN_ACTIVE_CLASSNAME, id === 0);
this.overrideHash(id > 0 ? this.chat?.peerId : undefined);
const prevTabId = this.tabId;
this.log('selectTab', id, prevTabId);

1
src/lib/mediaPlayer.ts

@ -97,7 +97,6 @@ export default class VideoPlayer extends ControlsHover { @@ -97,7 +97,6 @@ export default class VideoPlayer extends ControlsHover {
}).finally(() => { // due to autoplay, play will not call
this.wrapper.classList.toggle('is-playing', !this.video.paused);
});
//(this.wrapper.querySelector('.toggle') as HTMLButtonElement).click();
}
}

Loading…
Cancel
Save