mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 04:51:49 +08:00
fix(core): can not get chrome version in desktop mode in iOS (#7791)
This commit is contained in:
Vendored
+8
-4
@@ -1,5 +1,3 @@
|
|||||||
import { assertExists } from '@blocksuite/global/utils';
|
|
||||||
|
|
||||||
export class UaHelper {
|
export class UaHelper {
|
||||||
private readonly uaMap;
|
private readonly uaMap;
|
||||||
public isLinux = false;
|
public isLinux = false;
|
||||||
@@ -12,8 +10,14 @@ export class UaHelper {
|
|||||||
public isIOS = false;
|
public isIOS = false;
|
||||||
|
|
||||||
getChromeVersion = (): number => {
|
getChromeVersion = (): number => {
|
||||||
const raw = this.navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
let raw = this.navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
||||||
assertExists(raw);
|
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);
|
return parseInt(raw[2], 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user