fix: fatal error on iOS Chrome

This commit is contained in:
himself65 2023-03-28 04:13:03 -05:00
parent 7d3ae9a0c9
commit abdee7fac2
3 changed files with 6 additions and 2 deletions

View File

@ -30,7 +30,6 @@ type AppPropsWithLayout = AppProps & {
const EmptyLayout = (page: ReactElement) => page;
const clientSideEmotionCache = createEmotionCache();
const helmetContext = {};
const App = function App({
Component,

View File

@ -13,6 +13,7 @@ type BrowserBase = {
// browser special properties
isLinux: boolean;
isMacOs: boolean;
isIOS: boolean;
isSafari: boolean;
isWindows: boolean;
isFireFox: boolean;
@ -83,8 +84,10 @@ export function getEnvironment() {
isFireFox: uaHelper.isFireFox,
isMobile: uaHelper.isMobile,
isChrome: uaHelper.isChrome,
isIOS: uaHelper.isIOS,
} as Browser;
if (environment.isChrome === true) {
// Chrome on iOS is still Safari
if (environment.isChrome && !environment.isIOS) {
assertEquals(environment.isSafari, false);
assertEquals(environment.isFireFox, false);
environment = {

View File

@ -57,6 +57,7 @@ export function getUaHelper() {
public isFireFox = false;
public isMobile = false;
public isChrome = false;
public isIOS = false;
getChromeVersion = (): number => {
const raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
@ -81,6 +82,7 @@ export function getUaHelper() {
this.isFireFox = this.checkUseragent('firefox');
this.isMobile = this.checkUseragent('mobile');
this.isChrome = this.checkUseragent('chrome');
this.isIOS = this.checkUseragent('ios');
}
}
uaHelper = new UaHelper();