mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-02 14:33:54 +03:00
fix(core): can not get chrome version in desktop mode in iOS (#7791)
This commit is contained in:
parent
8db37e9bbf
commit
3d4fbcaebc
12
packages/common/env/src/ua-helper.ts
vendored
12
packages/common/env/src/ua-helper.ts
vendored
@ -1,5 +1,3 @@
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
|
||||
export class UaHelper {
|
||||
private readonly uaMap;
|
||||
public isLinux = false;
|
||||
@ -12,8 +10,14 @@ export class UaHelper {
|
||||
public isIOS = false;
|
||||
|
||||
getChromeVersion = (): number => {
|
||||
const raw = this.navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
||||
assertExists(raw);
|
||||
let raw = this.navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
||||
if (!raw) {
|
||||
raw = this.navigator.userAgent.match(/(CriOS)\/([0-9]+)/);
|
||||
}
|
||||
if (!raw) {
|
||||
console.error('Cannot get chrome version');
|
||||
return 0;
|
||||
}
|
||||
return parseInt(raw[2], 10);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user