diff --git a/assets/Scripts/chat18x/foundation/identity/MachineInfoService.ts b/assets/Scripts/chat18x/foundation/identity/MachineInfoService.ts index 423e7d45..c810d1b2 100644 --- a/assets/Scripts/chat18x/foundation/identity/MachineInfoService.ts +++ b/assets/Scripts/chat18x/foundation/identity/MachineInfoService.ts @@ -1,5 +1,6 @@ import { sys, native } from "cc"; import { EDITOR, PREVIEW } from "cc/env"; +import { PlatformHelper } from "../../../Main/Channel/PlatformHelper"; function isWeChatMiniGame(): boolean { const g: any = globalThis as any; @@ -30,7 +31,7 @@ function tryMiniGameModel(): string | null { function tryNativeModel(): string | null { // if (!sys.isNative) return null; // try { -// if (sys.platform === sys.Platform.ANDROID) { +// if (PlatformHelper.isAndroid()) { // const s = native.reflection.callStaticMethod( // "org/cocos2dx/javascript/AppActivity", // "getDeviceModel", @@ -38,7 +39,7 @@ function tryNativeModel(): string | null { // ); // return (s && String(s).trim()) || null; // } -// if (sys.platform === sys.Platform.IOS) { +// if (PlatformHelper.isIOS()) { // const s = native.reflection.callStaticMethod("AppController", "getHardwareModel"); // return (s && String(s).trim()) || null; // } @@ -67,8 +68,8 @@ export class MachineInfoService { public runtimeTag(): string { if (EDITOR) return PREVIEW ? "editor-preview" : "editor"; if (sys.isNative) { - if (sys.platform === sys.Platform.ANDROID) return "native-android"; - if (sys.platform === sys.Platform.IOS) return "native-ios"; + if (PlatformHelper.isAndroid()) return "native-android"; + if (PlatformHelper.isIOS()) return "native-ios"; return "native"; } if (isWeChatMiniGame()) return "minigame-wechat"; @@ -115,13 +116,13 @@ export class MachineInfoService { return 3; // 在 Cocos Creator 编辑器里运行 } - if (sys.platform === sys.Platform.ANDROID) { + if (PlatformHelper.isAndroid()) { return 1; } - if (sys.platform === sys.Platform.IOS) { + if (PlatformHelper.isIOS()) { return 2; } - if (sys.platform === sys.Platform.WIN32) { + if (PlatformHelper.isWinDesktop()) { return 3; } return 3;