From ae5bebffb9ff9a2fd0a1031346e3036e0836e3b6 Mon Sep 17 00:00:00 2001 From: liangguirong Date: Fri, 21 Feb 2025 11:18:44 +0800 Subject: [PATCH] =?UTF-8?q?utilCode=E4=BF=AE=E6=94=B9=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liangguirong --- utilCode/library/src/main/utilcode/CountryUtils.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utilCode/library/src/main/utilcode/CountryUtils.ts b/utilCode/library/src/main/utilcode/CountryUtils.ts index 239b1b0b..a2b735ef 100644 --- a/utilCode/library/src/main/utilcode/CountryUtils.ts +++ b/utilCode/library/src/main/utilcode/CountryUtils.ts @@ -15,16 +15,20 @@ import sim from '@ohos.telephony.sim'; import I18n from '@ohos.i18n'; -import { Callback } from "./basic"; +import { Callback } from "./basic" +import { deviceInfo } from '@kit.BasicServicesKit'; export class CountryUtils { private static countryCodeMap; public static getCountryCodeBySim( callback: Callback) { - sim.getISOCountryCodeForSim(0, (err, data) => { - callback(err.message, this.getCountryCode(data)) - }); + let deviceTypeArr: string[] = ["2in1","tv","wearable","car"] + if(!deviceTypeArr.includes(deviceInfo.deviceType)) { + sim.getISOCountryCodeForSim(0, (err, data) => { + callback(err.message, this.getCountryCode(data)) + }); + } } public static getCountryCodeByLanguage(): string { -- Gitee