diff --git a/entry/src/main/ets/common/utils/CallUtils.ts b/entry/src/main/ets/common/utils/CallUtils.ts index f456680..7f8bc82 100644 --- a/entry/src/main/ets/common/utils/CallUtils.ts +++ b/entry/src/main/ets/common/utils/CallUtils.ts @@ -45,14 +45,14 @@ export class CallUtils { sim.hasSimCard(accountId).then((res) => { resolve(res); if (accountId === 0) { - AppStorage.SetOrCreate("hasSimCard1", res); + AppStorage.SetOrCreate('hasSimCard1', res); } else if (accountId === 1) { - AppStorage.SetOrCreate("hasSimCard2", res); + AppStorage.SetOrCreate('hasSimCard2', res); } }) .catch((err) => { reject(err); - LogUtils.i(TAG, "catch:hasSimeCard :" + JSON.stringify(err)); + LogUtils.i(TAG, 'catch:hasSimeCard :' + JSON.stringify(err)); }); }); @@ -68,11 +68,11 @@ export class CallUtils { slotId: 0 }).then((res) => { resolve(res); - AppStorage.SetOrCreate("IsEmergencyPhoneNumber", res) - LogUtils.i(TAG, "then:isEmergencyPhoneNumber :" + JSON.stringify(res)); + AppStorage.SetOrCreate('IsEmergencyPhoneNumber', res) + LogUtils.i(TAG, 'then:isEmergencyPhoneNumber :' + JSON.stringify(res)); }).catch((err) => { reject(err); - LogUtils.i(TAG, "catch:isEmergencyPhoneNumber :" + JSON.stringify(err)); + LogUtils.i(TAG, 'catch:isEmergencyPhoneNumber :' + JSON.stringify(err)); }); }); } diff --git a/entry/src/main/ets/model/CallDataManager.ets b/entry/src/main/ets/model/CallDataManager.ets index eedf62d..bdf3580 100644 --- a/entry/src/main/ets/model/CallDataManager.ets +++ b/entry/src/main/ets/model/CallDataManager.ets @@ -26,7 +26,7 @@ import CallListStruct from '../common/struct/CallListStruct'; import DefaultCallData from '../common/struct/TypeUtils'; import VibrationAndProximityUtils from '../common/utils/VibrationAndProximityUtils'; -const TAG = "CallDataManager"; +const TAG = 'CallDataManager'; /** * class CallDataManager */ @@ -64,7 +64,7 @@ export default class CallDataManager { }); } if (this.callList.length === 0) { - LogUtils.i(TAG, "init callList: undefined"); + LogUtils.i(TAG, 'init callList: undefined'); this.callList = callList; } else { let oldCallList = this.callList; @@ -74,7 +74,7 @@ export default class CallDataManager { }); } if (this.callTimeList.length === 0) { - LogUtils.i(TAG, "init callTimeList: undefined"); + LogUtils.i(TAG, 'init callTimeList: undefined'); this.callTimeList = callTimeList; } else { let oldCallTimeList = this.callTimeList; @@ -99,7 +99,7 @@ export default class CallDataManager { return; } const targetObj = this.callList.find((v) => v.callId === callId); - LogUtils.i(TAG, "update :") + LogUtils.i(TAG, 'update :') if (targetObj) { const { oldCallState } = targetObj; Object.assign(targetObj, { @@ -157,10 +157,10 @@ export default class CallDataManager { public clearCall(callData) { this.NotificationManager.cancelNotification(); AppStorage.Get('notificationManager').sendCapsuleNotification(callData, true); - AppStorage.Delete("CallTimeList"); + AppStorage.Delete('CallTimeList'); this.clearData(); globalThis.calluiAbilityContext?.terminateSelf().then((data) => { - LogUtils.i(TAG, "calluiAbility terminateSelf"); + LogUtils.i(TAG, 'calluiAbility terminateSelf'); }); // remove Proximity Listener VibrationAndProximityUtils.wakeupScreen(); @@ -180,7 +180,7 @@ export default class CallDataManager { public hasAliveCall() { const callData = this.callList.find((call) => call.callState !== CallStateConst.CALL_STATUS_DISCONNECTED && call.callState !== CallStateConst.CALL_STATUS_DISCONNECTING); - LogUtils.i(TAG, "hasAliveCall:" + JSON.stringify(callData !== undefined)); + LogUtils.i(TAG, 'hasAliveCall:' + JSON.stringify(callData !== undefined)); return callData !== undefined; } @@ -231,7 +231,7 @@ export default class CallDataManager { */ updateCallTimeList(callData) { const CallTimeObj = this.callTimeList.find((v) => v.callId === callData.callId); - LogUtils.i(TAG, "updateCallTimeList : " + JSON.stringify(CallTimeObj)) + LogUtils.i(TAG, 'updateCallTimeList : ' + JSON.stringify(CallTimeObj)) if (!CallTimeObj && callData.callState === CallStateConst.CALL_STATUS_ACTIVE) { const obj = { callId: callData.callId, @@ -240,20 +240,20 @@ export default class CallDataManager { endTimestamp: 0, }; this.callTimeList.push(obj); - AppStorage.SetOrCreate("CallTimeList", this.callTimeList) - LogUtils.i(TAG, "updateCallTimeList : " + JSON.stringify(this.callTimeList)) + AppStorage.SetOrCreate('CallTimeList', this.callTimeList) + LogUtils.i(TAG, 'updateCallTimeList : ' + JSON.stringify(this.callTimeList)) } } clearData() { this.callList.splice(0, this.callList.length); - LogUtils.i(TAG, "clearData: " + JSON.stringify(this.callList)); - let inputvalue = AppStorage.Delete("TextInputValue"); - LogUtils.i(TAG, "clearData:TextInputValue " + JSON.stringify(inputvalue)); - let textinput = AppStorage.Delete("TextInput"); - AppStorage.Delete("CallTimeList"); - AppStorage.Delete("notificationManager"); - AppStorage.Delete("currentAudioDeviceIcon"); - AppStorage.Delete("datalist"); + LogUtils.i(TAG, 'clearData: ' + JSON.stringify(this.callList)); + let inputvalue = AppStorage.Delete('TextInputValue'); + LogUtils.i(TAG, 'clearData:TextInputValue ' + JSON.stringify(inputvalue)); + let textinput = AppStorage.Delete('TextInput'); + AppStorage.Delete('CallTimeList'); + AppStorage.Delete('notificationManager'); + AppStorage.Delete('currentAudioDeviceIcon'); + AppStorage.Delete('datalist'); } } \ No newline at end of file diff --git a/entry/src/main/ets/model/CallManager.ets b/entry/src/main/ets/model/CallManager.ets index ed0391d..b3d7412 100644 --- a/entry/src/main/ets/model/CallManager.ets +++ b/entry/src/main/ets/model/CallManager.ets @@ -27,7 +27,7 @@ import DefaultCallData from '../common/struct/TypeUtils'; import CallListStruct from '../common/struct/CallListStruct'; import VibrationAndProximityUtils from '../common/utils/VibrationAndProximityUtils'; -const TAG = "CallManager"; +const TAG = 'CallManager'; const TIMING = 1000; /** @@ -78,13 +78,13 @@ export default class CallManager { if (globalThis.abilityWant && globalThis.abilityWant.parameters && ('callState' in globalThis.abilityWant.parameters)) { if (!this.isServiceConnected) { globalThis.calluiAbilityContext?.terminateSelf().then((data) => { - LogUtils.i(TAG, "calluiAbility terminateSelf because service disconnected"); + LogUtils.i(TAG, 'calluiAbility terminateSelf because service disconnected'); }); return; } let callData = this.getCallDataFromWant(globalThis.abilityWant.parameters); this.update(callData); - LogUtils.i(TAG, "initCallData featureAbility.getWant :") + LogUtils.i(TAG, 'initCallData featureAbility.getWant :') } else { this.mCallServiceProxy.publish({ key: 'getInitCallData', @@ -119,12 +119,12 @@ export default class CallManager { * @param { Object } callData -Object */ async update(callData) { - LogUtils.i(TAG, "update calldata:") + LogUtils.i(TAG, 'update calldata:') if (this.callData != undefined && this.callData.callId === callData.callId) { const { callState } = this.callData; if (callState === 6 && this.callList.length === 1) { globalThis.calluiAbilityContext?.terminateSelf().then((data) => { - LogUtils.i(TAG, "calluiAbility terminateSelf because service disconnected"); + LogUtils.i(TAG, 'calluiAbility terminateSelf because service disconnected'); }); // remove Proximity Listener VibrationAndProximityUtils.wakeupScreen(); @@ -136,16 +136,16 @@ export default class CallManager { this.mCallDataManager.update(callData); call.formatPhoneNumber(callData.accountNumber, (err, data) => { if (err) { - LogUtils.i(TAG, "updata calldata formatPhoneNumber err:" + JSON.stringify(err)); + LogUtils.i(TAG, 'updata calldata formatPhoneNumber err:' + JSON.stringify(err)); } else if (data === undefined) { - AppStorage.SetOrCreate("AccountNumber", callData.accountNumber); + AppStorage.SetOrCreate('AccountNumber', callData.accountNumber); } else { - LogUtils.i(TAG, "updata calldata formatPhoneNumber success:" + JSON.stringify(data)); - AppStorage.SetOrCreate("AccountNumber", data); + LogUtils.i(TAG, 'updata calldata formatPhoneNumber success:' + JSON.stringify(data)); + AppStorage.SetOrCreate('AccountNumber', data); } }); CallUtils.isEmergencyPhoneNumber(callData.accountNumber); - LogUtils.i(TAG, "update :"); + LogUtils.i(TAG, 'update :'); } /** @@ -153,11 +153,11 @@ export default class CallManager { */ updateCallTimeList() { if (!this.mCallDataManager.hasActiveCall()) { - LogUtils.i(TAG, "no active calls to update"); + LogUtils.i(TAG, 'no active calls to update'); return; } - this.callTimeList = AppStorage.Get("CallTimeList") + this.callTimeList = AppStorage.Get('CallTimeList'); this.callTimeList.forEach((item, i) => { if (this.mCallDataManager.isActiveCall(item.callId)) { item.endTimestamp = new Date().valueOf(); @@ -167,7 +167,7 @@ export default class CallManager { this.callTimeList.splice(i, 1, { ...item, }); - AppStorage.SetOrCreate("CallTimeList", this.callTimeList); + AppStorage.SetOrCreate('CallTimeList', this.callTimeList); } }); this.mTimeMeter = setTimeout(() => { diff --git a/entry/src/main/ets/model/CallServiceProxy.ets b/entry/src/main/ets/model/CallServiceProxy.ets index 9ddbd8c..3cc4499 100644 --- a/entry/src/main/ets/model/CallServiceProxy.ets +++ b/entry/src/main/ets/model/CallServiceProxy.ets @@ -27,7 +27,7 @@ import commonEvent from '@ohos.commonEvent'; import call from '@ohos.telephony.call'; import LogUtils from '../common/utils/LogUtils'; -const TAG = "CallServiceProxy"; +const TAG = 'CallServiceProxy'; const prefixLog = 'callUI app:@ohos.telephony.call:'; /** @@ -52,7 +52,7 @@ export default class CallServiceProxy { * Make a phone call */ public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) { - LogUtils.i(TAG, "dialCall phoneNumber :") + LogUtils.i(TAG, 'dialCall phoneNumber :'); return call.dial(phoneNumber, { accountId, videoState, @@ -77,9 +77,9 @@ export default class CallServiceProxy { */ public acceptCall = function (callId) { call.answerCall(callId).then((res) => { - LogUtils.i(TAG, prefixLog + "call.answerCall : %s" + JSON.stringify(callId)) + LogUtils.i(TAG, prefixLog + 'call.answerCall : %s' + JSON.stringify(callId)) }).catch((err) => { - LogUtils.i(TAG, prefixLog + "call.answerCall catch : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'call.answerCall catch : %s' + JSON.stringify(err)) }); }; @@ -97,10 +97,10 @@ export default class CallServiceProxy { messageContent: msg }) : call.rejectCall(callId); rejectCallPromise.then((res) => { - LogUtils.i(TAG, prefixLog + "then:rejectCall") + LogUtils.i(TAG, prefixLog + 'then:rejectCall'); }) .catch((err) => { - LogUtils.i(TAG, prefixLog + "catch:rejectCall : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:rejectCall : %s' + JSON.stringify(err)); }); }; @@ -114,10 +114,10 @@ export default class CallServiceProxy { public hangUpCall = (callId) => new Promise((resolve, reject) => { call.hangUpCall(callId).then((res) => { resolve(res); - LogUtils.i(TAG, prefixLog + "then:hangUpCall : %s" + JSON.stringify(callId)) + LogUtils.i(TAG, prefixLog + 'then:hangUpCall : %s' + JSON.stringify(callId)) }).catch((err) => { reject(err); - LogUtils.i(TAG, prefixLog + "catch:hangUpCall : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:hangUpCall : %s' + JSON.stringify(err)) }); }); @@ -131,11 +131,11 @@ export default class CallServiceProxy { public holdCall = (callId) => new Promise((resolve, reject) => { call.holdCall(callId).then((res) => { resolve(res); - LogUtils.i(TAG, prefixLog + "then:holdCall : %s" + JSON.stringify(callId)) + LogUtils.i(TAG, prefixLog + 'then:holdCall : %s' + JSON.stringify(callId)); }) .catch((err) => { reject(err); - LogUtils.i(TAG, prefixLog + "catch:holdCall : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:holdCall : %s' + JSON.stringify(err)); }); }); @@ -149,11 +149,11 @@ export default class CallServiceProxy { public unHoldCall = (callId) => new Promise((resolve, reject) => { call.unHoldCall(callId).then((res) => { resolve(res); - LogUtils.i(TAG, prefixLog + "then:unholdCall : %s" + JSON.stringify(callId)) + LogUtils.i(TAG, prefixLog + 'then:unholdCall : %s' + JSON.stringify(callId)); }) .catch((err) => { reject(err); - LogUtils.i(TAG, prefixLog + "catch:unHoldCall : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:unHoldCall : %s' + JSON.stringify(err)); }); }); @@ -162,9 +162,9 @@ export default class CallServiceProxy { */ public setMuted() { call.setMuted().then((res) => { - LogUtils.i(TAG, prefixLog + "then:setMute") + LogUtils.i(TAG, prefixLog + 'then:setMute'); }).catch((err) => { - LogUtils.i(TAG, prefixLog + "catch:setMute : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:setMute : %s' + JSON.stringify(err)); }); }; @@ -173,9 +173,9 @@ export default class CallServiceProxy { */ public cancelMuted() { call.cancelMuted().then((res) => { - LogUtils.i(TAG, prefixLog + "then:cancelMuted") + LogUtils.i(TAG, prefixLog + 'then:cancelMuted'); }).catch((err) => { - LogUtils.i(TAG, prefixLog + "catch:cancelMuted : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:cancelMuted : %s' + JSON.stringify(err)) }); }; @@ -189,11 +189,11 @@ export default class CallServiceProxy { public switchCall = (callId) => new Promise((resolve, reject) => { call.switchCall(callId).then((res) => { resolve(res); - LogUtils.i(TAG, prefixLog + "then:switchCall : %s" + JSON.stringify(callId)) + LogUtils.i(TAG, prefixLog + 'then:switchCall : %s' + JSON.stringify(callId)) }) .catch((err) => { reject(err); - LogUtils.i(TAG, prefixLog + "catch:switchCall : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:switchCall : %s' + JSON.stringify(err)) }); }); @@ -205,10 +205,10 @@ export default class CallServiceProxy { public registerCallStateCallback(callBack) { call.on('callDetailsChange', (data) => { if (!data) { - LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback") + LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback') return; } - LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback callState") + LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback callState') callBack(data); }); } @@ -219,10 +219,10 @@ export default class CallServiceProxy { public unRegisterCallStateCallback() { call.off('callDetailsChange', (data) => { if (!data) { - LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback") + LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallStateCallback') return; } - LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback") + LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallStateCallback') }); } @@ -232,9 +232,9 @@ export default class CallServiceProxy { public registerCallEventCallback() { call.on('callEventChange', (data) => { if (!data) { - LogUtils.i(TAG, prefixLog + "call.on callEventChange") + LogUtils.i(TAG, prefixLog + 'call.on callEventChange') } else { - LogUtils.i(TAG, prefixLog + "call.on callEventChange") + LogUtils.i(TAG, prefixLog + 'call.on callEventChange') } }); } @@ -245,9 +245,9 @@ export default class CallServiceProxy { public unRegisterCallEventCallback() { call.off('callEventChange', (data) => { if (!data) { - LogUtils.i(TAG, prefixLog + "call.off unRegisterCallEventCallback : %s") + LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallEventCallback : %s') } else { - LogUtils.i(TAG, prefixLog + "call.off unRegisterCallEventCallback : %s") + LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallEventCallback : %s') } }); } @@ -261,9 +261,9 @@ export default class CallServiceProxy { */ public startDTMF = (callId = 1, str = '1') => { call.startDTMF(callId, str).then((res) => { - LogUtils.i(TAG, prefixLog + "then:startDtmf : %s" + JSON.stringify(callId) + JSON.stringify(str)) + LogUtils.i(TAG, prefixLog + 'then:startDtmf : %s' + JSON.stringify(callId) + JSON.stringify(str)) }).catch((err) => { - LogUtils.i(TAG, prefixLog + "catch:startDtmf : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:startDtmf : %s' + JSON.stringify(err)) }); }; @@ -274,9 +274,9 @@ export default class CallServiceProxy { */ public stopDTMF = (callId = 1) => { call.stopDTMF(callId).then((res) => { - LogUtils.i(TAG, prefixLog + "then:stopDtmf : %s" + JSON.stringify(callId)) + LogUtils.i(TAG, prefixLog + 'then:stopDtmf : %s' + JSON.stringify(callId)) }).catch((err) => { - LogUtils.i(TAG, prefixLog + "then:startDtmf : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'then:startDtmf : %s' + JSON.stringify(err)) }); }; @@ -287,23 +287,23 @@ export default class CallServiceProxy { */ public combineConference = (callId) => { call.combineConference(callId).then((res) => { - LogUtils.i(TAG, prefixLog + "then:combineConference : %s" + JSON.stringify(callId)) + LogUtils.i(TAG, prefixLog + 'then:combineConference : %s' + JSON.stringify(callId)) }).catch((err) => { - LogUtils.i(TAG, prefixLog + "catch:combineConference : %s" + JSON.stringify(err)) + LogUtils.i(TAG, prefixLog + 'catch:combineConference : %s' + JSON.stringify(err)) }); }; public publish(data) { - LogUtils.i(TAG, prefixLog + "callui.event.callEvent publish") + LogUtils.i(TAG, prefixLog + 'callui.event.callEvent publish') commonEvent.publish('callui.event.callEvent', { bundleName: 'com.ohos.callui', isOrdered: false, - subscriberPermissions: ["ohos.permission.GET_TELEPHONY_STATE"], + subscriberPermissions: ['ohos.permission.GET_TELEPHONY_STATE'], data: JSON.stringify(data) }, (res) => { - LogUtils.i(TAG, prefixLog + "callui.event.callEvent success") + LogUtils.i(TAG, prefixLog + 'callui.event.callEvent success') }); - LogUtils.i(TAG, prefixLog + "callui.event.callEvent publish end") + LogUtils.i(TAG, prefixLog + 'callui.event.callEvent publish end') } } diff --git a/entry/src/main/ets/model/NotificationManager.ets b/entry/src/main/ets/model/NotificationManager.ets index 2ab8fea..081ffd5 100644 --- a/entry/src/main/ets/model/NotificationManager.ets +++ b/entry/src/main/ets/model/NotificationManager.ets @@ -24,7 +24,7 @@ import callStateConst from '../common/constant/CallStateConst'; import LogUtils from '../common/utils/LogUtils'; import * as Constants from '../common/utils/Constants'; -const TAG = "NotificationManager"; +const TAG = 'NotificationManager'; const ID = 0; const notificationRequest = { @@ -86,15 +86,15 @@ export default class NotificationManager { const data = { callId, btnType: key }; - LogUtils.i(TAG, "sendNotification getResourceManager key:" + JSON.stringify(key)); + LogUtils.i(TAG, 'sendNotification getResourceManager key:' + JSON.stringify(key)); const wantAgentObj = await this.getWantAgent(data, SEND_COMMON_EVENT); const title = globalThis.calluiAbilityContext?.resourceManager.getStringSync(textMap[key]); - LogUtils.i(TAG, "sendNotification getResourceManager textMap[key].id:" + JSON.stringify(title)); + LogUtils.i(TAG, 'sendNotification getResourceManager textMap[key].id:' + JSON.stringify(title)); notificationRequest.actionButtons.push({ title: title, wantAgent: wantAgentObj }); - LogUtils.i(TAG, "sendNotification getResourceManager notificationRequest.actionButtons.push:" + JSON.stringify(notificationRequest.actionButtons)); + LogUtils.i(TAG, 'sendNotification getResourceManager notificationRequest.actionButtons.push:' + JSON.stringify(notificationRequest.actionButtons)); } } Object.assign(notificationRequest.content.longText, { @@ -104,11 +104,11 @@ export default class NotificationManager { longText: expandedName }); notification.publish(notificationRequest).then((data) => { - LogUtils.i(TAG, "sendNotification publish success") + LogUtils.i(TAG, 'sendNotification publish success') }).catch((err) => { - LogUtils.i(TAG, "sendNotification public err" + JSON.stringify(err)) + LogUtils.i(TAG, 'sendNotification public err' + JSON.stringify(err)) }); - LogUtils.i(TAG, "sendNotification end :") + LogUtils.i(TAG, 'sendNotification end :') } /** @@ -169,11 +169,11 @@ export default class NotificationManager { * Cancel notice */ cancelNotification() { - LogUtils.i(TAG, "cancelNotification") + LogUtils.i(TAG, 'cancelNotification') notification.cancel(ID).then((res) => { - LogUtils.i(TAG, "notify.cancel res data : %s" + JSON.stringify(res)) + LogUtils.i(TAG, 'notify.cancel res data : %s' + JSON.stringify(res)) }).catch((err) => { - LogUtils.i(TAG, "notify.cancel err data : %s" + JSON.stringify(err)) + LogUtils.i(TAG, 'notify.cancel err data : %s' + JSON.stringify(err)) }); } @@ -185,13 +185,13 @@ export default class NotificationManager { * @param {boolean} isBackground - is background */ sendCapsuleNotification(callData, isBackground) { - LogUtils.i(TAG, "sendCapsuleNotification isBackground : " + JSON.stringify(isBackground)) - LogUtils.i(TAG, "sendCapsuleNotification callData.startTime :") + LogUtils.i(TAG, 'sendCapsuleNotification isBackground : ' + JSON.stringify(isBackground)) + LogUtils.i(TAG, 'sendCapsuleNotification callData.startTime :') const {callState, startTime} = callData; let commonEventPublishData = { bundleName: 'com.ohos.systemui', isOrdered: false, - subscriberPermissions: ["ohos.permission.GET_TELEPHONY_STATE"], + subscriberPermissions: ['ohos.permission.GET_TELEPHONY_STATE'], data: JSON.stringify({ callState, startTime: startTime * 1000, @@ -203,9 +203,9 @@ export default class NotificationManager { commonEvent.publish('CAPSULE_EVENT_CALL_UI', commonEventPublishData, (err, data) => { if (err) { - LogUtils.i(TAG, "sendCapsuleNotification publish launcher err:" + JSON.stringify(err)) + LogUtils.i(TAG, 'sendCapsuleNotification publish launcher err:' + JSON.stringify(err)) } else { - LogUtils.i(TAG, "sendCapsuleNotification publish launcher success:" + JSON.stringify(data)) + LogUtils.i(TAG, 'sendCapsuleNotification publish launcher success:' + JSON.stringify(data)) } }) } diff --git a/entry/src/main/ets/pages/index.ets b/entry/src/main/ets/pages/index.ets index 1e41b03..7addb3f 100644 --- a/entry/src/main/ets/pages/index.ets +++ b/entry/src/main/ets/pages/index.ets @@ -25,7 +25,7 @@ import Keyboard from '../common/components/Keyboard'; import IncomingCom from '../common/components/IncomingCom'; import CallStateConst from '../common/constant/CallStateConst'; import LogUtils from '../common/utils/LogUtils'; -import byTrace from "@ohos.bytrace" +import byTrace from '@ohos.bytrace' import NotificationManager from '../model/NotificationManager'; import CallManager from '../model/CallManager'; import backgroundTaskManager from '@ohos.backgroundTaskManager'; @@ -37,7 +37,7 @@ import CallListStruct from '../common/struct/CallListStruct' import CallTimeListStruct from '../common/struct/CallTimeListStruct' const AIRPLANE_MODE = 1; -const TAG = "Index"; +const TAG = 'Index'; /** * @file: Main interface @@ -102,7 +102,7 @@ struct Index { } aboutToAppear(): void { - LogUtils.i(TAG, "aboutToAppear") + LogUtils.i(TAG, 'aboutToAppear') byTrace.startTrace('aboutToAppear', 0); this.notificationManager = new NotificationManager(); CallManager.getInstance()?.init(this); @@ -110,23 +110,23 @@ struct Index { this.mCallDataManager = CallDataManager.getInstance(); byTrace.finishTrace('aboutToAppear', 0); this.smListener = mediaQuery.matchMediaSync('(320vp { - LogUtils.i(TAG, "stopBackgroundRunning succeeded"); + LogUtils.i(TAG, 'stopBackgroundRunning succeeded'); }).catch((err) => { - LogUtils.i(TAG, "stopBackgroundRunning failed"); + LogUtils.i(TAG, 'stopBackgroundRunning failed'); }); } @@ -203,9 +203,9 @@ struct Index { wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { backgroundTaskManager.startBackgroundRunning(globalThis.calluiAbilityContext, backgroundTaskManager.BackgroundMode.VOIP, wantAgentObj).then(() => { - LogUtils.i(TAG, "startBackgroundRunning succeeded") + LogUtils.i(TAG, 'startBackgroundRunning succeeded') }).catch((err) => { - LogUtils.i(TAG, "startBackgroundRunning failed cause:" + JSON.stringify(err)) + LogUtils.i(TAG, 'startBackgroundRunning failed cause:' + JSON.stringify(err)) }); }); } @@ -225,7 +225,7 @@ struct Index { * @return {number} - callState */ private callState() { - LogUtils.i(TAG, "callState : " + this.callData.callState) + LogUtils.i(TAG, 'callState : ' + this.callData.callState) return this.callData.callState; } @@ -312,7 +312,7 @@ struct Index { if (this.isTripleCall()) { Column() { - Text($r("app.string.end_holding_call")) + Text($r('app.string.end_holding_call')) .fontColor('#FFFFFF') .fontSize(14) .height(19) @@ -324,8 +324,8 @@ struct Index { } } .padding({ bottom: this.isTripleCall() ? 71 : 106 }) - .width("100%") - .height("100%") + .width('100%') + .height('100%') .backgroundImage('assets/picture/wallpaper.png', ImageRepeat.NoRepeat) .backgroundImageSize(ImageSize.Cover) } diff --git a/mobiledatasettings/src/main/ets/common/components/headComponent.ets b/mobiledatasettings/src/main/ets/common/components/headComponent.ets index a4748f8..42700ea 100644 --- a/mobiledatasettings/src/main/ets/common/components/headComponent.ets +++ b/mobiledatasettings/src/main/ets/common/components/headComponent.ets @@ -14,7 +14,7 @@ */ import LogUtils from '../utils/LogUtils' -const TAG = "HeadComponent" +const TAG = 'HeadComponent' /** * head custom component @@ -29,13 +29,13 @@ export default struct HeadComponent { Image($r('app.media.ic_back')) .width(24) .height(24) - .fillColor($r("sys.color.ohos_id_color_primary")) + .fillColor($r('sys.color.ohos_id_color_primary')) } .margin({ right: 16 }) .backgroundColor(this.isTouch ? $r('app.color.color_E3E3E3_grey') : $r('app.color.color_00000000_transparent')) .onClick(() => { globalThis.settingsAbilityContext?.terminateSelf().then((data) => { - LogUtils.i(TAG, "terminateSelfCallBack"); + LogUtils.i(TAG, 'terminateSelfCallBack'); }); }) .onTouch((event: TouchEvent) => { @@ -57,7 +57,7 @@ export default struct HeadComponent { .textAlign(TextAlign.Start) .margin({ top: 15, bottom: 15 }); } - .width("100%") + .width('100%') .padding({ left: 12 }) .height(56) .alignItems(VerticalAlign.Center) diff --git a/mobiledatasettings/src/main/ets/common/components/listItem/listItem.ets b/mobiledatasettings/src/main/ets/common/components/listItem/listItem.ets index 16d8ff5..76f481a 100644 --- a/mobiledatasettings/src/main/ets/common/components/listItem/listItem.ets +++ b/mobiledatasettings/src/main/ets/common/components/listItem/listItem.ets @@ -27,7 +27,7 @@ import { } from '../../../model/mobileDataStatus'; import LogUtils from '../../utils/LogUtils' -const TAG = "ListItem" +const TAG = 'ListItem' @Component export default struct listItem { @@ -97,13 +97,13 @@ export default struct listItem { .opacity(0.6) .lineHeight(19) .letterSpacing(1) - .visibility(this.describe == $r("app.string.mobile_empty_string") ? Visibility.None : Visibility.Visible) + .visibility(this.describe == $r('app.string.mobile_empty_string') ? Visibility.None : Visibility.Visible) } .width('100%') .alignItems(HorizontalAlign.Start) .margin({ right: 26 }) .onClick(() => { - LogUtils.i(TAG, "onclick clickHandle") + LogUtils.i(TAG, 'onclick clickHandle') this.clickHandle(); }) .enabled(this.isDisabled) @@ -114,7 +114,7 @@ export default struct listItem { .enabled(this.isDisabled) .onChange((isOn: boolean) => { this.controlSwitch = !this.controlSwitch; - LogUtils.i(TAG, 'onclick cardType is :' + JSON.stringify(this.cardType) + 'switcher is:' + JSON.stringify(this.isCon) + "Switch status:" + this.controlSwitch); + LogUtils.i(TAG, 'onclick cardType is :' + JSON.stringify(this.cardType) + 'switcher is:' + JSON.stringify(this.isCon) + 'Switch status:' + this.controlSwitch); if (this.controlSwitch && this.isCon === 0) { this.recordTypeDialog.open(); } else if (this.controlSwitch == false && this.isCon === 0) { @@ -130,7 +130,7 @@ export default struct listItem { }.visibility(this.isSupport ? Visibility.None : Visibility.Visible) } } - .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) + .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) .opacity(this.isDisabled ? 1 : 0.4) .margin({ top: 8, bottom: this.isSupport ? 5 : 11 }) .onClick(() => { @@ -156,7 +156,7 @@ struct dataRomingDialog { Text($r('app.string.mobile_data_tips')) .fontSize(20) .fontWeight(FontWeight.Medium) - .fontFamily("HarmonyHeiTi") + .fontFamily('HarmonyHeiTi') .height(56) .align(Alignment.Center) Text($r('app.string.mobile_data_turn_on_data_roaming')) @@ -172,12 +172,12 @@ struct dataRomingDialog { Flex({ justifyContent: FlexAlign.SpaceAround }) { Text(publiccontent.strings.cancel) .fontWeight(FontWeight.Medium) - .fontFamily("HarmonnyHeiTi") + .fontFamily('HarmonnyHeiTi') .height(21) .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) .fontSize($r('sys.float.ohos_id_text_size_button1')) .onClick(() => { - LogUtils.i(TAG, "dataRomingDialog onclick cancel"); + LogUtils.i(TAG, 'dataRomingDialog onclick cancel'); this.controller.close(); this.isMsg = false; }) @@ -185,12 +185,12 @@ struct dataRomingDialog { Text(publiccontent.strings.confirm) .fontWeight(FontWeight.Medium) - .fontFamily("HarmonnyHeiTi") + .fontFamily('HarmonnyHeiTi') .height(21) .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) .fontSize($r('sys.float.ohos_id_text_size_button1')) .onClick(() => { - LogUtils.i(TAG, "dataRomingDialog onclick confim toggletype: " + JSON.stringify(this.isCon) + " for cardtype:" + JSON.stringify(this.cardType)); + LogUtils.i(TAG, 'dataRomingDialog onclick confim toggletype: ' + JSON.stringify(this.isCon) + ' for cardtype:' + JSON.stringify(this.cardType)); this.controller.close(); this.isMsg = true; this.cardType == 0 ? enableCellularDataRoamingCardOne() : enableCellularDataRoamingCardTwo(); diff --git a/mobiledatasettings/src/main/ets/common/components/subHeader.ets b/mobiledatasettings/src/main/ets/common/components/subHeader.ets index b501edd..fd4fa74 100644 --- a/mobiledatasettings/src/main/ets/common/components/subHeader.ets +++ b/mobiledatasettings/src/main/ets/common/components/subHeader.ets @@ -34,14 +34,14 @@ export struct SubHeader { .fontFamily('HarmonyHeiTi') .fontWeight(FontWeight.Medium) } - .width("100%") + .width('100%') .height(48) .alignItems(VerticalAlign.Bottom) .padding({ bottom: 9, top: 19.5, left: $r('sys.float.ohos_id_card_margin_start'), - right: $r("sys.float.ohos_id_card_margin_end") + right: $r('sys.float.ohos_id_card_margin_end') }) } } \ No newline at end of file diff --git a/mobiledatasettings/src/main/ets/common/model/getCellularDataRoamingEnabledApi.ets b/mobiledatasettings/src/main/ets/common/model/getCellularDataRoamingEnabledApi.ets index 3925613..8a8d331 100644 --- a/mobiledatasettings/src/main/ets/common/model/getCellularDataRoamingEnabledApi.ets +++ b/mobiledatasettings/src/main/ets/common/model/getCellularDataRoamingEnabledApi.ets @@ -21,7 +21,7 @@ import telephonyData from '@ohos.telephony.data'; import radio from '@ohos.telephony.radio'; import LogUtils from '../utils/LogUtils' -const TAG = "getCellularDataRomingEnabledApi" +const TAG = 'getCellularDataRomingEnabledApi' /** * Whether to enable cellular data roaming * @@ -39,10 +39,10 @@ export function getSupportNetwork(slotId = 0) { return new Promise(function (resolve, reject) { try { let isSupported = radio.isNrSupported(); - LogUtils.i(TAG, "getSupportNetwork success data:" + JSON.stringify(isSupported)) + LogUtils.i(TAG, 'getSupportNetwork success data:' + JSON.stringify(isSupported)) resolve(isSupported); } catch (error) { - LogUtils.i(TAG, "getSupportNetwork success catch:" + JSON.stringify(error)) + LogUtils.i(TAG, 'getSupportNetwork success catch:' + JSON.stringify(error)) reject(error); } }); diff --git a/mobiledatasettings/src/main/ets/common/model/getPreferredNetworkModeApi.ets b/mobiledatasettings/src/main/ets/common/model/getPreferredNetworkModeApi.ets index c82e011..dc90417 100644 --- a/mobiledatasettings/src/main/ets/common/model/getPreferredNetworkModeApi.ets +++ b/mobiledatasettings/src/main/ets/common/model/getPreferredNetworkModeApi.ets @@ -19,7 +19,7 @@ import radio from '@ohos.telephony.radio'; import LogUtils from '../utils/LogUtils' -const TAG = "getPreferredNetworkModelApi" +const TAG = 'getPreferredNetworkModelApi' /** * Get the preferred network mode @@ -30,10 +30,10 @@ const TAG = "getPreferredNetworkModelApi" export function getPreferredNetwork(val) { return new Promise((resolve) => { radio.getPreferredNetwork(val).then((res) => { - LogUtils.i(TAG, "getPreferredNetwork success data then:" + JSON.stringify(res)) + LogUtils.i(TAG, 'getPreferredNetwork success data then:' + JSON.stringify(res)) resolve(res); }).catch((err) => { - LogUtils.i(TAG, "getPreferredNetwork success catch:" + JSON.stringify(err)) + LogUtils.i(TAG, 'getPreferredNetwork success catch:' + JSON.stringify(err)) }); }); } \ No newline at end of file diff --git a/mobiledatasettings/src/main/ets/common/model/getSimStateApi.ets b/mobiledatasettings/src/main/ets/common/model/getSimStateApi.ets index b1044e2..663c1ac 100644 --- a/mobiledatasettings/src/main/ets/common/model/getSimStateApi.ets +++ b/mobiledatasettings/src/main/ets/common/model/getSimStateApi.ets @@ -19,7 +19,7 @@ import sim from '@ohos.telephony.sim'; -const TAG = "GetSimStateApi" +const TAG = 'GetSimStateApi' /** * Get cardOne status diff --git a/mobiledatasettings/src/main/ets/common/model/setPreferredNetworkApi.ets b/mobiledatasettings/src/main/ets/common/model/setPreferredNetworkApi.ets index 7dfbb49..3958e33 100644 --- a/mobiledatasettings/src/main/ets/common/model/setPreferredNetworkApi.ets +++ b/mobiledatasettings/src/main/ets/common/model/setPreferredNetworkApi.ets @@ -19,7 +19,7 @@ import radio from '@ohos.telephony.radio'; import LogUtils from '../utils/LogUtils'; -const TAG = "setPreferredNetworkModelApi" +const TAG = 'setPreferredNetworkModelApi' /** * Set the preferred network mode @@ -31,10 +31,10 @@ const TAG = "setPreferredNetworkModelApi" export function setPreferredNetwork(slotId, auto) { return new Promise((resolve) => { radio.setPreferredNetwork(slotId, auto).then((res) => { - LogUtils.i(TAG, "setPreferredNetwork success data then:" + JSON.stringify(res)) + LogUtils.i(TAG, 'setPreferredNetwork success data then:' + JSON.stringify(res)) resolve(res); }).catch((err) => { - LogUtils.i(TAG, "setPreferredNetwork catch:" + JSON.stringify(err)) + LogUtils.i(TAG, 'setPreferredNetwork catch:' + JSON.stringify(err)) }); }); } \ No newline at end of file diff --git a/mobiledatasettings/src/main/ets/common/utils/LogUtils.ts b/mobiledatasettings/src/main/ets/common/utils/LogUtils.ts index de98fd2..c367fe2 100644 --- a/mobiledatasettings/src/main/ets/common/utils/LogUtils.ts +++ b/mobiledatasettings/src/main/ets/common/utils/LogUtils.ts @@ -30,19 +30,19 @@ */ export class LogUtils { d(TAG, msg): void { - console.debug("[mobiledatasettings:]" + TAG + ":" + msg); + console.debug('[mobiledatasettings:]' + TAG + ':' + msg); } i(TAG, msg): void { - console.info("[mobiledatasettings:]" + TAG + ":" + msg); + console.info('[mobiledatasettings:]' + TAG + ':' + msg); } w(TAG, msg): void { - console.warn("[mobiledatasettings:]" + TAG + ":" + msg); + console.warn('[mobiledatasettings:]' + TAG + ':' + msg); } e(TAG, msg): void { - console.error("[mobiledatasettings:]" + TAG + ":" + msg); + console.error('[mobiledatasettings:]' + TAG + ':' + msg); } } diff --git a/mobiledatasettings/src/main/ets/model/mobileDataStatus.ets b/mobiledatasettings/src/main/ets/model/mobileDataStatus.ets index d12247d..069f7ac 100644 --- a/mobiledatasettings/src/main/ets/model/mobileDataStatus.ets +++ b/mobiledatasettings/src/main/ets/model/mobileDataStatus.ets @@ -17,7 +17,7 @@ import radio from '@ohos.telephony.radio'; import LogUtils from '../common/utils/LogUtils'; import call from '@ohos.telephony.call'; -const TAG = "mobileDataStatus" +const TAG = 'mobileDataStatus'; /** * Get cellular data status @@ -35,15 +35,15 @@ export function getOperatorName(slotId = 0) { try { radio.getOperatorName(slotId, (error, value) => { if (error) { - LogUtils.i(TAG, "getOperatorName error:" + JSON.stringify(error)) + LogUtils.i(TAG, 'getOperatorName error:' + JSON.stringify(error)) reject(error); } else { - LogUtils.i(TAG, "getOperatorName value:" + JSON.stringify(value)) + LogUtils.i(TAG, 'getOperatorName value:' + JSON.stringify(value)) resolve(value); } }); } catch (error) { - LogUtils.i(TAG, "getOperatorName catch:" + JSON.stringify(error)) + LogUtils.i(TAG, 'getOperatorName catch:' + JSON.stringify(error)) reject(error); } }); @@ -90,15 +90,15 @@ export function enableCellularDataRoamingCardOne(slotId = 0) { try { telephonyData.enableCellularDataRoaming(slotId, (error, value) => { if (error) { - LogUtils.i(TAG, "enableCellularDataRoaming card one error :" + JSON.stringify(error)); + LogUtils.i(TAG, 'enableCellularDataRoaming card one error :' + JSON.stringify(error)); reject(error); } else { - LogUtils.i(TAG, "enableCellularDataRoaming card one success : then" + JSON.stringify(value)); + LogUtils.i(TAG, 'enableCellularDataRoaming card one success : then' + JSON.stringify(value)); resolve(value); } }); } catch (error) { - LogUtils.i(TAG, "enableCellularDataRoaming card one catch: " + JSON.stringify(error)); + LogUtils.i(TAG, 'enableCellularDataRoaming card one catch: ' + JSON.stringify(error)); reject(error); } }); @@ -109,15 +109,15 @@ export function enableCellularDataRoamingCardTwo(slotId = 1) { try { telephonyData.enableCellularDataRoaming(slotId, (error, value) => { if (error) { - LogUtils.i(TAG, "enableCellularDataRoaming card two error :" + JSON.stringify(error)); + LogUtils.i(TAG, 'enableCellularDataRoaming card two error :' + JSON.stringify(error)); reject(error); } else { - LogUtils.i(TAG, "enableCellularDataRoaming card two success :then" + JSON.stringify(value)); + LogUtils.i(TAG, 'enableCellularDataRoaming card two success :then' + JSON.stringify(value)); resolve(value); } }); } catch (error) { - LogUtils.i(TAG, "enableCellularDataRoaming card two catch: " + JSON.stringify(error)); + LogUtils.i(TAG, 'enableCellularDataRoaming card two catch: ' + JSON.stringify(error)); reject(error); } }); @@ -133,15 +133,15 @@ export function disableCellularDataRoamingCardOne(slotId = 0) { try { telephonyData.disableCellularDataRoaming(slotId, (error, value) => { if (error) { - LogUtils.i(TAG, "disableCellularDataRoaming card one error : " + JSON.stringify(error)); + LogUtils.i(TAG, 'disableCellularDataRoaming card one error : ' + JSON.stringify(error)); reject(error); } else { - LogUtils.i(TAG, "disableCellularDataRoaming card one success : then" + JSON.stringify(value)); + LogUtils.i(TAG, 'disableCellularDataRoaming card one success : then' + JSON.stringify(value)); resolve(value); } }); } catch (error) { - LogUtils.i(TAG, "disableCellularDataRoaming card one catch:" + JSON.stringify(error)); + LogUtils.i(TAG, 'disableCellularDataRoaming card one catch:' + JSON.stringify(error)); reject(error); } }); @@ -152,15 +152,15 @@ export function disableCellularDataRoamingCardTwo(slotId = 1) { try { telephonyData.disableCellularDataRoaming(slotId, (error, value) => { if (error) { - LogUtils.i(TAG, "disableCellularDataRoaming card two error :" + JSON.stringify(error)); + LogUtils.i(TAG, 'disableCellularDataRoaming card two error :' + JSON.stringify(error)); reject(error); } else { - LogUtils.i(TAG, "disableCellularDataRoaming card two success :then" + JSON.stringify(value)); + LogUtils.i(TAG, 'disableCellularDataRoaming card two success :then' + JSON.stringify(value)); resolve(value); } }); } catch (error) { - LogUtils.i(TAG, "disableCellularDataRoaming card two catch:" + JSON.stringify(error)); + LogUtils.i(TAG, 'disableCellularDataRoaming card two catch:' + JSON.stringify(error)); reject(error); } }); @@ -169,34 +169,34 @@ export function disableCellularDataRoamingCardTwo(slotId = 1) { export function enableImsSwitchCardOne() { call.enableImsSwitch(0).then((data) => { - AppStorage.SetOrCreate("imsOne", true); - LogUtils.i(TAG, "enableImsSwitch card one : success then " + JSON.stringify(data)); + AppStorage.SetOrCreate('imsOne', true); + LogUtils.i(TAG, 'enableImsSwitch card one : success then ' + JSON.stringify(data)); }).catch((error) => { - LogUtils.i(TAG, "enableImsSwitch card one : catch" + JSON.stringify(error)); + LogUtils.i(TAG, 'enableImsSwitch card one : catch' + JSON.stringify(error)); }); } export function enableImsSwitchCardTwo() { call.enableImsSwitch(1).then((data) => { - LogUtils.i(TAG, "enableImsSwitch card two : success then " + JSON.stringify(data)); + LogUtils.i(TAG, 'enableImsSwitch card two : success then ' + JSON.stringify(data)); }).catch((error) => { - LogUtils.i(TAG, "enableImsSwitch card two : catch" + JSON.stringify(error)); + LogUtils.i(TAG, 'enableImsSwitch card two : catch' + JSON.stringify(error)); }); } export function disableImsSwitchCardOne() { call.disableImsSwitch(0).then((data) => { - AppStorage.SetOrCreate("imsOne", false); - LogUtils.i(TAG, "disableImsSwitch card one : success then " + JSON.stringify(data)); + AppStorage.SetOrCreate('imsOne', false); + LogUtils.i(TAG, 'disableImsSwitch card one : success then ' + JSON.stringify(data)); }).catch((error) => { - LogUtils.i(TAG, "disableImsSwitch card one : catch" + JSON.stringify(error)); + LogUtils.i(TAG, 'disableImsSwitch card one : catch' + JSON.stringify(error)); }); } export function disableImsSwitchCardTwo() { call.disableImsSwitch(1).then((data) => { - LogUtils.i(TAG, "disableImsSwitch card two : success then " + JSON.stringify(data)); + LogUtils.i(TAG, 'disableImsSwitch card two : success then ' + JSON.stringify(data)); }).catch((error) => { - LogUtils.i(TAG, "disableImsSwitch card two : catch" + JSON.stringify(error)); + LogUtils.i(TAG, 'disableImsSwitch card two : catch' + JSON.stringify(error)); }); } diff --git a/mobiledatasettings/src/main/ets/model/registerSimStateApi.ets b/mobiledatasettings/src/main/ets/model/registerSimStateApi.ets index 63c7e09..4718f9d 100644 --- a/mobiledatasettings/src/main/ets/model/registerSimStateApi.ets +++ b/mobiledatasettings/src/main/ets/model/registerSimStateApi.ets @@ -20,7 +20,7 @@ import observer from '@ohos.telephony.observer'; import LogUtils from '../common/utils/LogUtils'; import sim from '@ohos.telephony.sim'; -const TAG = "registerSimStateAPi" +const TAG = 'registerSimStateAPi'; /** * Monitor the SIM card status @@ -32,9 +32,9 @@ export function registerSimStateChange(slotId, callBack) { return observer.on('simStateChange', { slotId: slotId }, (callStateInfo) => { - LogUtils.i(TAG, "registerSimStateChange: then " + JSON.stringify(callStateInfo)) + LogUtils.i(TAG, 'registerSimStateChange: then ' + JSON.stringify(callStateInfo)); callBack(callStateInfo); - return callStateInfo + return callStateInfo; }); } diff --git a/mobiledatasettings/src/main/ets/pages/index.ets b/mobiledatasettings/src/main/ets/pages/index.ets index f9ef854..0732395 100644 --- a/mobiledatasettings/src/main/ets/pages/index.ets +++ b/mobiledatasettings/src/main/ets/pages/index.ets @@ -40,7 +40,7 @@ import HeadComponent from '../common/components/headComponent'; import { SubHeader } from '../common/components/subHeader'; import LogUtils from '../common/utils/LogUtils'; -const TAG = "Index"; +const TAG = 'Index'; @Entry @Component @@ -75,7 +75,7 @@ struct Index { setCache_cun_name = 'DISTRIBUTEDDATA_CUN_NAME'; setCache_wl_name = 'SETCACHE_WL_NAME'; @State enable5g: boolean = false; - @StorageLink("imsOne")enableISM: boolean = false; + @StorageLink('imsOne')enableISM: boolean = false; @State enableISM2: boolean = false; @State TelephoneNumber: string = ''; @State TelephoneNumber2?: string = ''; @@ -93,11 +93,11 @@ struct Index { if (res == 0) { this.byValueWLMS = $r('app.string.mobile_data_5g'); } else if (res == 5) { - this.byValueWLMS = $r("app.string.mobile_data_4g"); + this.byValueWLMS = $r('app.string.mobile_data_4g'); } else if (res == 6) { - this.byValueWLMS = $r("app.string.mobile_data_3g"); + this.byValueWLMS = $r('app.string.mobile_data_3g'); } else if (res == 1) { - this.byValueWLMS = $r("app.string.mobile_data_2g"); + this.byValueWLMS = $r('app.string.mobile_data_2g'); } } @@ -106,7 +106,7 @@ struct Index { */ getSimStateDataCardOne() { getSimStateCardOne().then((res: number) => { - LogUtils.i(TAG, "getSimStateData Card1 :success " + JSON.stringify(res)) + LogUtils.i(TAG, 'getSimStateData Card1 :success ' + JSON.stringify(res)) const simState = { SIM_STATE_UNKNOWN: 0, SIM_STATE_NOT_PRESENT: 1, @@ -131,7 +131,7 @@ struct Index { */ getSimStateDataCardTwo() { getSimStateCardTwo().then((res: number) => { - LogUtils.i(TAG, "getSimState Card2 :success then" + JSON.stringify(res)); + LogUtils.i(TAG, 'getSimState Card2 :success then' + JSON.stringify(res)); const simState = { SIM_STATE_UNKNOWN: 0, SIM_STATE_NOT_PRESENT: 1, @@ -167,10 +167,10 @@ struct Index { */ getSimCardOnePhoneNumber() { getSimCardOnePhoneNumber().then((res) => { - LogUtils.i(TAG, "getSimTelephoneNumber card1 other success" + JSON.stringify(res)); + LogUtils.i(TAG, 'getSimTelephoneNumber card1 other success' + JSON.stringify(res)); this.TelephoneNumber = res; }).catch((err) => { - LogUtils.i(TAG, "getSimTelephoneNumber card1 other catch" + JSON.stringify(err)); + LogUtils.i(TAG, 'getSimTelephoneNumber card1 other catch' + JSON.stringify(err)); }); } @@ -179,10 +179,10 @@ struct Index { */ getSimCardTwoPhoneNumber() { getSimCardTwoPhoneNumber().then((res) => { - LogUtils.i(TAG, "getSimTelephoneNumber card2 other success" + JSON.stringify(res)); + LogUtils.i(TAG, 'getSimTelephoneNumber card2 other success' + JSON.stringify(res)); this.TelephoneNumber2 = res; }).catch((err) => { - LogUtils.i(TAG, "getSimTelephoneNumber card2 other catch" + JSON.stringify(err)); + LogUtils.i(TAG, 'getSimTelephoneNumber card2 other catch' + JSON.stringify(err)); }); } @@ -191,10 +191,10 @@ struct Index { */ getCellularDataState() { isCellularDataEnabled().then((data) => { - LogUtils.i(TAG, "isCellularDataEnabled success: isON:" + JSON.stringify(data)); + LogUtils.i(TAG, 'isCellularDataEnabled success: isON:' + JSON.stringify(data)); this.isDataEnable = data; }).catch((error) => { - LogUtils.i(TAG, "isCellularDataEnabled error catch" + JSON.stringify(error)); + LogUtils.i(TAG, 'isCellularDataEnabled error catch' + JSON.stringify(error)); }); } @@ -245,25 +245,25 @@ struct Index { call.isImsSwitchEnabled(slotId).then((res: boolean) => { if (slotId) { this.enableISM2 = res; - LogUtils.i(TAG, "isImsSwitchEnable enable 1:" + JSON.stringify(this.enableISM2)); + LogUtils.i(TAG, 'isImsSwitchEnable enable 1:' + JSON.stringify(this.enableISM2)); } else { this.enableISM = res; - LogUtils.i(TAG, "isImsSwitchEnable enable 0:" + JSON.stringify(this.enableISM)); + LogUtils.i(TAG, 'isImsSwitchEnable enable 0:' + JSON.stringify(this.enableISM)); } }).catch((err) => { if (slotId) { this.enableISM2 = true; - LogUtils.i(TAG, "isImsSwitchEnable err 1:" + JSON.stringify(this.enableISM2)); + LogUtils.i(TAG, 'isImsSwitchEnable err 1:' + JSON.stringify(this.enableISM2)); } else { this.enableISM = true; - LogUtils.i(TAG, "isImsSwitchEnable err 0:" + JSON.stringify(this.enableISM)); + LogUtils.i(TAG, 'isImsSwitchEnable err 0:' + JSON.stringify(this.enableISM)); } - LogUtils.i(TAG, "isImsSwitchEnabled card catch:" + JSON.stringify(err)); + LogUtils.i(TAG, 'isImsSwitchEnabled card catch:' + JSON.stringify(err)); }); } aboutToAppear() { - LogUtils.i(TAG, "aboutToAppear") + LogUtils.i(TAG, 'aboutToAppear') this.initAirPlaneMode(); if (getMaxSimCount() === 2) { this.addRegisterSimStateChange(1); @@ -301,24 +301,24 @@ struct Index { */ radioChange(slotId, v) { const res = setPreferredNetwork(slotId, v); - LogUtils.i(TAG, "radioChange res:" + JSON.stringify(res)); + LogUtils.i(TAG, 'radioChange res:' + JSON.stringify(res)); } getCellularDataRoamingEnabled() { isCellularDataRoamingEnabledCardOne().then((res) => { - LogUtils.i(TAG,"getCellularDataRoamingEnabled card one success then:" + JSON.stringify(res)); + LogUtils.i(TAG,'getCellularDataRoamingEnabled card one success then:' + JSON.stringify(res)); this.dataRoamSwitchCardOne = res; }).catch((err) => { this.dataRoamSwitchCardOne = false; - LogUtils.i(TAG, "enableCellularDataRoaming card one catch:" + JSON.stringify(err)); + LogUtils.i(TAG, 'enableCellularDataRoaming card one catch:' + JSON.stringify(err)); }); if (getMaxSimCount() === 2) { isCellularDataRoamingEnabledCardTwo().then((res) => { - LogUtils.i(TAG,"getCellularDataRoamingEnabled card two success then:" + JSON.stringify(res)); + LogUtils.i(TAG,'getCellularDataRoamingEnabled card two success then:' + JSON.stringify(res)); this.dataRoamSwitchCardTwo = res; }).catch((err) => { this.dataRoamSwitchCardTwo = false; - LogUtils.i(TAG, "enableCellularDataRoaming card two catch:" + JSON.stringify(err)); + LogUtils.i(TAG, 'enableCellularDataRoaming card two catch:' + JSON.stringify(err)); }); } } @@ -371,18 +371,18 @@ struct Index { .enabled((this.simStateStatusCardOne || this.simStateStatusCardTwo) && !this.isAirPlaneMode) .onChange((isOn: boolean) => { this.isDataEnable = !this.isDataEnable; - LogUtils.i(TAG, "mobile data switch changes enable:" + JSON.stringify(this.isDataEnable)); + LogUtils.i(TAG, 'mobile data switch changes enable:' + JSON.stringify(this.isDataEnable)); if (this.isDataEnable == false) { disableCellularData().then((data) => { - LogUtils.i(TAG, "disableCellularData: success then" + JSON.stringify(data)); + LogUtils.i(TAG, 'disableCellularData: success then' + JSON.stringify(data)); }).catch((error) => { - LogUtils.i(TAG, "disableCellularData: error catch" + JSON.stringify(error)); + LogUtils.i(TAG, 'disableCellularData: error catch' + JSON.stringify(error)); }); } else { enableCellularData().then((data) => { - LogUtils.i(TAG, "enableCellularData: success then" + JSON.stringify(data)); + LogUtils.i(TAG, 'enableCellularData: success then' + JSON.stringify(data)); }).catch((error) => { - LogUtils.i(TAG, "enableCellularData: error catch" + JSON.stringify(error)); + LogUtils.i(TAG, 'enableCellularData: error catch' + JSON.stringify(error)); }); } }) @@ -394,9 +394,9 @@ struct Index { bottom: 4 }) .height(90) - .width("100%") + .width('100%') .borderRadius(16) - .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) + .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) .opacity((this.simStateStatusCardOne || this.simStateStatusCardTwo) && !this.isAirPlaneMode ? 1 : 0.4) SubHeader({ @@ -419,7 +419,7 @@ struct Index { Divider() .strokeWidth(0.5) - .color("#E3E3E3") + .color('#E3E3E3') .lineCap(LineCapStyle.Round) .margin({ right: '2%' }) @@ -441,9 +441,9 @@ struct Index { top: 4, bottom: 4 }) - .width("100%") + .width('100%') .borderRadius(16) - .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) + .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) .opacity(this.simStateStatusCardOne && !this.isAirPlaneMode ? 1 : 0.4) SubHeader({ @@ -466,7 +466,7 @@ struct Index { }) Divider() .strokeWidth(0.5) - .color("#E3E3E3") + .color('#E3E3E3') .lineCap(LineCapStyle.Round) .margin({ right: '2%' }) item({ @@ -493,9 +493,9 @@ struct Index { top: 4, bottom: 4 }) - .width("100%") + .width('100%') .borderRadius(16) - .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) + .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) .opacity(this.simStateStatusCardTwo && !this.isAirPlaneMode ? 1 : 0.4) .visibility(getMaxSimCount() === 2 ? Visibility.Visible : Visibility.Hidden) } @@ -515,6 +515,6 @@ struct Index { .padding({ left: 12, right: 12 }) .width('100%') .height('100%') - .backgroundColor($r("sys.color.ohos_id_color_sub_background")) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } } \ No newline at end of file