mirror of
https://gitee.com/openharmony/applications_call
synced 2024-11-27 00:20:46 +00:00
!114 use single quotes
Merge pull request !114 from zhouhongli2023/master
This commit is contained in:
commit
6c05ab9b3d
@ -45,14 +45,14 @@ export class CallUtils {
|
|||||||
sim.hasSimCard(accountId).then((res) => {
|
sim.hasSimCard(accountId).then((res) => {
|
||||||
resolve(res);
|
resolve(res);
|
||||||
if (accountId === 0) {
|
if (accountId === 0) {
|
||||||
AppStorage.SetOrCreate("hasSimCard1", res);
|
AppStorage.SetOrCreate('hasSimCard1', res);
|
||||||
} else if (accountId === 1) {
|
} else if (accountId === 1) {
|
||||||
AppStorage.SetOrCreate("hasSimCard2", res);
|
AppStorage.SetOrCreate('hasSimCard2', res);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
reject(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
|
slotId: 0
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
resolve(res);
|
resolve(res);
|
||||||
AppStorage.SetOrCreate("IsEmergencyPhoneNumber", res)
|
AppStorage.SetOrCreate('IsEmergencyPhoneNumber', res)
|
||||||
LogUtils.i(TAG, "then:isEmergencyPhoneNumber :" + JSON.stringify(res));
|
LogUtils.i(TAG, 'then:isEmergencyPhoneNumber :' + JSON.stringify(res));
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
reject(err);
|
reject(err);
|
||||||
LogUtils.i(TAG, "catch:isEmergencyPhoneNumber :" + JSON.stringify(err));
|
LogUtils.i(TAG, 'catch:isEmergencyPhoneNumber :' + JSON.stringify(err));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import CallListStruct from '../common/struct/CallListStruct';
|
|||||||
import DefaultCallData from '../common/struct/TypeUtils';
|
import DefaultCallData from '../common/struct/TypeUtils';
|
||||||
import VibrationAndProximityUtils from '../common/utils/VibrationAndProximityUtils';
|
import VibrationAndProximityUtils from '../common/utils/VibrationAndProximityUtils';
|
||||||
|
|
||||||
const TAG = "CallDataManager";
|
const TAG = 'CallDataManager';
|
||||||
/**
|
/**
|
||||||
* class CallDataManager
|
* class CallDataManager
|
||||||
*/
|
*/
|
||||||
@ -64,7 +64,7 @@ export default class CallDataManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.callList.length === 0) {
|
if (this.callList.length === 0) {
|
||||||
LogUtils.i(TAG, "init callList: undefined");
|
LogUtils.i(TAG, 'init callList: undefined');
|
||||||
this.callList = callList;
|
this.callList = callList;
|
||||||
} else {
|
} else {
|
||||||
let oldCallList = this.callList;
|
let oldCallList = this.callList;
|
||||||
@ -74,7 +74,7 @@ export default class CallDataManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.callTimeList.length === 0) {
|
if (this.callTimeList.length === 0) {
|
||||||
LogUtils.i(TAG, "init callTimeList: undefined");
|
LogUtils.i(TAG, 'init callTimeList: undefined');
|
||||||
this.callTimeList = callTimeList;
|
this.callTimeList = callTimeList;
|
||||||
} else {
|
} else {
|
||||||
let oldCallTimeList = this.callTimeList;
|
let oldCallTimeList = this.callTimeList;
|
||||||
@ -99,7 +99,7 @@ export default class CallDataManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const targetObj = this.callList.find((v) => v.callId === callId);
|
const targetObj = this.callList.find((v) => v.callId === callId);
|
||||||
LogUtils.i(TAG, "update :")
|
LogUtils.i(TAG, 'update :')
|
||||||
if (targetObj) {
|
if (targetObj) {
|
||||||
const { oldCallState } = targetObj;
|
const { oldCallState } = targetObj;
|
||||||
Object.assign(targetObj, {
|
Object.assign(targetObj, {
|
||||||
@ -157,10 +157,10 @@ export default class CallDataManager {
|
|||||||
public clearCall(callData) {
|
public clearCall(callData) {
|
||||||
this.NotificationManager.cancelNotification();
|
this.NotificationManager.cancelNotification();
|
||||||
AppStorage.Get<NotificationManager>('notificationManager').sendCapsuleNotification(callData, true);
|
AppStorage.Get<NotificationManager>('notificationManager').sendCapsuleNotification(callData, true);
|
||||||
AppStorage.Delete("CallTimeList");
|
AppStorage.Delete('CallTimeList');
|
||||||
this.clearData();
|
this.clearData();
|
||||||
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
|
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
|
||||||
LogUtils.i(TAG, "calluiAbility terminateSelf");
|
LogUtils.i(TAG, 'calluiAbility terminateSelf');
|
||||||
});
|
});
|
||||||
// remove Proximity Listener
|
// remove Proximity Listener
|
||||||
VibrationAndProximityUtils.wakeupScreen();
|
VibrationAndProximityUtils.wakeupScreen();
|
||||||
@ -180,7 +180,7 @@ export default class CallDataManager {
|
|||||||
public hasAliveCall() {
|
public hasAliveCall() {
|
||||||
const callData = this.callList.find((call) => call.callState !== CallStateConst.CALL_STATUS_DISCONNECTED
|
const callData = this.callList.find((call) => call.callState !== CallStateConst.CALL_STATUS_DISCONNECTED
|
||||||
&& call.callState !== CallStateConst.CALL_STATUS_DISCONNECTING);
|
&& 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;
|
return callData !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ export default class CallDataManager {
|
|||||||
*/
|
*/
|
||||||
updateCallTimeList(callData) {
|
updateCallTimeList(callData) {
|
||||||
const CallTimeObj = this.callTimeList.find((v) => v.callId === callData.callId);
|
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) {
|
if (!CallTimeObj && callData.callState === CallStateConst.CALL_STATUS_ACTIVE) {
|
||||||
const obj = {
|
const obj = {
|
||||||
callId: callData.callId,
|
callId: callData.callId,
|
||||||
@ -240,20 +240,20 @@ export default class CallDataManager {
|
|||||||
endTimestamp: 0,
|
endTimestamp: 0,
|
||||||
};
|
};
|
||||||
this.callTimeList.push(obj);
|
this.callTimeList.push(obj);
|
||||||
AppStorage.SetOrCreate("CallTimeList", this.callTimeList)
|
AppStorage.SetOrCreate('CallTimeList', this.callTimeList)
|
||||||
LogUtils.i(TAG, "updateCallTimeList : " + JSON.stringify(this.callTimeList))
|
LogUtils.i(TAG, 'updateCallTimeList : ' + JSON.stringify(this.callTimeList))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clearData() {
|
clearData() {
|
||||||
this.callList.splice(0, this.callList.length);
|
this.callList.splice(0, this.callList.length);
|
||||||
LogUtils.i(TAG, "clearData: " + JSON.stringify(this.callList));
|
LogUtils.i(TAG, 'clearData: ' + JSON.stringify(this.callList));
|
||||||
let inputvalue = AppStorage.Delete("TextInputValue");
|
let inputvalue = AppStorage.Delete('TextInputValue');
|
||||||
LogUtils.i(TAG, "clearData:TextInputValue " + JSON.stringify(inputvalue));
|
LogUtils.i(TAG, 'clearData:TextInputValue ' + JSON.stringify(inputvalue));
|
||||||
let textinput = AppStorage.Delete("TextInput");
|
let textinput = AppStorage.Delete('TextInput');
|
||||||
AppStorage.Delete("CallTimeList");
|
AppStorage.Delete('CallTimeList');
|
||||||
AppStorage.Delete("notificationManager");
|
AppStorage.Delete('notificationManager');
|
||||||
AppStorage.Delete("currentAudioDeviceIcon");
|
AppStorage.Delete('currentAudioDeviceIcon');
|
||||||
AppStorage.Delete("datalist");
|
AppStorage.Delete('datalist');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,7 +27,7 @@ import DefaultCallData from '../common/struct/TypeUtils';
|
|||||||
import CallListStruct from '../common/struct/CallListStruct';
|
import CallListStruct from '../common/struct/CallListStruct';
|
||||||
import VibrationAndProximityUtils from '../common/utils/VibrationAndProximityUtils';
|
import VibrationAndProximityUtils from '../common/utils/VibrationAndProximityUtils';
|
||||||
|
|
||||||
const TAG = "CallManager";
|
const TAG = 'CallManager';
|
||||||
const TIMING = 1000;
|
const TIMING = 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,13 +78,13 @@ export default class CallManager {
|
|||||||
if (globalThis.abilityWant && globalThis.abilityWant.parameters && ('callState' in globalThis.abilityWant.parameters)) {
|
if (globalThis.abilityWant && globalThis.abilityWant.parameters && ('callState' in globalThis.abilityWant.parameters)) {
|
||||||
if (!this.isServiceConnected) {
|
if (!this.isServiceConnected) {
|
||||||
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
|
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
|
||||||
LogUtils.i(TAG, "calluiAbility terminateSelf because service disconnected");
|
LogUtils.i(TAG, 'calluiAbility terminateSelf because service disconnected');
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let callData = this.getCallDataFromWant(globalThis.abilityWant.parameters);
|
let callData = this.getCallDataFromWant(globalThis.abilityWant.parameters);
|
||||||
this.update(callData);
|
this.update(callData);
|
||||||
LogUtils.i(TAG, "initCallData featureAbility.getWant :")
|
LogUtils.i(TAG, 'initCallData featureAbility.getWant :')
|
||||||
} else {
|
} else {
|
||||||
this.mCallServiceProxy.publish({
|
this.mCallServiceProxy.publish({
|
||||||
key: 'getInitCallData',
|
key: 'getInitCallData',
|
||||||
@ -119,12 +119,12 @@ export default class CallManager {
|
|||||||
* @param { Object } callData -Object
|
* @param { Object } callData -Object
|
||||||
*/
|
*/
|
||||||
async update(callData) {
|
async update(callData) {
|
||||||
LogUtils.i(TAG, "update calldata:")
|
LogUtils.i(TAG, 'update calldata:')
|
||||||
if (this.callData != undefined && this.callData.callId === callData.callId) {
|
if (this.callData != undefined && this.callData.callId === callData.callId) {
|
||||||
const { callState } = this.callData;
|
const { callState } = this.callData;
|
||||||
if (callState === 6 && this.callList.length === 1) {
|
if (callState === 6 && this.callList.length === 1) {
|
||||||
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
|
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
|
||||||
LogUtils.i(TAG, "calluiAbility terminateSelf because service disconnected");
|
LogUtils.i(TAG, 'calluiAbility terminateSelf because service disconnected');
|
||||||
});
|
});
|
||||||
// remove Proximity Listener
|
// remove Proximity Listener
|
||||||
VibrationAndProximityUtils.wakeupScreen();
|
VibrationAndProximityUtils.wakeupScreen();
|
||||||
@ -136,16 +136,16 @@ export default class CallManager {
|
|||||||
this.mCallDataManager.update(callData);
|
this.mCallDataManager.update(callData);
|
||||||
call.formatPhoneNumber(callData.accountNumber, (err, data) => {
|
call.formatPhoneNumber(callData.accountNumber, (err, data) => {
|
||||||
if (err) {
|
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) {
|
} else if (data === undefined) {
|
||||||
AppStorage.SetOrCreate("AccountNumber", callData.accountNumber);
|
AppStorage.SetOrCreate('AccountNumber', callData.accountNumber);
|
||||||
} else {
|
} else {
|
||||||
LogUtils.i(TAG, "updata calldata formatPhoneNumber success:" + JSON.stringify(data));
|
LogUtils.i(TAG, 'updata calldata formatPhoneNumber success:' + JSON.stringify(data));
|
||||||
AppStorage.SetOrCreate("AccountNumber", data);
|
AppStorage.SetOrCreate('AccountNumber', data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
CallUtils.isEmergencyPhoneNumber(callData.accountNumber);
|
CallUtils.isEmergencyPhoneNumber(callData.accountNumber);
|
||||||
LogUtils.i(TAG, "update :");
|
LogUtils.i(TAG, 'update :');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,11 +153,11 @@ export default class CallManager {
|
|||||||
*/
|
*/
|
||||||
updateCallTimeList() {
|
updateCallTimeList() {
|
||||||
if (!this.mCallDataManager.hasActiveCall()) {
|
if (!this.mCallDataManager.hasActiveCall()) {
|
||||||
LogUtils.i(TAG, "no active calls to update");
|
LogUtils.i(TAG, 'no active calls to update');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.callTimeList = AppStorage.Get("CallTimeList")
|
this.callTimeList = AppStorage.Get('CallTimeList');
|
||||||
this.callTimeList.forEach((item, i) => {
|
this.callTimeList.forEach((item, i) => {
|
||||||
if (this.mCallDataManager.isActiveCall(item.callId)) {
|
if (this.mCallDataManager.isActiveCall(item.callId)) {
|
||||||
item.endTimestamp = new Date().valueOf();
|
item.endTimestamp = new Date().valueOf();
|
||||||
@ -167,7 +167,7 @@ export default class CallManager {
|
|||||||
this.callTimeList.splice(i, 1, {
|
this.callTimeList.splice(i, 1, {
|
||||||
...item,
|
...item,
|
||||||
});
|
});
|
||||||
AppStorage.SetOrCreate("CallTimeList", this.callTimeList);
|
AppStorage.SetOrCreate('CallTimeList', this.callTimeList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.mTimeMeter = setTimeout(() => {
|
this.mTimeMeter = setTimeout(() => {
|
||||||
|
@ -27,7 +27,7 @@ import commonEvent from '@ohos.commonEvent';
|
|||||||
import call from '@ohos.telephony.call';
|
import call from '@ohos.telephony.call';
|
||||||
import LogUtils from '../common/utils/LogUtils';
|
import LogUtils from '../common/utils/LogUtils';
|
||||||
|
|
||||||
const TAG = "CallServiceProxy";
|
const TAG = 'CallServiceProxy';
|
||||||
const prefixLog = 'callUI app:@ohos.telephony.call:';
|
const prefixLog = 'callUI app:@ohos.telephony.call:';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ export default class CallServiceProxy {
|
|||||||
* Make a phone call
|
* Make a phone call
|
||||||
*/
|
*/
|
||||||
public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) {
|
public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) {
|
||||||
LogUtils.i(TAG, "dialCall phoneNumber :")
|
LogUtils.i(TAG, 'dialCall phoneNumber :');
|
||||||
return call.dial(phoneNumber, {
|
return call.dial(phoneNumber, {
|
||||||
accountId,
|
accountId,
|
||||||
videoState,
|
videoState,
|
||||||
@ -77,9 +77,9 @@ export default class CallServiceProxy {
|
|||||||
*/
|
*/
|
||||||
public acceptCall = function (callId) {
|
public acceptCall = function (callId) {
|
||||||
call.answerCall(callId).then((res) => {
|
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) => {
|
}).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
|
messageContent: msg
|
||||||
}) : call.rejectCall(callId);
|
}) : call.rejectCall(callId);
|
||||||
rejectCallPromise.then((res) => {
|
rejectCallPromise.then((res) => {
|
||||||
LogUtils.i(TAG, prefixLog + "then:rejectCall")
|
LogUtils.i(TAG, prefixLog + 'then:rejectCall');
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.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) => {
|
public hangUpCall = (callId) => new Promise((resolve, reject) => {
|
||||||
call.hangUpCall(callId).then((res) => {
|
call.hangUpCall(callId).then((res) => {
|
||||||
resolve(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) => {
|
}).catch((err) => {
|
||||||
reject(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) => {
|
public holdCall = (callId) => new Promise((resolve, reject) => {
|
||||||
call.holdCall(callId).then((res) => {
|
call.holdCall(callId).then((res) => {
|
||||||
resolve(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) => {
|
.catch((err) => {
|
||||||
reject(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) => {
|
public unHoldCall = (callId) => new Promise((resolve, reject) => {
|
||||||
call.unHoldCall(callId).then((res) => {
|
call.unHoldCall(callId).then((res) => {
|
||||||
resolve(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) => {
|
.catch((err) => {
|
||||||
reject(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() {
|
public setMuted() {
|
||||||
call.setMuted().then((res) => {
|
call.setMuted().then((res) => {
|
||||||
LogUtils.i(TAG, prefixLog + "then:setMute")
|
LogUtils.i(TAG, prefixLog + 'then:setMute');
|
||||||
}).catch((err) => {
|
}).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() {
|
public cancelMuted() {
|
||||||
call.cancelMuted().then((res) => {
|
call.cancelMuted().then((res) => {
|
||||||
LogUtils.i(TAG, prefixLog + "then:cancelMuted")
|
LogUtils.i(TAG, prefixLog + 'then:cancelMuted');
|
||||||
}).catch((err) => {
|
}).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) => {
|
public switchCall = (callId) => new Promise((resolve, reject) => {
|
||||||
call.switchCall(callId).then((res) => {
|
call.switchCall(callId).then((res) => {
|
||||||
resolve(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) => {
|
.catch((err) => {
|
||||||
reject(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) {
|
public registerCallStateCallback(callBack) {
|
||||||
call.on('callDetailsChange', (data) => {
|
call.on('callDetailsChange', (data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback")
|
LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback callState")
|
LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback callState')
|
||||||
callBack(data);
|
callBack(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -219,10 +219,10 @@ export default class CallServiceProxy {
|
|||||||
public unRegisterCallStateCallback() {
|
public unRegisterCallStateCallback() {
|
||||||
call.off('callDetailsChange', (data) => {
|
call.off('callDetailsChange', (data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
|
LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallStateCallback')
|
||||||
return;
|
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() {
|
public registerCallEventCallback() {
|
||||||
call.on('callEventChange', (data) => {
|
call.on('callEventChange', (data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
LogUtils.i(TAG, prefixLog + "call.on callEventChange")
|
LogUtils.i(TAG, prefixLog + 'call.on callEventChange')
|
||||||
} else {
|
} 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() {
|
public unRegisterCallEventCallback() {
|
||||||
call.off('callEventChange', (data) => {
|
call.off('callEventChange', (data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallEventCallback : %s")
|
LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallEventCallback : %s')
|
||||||
} else {
|
} 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') => {
|
public startDTMF = (callId = 1, str = '1') => {
|
||||||
call.startDTMF(callId, str).then((res) => {
|
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) => {
|
}).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) => {
|
public stopDTMF = (callId = 1) => {
|
||||||
call.stopDTMF(callId).then((res) => {
|
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) => {
|
}).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) => {
|
public combineConference = (callId) => {
|
||||||
call.combineConference(callId).then((res) => {
|
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) => {
|
}).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) {
|
public publish(data) {
|
||||||
LogUtils.i(TAG, prefixLog + "callui.event.callEvent publish")
|
LogUtils.i(TAG, prefixLog + 'callui.event.callEvent publish')
|
||||||
commonEvent.publish('callui.event.callEvent', {
|
commonEvent.publish('callui.event.callEvent', {
|
||||||
bundleName: 'com.ohos.callui',
|
bundleName: 'com.ohos.callui',
|
||||||
isOrdered: false,
|
isOrdered: false,
|
||||||
subscriberPermissions: ["ohos.permission.GET_TELEPHONY_STATE"],
|
subscriberPermissions: ['ohos.permission.GET_TELEPHONY_STATE'],
|
||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
}, (res) => {
|
}, (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')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import callStateConst from '../common/constant/CallStateConst';
|
|||||||
import LogUtils from '../common/utils/LogUtils';
|
import LogUtils from '../common/utils/LogUtils';
|
||||||
import * as Constants from '../common/utils/Constants';
|
import * as Constants from '../common/utils/Constants';
|
||||||
|
|
||||||
const TAG = "NotificationManager";
|
const TAG = 'NotificationManager';
|
||||||
const ID = 0;
|
const ID = 0;
|
||||||
|
|
||||||
const notificationRequest = {
|
const notificationRequest = {
|
||||||
@ -86,15 +86,15 @@ export default class NotificationManager {
|
|||||||
const data = {
|
const data = {
|
||||||
callId, btnType: key
|
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 wantAgentObj = await this.getWantAgent(data, SEND_COMMON_EVENT);
|
||||||
const title = globalThis.calluiAbilityContext?.resourceManager.getStringSync(textMap[key]);
|
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({
|
notificationRequest.actionButtons.push({
|
||||||
title: title,
|
title: title,
|
||||||
wantAgent: wantAgentObj
|
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, {
|
Object.assign(notificationRequest.content.longText, {
|
||||||
@ -104,11 +104,11 @@ export default class NotificationManager {
|
|||||||
longText: expandedName
|
longText: expandedName
|
||||||
});
|
});
|
||||||
notification.publish(notificationRequest).then((data) => {
|
notification.publish(notificationRequest).then((data) => {
|
||||||
LogUtils.i(TAG, "sendNotification publish success")
|
LogUtils.i(TAG, 'sendNotification publish success')
|
||||||
}).catch((err) => {
|
}).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
|
* Cancel notice
|
||||||
*/
|
*/
|
||||||
cancelNotification() {
|
cancelNotification() {
|
||||||
LogUtils.i(TAG, "cancelNotification")
|
LogUtils.i(TAG, 'cancelNotification')
|
||||||
notification.cancel(ID).then((res) => {
|
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) => {
|
}).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
|
* @param {boolean} isBackground - is background
|
||||||
*/
|
*/
|
||||||
sendCapsuleNotification(callData, isBackground) {
|
sendCapsuleNotification(callData, isBackground) {
|
||||||
LogUtils.i(TAG, "sendCapsuleNotification isBackground : " + JSON.stringify(isBackground))
|
LogUtils.i(TAG, 'sendCapsuleNotification isBackground : ' + JSON.stringify(isBackground))
|
||||||
LogUtils.i(TAG, "sendCapsuleNotification callData.startTime :")
|
LogUtils.i(TAG, 'sendCapsuleNotification callData.startTime :')
|
||||||
const {callState, startTime} = callData;
|
const {callState, startTime} = callData;
|
||||||
let commonEventPublishData = {
|
let commonEventPublishData = {
|
||||||
bundleName: 'com.ohos.systemui',
|
bundleName: 'com.ohos.systemui',
|
||||||
isOrdered: false,
|
isOrdered: false,
|
||||||
subscriberPermissions: ["ohos.permission.GET_TELEPHONY_STATE"],
|
subscriberPermissions: ['ohos.permission.GET_TELEPHONY_STATE'],
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
callState,
|
callState,
|
||||||
startTime: startTime * 1000,
|
startTime: startTime * 1000,
|
||||||
@ -203,9 +203,9 @@ export default class NotificationManager {
|
|||||||
|
|
||||||
commonEvent.publish('CAPSULE_EVENT_CALL_UI', commonEventPublishData, (err, data) => {
|
commonEvent.publish('CAPSULE_EVENT_CALL_UI', commonEventPublishData, (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
LogUtils.i(TAG, "sendCapsuleNotification publish launcher err:" + JSON.stringify(err))
|
LogUtils.i(TAG, 'sendCapsuleNotification publish launcher err:' + JSON.stringify(err))
|
||||||
} else {
|
} else {
|
||||||
LogUtils.i(TAG, "sendCapsuleNotification publish launcher success:" + JSON.stringify(data))
|
LogUtils.i(TAG, 'sendCapsuleNotification publish launcher success:' + JSON.stringify(data))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import Keyboard from '../common/components/Keyboard';
|
|||||||
import IncomingCom from '../common/components/IncomingCom';
|
import IncomingCom from '../common/components/IncomingCom';
|
||||||
import CallStateConst from '../common/constant/CallStateConst';
|
import CallStateConst from '../common/constant/CallStateConst';
|
||||||
import LogUtils from '../common/utils/LogUtils';
|
import LogUtils from '../common/utils/LogUtils';
|
||||||
import byTrace from "@ohos.bytrace"
|
import byTrace from '@ohos.bytrace'
|
||||||
import NotificationManager from '../model/NotificationManager';
|
import NotificationManager from '../model/NotificationManager';
|
||||||
import CallManager from '../model/CallManager';
|
import CallManager from '../model/CallManager';
|
||||||
import backgroundTaskManager from '@ohos.backgroundTaskManager';
|
import backgroundTaskManager from '@ohos.backgroundTaskManager';
|
||||||
@ -37,7 +37,7 @@ import CallListStruct from '../common/struct/CallListStruct'
|
|||||||
import CallTimeListStruct from '../common/struct/CallTimeListStruct'
|
import CallTimeListStruct from '../common/struct/CallTimeListStruct'
|
||||||
|
|
||||||
const AIRPLANE_MODE = 1;
|
const AIRPLANE_MODE = 1;
|
||||||
const TAG = "Index";
|
const TAG = 'Index';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file: Main interface
|
* @file: Main interface
|
||||||
@ -102,7 +102,7 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aboutToAppear(): void {
|
aboutToAppear(): void {
|
||||||
LogUtils.i(TAG, "aboutToAppear")
|
LogUtils.i(TAG, 'aboutToAppear')
|
||||||
byTrace.startTrace('aboutToAppear', 0);
|
byTrace.startTrace('aboutToAppear', 0);
|
||||||
this.notificationManager = new NotificationManager();
|
this.notificationManager = new NotificationManager();
|
||||||
CallManager.getInstance()?.init(this);
|
CallManager.getInstance()?.init(this);
|
||||||
@ -110,23 +110,23 @@ struct Index {
|
|||||||
this.mCallDataManager = CallDataManager.getInstance();
|
this.mCallDataManager = CallDataManager.getInstance();
|
||||||
byTrace.finishTrace('aboutToAppear', 0);
|
byTrace.finishTrace('aboutToAppear', 0);
|
||||||
this.smListener = mediaQuery.matchMediaSync('(320vp<width<=520vp)');
|
this.smListener = mediaQuery.matchMediaSync('(320vp<width<=520vp)');
|
||||||
this.smListener?.on("change", this.isBreakpointSM);
|
this.smListener?.on('change', this.isBreakpointSM);
|
||||||
this.mdListener = mediaQuery.matchMediaSync('(520vp<width<=840vp)');
|
this.mdListener = mediaQuery.matchMediaSync('(520vp<width<=840vp)');
|
||||||
this.mdListener?.on("change", this.isBreakpointMD);
|
this.mdListener?.on('change', this.isBreakpointMD);
|
||||||
this.lgListener = mediaQuery.matchMediaSync('(840vp<width)');
|
this.lgListener = mediaQuery.matchMediaSync('(840vp<width)');
|
||||||
this.lgListener?.on("change", this.isBreakpointLG);
|
this.lgListener?.on('change', this.isBreakpointLG);
|
||||||
this.initAirPlaneMode();
|
this.initAirPlaneMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageShow() {
|
onPageShow() {
|
||||||
LogUtils.i(TAG, "onPageShow");
|
LogUtils.i(TAG, 'onPageShow');
|
||||||
byTrace.startTrace('onPageShow', 1);
|
byTrace.startTrace('onPageShow', 1);
|
||||||
globalThis.appInactiveState = false;
|
globalThis.appInactiveState = false;
|
||||||
this.stopBackgroundRunning();
|
this.stopBackgroundRunning();
|
||||||
this.notificationManager?.cancelNotification();
|
this.notificationManager?.cancelNotification();
|
||||||
this.notificationManager?.sendCapsuleNotification(this.incomingData ? this.callData : this.incomingData, false);
|
this.notificationManager?.sendCapsuleNotification(this.incomingData ? this.callData : this.incomingData, false);
|
||||||
byTrace.finishTrace('onPageShow', 1);
|
byTrace.finishTrace('onPageShow', 1);
|
||||||
LogUtils.i(TAG, "onPageShow end");
|
LogUtils.i(TAG, 'onPageShow end');
|
||||||
}
|
}
|
||||||
|
|
||||||
initAirPlaneMode() {
|
initAirPlaneMode() {
|
||||||
@ -149,12 +149,12 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onPageHide() {
|
onPageHide() {
|
||||||
LogUtils.i(TAG, "onPageHide");
|
LogUtils.i(TAG, 'onPageHide');
|
||||||
if (!this.mHangup) {
|
if (!this.mHangup) {
|
||||||
globalThis.appInactiveState = true;
|
globalThis.appInactiveState = true;
|
||||||
this.updateNotification();
|
this.updateNotification();
|
||||||
}
|
}
|
||||||
LogUtils.i(TAG, "onPageHide end");
|
LogUtils.i(TAG, 'onPageHide end');
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNotification() {
|
updateNotification() {
|
||||||
@ -169,7 +169,7 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aboutToDisappear() {
|
aboutToDisappear() {
|
||||||
LogUtils.i(TAG, "aboutToDisappear");
|
LogUtils.i(TAG, 'aboutToDisappear');
|
||||||
this.stopBackgroundRunning();
|
this.stopBackgroundRunning();
|
||||||
this.smListener?.off('change', this.isBreakpointSM);
|
this.smListener?.off('change', this.isBreakpointSM);
|
||||||
this.mdListener?.off('change', this.isBreakpointMD);
|
this.mdListener?.off('change', this.isBreakpointMD);
|
||||||
@ -179,14 +179,14 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onBackPress() {
|
onBackPress() {
|
||||||
LogUtils.i(TAG, "onBackPress");
|
LogUtils.i(TAG, 'onBackPress');
|
||||||
}
|
}
|
||||||
|
|
||||||
private stopBackgroundRunning() {
|
private stopBackgroundRunning() {
|
||||||
backgroundTaskManager.stopBackgroundRunning(globalThis.calluiAbilityContext).then(() => {
|
backgroundTaskManager.stopBackgroundRunning(globalThis.calluiAbilityContext).then(() => {
|
||||||
LogUtils.i(TAG, "stopBackgroundRunning succeeded");
|
LogUtils.i(TAG, 'stopBackgroundRunning succeeded');
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
LogUtils.i(TAG, "stopBackgroundRunning failed");
|
LogUtils.i(TAG, 'stopBackgroundRunning failed');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,9 +203,9 @@ struct Index {
|
|||||||
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
|
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
|
||||||
backgroundTaskManager.startBackgroundRunning(globalThis.calluiAbilityContext,
|
backgroundTaskManager.startBackgroundRunning(globalThis.calluiAbilityContext,
|
||||||
backgroundTaskManager.BackgroundMode.VOIP, wantAgentObj).then(() => {
|
backgroundTaskManager.BackgroundMode.VOIP, wantAgentObj).then(() => {
|
||||||
LogUtils.i(TAG, "startBackgroundRunning succeeded")
|
LogUtils.i(TAG, 'startBackgroundRunning succeeded')
|
||||||
}).catch((err) => {
|
}).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
|
* @return {number} - callState
|
||||||
*/
|
*/
|
||||||
private callState() {
|
private callState() {
|
||||||
LogUtils.i(TAG, "callState : " + this.callData.callState)
|
LogUtils.i(TAG, 'callState : ' + this.callData.callState)
|
||||||
return this.callData.callState;
|
return this.callData.callState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ struct Index {
|
|||||||
|
|
||||||
if (this.isTripleCall()) {
|
if (this.isTripleCall()) {
|
||||||
Column() {
|
Column() {
|
||||||
Text($r("app.string.end_holding_call"))
|
Text($r('app.string.end_holding_call'))
|
||||||
.fontColor('#FFFFFF')
|
.fontColor('#FFFFFF')
|
||||||
.fontSize(14)
|
.fontSize(14)
|
||||||
.height(19)
|
.height(19)
|
||||||
@ -324,8 +324,8 @@ struct Index {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding({ bottom: this.isTripleCall() ? 71 : 106 })
|
.padding({ bottom: this.isTripleCall() ? 71 : 106 })
|
||||||
.width("100%")
|
.width('100%')
|
||||||
.height("100%")
|
.height('100%')
|
||||||
.backgroundImage('assets/picture/wallpaper.png', ImageRepeat.NoRepeat)
|
.backgroundImage('assets/picture/wallpaper.png', ImageRepeat.NoRepeat)
|
||||||
.backgroundImageSize(ImageSize.Cover)
|
.backgroundImageSize(ImageSize.Cover)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
import LogUtils from '../utils/LogUtils'
|
import LogUtils from '../utils/LogUtils'
|
||||||
|
|
||||||
const TAG = "HeadComponent"
|
const TAG = 'HeadComponent'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* head custom component
|
* head custom component
|
||||||
@ -29,13 +29,13 @@ export default struct HeadComponent {
|
|||||||
Image($r('app.media.ic_back'))
|
Image($r('app.media.ic_back'))
|
||||||
.width(24)
|
.width(24)
|
||||||
.height(24)
|
.height(24)
|
||||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
.fillColor($r('sys.color.ohos_id_color_primary'))
|
||||||
}
|
}
|
||||||
.margin({ right: 16 })
|
.margin({ right: 16 })
|
||||||
.backgroundColor(this.isTouch ? $r('app.color.color_E3E3E3_grey') : $r('app.color.color_00000000_transparent'))
|
.backgroundColor(this.isTouch ? $r('app.color.color_E3E3E3_grey') : $r('app.color.color_00000000_transparent'))
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
globalThis.settingsAbilityContext?.terminateSelf().then((data) => {
|
globalThis.settingsAbilityContext?.terminateSelf().then((data) => {
|
||||||
LogUtils.i(TAG, "terminateSelfCallBack");
|
LogUtils.i(TAG, 'terminateSelfCallBack');
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.onTouch((event: TouchEvent) => {
|
.onTouch((event: TouchEvent) => {
|
||||||
@ -57,7 +57,7 @@ export default struct HeadComponent {
|
|||||||
.textAlign(TextAlign.Start)
|
.textAlign(TextAlign.Start)
|
||||||
.margin({ top: 15, bottom: 15 });
|
.margin({ top: 15, bottom: 15 });
|
||||||
}
|
}
|
||||||
.width("100%")
|
.width('100%')
|
||||||
.padding({ left: 12 })
|
.padding({ left: 12 })
|
||||||
.height(56)
|
.height(56)
|
||||||
.alignItems(VerticalAlign.Center)
|
.alignItems(VerticalAlign.Center)
|
||||||
|
@ -27,7 +27,7 @@ import {
|
|||||||
} from '../../../model/mobileDataStatus';
|
} from '../../../model/mobileDataStatus';
|
||||||
import LogUtils from '../../utils/LogUtils'
|
import LogUtils from '../../utils/LogUtils'
|
||||||
|
|
||||||
const TAG = "ListItem"
|
const TAG = 'ListItem'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default struct listItem {
|
export default struct listItem {
|
||||||
@ -97,13 +97,13 @@ export default struct listItem {
|
|||||||
.opacity(0.6)
|
.opacity(0.6)
|
||||||
.lineHeight(19)
|
.lineHeight(19)
|
||||||
.letterSpacing(1)
|
.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%')
|
.width('100%')
|
||||||
.alignItems(HorizontalAlign.Start)
|
.alignItems(HorizontalAlign.Start)
|
||||||
.margin({ right: 26 })
|
.margin({ right: 26 })
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
LogUtils.i(TAG, "onclick clickHandle")
|
LogUtils.i(TAG, 'onclick clickHandle')
|
||||||
this.clickHandle();
|
this.clickHandle();
|
||||||
})
|
})
|
||||||
.enabled(this.isDisabled)
|
.enabled(this.isDisabled)
|
||||||
@ -114,7 +114,7 @@ export default struct listItem {
|
|||||||
.enabled(this.isDisabled)
|
.enabled(this.isDisabled)
|
||||||
.onChange((isOn: boolean) => {
|
.onChange((isOn: boolean) => {
|
||||||
this.controlSwitch = !this.controlSwitch;
|
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) {
|
if (this.controlSwitch && this.isCon === 0) {
|
||||||
this.recordTypeDialog.open();
|
this.recordTypeDialog.open();
|
||||||
} else if (this.controlSwitch == false && this.isCon === 0) {
|
} else if (this.controlSwitch == false && this.isCon === 0) {
|
||||||
@ -130,7 +130,7 @@ export default struct listItem {
|
|||||||
}.visibility(this.isSupport ? Visibility.None : Visibility.Visible)
|
}.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)
|
.opacity(this.isDisabled ? 1 : 0.4)
|
||||||
.margin({ top: 8, bottom: this.isSupport ? 5 : 11 })
|
.margin({ top: 8, bottom: this.isSupport ? 5 : 11 })
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
@ -156,7 +156,7 @@ struct dataRomingDialog {
|
|||||||
Text($r('app.string.mobile_data_tips'))
|
Text($r('app.string.mobile_data_tips'))
|
||||||
.fontSize(20)
|
.fontSize(20)
|
||||||
.fontWeight(FontWeight.Medium)
|
.fontWeight(FontWeight.Medium)
|
||||||
.fontFamily("HarmonyHeiTi")
|
.fontFamily('HarmonyHeiTi')
|
||||||
.height(56)
|
.height(56)
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
Text($r('app.string.mobile_data_turn_on_data_roaming'))
|
Text($r('app.string.mobile_data_turn_on_data_roaming'))
|
||||||
@ -172,12 +172,12 @@ struct dataRomingDialog {
|
|||||||
Flex({ justifyContent: FlexAlign.SpaceAround }) {
|
Flex({ justifyContent: FlexAlign.SpaceAround }) {
|
||||||
Text(publiccontent.strings.cancel)
|
Text(publiccontent.strings.cancel)
|
||||||
.fontWeight(FontWeight.Medium)
|
.fontWeight(FontWeight.Medium)
|
||||||
.fontFamily("HarmonnyHeiTi")
|
.fontFamily('HarmonnyHeiTi')
|
||||||
.height(21)
|
.height(21)
|
||||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
LogUtils.i(TAG, "dataRomingDialog onclick cancel");
|
LogUtils.i(TAG, 'dataRomingDialog onclick cancel');
|
||||||
this.controller.close();
|
this.controller.close();
|
||||||
this.isMsg = false;
|
this.isMsg = false;
|
||||||
})
|
})
|
||||||
@ -185,12 +185,12 @@ struct dataRomingDialog {
|
|||||||
|
|
||||||
Text(publiccontent.strings.confirm)
|
Text(publiccontent.strings.confirm)
|
||||||
.fontWeight(FontWeight.Medium)
|
.fontWeight(FontWeight.Medium)
|
||||||
.fontFamily("HarmonnyHeiTi")
|
.fontFamily('HarmonnyHeiTi')
|
||||||
.height(21)
|
.height(21)
|
||||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
||||||
.onClick(() => {
|
.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.controller.close();
|
||||||
this.isMsg = true;
|
this.isMsg = true;
|
||||||
this.cardType == 0 ? enableCellularDataRoamingCardOne() : enableCellularDataRoamingCardTwo();
|
this.cardType == 0 ? enableCellularDataRoamingCardOne() : enableCellularDataRoamingCardTwo();
|
||||||
|
@ -34,14 +34,14 @@ export struct SubHeader {
|
|||||||
.fontFamily('HarmonyHeiTi')
|
.fontFamily('HarmonyHeiTi')
|
||||||
.fontWeight(FontWeight.Medium)
|
.fontWeight(FontWeight.Medium)
|
||||||
}
|
}
|
||||||
.width("100%")
|
.width('100%')
|
||||||
.height(48)
|
.height(48)
|
||||||
.alignItems(VerticalAlign.Bottom)
|
.alignItems(VerticalAlign.Bottom)
|
||||||
.padding({
|
.padding({
|
||||||
bottom: 9,
|
bottom: 9,
|
||||||
top: 19.5,
|
top: 19.5,
|
||||||
left: $r('sys.float.ohos_id_card_margin_start'),
|
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')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ import telephonyData from '@ohos.telephony.data';
|
|||||||
import radio from '@ohos.telephony.radio';
|
import radio from '@ohos.telephony.radio';
|
||||||
import LogUtils from '../utils/LogUtils'
|
import LogUtils from '../utils/LogUtils'
|
||||||
|
|
||||||
const TAG = "getCellularDataRomingEnabledApi"
|
const TAG = 'getCellularDataRomingEnabledApi'
|
||||||
/**
|
/**
|
||||||
* Whether to enable cellular data roaming
|
* Whether to enable cellular data roaming
|
||||||
*
|
*
|
||||||
@ -39,10 +39,10 @@ export function getSupportNetwork(slotId = 0) {
|
|||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
try {
|
try {
|
||||||
let isSupported = radio.isNrSupported();
|
let isSupported = radio.isNrSupported();
|
||||||
LogUtils.i(TAG, "getSupportNetwork success data:" + JSON.stringify(isSupported))
|
LogUtils.i(TAG, 'getSupportNetwork success data:' + JSON.stringify(isSupported))
|
||||||
resolve(isSupported);
|
resolve(isSupported);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LogUtils.i(TAG, "getSupportNetwork success catch:" + JSON.stringify(error))
|
LogUtils.i(TAG, 'getSupportNetwork success catch:' + JSON.stringify(error))
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import radio from '@ohos.telephony.radio';
|
import radio from '@ohos.telephony.radio';
|
||||||
import LogUtils from '../utils/LogUtils'
|
import LogUtils from '../utils/LogUtils'
|
||||||
|
|
||||||
const TAG = "getPreferredNetworkModelApi"
|
const TAG = 'getPreferredNetworkModelApi'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the preferred network mode
|
* Get the preferred network mode
|
||||||
@ -30,10 +30,10 @@ const TAG = "getPreferredNetworkModelApi"
|
|||||||
export function getPreferredNetwork(val) {
|
export function getPreferredNetwork(val) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
radio.getPreferredNetwork(val).then((res) => {
|
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);
|
resolve(res);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
LogUtils.i(TAG, "getPreferredNetwork success catch:" + JSON.stringify(err))
|
LogUtils.i(TAG, 'getPreferredNetwork success catch:' + JSON.stringify(err))
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
import sim from '@ohos.telephony.sim';
|
import sim from '@ohos.telephony.sim';
|
||||||
|
|
||||||
const TAG = "GetSimStateApi"
|
const TAG = 'GetSimStateApi'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get cardOne status
|
* Get cardOne status
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import radio from '@ohos.telephony.radio';
|
import radio from '@ohos.telephony.radio';
|
||||||
import LogUtils from '../utils/LogUtils';
|
import LogUtils from '../utils/LogUtils';
|
||||||
|
|
||||||
const TAG = "setPreferredNetworkModelApi"
|
const TAG = 'setPreferredNetworkModelApi'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the preferred network mode
|
* Set the preferred network mode
|
||||||
@ -31,10 +31,10 @@ const TAG = "setPreferredNetworkModelApi"
|
|||||||
export function setPreferredNetwork(slotId, auto) {
|
export function setPreferredNetwork(slotId, auto) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
radio.setPreferredNetwork(slotId, auto).then((res) => {
|
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);
|
resolve(res);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
LogUtils.i(TAG, "setPreferredNetwork catch:" + JSON.stringify(err))
|
LogUtils.i(TAG, 'setPreferredNetwork catch:' + JSON.stringify(err))
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -30,19 +30,19 @@
|
|||||||
*/
|
*/
|
||||||
export class LogUtils {
|
export class LogUtils {
|
||||||
d(TAG, msg): void {
|
d(TAG, msg): void {
|
||||||
console.debug("[mobiledatasettings:]" + TAG + ":" + msg);
|
console.debug('[mobiledatasettings:]' + TAG + ':' + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
i(TAG, msg): void {
|
i(TAG, msg): void {
|
||||||
console.info("[mobiledatasettings:]" + TAG + ":" + msg);
|
console.info('[mobiledatasettings:]' + TAG + ':' + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
w(TAG, msg): void {
|
w(TAG, msg): void {
|
||||||
console.warn("[mobiledatasettings:]" + TAG + ":" + msg);
|
console.warn('[mobiledatasettings:]' + TAG + ':' + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
e(TAG, msg): void {
|
e(TAG, msg): void {
|
||||||
console.error("[mobiledatasettings:]" + TAG + ":" + msg);
|
console.error('[mobiledatasettings:]' + TAG + ':' + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import radio from '@ohos.telephony.radio';
|
|||||||
import LogUtils from '../common/utils/LogUtils';
|
import LogUtils from '../common/utils/LogUtils';
|
||||||
import call from '@ohos.telephony.call';
|
import call from '@ohos.telephony.call';
|
||||||
|
|
||||||
const TAG = "mobileDataStatus"
|
const TAG = 'mobileDataStatus';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get cellular data status
|
* Get cellular data status
|
||||||
@ -35,15 +35,15 @@ export function getOperatorName(slotId = 0) {
|
|||||||
try {
|
try {
|
||||||
radio.getOperatorName(slotId, (error, value) => {
|
radio.getOperatorName(slotId, (error, value) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
LogUtils.i(TAG, "getOperatorName error:" + JSON.stringify(error))
|
LogUtils.i(TAG, 'getOperatorName error:' + JSON.stringify(error))
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
LogUtils.i(TAG, "getOperatorName value:" + JSON.stringify(value))
|
LogUtils.i(TAG, 'getOperatorName value:' + JSON.stringify(value))
|
||||||
resolve(value);
|
resolve(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LogUtils.i(TAG, "getOperatorName catch:" + JSON.stringify(error))
|
LogUtils.i(TAG, 'getOperatorName catch:' + JSON.stringify(error))
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -90,15 +90,15 @@ export function enableCellularDataRoamingCardOne(slotId = 0) {
|
|||||||
try {
|
try {
|
||||||
telephonyData.enableCellularDataRoaming(slotId, (error, value) => {
|
telephonyData.enableCellularDataRoaming(slotId, (error, value) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
LogUtils.i(TAG, "enableCellularDataRoaming card one error :" + JSON.stringify(error));
|
LogUtils.i(TAG, 'enableCellularDataRoaming card one error :' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} 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);
|
resolve(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LogUtils.i(TAG, "enableCellularDataRoaming card one catch: " + JSON.stringify(error));
|
LogUtils.i(TAG, 'enableCellularDataRoaming card one catch: ' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -109,15 +109,15 @@ export function enableCellularDataRoamingCardTwo(slotId = 1) {
|
|||||||
try {
|
try {
|
||||||
telephonyData.enableCellularDataRoaming(slotId, (error, value) => {
|
telephonyData.enableCellularDataRoaming(slotId, (error, value) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
LogUtils.i(TAG, "enableCellularDataRoaming card two error :" + JSON.stringify(error));
|
LogUtils.i(TAG, 'enableCellularDataRoaming card two error :' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} 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);
|
resolve(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LogUtils.i(TAG, "enableCellularDataRoaming card two catch: " + JSON.stringify(error));
|
LogUtils.i(TAG, 'enableCellularDataRoaming card two catch: ' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -133,15 +133,15 @@ export function disableCellularDataRoamingCardOne(slotId = 0) {
|
|||||||
try {
|
try {
|
||||||
telephonyData.disableCellularDataRoaming(slotId, (error, value) => {
|
telephonyData.disableCellularDataRoaming(slotId, (error, value) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
LogUtils.i(TAG, "disableCellularDataRoaming card one error : " + JSON.stringify(error));
|
LogUtils.i(TAG, 'disableCellularDataRoaming card one error : ' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} 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);
|
resolve(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LogUtils.i(TAG, "disableCellularDataRoaming card one catch:" + JSON.stringify(error));
|
LogUtils.i(TAG, 'disableCellularDataRoaming card one catch:' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -152,15 +152,15 @@ export function disableCellularDataRoamingCardTwo(slotId = 1) {
|
|||||||
try {
|
try {
|
||||||
telephonyData.disableCellularDataRoaming(slotId, (error, value) => {
|
telephonyData.disableCellularDataRoaming(slotId, (error, value) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
LogUtils.i(TAG, "disableCellularDataRoaming card two error :" + JSON.stringify(error));
|
LogUtils.i(TAG, 'disableCellularDataRoaming card two error :' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} 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);
|
resolve(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LogUtils.i(TAG, "disableCellularDataRoaming card two catch:" + JSON.stringify(error));
|
LogUtils.i(TAG, 'disableCellularDataRoaming card two catch:' + JSON.stringify(error));
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -169,34 +169,34 @@ export function disableCellularDataRoamingCardTwo(slotId = 1) {
|
|||||||
|
|
||||||
export function enableImsSwitchCardOne() {
|
export function enableImsSwitchCardOne() {
|
||||||
call.enableImsSwitch(0).then((data) => {
|
call.enableImsSwitch(0).then((data) => {
|
||||||
AppStorage.SetOrCreate("imsOne", true);
|
AppStorage.SetOrCreate('imsOne', true);
|
||||||
LogUtils.i(TAG, "enableImsSwitch card one : success then " + JSON.stringify(data));
|
LogUtils.i(TAG, 'enableImsSwitch card one : success then ' + JSON.stringify(data));
|
||||||
}).catch((error) => {
|
}).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() {
|
export function enableImsSwitchCardTwo() {
|
||||||
call.enableImsSwitch(1).then((data) => {
|
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) => {
|
}).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() {
|
export function disableImsSwitchCardOne() {
|
||||||
call.disableImsSwitch(0).then((data) => {
|
call.disableImsSwitch(0).then((data) => {
|
||||||
AppStorage.SetOrCreate("imsOne", false);
|
AppStorage.SetOrCreate('imsOne', false);
|
||||||
LogUtils.i(TAG, "disableImsSwitch card one : success then " + JSON.stringify(data));
|
LogUtils.i(TAG, 'disableImsSwitch card one : success then ' + JSON.stringify(data));
|
||||||
}).catch((error) => {
|
}).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() {
|
export function disableImsSwitchCardTwo() {
|
||||||
call.disableImsSwitch(1).then((data) => {
|
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) => {
|
}).catch((error) => {
|
||||||
LogUtils.i(TAG, "disableImsSwitch card two : catch" + JSON.stringify(error));
|
LogUtils.i(TAG, 'disableImsSwitch card two : catch' + JSON.stringify(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import observer from '@ohos.telephony.observer';
|
|||||||
import LogUtils from '../common/utils/LogUtils';
|
import LogUtils from '../common/utils/LogUtils';
|
||||||
import sim from '@ohos.telephony.sim';
|
import sim from '@ohos.telephony.sim';
|
||||||
|
|
||||||
const TAG = "registerSimStateAPi"
|
const TAG = 'registerSimStateAPi';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor the SIM card status
|
* Monitor the SIM card status
|
||||||
@ -32,9 +32,9 @@ export function registerSimStateChange(slotId, callBack) {
|
|||||||
return observer.on('simStateChange', {
|
return observer.on('simStateChange', {
|
||||||
slotId: slotId
|
slotId: slotId
|
||||||
}, (callStateInfo) => {
|
}, (callStateInfo) => {
|
||||||
LogUtils.i(TAG, "registerSimStateChange: then " + JSON.stringify(callStateInfo))
|
LogUtils.i(TAG, 'registerSimStateChange: then ' + JSON.stringify(callStateInfo));
|
||||||
callBack(callStateInfo);
|
callBack(callStateInfo);
|
||||||
return callStateInfo
|
return callStateInfo;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import HeadComponent from '../common/components/headComponent';
|
|||||||
import { SubHeader } from '../common/components/subHeader';
|
import { SubHeader } from '../common/components/subHeader';
|
||||||
import LogUtils from '../common/utils/LogUtils';
|
import LogUtils from '../common/utils/LogUtils';
|
||||||
|
|
||||||
const TAG = "Index";
|
const TAG = 'Index';
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
@ -75,7 +75,7 @@ struct Index {
|
|||||||
setCache_cun_name = 'DISTRIBUTEDDATA_CUN_NAME';
|
setCache_cun_name = 'DISTRIBUTEDDATA_CUN_NAME';
|
||||||
setCache_wl_name = 'SETCACHE_WL_NAME';
|
setCache_wl_name = 'SETCACHE_WL_NAME';
|
||||||
@State enable5g: boolean = false;
|
@State enable5g: boolean = false;
|
||||||
@StorageLink("imsOne")enableISM: boolean = false;
|
@StorageLink('imsOne')enableISM: boolean = false;
|
||||||
@State enableISM2: boolean = false;
|
@State enableISM2: boolean = false;
|
||||||
@State TelephoneNumber: string = '';
|
@State TelephoneNumber: string = '';
|
||||||
@State TelephoneNumber2?: string = '';
|
@State TelephoneNumber2?: string = '';
|
||||||
@ -93,11 +93,11 @@ struct Index {
|
|||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
this.byValueWLMS = $r('app.string.mobile_data_5g');
|
this.byValueWLMS = $r('app.string.mobile_data_5g');
|
||||||
} else if (res == 5) {
|
} else if (res == 5) {
|
||||||
this.byValueWLMS = $r("app.string.mobile_data_4g");
|
this.byValueWLMS = $r('app.string.mobile_data_4g');
|
||||||
} else if (res == 6) {
|
} else if (res == 6) {
|
||||||
this.byValueWLMS = $r("app.string.mobile_data_3g");
|
this.byValueWLMS = $r('app.string.mobile_data_3g');
|
||||||
} else if (res == 1) {
|
} 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() {
|
getSimStateDataCardOne() {
|
||||||
getSimStateCardOne().then((res: number) => {
|
getSimStateCardOne().then((res: number) => {
|
||||||
LogUtils.i(TAG, "getSimStateData Card1 :success " + JSON.stringify(res))
|
LogUtils.i(TAG, 'getSimStateData Card1 :success ' + JSON.stringify(res))
|
||||||
const simState = {
|
const simState = {
|
||||||
SIM_STATE_UNKNOWN: 0,
|
SIM_STATE_UNKNOWN: 0,
|
||||||
SIM_STATE_NOT_PRESENT: 1,
|
SIM_STATE_NOT_PRESENT: 1,
|
||||||
@ -131,7 +131,7 @@ struct Index {
|
|||||||
*/
|
*/
|
||||||
getSimStateDataCardTwo() {
|
getSimStateDataCardTwo() {
|
||||||
getSimStateCardTwo().then((res: number) => {
|
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 = {
|
const simState = {
|
||||||
SIM_STATE_UNKNOWN: 0,
|
SIM_STATE_UNKNOWN: 0,
|
||||||
SIM_STATE_NOT_PRESENT: 1,
|
SIM_STATE_NOT_PRESENT: 1,
|
||||||
@ -167,10 +167,10 @@ struct Index {
|
|||||||
*/
|
*/
|
||||||
getSimCardOnePhoneNumber() {
|
getSimCardOnePhoneNumber() {
|
||||||
getSimCardOnePhoneNumber().then((res) => {
|
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;
|
this.TelephoneNumber = res;
|
||||||
}).catch((err) => {
|
}).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() {
|
||||||
getSimCardTwoPhoneNumber().then((res) => {
|
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;
|
this.TelephoneNumber2 = res;
|
||||||
}).catch((err) => {
|
}).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() {
|
getCellularDataState() {
|
||||||
isCellularDataEnabled().then((data) => {
|
isCellularDataEnabled().then((data) => {
|
||||||
LogUtils.i(TAG, "isCellularDataEnabled success: isON:" + JSON.stringify(data));
|
LogUtils.i(TAG, 'isCellularDataEnabled success: isON:' + JSON.stringify(data));
|
||||||
this.isDataEnable = data;
|
this.isDataEnable = data;
|
||||||
}).catch((error) => {
|
}).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) => {
|
call.isImsSwitchEnabled(slotId).then((res: boolean) => {
|
||||||
if (slotId) {
|
if (slotId) {
|
||||||
this.enableISM2 = res;
|
this.enableISM2 = res;
|
||||||
LogUtils.i(TAG, "isImsSwitchEnable enable 1:" + JSON.stringify(this.enableISM2));
|
LogUtils.i(TAG, 'isImsSwitchEnable enable 1:' + JSON.stringify(this.enableISM2));
|
||||||
} else {
|
} else {
|
||||||
this.enableISM = res;
|
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) => {
|
}).catch((err) => {
|
||||||
if (slotId) {
|
if (slotId) {
|
||||||
this.enableISM2 = true;
|
this.enableISM2 = true;
|
||||||
LogUtils.i(TAG, "isImsSwitchEnable err 1:" + JSON.stringify(this.enableISM2));
|
LogUtils.i(TAG, 'isImsSwitchEnable err 1:' + JSON.stringify(this.enableISM2));
|
||||||
} else {
|
} else {
|
||||||
this.enableISM = true;
|
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() {
|
aboutToAppear() {
|
||||||
LogUtils.i(TAG, "aboutToAppear")
|
LogUtils.i(TAG, 'aboutToAppear')
|
||||||
this.initAirPlaneMode();
|
this.initAirPlaneMode();
|
||||||
if (getMaxSimCount() === 2) {
|
if (getMaxSimCount() === 2) {
|
||||||
this.addRegisterSimStateChange(1);
|
this.addRegisterSimStateChange(1);
|
||||||
@ -301,24 +301,24 @@ struct Index {
|
|||||||
*/
|
*/
|
||||||
radioChange(slotId, v) {
|
radioChange(slotId, v) {
|
||||||
const res = setPreferredNetwork(slotId, v);
|
const res = setPreferredNetwork(slotId, v);
|
||||||
LogUtils.i(TAG, "radioChange res:" + JSON.stringify(res));
|
LogUtils.i(TAG, 'radioChange res:' + JSON.stringify(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
getCellularDataRoamingEnabled() {
|
getCellularDataRoamingEnabled() {
|
||||||
isCellularDataRoamingEnabledCardOne().then((res) => {
|
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;
|
this.dataRoamSwitchCardOne = res;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
this.dataRoamSwitchCardOne = false;
|
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) {
|
if (getMaxSimCount() === 2) {
|
||||||
isCellularDataRoamingEnabledCardTwo().then((res) => {
|
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;
|
this.dataRoamSwitchCardTwo = res;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
this.dataRoamSwitchCardTwo = false;
|
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)
|
.enabled((this.simStateStatusCardOne || this.simStateStatusCardTwo) && !this.isAirPlaneMode)
|
||||||
.onChange((isOn: boolean) => {
|
.onChange((isOn: boolean) => {
|
||||||
this.isDataEnable = !this.isDataEnable;
|
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) {
|
if (this.isDataEnable == false) {
|
||||||
disableCellularData().then((data) => {
|
disableCellularData().then((data) => {
|
||||||
LogUtils.i(TAG, "disableCellularData: success then" + JSON.stringify(data));
|
LogUtils.i(TAG, 'disableCellularData: success then' + JSON.stringify(data));
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
LogUtils.i(TAG, "disableCellularData: error catch" + JSON.stringify(error));
|
LogUtils.i(TAG, 'disableCellularData: error catch' + JSON.stringify(error));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
enableCellularData().then((data) => {
|
enableCellularData().then((data) => {
|
||||||
LogUtils.i(TAG, "enableCellularData: success then" + JSON.stringify(data));
|
LogUtils.i(TAG, 'enableCellularData: success then' + JSON.stringify(data));
|
||||||
}).catch((error) => {
|
}).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
|
bottom: 4
|
||||||
})
|
})
|
||||||
.height(90)
|
.height(90)
|
||||||
.width("100%")
|
.width('100%')
|
||||||
.borderRadius(16)
|
.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)
|
.opacity((this.simStateStatusCardOne || this.simStateStatusCardTwo) && !this.isAirPlaneMode ? 1 : 0.4)
|
||||||
|
|
||||||
SubHeader({
|
SubHeader({
|
||||||
@ -419,7 +419,7 @@ struct Index {
|
|||||||
|
|
||||||
Divider()
|
Divider()
|
||||||
.strokeWidth(0.5)
|
.strokeWidth(0.5)
|
||||||
.color("#E3E3E3")
|
.color('#E3E3E3')
|
||||||
.lineCap(LineCapStyle.Round)
|
.lineCap(LineCapStyle.Round)
|
||||||
.margin({ right: '2%' })
|
.margin({ right: '2%' })
|
||||||
|
|
||||||
@ -441,9 +441,9 @@ struct Index {
|
|||||||
top: 4,
|
top: 4,
|
||||||
bottom: 4
|
bottom: 4
|
||||||
})
|
})
|
||||||
.width("100%")
|
.width('100%')
|
||||||
.borderRadius(16)
|
.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)
|
.opacity(this.simStateStatusCardOne && !this.isAirPlaneMode ? 1 : 0.4)
|
||||||
|
|
||||||
SubHeader({
|
SubHeader({
|
||||||
@ -466,7 +466,7 @@ struct Index {
|
|||||||
})
|
})
|
||||||
Divider()
|
Divider()
|
||||||
.strokeWidth(0.5)
|
.strokeWidth(0.5)
|
||||||
.color("#E3E3E3")
|
.color('#E3E3E3')
|
||||||
.lineCap(LineCapStyle.Round)
|
.lineCap(LineCapStyle.Round)
|
||||||
.margin({ right: '2%' })
|
.margin({ right: '2%' })
|
||||||
item({
|
item({
|
||||||
@ -493,9 +493,9 @@ struct Index {
|
|||||||
top: 4,
|
top: 4,
|
||||||
bottom: 4
|
bottom: 4
|
||||||
})
|
})
|
||||||
.width("100%")
|
.width('100%')
|
||||||
.borderRadius(16)
|
.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)
|
.opacity(this.simStateStatusCardTwo && !this.isAirPlaneMode ? 1 : 0.4)
|
||||||
.visibility(getMaxSimCount() === 2 ? Visibility.Visible : Visibility.Hidden)
|
.visibility(getMaxSimCount() === 2 ? Visibility.Visible : Visibility.Hidden)
|
||||||
}
|
}
|
||||||
@ -515,6 +515,6 @@ struct Index {
|
|||||||
.padding({ left: 12, right: 12 })
|
.padding({ left: 12, right: 12 })
|
||||||
.width('100%')
|
.width('100%')
|
||||||
.height('100%')
|
.height('100%')
|
||||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user