Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): can not get chrome version in desktop mode in iOS (#7791)

L-Sun3d4fbcaebce1
diff --git a/packages/common/env/src/ua-helper.ts b/packages/common/env/src/ua-helper.ts
index fc372b6d9a..8a0322fcfb 100644
--- a/packages/common/env/src/ua-helper.ts
+++ b/packages/common/env/src/ua-helper.ts
@@ -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);
};