mirror of
https://github.com/openharmony/applications_call.git
synced 2026-07-01 20:24:03 -04:00
@@ -48,7 +48,7 @@ export default struct FuncBtn {
|
||||
*/
|
||||
changeBtn(type) {
|
||||
HiLog.i(TAG, "changeBtn type : %s" + type);
|
||||
const BtnName = ['record', 'keep', 'video', 'mute'];
|
||||
const BtnName = ['record', 'video', 'mute'];
|
||||
if (Method.includes(BtnName, type)) {
|
||||
this.isActive = !this.isActive;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ export default struct FuncBtnGroup {
|
||||
}else{
|
||||
this.btnList = this.btnListCall
|
||||
}
|
||||
this.onCallStateChange(this.callData.callState)
|
||||
HiLog.i(TAG, "upData BtnList");
|
||||
}
|
||||
|
||||
@@ -98,18 +99,12 @@ export default struct FuncBtnGroup {
|
||||
*/
|
||||
onCallStateChange(newVal) {
|
||||
HiLog.i(TAG, "Calling status changed : %s" + JSON.stringify(newVal));
|
||||
const BtnName= ['video', 'record', 'add', 'mute', 'contact']
|
||||
if (this.callList.length >= 2 && this.callList.every((v) =>
|
||||
v.conferenceState !== ConferenceConst.TEL_CONFERENCE_ACTIVE)) {
|
||||
this.btnList.splice(1, 2, ...this.mClone.clone(BtnGroupConfig.threePartyList));
|
||||
} else {
|
||||
this.btnList.splice(1, 2, new Array(BtnGroupConfig.btnGroupList).splice(1, 2));
|
||||
this.btnList.splice(1, 2, ...this.mClone.clone(BtnGroupConfig.btnGroupList).splice(1, 2));
|
||||
}
|
||||
const BtnName= ['video', 'record', 'add', 'contact']
|
||||
if (newVal === CallStateConst.CALL_STATUS_ACTIVE || newVal === CallStateConst.CALL_STATUS_HOLDING) {
|
||||
this.btnList.forEach((item) => {
|
||||
if (!Method.includes(BtnName,(item.type))) {
|
||||
item.isDisable = false;
|
||||
item.isActive = false;
|
||||
}
|
||||
});
|
||||
if (newVal === CallStateConst.CALL_STATUS_HOLDING) {
|
||||
@@ -132,7 +127,7 @@ export default struct FuncBtnGroup {
|
||||
*/
|
||||
btnClick(obj) {
|
||||
HiLog.i(TAG, "btnClick get icon type : %s" + JSON.stringify(obj));
|
||||
const BtnName= ['record', 'keep', 'video', 'mute']
|
||||
const BtnName= ['record', 'video', 'mute']
|
||||
const type = obj.type;
|
||||
const { callId } = this.callData;
|
||||
if (Method.includes(BtnName,type)) {
|
||||
@@ -203,7 +198,7 @@ export default struct FuncBtnGroup {
|
||||
keepHandle(type) {
|
||||
const awaitIsActive = this.btnList.find((v) => v.type === type).isActive;
|
||||
HiLog.i(TAG, "keep handle");
|
||||
awaitIsActive ? this.mCallServiceProxy.holdCall(this.callData.callId) : this.mCallServiceProxy.unHoldCall(this.callData.callId);
|
||||
!awaitIsActive ? this.mCallServiceProxy.holdCall(this.callData.callId) : this.mCallServiceProxy.unHoldCall(this.callData.callId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,10 +42,12 @@ export default struct ContactCard {
|
||||
@Link callData: any;
|
||||
private mUtils: Utils;
|
||||
private timer;
|
||||
private emergency = $r('app.string.emergency');
|
||||
@StorageLink("CallTimeList") callTimeList: any = [];
|
||||
@StorageLink("TextInput") textInput: string = '';
|
||||
@StorageLink("TextInputValue") textInputValue: string = '';
|
||||
@StorageLink("AccountNumber") accountNumber: string = '';
|
||||
@StorageLink("IsEmergencyPhoneNumber") isEmergencyPhoneNumber: boolean = false;
|
||||
|
||||
public aboutToAppear(callData, callList, callTimeList): void {
|
||||
HiLog.i(TAG, "aboutToAppear");
|
||||
@@ -114,7 +116,7 @@ export default struct ContactCard {
|
||||
}
|
||||
} else if (!this.isShowKeyboard) {
|
||||
Column() {
|
||||
Text(this.callData.contactName ? this.callData.contactName : this.accountNumber)
|
||||
Text(this.isEmergencyPhoneNumber ? this.emergency : this.callData.contactName ? this.callData.contactName : this.accountNumber)
|
||||
.fontSize(30)
|
||||
.height(40)
|
||||
.lineHeight(40)
|
||||
@@ -154,6 +156,17 @@ export default struct ContactCard {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.callData.callState === 1) {
|
||||
Row() {
|
||||
Text($r("app.string.callHold"))
|
||||
.fontSize(14)
|
||||
.height(19)
|
||||
.lineHeight(19)
|
||||
.fontColor('#FFFFFF')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.callData.callState === 2) {
|
||||
Row() {
|
||||
Text($r("app.string.dialing"))
|
||||
|
||||
@@ -136,9 +136,28 @@ export default class CallManager {
|
||||
AppStorage.SetOrCreate("AccountNumber", data)
|
||||
}
|
||||
});
|
||||
this.isEmergencyPhoneNumber(callData.accountNumber)
|
||||
HiLog.i(TAG, "update :")
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the call is an emergency call.
|
||||
*
|
||||
* @param { phoneNumber } phoneNumber-number
|
||||
*
|
||||
* @return { boolean } - return success true fail false
|
||||
*/
|
||||
private isEmergencyPhoneNumber = (phoneNumber) => new Promise((resolve, reject) => {
|
||||
call.isEmergencyPhoneNumber(phoneNumber, {slotId: 0}).then((res) => {
|
||||
resolve(res);
|
||||
AppStorage.SetOrCreate("IsEmergencyPhoneNumber", res)
|
||||
HiLog.i(TAG, "then:isEmergencyPhoneNumber : %s" + JSON.stringify(res))
|
||||
}).catch((err) => {
|
||||
reject(err);
|
||||
HiLog.i(TAG, "catch:isEmergencyPhoneNumber : %s" + JSON.stringify(err))
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* update call time list
|
||||
*/
|
||||
|
||||
@@ -138,7 +138,7 @@ export default class CallServiceProxy {
|
||||
public unHoldCall = (callId) => new Promise((resolve, reject) => {
|
||||
call.unHoldCall(callId).then((res) => {
|
||||
resolve(res);
|
||||
HiLog.i(TAG, prefixLog + "then:holdCall : %s" + JSON.stringify(callId))
|
||||
HiLog.i(TAG, prefixLog + "then:unholdCall : %s" + JSON.stringify(callId))
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err);
|
||||
|
||||
@@ -203,6 +203,10 @@
|
||||
{
|
||||
"name": "SMS_Authorization_Notification",
|
||||
"value": "Go to settings for SMS Authorization"
|
||||
},
|
||||
{
|
||||
"name": "emergency",
|
||||
"value": "Emergency"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -204,6 +204,10 @@
|
||||
{
|
||||
"name": "SMS_Authorization_Notification",
|
||||
"value": "请前往设置进行短信授权"
|
||||
},
|
||||
{
|
||||
"name": "emergency",
|
||||
"value": "紧急通话"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user