From 227f706a0c0e038245b2c8da55a59e2abafe6c6f Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sun, 28 May 2023 14:32:09 +0200 Subject: [PATCH] General: Fix compatibility on old browsers (#3186) --- public/unsupported.html | 22 +++++++++++++++++++++- src/components/middle/MiddleColumn.tsx | 6 ++++-- src/index.html | 14 ++++++++------ src/lib/fasterdom/stricterdom.ts | 2 ++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/public/unsupported.html b/public/unsupported.html index d83f11248..5625effd2 100644 --- a/public/unsupported.html +++ b/public/unsupported.html @@ -2,6 +2,18 @@ Unsupported browser + + @@ -9,10 +21,18 @@
-

Your browser is not supported. Please, update it or use our native clients

+

Your browser is not supported

+

Please, update it or use our native clients.

+ I'm Feeling Lucky
+ diff --git a/src/components/middle/MiddleColumn.tsx b/src/components/middle/MiddleColumn.tsx index 81c2c3c4b..f95bf1a44 100644 --- a/src/components/middle/MiddleColumn.tsx +++ b/src/components/middle/MiddleColumn.tsx @@ -25,7 +25,9 @@ import { TMP_CHAT_ID, MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES, } from '../../config'; -import { IS_ANDROID, IS_IOS, MASK_IMAGE_DISABLED } from '../../util/windowEnvironment'; +import { + IS_ANDROID, IS_IOS, IS_TRANSLATION_SUPPORTED, MASK_IMAGE_DISABLED, +} from '../../util/windowEnvironment'; import { DropAreaState } from './composer/DropArea'; import { selectCanAnimateInterface, @@ -608,7 +610,7 @@ function MiddleColumn({ /> - + {IS_TRANSLATION_SUPPORTED && } diff --git a/src/index.html b/src/index.html index e415ec351..a460e350f 100644 --- a/src/index.html +++ b/src/index.html @@ -77,16 +77,18 @@ var isCompatible = hasPromise && hasWebSockets && hasWebCrypto && hasObjectFromEntries; - if (isCompatible) { + if (isCompatible || (window.localStorage && window.localStorage.getItem('tt-ignore-compat'))) { window.isCompatTestPassed = true; return; } - console.warn('Compatibility test report:'); - console.warn('Promise', hasPromise); - console.warn('WebSocket', hasWebSockets); - console.warn('WebCrypto', hasWebCrypto); - console.warn('Object.fromEntries', hasObjectFromEntries); + if (window.console && console.warn) { + console.warn('Compatibility test report:'); + console.warn('Promise', hasPromise); + console.warn('WebSocket', hasWebSockets); + console.warn('WebCrypto', hasWebCrypto); + console.warn('Object.fromEntries', hasObjectFromEntries); + } document.body.innerHTML = '