Browse Source

Fix blinking chat in Firefox

Replaced description in delete messages popup
master
morethanwords 3 years ago
parent
commit
86e2682f91
  1. 7
      src/components/popups/deleteMessages.ts
  2. 10
      src/components/transition.ts
  3. 4
      src/index.ts
  4. 7
      src/lib/appManagers/appImManager.ts
  5. 4
      src/scss/partials/_chat.scss
  6. 2
      src/scss/partials/_chatBubble.scss

7
src/components/popups/deleteMessages.ts

@ -12,6 +12,7 @@ import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from " @@ -12,6 +12,7 @@ import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from "
import { ChatType } from "../chat/chat";
import { i18n, LangPackKey } from "../../lib/langPack";
import PeerTitle from "../peerTitle";
import appPeersManager from "../../lib/appManagers/appPeersManager";
export default class PopupDeleteMessages {
constructor(peerId: number, mids: number[], type: ChatType, onConfirm?: () => void) {
@ -35,7 +36,11 @@ export default class PopupDeleteMessages { @@ -35,7 +36,11 @@ export default class PopupDeleteMessages {
titleArgs = [i18n('messages', [mids.length])];
}
description = mids.length === 1 ? 'AreYouSureDeleteSingleMessage' : 'AreYouSureDeleteFewMessages';
if(appPeersManager.isMegagroup(peerId)) {
description = mids.length === 1 ? 'AreYouSureDeleteSingleMessageMega' : 'AreYouSureDeleteFewMessagesMega';
} else {
description = mids.length === 1 ? 'AreYouSureDeleteSingleMessage' : 'AreYouSureDeleteFewMessages';
}
buttons = [{
langKey: 'Delete',

10
src/components/transition.ts

@ -193,7 +193,14 @@ const Transition = ( @@ -193,7 +193,14 @@ const Transition = (
}
if(!animate) {
if(from) from.classList.remove('active', 'to', 'from');
if(from) from.classList.remove('active', 'to', 'from');
else if(to) { // fix instant opening back from closed slider (e.g. instant closening and opening right sidebar)
const callback = onTransitionEndCallbacks.get(to);
if(callback) {
callback();
}
}
if(to) {
to.classList.remove('to', 'from');
to.classList.add('active');
@ -264,6 +271,7 @@ const Transition = ( @@ -264,6 +271,7 @@ const Transition = (
const timeout = window.setTimeout(callback, transitionTime);
onTransitionEndCallbacks.set(_from, () => {
clearTimeout(timeout);
onTransitionEndCallbacks.delete(_from);
});
}

4
src/index.ts

@ -164,6 +164,10 @@ console.timeEnd('get storage1'); */ @@ -164,6 +164,10 @@ console.timeEnd('get storage1'); */
}
});
if(userAgent.isFirefox) {
document.documentElement.classList.add('is-firefox');
}
if(userAgent.isApple) {
if(userAgent.isSafari) {
document.documentElement.classList.add('is-safari');

7
src/lib/appManagers/appImManager.ts

@ -1040,16 +1040,17 @@ export class AppImManager { @@ -1040,16 +1040,17 @@ export class AppImManager {
this.log('selectTab', id, prevTabId);
let animationPromise: Promise<any> = doubleRaf();
let animationPromise: Promise<any> = rootScope.settings.animationsEnabled ? doubleRaf() : Promise.resolve();
if(prevTabId !== -1 && prevTabId !== id && rootScope.settings.animationsEnabled && animate !== false) {
const transitionTime = (mediaSizes.isMobile ? 250 : 200) + 100; // * cause transition time could be > 250ms
animationPromise = pause(transitionTime);
dispatchHeavyAnimationEvent(animationPromise, transitionTime);
this.columnEl.classList.add('disable-hover');
// ! it's very heavy operation. will blink in firefox
/* this.columnEl.classList.add('disable-hover');
animationPromise.finally(() => {
this.columnEl.classList.remove('disable-hover');
});
}); */
}
this.tabId = id;

4
src/scss/partials/_chat.scss

@ -28,7 +28,7 @@ $chat-helper-size: 36px; @@ -28,7 +28,7 @@ $chat-helper-size: 36px;
flex: 0 0 auto;
position: relative;
transition: transform var(--transition-standard-out);
transform: translateY(var(--translateY));
transform: translate3d(0, var(--translateY), 0);
/* body.is-keyboard-opened & {
--bottom: var(--padding-bottom);
@ -1001,7 +1001,7 @@ $chat-helper-size: 36px; @@ -1001,7 +1001,7 @@ $chat-helper-size: 36px;
flex: 1 1 auto;
position: relative;
transform: translateY(var(--translateY));
transform: translate3d(0, var(--translateY), 0);
transition: transform var(--transition-standard-out);
@include animation-level(0) {

2
src/scss/partials/_chatBubble.scss

@ -2036,7 +2036,7 @@ $bubble-margin: .25rem; @@ -2036,7 +2036,7 @@ $bubble-margin: .25rem;
color: var(--message-out-primary-color);
}
&-wrapper {
/* html:not(.is-firefox) */ &-wrapper {
@include respond-to(medium-screens) {
transform: scale(1) translateX(calc((var(--chat-input-size) + #{$btn-send-margin}) * -1));

Loading…
Cancel
Save