diff --git a/callui/src/main/ets/default/common/components/FuncBtn.ets b/callui/src/main/ets/default/common/components/FuncBtn.ets index c95aba7..abe1db0 100644 --- a/callui/src/main/ets/default/common/components/FuncBtn.ets +++ b/callui/src/main/ets/default/common/components/FuncBtn.ets @@ -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; } diff --git a/callui/src/main/ets/default/common/components/FuncBtnGroup.ets b/callui/src/main/ets/default/common/components/FuncBtnGroup.ets index ba4da31..eb24452 100644 --- a/callui/src/main/ets/default/common/components/FuncBtnGroup.ets +++ b/callui/src/main/ets/default/common/components/FuncBtnGroup.ets @@ -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); } /** diff --git a/callui/src/main/ets/default/common/components/contactCard.ets b/callui/src/main/ets/default/common/components/contactCard.ets index d9521b0..829ff06 100644 --- a/callui/src/main/ets/default/common/components/contactCard.ets +++ b/callui/src/main/ets/default/common/components/contactCard.ets @@ -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")) diff --git a/callui/src/main/ets/default/model/CallManager.ets b/callui/src/main/ets/default/model/CallManager.ets index ae187e6..5b3555a 100644 --- a/callui/src/main/ets/default/model/CallManager.ets +++ b/callui/src/main/ets/default/model/CallManager.ets @@ -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 */ diff --git a/callui/src/main/ets/default/model/CallServiceProxy.ets b/callui/src/main/ets/default/model/CallServiceProxy.ets index e9f779e..80d3431 100644 --- a/callui/src/main/ets/default/model/CallServiceProxy.ets +++ b/callui/src/main/ets/default/model/CallServiceProxy.ets @@ -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); diff --git a/callui/src/main/resources/base/element/string.json b/callui/src/main/resources/base/element/string.json index 6617d69..1cfc7f6 100644 --- a/callui/src/main/resources/base/element/string.json +++ b/callui/src/main/resources/base/element/string.json @@ -203,6 +203,10 @@ { "name": "SMS_Authorization_Notification", "value": "Go to settings for SMS Authorization" + }, + { + "name": "emergency", + "value": "Emergency" } ] } \ No newline at end of file diff --git a/callui/src/main/resources/zh_CN/element/string.json b/callui/src/main/resources/zh_CN/element/string.json index 05ef938..f4905a0 100644 --- a/callui/src/main/resources/zh_CN/element/string.json +++ b/callui/src/main/resources/zh_CN/element/string.json @@ -204,6 +204,10 @@ { "name": "SMS_Authorization_Notification", "value": "请前往设置进行短信授权" + }, + { + "name": "emergency", + "value": "紧急通话" } ] } \ No newline at end of file