change stage mode

Signed-off-by: w00636648 <wangziming14@huawei.com>
This commit is contained in:
w00636648 2022-09-24 19:20:44 +08:00
parent fcced3379c
commit 41f2eb4d79
159 changed files with 1703 additions and 1377 deletions

14
AppScope/app.json5 Normal file
View File

@ -0,0 +1,14 @@
{
"app": {
"bundleName": "com.ohos.callui",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"singleton": true,
"keepAlive": true
},
}

View File

@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "通话"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -16,7 +16,7 @@
"app": {
"signingConfigs": [
{
"name": "default",
"name": "release",
"material": {
"storePassword": "",
"certpath": "signature/OpenHarmony.cer",
@ -28,19 +28,19 @@
}
}
],
"compileSdkVersion": 8,
"compatibleSdkVersion": 8,
"compileSdkVersion": 9,
"compatibleSdkVersion": 9,
"products": [
{
"name": "default",
"signingConfig": "default",
"signingConfig": "release",
}
]
},
"modules": [
{
"name": "callui",
"srcPath": "./callui",
"name": "com.ohos.callui",
"srcPath": "./entry",
"targets": [
{
"name": "default",
@ -51,7 +51,11 @@
]
},
{
"name": "mobiledatasettings",
"name": "common",
"srcPath": "./common"
},
{
"name": "com.ohos.mobiledatasettings",
"srcPath": "./mobiledatasettings",
"targets": [
{

View File

@ -1,25 +0,0 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
apiType: 'faMode',
showInServiceCenter: false,
buildOption: {
},
"targets": [
{
"name": "default",
}
]
}

View File

@ -1 +0,0 @@
module.exports = require('@ohos/hvigor-ohos-plugin').legacyHapTasks

View File

@ -1,93 +0,0 @@
{
"app": {
"bundleName": "com.ohos.callui",
"vendor": "ohos",
"singleton": true,
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"keepAlive": true
}
},
"module": {
"package": "com.ohos.callui",
"name": ".MyApplication",
"mainAbility": ".ServiceAbility",
"srcPath": "",
"deviceType": [
"phone",
"tablet"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "callui",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "default",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "JS_Empty Ability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "singleton"
},
{
"name": ".ServiceAbility",
"icon": "$media:icon",
"description": "service",
"type": "service",
"srcPath": "ServiceAbility",
"srcLanguage": "ets",
"visible": true
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions" : [
{
"name" : "ohos.permission.READ_CONTACTS"
},
{
"name" : "ohos.permission.SEND_MESSAGES"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
}
]
}
}

View File

@ -1,43 +0,0 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file: service entry
*/
import CallManagerService from './CallManagerService';
import HiLog from '../default/common/utils/Hilog';
const TAG = "Service";
export default {
/**
* onStart
*/
onStart() {
HiLog.i(TAG, "onStart callUI service")
this.callManagerService = new CallManagerService();
},
/**
* onStop
*/
onStop() {
HiLog.i(TAG, "onStop callUI service")
this.callManagerService.unsubscribe();
this.callManagerService.removeRegisterListener();
}
};

View File

@ -1,49 +0,0 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import CallManager from './model/CallManager';
import CallStateConst from './common/constant/CallStateConst';
import HiLog from './common/utils/Hilog';
import deviceInfo from '@ohos.deviceInfo';
const TAG = "App";
export default {
data:{
callData: {
...CallStateConst.defaultCallData
},
callList: [],
callTimeList: [],
appInactiveState: false,
},
/**
* onCreate
*/
onCreate() {
globalThis.deviceTypeInfo = deviceInfo.deviceType;
HiLog.i(TAG, "callui app Application onCreate")
},
/**
* onDestroy
*/
onDestroy() {
HiLog.i(TAG, "callui app Application onDestroy")
globalThis.callManager.clearTimer();
globalThis.callManager.unsubscribe();
}
};

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_add_filled_置灰</title>
<defs>
<path d="M15.9375,26.5625 C15.9375,27.080267 15.517767,27.5 15,27.5 C14.482233,27.5 14.0625,27.080267 14.0625,26.5625 L14.062,15.937 L3.4375,15.9375 C2.91973305,15.9375 2.5,15.517767 2.5,15 C2.5,14.482233 2.91973305,14.0625 3.4375,14.0625 L14.062,14.062 L14.0625,3.4375 C14.0625,2.91973305 14.482233,2.5 15,2.5 C15.517767,2.5 15.9375,2.91973305 15.9375,3.4375 L15.9375,26.5625 Z M26.5625,14.0625 C27.080267,14.0625 27.5,14.482233 27.5,15 C27.5,15.517767 27.080267,15.9375 26.5625,15.9375 L17.187,15.9375 L17.187,14.0625 L26.5625,14.0625 Z" id="path-1"></path>
</defs>
<g id="ic_public_add_filled_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_recording_置灰</title>
<defs>
<path d="M15,3.75 C15.6903559,3.75 16.25,4.36424348 16.25,5.12195122 L16.25,5.12195122 L16.25,24.8780488 C16.25,25.6357565 15.6903559,26.25 15,26.25 C14.3096441,26.25 13.75,25.6357565 13.75,24.8780488 L13.75,24.8780488 L13.75,5.12195122 C13.75,4.36424348 14.3096441,3.75 15,3.75 Z M8.75,8.14024396 C9.44035592,8.14024396 10,8.75448741 10,9.51219512 L10,9.51219512 L10,22.1341463 C10,22.8918541 9.44035594,23.5060976 8.75,23.5060976 C8.05964406,23.5060976 7.5,22.8918541 7.5,22.1341463 L7.5,22.1341463 L7.5,9.51219512 C7.5,8.75448741 8.05964408,8.14024396 8.75,8.14024396 Z M21.25,9.78658537 C21.9403559,9.78658537 22.5,10.4008288 22.5,11.1585366 L22.5,11.1585366 L22.5,19.3902439 C22.5,20.1479516 21.9403559,20.7621951 21.25,20.7621951 C20.5596441,20.7621951 20,20.1479516 20,19.3902439 L20,19.3902439 L20,11.1585366 C20,10.4008288 20.5596441,9.78658537 21.25,9.78658537 L21.25,9.78658537 Z M2.5,13.0792683 C3.19035594,13.0792683 3.75,13.6935118 3.75,14.4512195 L3.75,14.4512195 L3.75,17.195122 C3.75,17.9528297 3.19035594,18.5670732 2.5,18.5670732 C1.80964406,18.5670732 1.25,17.9528297 1.25,17.195122 L1.25,17.195122 L1.25,14.4512195 C1.25,13.6935118 1.80964406,13.0792683 2.5,13.0792683 Z M27.5,12.5304878 C28.1903559,12.5304878 28.75,13.1447313 28.75,13.902439 L28.75,13.902439 L28.75,17.195122 C28.75,17.9528297 28.1903559,18.5670732 27.5,18.5670732 C26.8096441,18.5670732 26.25,17.9528297 26.25,17.195122 L26.25,17.195122 L26.25,13.902439 C26.25,13.1447313 26.8096441,12.5304878 27.5,12.5304878 Z" id="path-1"></path>
</defs>
<g id="ic_public_recording_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" fill-rule="nonzero" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_video_置灰</title>
<defs>
<path d="M23.125,20.3125 C23.125,22.7287458 21.1662458,24.6875 18.75,24.6875 L4.375,24.6875 C1.95875422,24.6875 0,22.7287458 0,20.3125 L0,9.6875 C0,7.27125422 1.95875422,5.3125 4.375,5.3125 L18.75,5.3125 C21.1638993,5.3125 23.1211951,7.26745161 23.1249945,9.68046173 L23.125,20.3125 Z M18.75,7.1875 L4.375,7.1875 C3.02033929,7.1875 1.91733035,8.2649493 1.87618963,9.60963146 L1.875,9.6875 L1.875,20.3125 C1.875,21.6671607 2.9524493,22.7701696 4.29713146,22.8113104 L4.375,22.8125 L18.75,22.8125 C20.1046607,22.8125 21.2076696,21.7350507 21.2488104,20.3903685 L21.25,20.3125 L21.25,9.6875 C21.25,8.33283929 20.1725507,7.22983035 18.8278685,7.18868963 L18.75,7.1875 Z M26.7956758,8.56873671 C27.8653453,8.00716024 29.1877314,8.419051 29.7493079,9.48872047 C29.9139707,9.80236381 30,10.1513046 30,10.5055446 L30,10.5055446 L30,19.4944554 C30,20.7025783 29.0206229,21.6819554 27.8125,21.6819554 C27.45826,21.6819554 27.1093192,21.595926 26.7956758,21.4312633 L26.7956758,21.4312633 L24.375,20.1595 L24.375,18.0415 L27.6672394,19.7711422 C27.6840417,19.7799634 27.7015532,19.787205 27.7195477,19.7928111 L27.7747546,19.8046675 L27.8125,19.8069554 C27.985089,19.8069554 28.125,19.6670444 28.125,19.4944554 L28.125,19.4944554 L28.125,10.5055446 C28.125,10.4549389 28.1127101,10.4050902 28.0891868,10.360284 L28.0891868,10.360284 L28.0703849,10.3289938 C27.9821584,10.1997777 27.8091343,10.1543629 27.6672394,10.2288578 L27.6672394,10.2288578 L24.375,11.9565 L24.375,9.8395 Z" id="path-1"></path>
</defs>
<g id="ic_public_video_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" fill-rule="nonzero" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_voice_置灰</title>
<defs>
<path d="M23.4375,13.125 C23.955267,13.125 24.375,13.544733 24.375,14.0625 C24.375,18.9236084 20.6752266,22.9205885 15.9379544,23.3911656 L15.9375,26.5625 C15.9375,27.080267 15.517767,27.5 15,27.5 C14.5007247,27.5 14.092606,27.1097125 14.0640915,26.6175852 L14.0625,26.5625 L14.0620456,23.3911656 C9.32477337,22.9205885 5.625,18.9236084 5.625,14.0625 C5.625,13.544733 6.04473305,13.125 6.5625,13.125 C7.08026695,13.125 7.5,13.544733 7.5,14.0625 C7.5,18.2046356 10.8578644,21.5625 15,21.5625 C19.1421356,21.5625 22.5,18.2046356 22.5,14.0625 C22.5,13.544733 22.919733,13.125 23.4375,13.125 Z M15,2.5 C17.7614237,2.5 20,4.73857625 20,7.5 L20,7.5 L20,14.0625 C20,16.8239237 17.7614237,19.0625 15,19.0625 C12.2385763,19.0625 10,16.8239237 10,14.0625 L10,14.0625 L10,7.5 C10,4.73857625 12.2385763,2.5 15,2.5 Z M15,4.375 C13.2741102,4.375 11.875,5.77411016 11.875,7.5 L11.875,7.5 L11.875,14.0625 C11.875,15.7883898 13.2741102,17.1875 15,17.1875 C16.7258898,17.1875 18.125,15.7883898 18.125,14.0625 L18.125,14.0625 L18.125,7.5 C18.125,5.77411016 16.7258898,4.375 15,4.375 Z" id="path-1"></path>
</defs>
<g id="ic_public_voice_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" fill-rule="nonzero" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,55 +0,0 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file: Contact management
*/
import featureAbility from '@ohos.ability.featureAbility';
import dataAbility from '@ohos.data.dataAbility';
import HiLog from '../common/utils/Hilog';
const TAG = "ContactManager";
const DBbaseUri = 'dataability:///com.ohos.contactsdataability';
const DBUri = DBbaseUri + '/contacts/contact_data';
/**
* class ContactManager
*/
export default class ContactManager {
/**
* get contact info
*
* @param { Object } callData -Object
*/
async getContactInfo(callData) {
try {
const columns = ['id', 'display_name', 'detail_info'];
const predicates = new dataAbility.DataAbilityPredicates();
predicates.equalTo('detail_info', callData.accountNumber);
predicates.equalTo('is_deleted', 0);
const dataAbilityHelper = await featureAbility.acquireDataAbilityHelper(DBbaseUri);
const resSet = await dataAbilityHelper.query(DBUri, columns, predicates);
HiLog.i(TAG, "getContactInfo resSet : %s" + JSON.stringify(resSet))
if (resSet.rowCount > 0) {
resSet.goToFirstRow();
callData.contactName = resSet.getString(resSet.getColumnIndex('display_name'));
}
} catch (err) {
HiLog.i(TAG, "getContactInfo catch err : %s" + JSON.stringify(err))
}
}
}

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_add_filled_置灰</title>
<defs>
<path d="M15.9375,26.5625 C15.9375,27.080267 15.517767,27.5 15,27.5 C14.482233,27.5 14.0625,27.080267 14.0625,26.5625 L14.062,15.937 L3.4375,15.9375 C2.91973305,15.9375 2.5,15.517767 2.5,15 C2.5,14.482233 2.91973305,14.0625 3.4375,14.0625 L14.062,14.062 L14.0625,3.4375 C14.0625,2.91973305 14.482233,2.5 15,2.5 C15.517767,2.5 15.9375,2.91973305 15.9375,3.4375 L15.9375,26.5625 Z M26.5625,14.0625 C27.080267,14.0625 27.5,14.482233 27.5,15 C27.5,15.517767 27.080267,15.9375 26.5625,15.9375 L17.187,15.9375 L17.187,14.0625 L26.5625,14.0625 Z" id="path-1"></path>
</defs>
<g id="ic_public_add_filled_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_pause_置灰</title>
<g id="ic_public_pause_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.4">
<path d="M10,4.375 C10.6903559,4.375 11.25,4.93464406 11.25,5.625 L11.25,24.375 C11.25,25.0653559 10.6903559,25.625 10,25.625 C9.30964406,25.625 8.75,25.0653559 8.75,24.375 L8.75,5.625 C8.75,4.93464406 9.30964406,4.375 10,4.375 Z M20,4.375 C20.6903559,4.375 21.25,4.93464406 21.25,5.625 L21.25,24.375 C21.25,25.0653559 20.6903559,25.625 20,25.625 C19.3096441,25.625 18.75,25.0653559 18.75,24.375 L18.75,5.625 C18.75,4.93464406 19.3096441,4.375 20,4.375 Z" id="ic/pause/ic_pause" fill="#FFFFFF"></path>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 864 B

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_recording_置灰</title>
<defs>
<path d="M15,3.75 C15.6903559,3.75 16.25,4.36424348 16.25,5.12195122 L16.25,5.12195122 L16.25,24.8780488 C16.25,25.6357565 15.6903559,26.25 15,26.25 C14.3096441,26.25 13.75,25.6357565 13.75,24.8780488 L13.75,24.8780488 L13.75,5.12195122 C13.75,4.36424348 14.3096441,3.75 15,3.75 Z M8.75,8.14024396 C9.44035592,8.14024396 10,8.75448741 10,9.51219512 L10,9.51219512 L10,22.1341463 C10,22.8918541 9.44035594,23.5060976 8.75,23.5060976 C8.05964406,23.5060976 7.5,22.8918541 7.5,22.1341463 L7.5,22.1341463 L7.5,9.51219512 C7.5,8.75448741 8.05964408,8.14024396 8.75,8.14024396 Z M21.25,9.78658537 C21.9403559,9.78658537 22.5,10.4008288 22.5,11.1585366 L22.5,11.1585366 L22.5,19.3902439 C22.5,20.1479516 21.9403559,20.7621951 21.25,20.7621951 C20.5596441,20.7621951 20,20.1479516 20,19.3902439 L20,19.3902439 L20,11.1585366 C20,10.4008288 20.5596441,9.78658537 21.25,9.78658537 L21.25,9.78658537 Z M2.5,13.0792683 C3.19035594,13.0792683 3.75,13.6935118 3.75,14.4512195 L3.75,14.4512195 L3.75,17.195122 C3.75,17.9528297 3.19035594,18.5670732 2.5,18.5670732 C1.80964406,18.5670732 1.25,17.9528297 1.25,17.195122 L1.25,17.195122 L1.25,14.4512195 C1.25,13.6935118 1.80964406,13.0792683 2.5,13.0792683 Z M27.5,12.5304878 C28.1903559,12.5304878 28.75,13.1447313 28.75,13.902439 L28.75,13.902439 L28.75,17.195122 C28.75,17.9528297 28.1903559,18.5670732 27.5,18.5670732 C26.8096441,18.5670732 26.25,17.9528297 26.25,17.195122 L26.25,17.195122 L26.25,13.902439 C26.25,13.1447313 26.8096441,12.5304878 27.5,12.5304878 Z" id="path-1"></path>
</defs>
<g id="ic_public_recording_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" fill-rule="nonzero" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_video_置灰</title>
<defs>
<path d="M23.125,20.3125 C23.125,22.7287458 21.1662458,24.6875 18.75,24.6875 L4.375,24.6875 C1.95875422,24.6875 0,22.7287458 0,20.3125 L0,9.6875 C0,7.27125422 1.95875422,5.3125 4.375,5.3125 L18.75,5.3125 C21.1638993,5.3125 23.1211951,7.26745161 23.1249945,9.68046173 L23.125,20.3125 Z M18.75,7.1875 L4.375,7.1875 C3.02033929,7.1875 1.91733035,8.2649493 1.87618963,9.60963146 L1.875,9.6875 L1.875,20.3125 C1.875,21.6671607 2.9524493,22.7701696 4.29713146,22.8113104 L4.375,22.8125 L18.75,22.8125 C20.1046607,22.8125 21.2076696,21.7350507 21.2488104,20.3903685 L21.25,20.3125 L21.25,9.6875 C21.25,8.33283929 20.1725507,7.22983035 18.8278685,7.18868963 L18.75,7.1875 Z M26.7956758,8.56873671 C27.8653453,8.00716024 29.1877314,8.419051 29.7493079,9.48872047 C29.9139707,9.80236381 30,10.1513046 30,10.5055446 L30,10.5055446 L30,19.4944554 C30,20.7025783 29.0206229,21.6819554 27.8125,21.6819554 C27.45826,21.6819554 27.1093192,21.595926 26.7956758,21.4312633 L26.7956758,21.4312633 L24.375,20.1595 L24.375,18.0415 L27.6672394,19.7711422 C27.6840417,19.7799634 27.7015532,19.787205 27.7195477,19.7928111 L27.7747546,19.8046675 L27.8125,19.8069554 C27.985089,19.8069554 28.125,19.6670444 28.125,19.4944554 L28.125,19.4944554 L28.125,10.5055446 C28.125,10.4549389 28.1127101,10.4050902 28.0891868,10.360284 L28.0891868,10.360284 L28.0703849,10.3289938 C27.9821584,10.1997777 27.8091343,10.1543629 27.6672394,10.2288578 L27.6672394,10.2288578 L24.375,11.9565 L24.375,9.8395 Z" id="path-1"></path>
</defs>
<g id="ic_public_video_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" fill-rule="nonzero" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_voice_置灰</title>
<defs>
<path d="M23.4375,13.125 C23.955267,13.125 24.375,13.544733 24.375,14.0625 C24.375,18.9236084 20.6752266,22.9205885 15.9379544,23.3911656 L15.9375,26.5625 C15.9375,27.080267 15.517767,27.5 15,27.5 C14.5007247,27.5 14.092606,27.1097125 14.0640915,26.6175852 L14.0625,26.5625 L14.0620456,23.3911656 C9.32477337,22.9205885 5.625,18.9236084 5.625,14.0625 C5.625,13.544733 6.04473305,13.125 6.5625,13.125 C7.08026695,13.125 7.5,13.544733 7.5,14.0625 C7.5,18.2046356 10.8578644,21.5625 15,21.5625 C19.1421356,21.5625 22.5,18.2046356 22.5,14.0625 C22.5,13.544733 22.919733,13.125 23.4375,13.125 Z M15,2.5 C17.7614237,2.5 20,4.73857625 20,7.5 L20,7.5 L20,14.0625 C20,16.8239237 17.7614237,19.0625 15,19.0625 C12.2385763,19.0625 10,16.8239237 10,14.0625 L10,14.0625 L10,7.5 C10,4.73857625 12.2385763,2.5 15,2.5 Z M15,4.375 C13.2741102,4.375 11.875,5.77411016 11.875,7.5 L11.875,7.5 L11.875,14.0625 C11.875,15.7883898 13.2741102,17.1875 15,17.1875 C16.7258898,17.1875 18.125,15.7883898 18.125,14.0625 L18.125,14.0625 L18.125,7.5 C18.125,5.77411016 16.7258898,4.375 15,4.375 Z" id="path-1"></path>
</defs>
<g id="ic_public_voice_置灰" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#FFFFFF" fill-rule="nonzero" opacity="0.4" xlink:href="#path-1"></use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

3
common/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/node_modules
/.preview
/build

View File

@ -0,0 +1,5 @@
{
"apiType": "stageMode",
"buildOption": {
}
}

3
common/hvigorfile.js Normal file
View File

@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks

1
common/index.ets Normal file
View File

@ -0,0 +1 @@
export { MainPage } from './src/main/ets/components/MainPage/MainPage'

14
common/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"license":"ISC",
"types":"",
"devDependencies":{},
"name":"@ohos/common",
"description":"a npm package which contains arkUI2.0 page",
"ohos":{
"org":""
},
"main":"index.ets",
"repository":{},
"version":"1.0.0",
"dependencies":{}
}

View File

@ -0,0 +1,16 @@
@Component
export struct MainPage {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,10 @@
{
"module": {
"name": "common",
"type": "har",
"deviceTypes": [
"default",
"tablet"
]
}
}

View File

@ -0,0 +1,8 @@
{
"string": [
{
"name": "page_show",
"value": "page from npm package"
}
]
}

View File

@ -105,7 +105,7 @@ import dataStorage from '@ohos.data.storage';
2选择 Project → Signing Configs添加StorePassword123456abcdefKeyPassword123456
2选择 Project → Signing Configs添加StorePassword123456abcKeyPassword123456abc
依次填入下图中完成后点击Apply再点击OK
![](../doc/image/signature_2.png)

View File

@ -1,2 +1,4 @@
/build
/node_modules
/node_modules
/.preview
/build
/.cxx

13
entry/build-profile.json5 Normal file
View File

@ -0,0 +1,13 @@
{
"apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}

2
entry/hvigorfile.js Normal file
View File

@ -0,0 +1,2 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks

14
entry/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"license":"ISC",
"devDependencies":{},
"name":"entry",
"ohos":{
"org":"huawei",
"directoryLevel":"module",
"buildTool":"hvigor"
},
"description":"example description",
"repository":{},
"version":"1.0.0",
"dependencies":{}
}

View File

@ -0,0 +1,33 @@
import AbilityStage from "@ohos.application.AbilityStage"
import deviceInfo from '@ohos.deviceInfo';
import backgroundTaskManager from '@ohos.backgroundTaskManager';
import LogUtils from '../common/utils/LogUtils'
const TAG = "MyAbilityStage";
export default class MyAbilityStage extends AbilityStage {
onCreate() {
globalThis.deviceTypeInfo = deviceInfo.deviceType;
this.applyEfficiencyResources();
LogUtils.i(TAG, "MyAbilityStage onCreate")
}
onDestroy() {
LogUtils.i(TAG, "MyAbilityStage onDestroy")
backgroundTaskManager.resetAllEfficiencyResources();
}
private applyEfficiencyResources() {
let request: backgroundTaskManager.EfficiencyResourcesRequest = {
resourceTypes: backgroundTaskManager.ResourceType.COMMON_EVENT,
isApply: true,
timeOut: 0,
reason: "apply",
isPersist: true,
isProcess: false,
}
let res = backgroundTaskManager.applyEfficiencyResources(request);
LogUtils.i(TAG, "result of applyEfficiencyResources is:" + res)
}
}

View File

@ -0,0 +1,46 @@
import featureAbility from '@ohos.ability.featureAbility';
import Ability from '@ohos.application.Ability'
import LogUtils from '../common/utils/LogUtils'
const TAG = "MainAbility";
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
LogUtils.i(TAG, "onCreate")
globalThis.abilityWant = want;
globalThis.calluiAbilityContext = this.context;
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
LogUtils.i(TAG, "onWindowStageCreate")
windowStage.loadContent("pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
LogUtils.i(TAG, "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
LogUtils.i(TAG, "onForeground")
}
onBackground() {
// Ability has back to background
LogUtils.i(TAG, "onBackground")
}
onDestroy() {
LogUtils.i(TAG, "onDestroy")
globalThis.callManager.clearTimer();
globalThis.callManager.unsubscribe();
}
};

View File

@ -20,7 +20,7 @@
import PA from '@ohos.ability.particleAbility';
import TelephonyCall from './TelephonyApi';
import commonEvent from '@ohos.commonEvent';
import HiLog from '../default/common/utils/Hilog';
import LogUtils from "../common/utils/LogUtils"
let subscriber;
const TAG = "CallManagerService";
@ -39,22 +39,24 @@ export default class CallManagerService {
private mTelephonyCall: TelephonyCall ;
private callData = null;
private callList = [];
private context: any;
public constructor() {
public constructor(context: any) {
this.mTelephonyCall = new TelephonyCall;
this.addRegisterListener();
this.addSubscriber();
this.context = context;
}
/**
* add callui app subscriber
*/
async addSubscriber() {
LogUtils.i(TAG, "addSubscriber")
subscriber = await new Promise((resolve) => {
commonEvent.createSubscriber({
events
}, (err, data) => {
HiLog.i(TAG, "addSubscriber")
resolve(data);
});
});
@ -73,11 +75,11 @@ export default class CallManagerService {
this.btnclickAgent(callId, btnType)
}
} else {
HiLog.i(TAG, "callui service commonEvent.subscribe failed err : %s" + JSON.stringify(err))
LogUtils.i(TAG, "addSubscriber commonEvent.subscribe failed err :" + JSON.stringify(err))
}
subscriber.finishCommonEvent()
.then(() => {
HiLog.i(TAG, "addSubscriber finishCommonEvent")
LogUtils.i(TAG, "addSubscriber finishCommonEvent")
})
});
}
@ -89,7 +91,7 @@ export default class CallManagerService {
* @param { string } btnType - button type
*/
btnclickAgent(callId, btnType) {
HiLog.i(TAG, "btnType : %s" + btnType)
LogUtils.i(TAG, "btnclickAgent btnType :" + btnType)
this.getMapObj(btnType, callId)
}
@ -139,16 +141,14 @@ export default class CallManagerService {
* @param { Object } callData - Object
*/
startAbility(callData) {
PA.startAbility({
want: {
this.context.startAbility({
bundleName: CALL_BUNDLE_NAME,
abilityName: ABILITY_NAME,
parameters: callData
}
}).then((data) => {
HiLog.i(TAG, "callUI service PA.startAbility data : %s" + JSON.stringify(data))
LogUtils.i(TAG, "callUI service startAbility data :" + JSON.stringify(data))
}).catch((err) => {
HiLog.i(TAG, "callUI service PA.startAbility err : %s" + JSON.stringify(err))
LogUtils.i(TAG, "callUI service startAbility err :" + JSON.stringify(err))
});
}
@ -179,12 +179,12 @@ export default class CallManagerService {
* @param { Object } callData - Object
*/
publishData(callData) {
commonEvent.publish('callui.event.callDetailsChange', {
bundleName: CALL_BUNDLE_NAME,
commonEvent.publish('callui.event.callDetailsChange', {
bundleName: 'com.ohos.callui',
isOrdered: false,
data: JSON.stringify(callData)
}, (res) => {
HiLog.i(TAG, "callUI service commonEvent.publish callback res")
LogUtils.i(TAG, "publishData commonEvent.publish callback res: callui.event.callDetailsChange")
});
}
@ -194,7 +194,7 @@ export default class CallManagerService {
unsubscribe() {
commonEvent.unsubscribe(subscriber, (err) => {
if (err.code !== 0) {
HiLog.i(TAG, "callUI service commonEvent.unsubscribe err: %s" + JSON.stringify(err))
LogUtils.i(TAG, "unsubscribe commonEvent.unsubscribe err:" + JSON.stringify(err))
}
});
}

View File

@ -0,0 +1,47 @@
import Want from '@ohos.application.Want';
import ServiceExtension from '@ohos.application.ServiceExtensionAbility';
import CallManagerService from './CallManagerService';
import rpc from '@ohos.rpc';
import LogUtils from "../common/utils/LogUtils"
const TAG = "ServiceAbility";
export default class ServiceAbility extends ServiceExtension {
callManagerService: CallManagerService
onCreate(want) {
LogUtils.i(TAG, "onCreate callUI service");
this.callManagerService = new CallManagerService(this.context);
}
onConnect(want:Want) {
LogUtils.i(TAG, "onConnect callUI service want:" + JSON.stringify(want));
let callData:any = {};
callData.accountNumber = want.parameters.accountNumber;
callData.videoState = want.parameters.videoState;
callData.callType = want.parameters.callType;
callData.callState = want.parameters.callState;
callData.conferenceState = want.parameters.conferenceState;
this.callManagerService.getCallData(callData);
return new Stub("ServiceAbility");
}
onRequest(want:Want, startId:number) {
LogUtils.i(TAG, "onRequest callUI service");
}
onDestroy() {
LogUtils.i(TAG, "onDestroy callUI service");
}
}
class Stub extends rpc.RemoteObject {
constructor(descriptor) {
super(descriptor);
}
onRemoteRequest(code, date, reply, option) {
try {
LogUtils.i(TAG, "Stub onRemoteRequest code:" + code)
return true;
} finally {
}
}
}

View File

@ -18,7 +18,7 @@
*/
import call from '@ohos.telephony.call';
import HiLog from '../default/common/utils/Hilog';
import LogUtils from "../common/utils/LogUtils"
const prefixLog = 'callui service:@ohos.telephony.call:';
const TAG = "TelephonyApi";
@ -33,10 +33,10 @@ export default class TelephonyApi {
public registerCallStateCallback(callBack) {
call.on('callDetailsChange', (data) => {
if (!data) {
HiLog.i(TAG, prefixLog + "call.on registerCallStateCallback" + JSON.stringify(data))
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback: " + JSON.stringify(data))
return;
}
HiLog.i(TAG, prefixLog + "call.on registerCallStateCallback callState :" + JSON.stringify(data.callState))
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback callState: " + JSON.stringify(data.callState))
callBack(data);
});
}
@ -47,10 +47,10 @@ export default class TelephonyApi {
public unRegisterCallStateCallback() {
call.off('callDetailsChange', (data) => {
if (!data) {
HiLog.i(TAG, prefixLog + "call.off unRegisterCallStateCallback" + JSON.stringify(data))
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback" + JSON.stringify(data))
return;
}
HiLog.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
});
}
@ -61,9 +61,9 @@ export default class TelephonyApi {
*/
public acceptCall = function (callId) {
call.answer(callId).then((res) => {
HiLog.i(TAG, prefixLog + "call.answer")
LogUtils.i(TAG, prefixLog + "call.answer")
}).catch((err) => {
HiLog.i(TAG, prefixLog + "call.answer catch : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "call.answer catch : %s" + JSON.stringify(err))
})
}
@ -77,12 +77,14 @@ export default class TelephonyApi {
* @param { string } msg - message string
*/
public rejectCall = function (callId, isSendSms = false, msg = '') {
const rejectCallPromise = isSendSms ? call.reject(callId, {messageContent: msg}) : call.reject(callId);
const rejectCallPromise = isSendSms ? call.reject(callId, {
messageContent: msg
}) : call.reject(callId);
rejectCallPromise.then((res) => {
HiLog.i(TAG, prefixLog + "then:rejectCall")
LogUtils.i(TAG, prefixLog + "then:rejectCall")
})
.catch((err) => {
HiLog.i(TAG, prefixLog + "catch:rejectCall : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:rejectCall : " + JSON.stringify(err))
});
};
@ -96,10 +98,10 @@ export default class TelephonyApi {
public hangUpCall = (callId) => new Promise((resolve, reject) => {
call.hangup(callId).then((res) => {
resolve(res);
HiLog.i(TAG, prefixLog + "then:hangUpCall : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "then:hangUpCall : %s" + JSON.stringify(callId))
}).catch((err) => {
reject(err);
HiLog.i(TAG, prefixLog + "catch:hangUpCall : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:hangUpCall : %s" + JSON.stringify(err))
});
});
}

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 789 B

After

Width:  |  Height:  |  Size: 789 B

View File

Before

Width:  |  Height:  |  Size: 756 B

After

Width:  |  Height:  |  Size: 756 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px"
height="30px"
viewBox="0 0 30 30"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_add_filled_置灰</title>
<defs>
<path
d="M15.9375,26.5625 C15.9375,27.080267 15.517767,27.5 15,27.5 C14.482233,27.5 14.0625,27.080267 14.0625,26.5625 L14.062,15.937 L3.4375,15.9375 C2.91973305,15.9375 2.5,15.517767 2.5,15 C2.5,14.482233 2.91973305,14.0625 3.4375,14.0625 L14.062,14.062 L14.0625,3.4375 C14.0625,2.91973305 14.482233,2.5 15,2.5 C15.517767,2.5 15.9375,2.91973305 15.9375,3.4375 L15.9375,26.5625 Z M26.5625,14.0625 C27.080267,14.0625 27.5,14.482233 27.5,15 C27.5,15.517767 27.080267,15.9375 26.5625,15.9375 L17.187,15.9375 L17.187,14.0625 L26.5625,14.0625 Z"
id="path-1"></path>
</defs>
<g
id="ic_public_add_filled_置灰"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd">
<mask
id="mask-2"
fill="#8c8c8c">
<use xlink:href="#path-1"></use>
</mask>
<use
id="形状结合"
fill="#FFFFFF"
opacity="0.4"
xlink:href="#path-1"></use>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 836 B

After

Width:  |  Height:  |  Size: 836 B

View File

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 850 B

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px"
height="30px"
viewBox="0 0 30 30"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_pause_置灰</title>
<g
id="ic_public_pause_置灰"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd"
opacity="0.4">
<path
d="M10,4.375 C10.6903559,4.375 11.25,4.93464406 11.25,5.625 L11.25,24.375 C11.25,25.0653559 10.6903559,25.625 10,25.625 C9.30964406,25.625 8.75,25.0653559 8.75,24.375 L8.75,5.625 C8.75,4.93464406 9.30964406,4.375 10,4.375 Z M20,4.375 C20.6903559,4.375 21.25,4.93464406 21.25,5.625 L21.25,24.375 C21.25,25.0653559 20.6903559,25.625 20,25.625 C19.3096441,25.625 18.75,25.0653559 18.75,24.375 L18.75,5.625 C18.75,4.93464406 19.3096441,4.375 20,4.375 Z"
id="ic/pause/ic_pause"
fill="#FFFFFF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 973 B

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px"
height="30px"
viewBox="0 0 30 30"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_recording_置灰</title>
<defs>
<path
d="M15,3.75 C15.6903559,3.75 16.25,4.36424348 16.25,5.12195122 L16.25,5.12195122 L16.25,24.8780488 C16.25,25.6357565 15.6903559,26.25 15,26.25 C14.3096441,26.25 13.75,25.6357565 13.75,24.8780488 L13.75,24.8780488 L13.75,5.12195122 C13.75,4.36424348 14.3096441,3.75 15,3.75 Z M8.75,8.14024396 C9.44035592,8.14024396 10,8.75448741 10,9.51219512 L10,9.51219512 L10,22.1341463 C10,22.8918541 9.44035594,23.5060976 8.75,23.5060976 C8.05964406,23.5060976 7.5,22.8918541 7.5,22.1341463 L7.5,22.1341463 L7.5,9.51219512 C7.5,8.75448741 8.05964408,8.14024396 8.75,8.14024396 Z M21.25,9.78658537 C21.9403559,9.78658537 22.5,10.4008288 22.5,11.1585366 L22.5,11.1585366 L22.5,19.3902439 C22.5,20.1479516 21.9403559,20.7621951 21.25,20.7621951 C20.5596441,20.7621951 20,20.1479516 20,19.3902439 L20,19.3902439 L20,11.1585366 C20,10.4008288 20.5596441,9.78658537 21.25,9.78658537 L21.25,9.78658537 Z M2.5,13.0792683 C3.19035594,13.0792683 3.75,13.6935118 3.75,14.4512195 L3.75,14.4512195 L3.75,17.195122 C3.75,17.9528297 3.19035594,18.5670732 2.5,18.5670732 C1.80964406,18.5670732 1.25,17.9528297 1.25,17.195122 L1.25,17.195122 L1.25,14.4512195 C1.25,13.6935118 1.80964406,13.0792683 2.5,13.0792683 Z M27.5,12.5304878 C28.1903559,12.5304878 28.75,13.1447313 28.75,13.902439 L28.75,13.902439 L28.75,17.195122 C28.75,17.9528297 28.1903559,18.5670732 27.5,18.5670732 C26.8096441,18.5670732 26.25,17.9528297 26.25,17.195122 L26.25,17.195122 L26.25,13.902439 C26.25,13.1447313 26.8096441,12.5304878 27.5,12.5304878 Z"
id="path-1"></path>
</defs>
<g
id="ic_public_recording_置灰"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd">
<mask
id="mask-2"
fill="#8c8c8c">
<use xlink:href="#path-1"></use>
</mask>
<use
id="形状结合"
fill="#FFFFFF"
fill-rule="nonzero"
opacity="0.4"
xlink:href="#path-1"></use>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px"
height="30px"
viewBox="0 0 30 30"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_video_置灰</title>
<defs>
<path
d="M23.125,20.3125 C23.125,22.7287458 21.1662458,24.6875 18.75,24.6875 L4.375,24.6875 C1.95875422,24.6875 0,22.7287458 0,20.3125 L0,9.6875 C0,7.27125422 1.95875422,5.3125 4.375,5.3125 L18.75,5.3125 C21.1638993,5.3125 23.1211951,7.26745161 23.1249945,9.68046173 L23.125,20.3125 Z M18.75,7.1875 L4.375,7.1875 C3.02033929,7.1875 1.91733035,8.2649493 1.87618963,9.60963146 L1.875,9.6875 L1.875,20.3125 C1.875,21.6671607 2.9524493,22.7701696 4.29713146,22.8113104 L4.375,22.8125 L18.75,22.8125 C20.1046607,22.8125 21.2076696,21.7350507 21.2488104,20.3903685 L21.25,20.3125 L21.25,9.6875 C21.25,8.33283929 20.1725507,7.22983035 18.8278685,7.18868963 L18.75,7.1875 Z M26.7956758,8.56873671 C27.8653453,8.00716024 29.1877314,8.419051 29.7493079,9.48872047 C29.9139707,9.80236381 30,10.1513046 30,10.5055446 L30,10.5055446 L30,19.4944554 C30,20.7025783 29.0206229,21.6819554 27.8125,21.6819554 C27.45826,21.6819554 27.1093192,21.595926 26.7956758,21.4312633 L26.7956758,21.4312633 L24.375,20.1595 L24.375,18.0415 L27.6672394,19.7711422 C27.6840417,19.7799634 27.7015532,19.787205 27.7195477,19.7928111 L27.7747546,19.8046675 L27.8125,19.8069554 C27.985089,19.8069554 28.125,19.6670444 28.125,19.4944554 L28.125,19.4944554 L28.125,10.5055446 C28.125,10.4549389 28.1127101,10.4050902 28.0891868,10.360284 L28.0891868,10.360284 L28.0703849,10.3289938 C27.9821584,10.1997777 27.8091343,10.1543629 27.6672394,10.2288578 L27.6672394,10.2288578 L24.375,11.9565 L24.375,9.8395 Z"
id="path-1"></path>
</defs>
<g
id="ic_public_video_置灰"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd">
<mask
id="mask-2"
fill="#8c8c8c">
<use xlink:href="#path-1"></use>
</mask>
<use
id="形状结合"
fill="#FFFFFF"
fill-rule="nonzero"
opacity="0.4"
xlink:href="#path-1"></use>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px"
height="30px"
viewBox="0 0 30 30"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ic_public_voice_置灰</title>
<defs>
<path
d="M23.4375,13.125 C23.955267,13.125 24.375,13.544733 24.375,14.0625 C24.375,18.9236084 20.6752266,22.9205885 15.9379544,23.3911656 L15.9375,26.5625 C15.9375,27.080267 15.517767,27.5 15,27.5 C14.5007247,27.5 14.092606,27.1097125 14.0640915,26.6175852 L14.0625,26.5625 L14.0620456,23.3911656 C9.32477337,22.9205885 5.625,18.9236084 5.625,14.0625 C5.625,13.544733 6.04473305,13.125 6.5625,13.125 C7.08026695,13.125 7.5,13.544733 7.5,14.0625 C7.5,18.2046356 10.8578644,21.5625 15,21.5625 C19.1421356,21.5625 22.5,18.2046356 22.5,14.0625 C22.5,13.544733 22.919733,13.125 23.4375,13.125 Z M15,2.5 C17.7614237,2.5 20,4.73857625 20,7.5 L20,7.5 L20,14.0625 C20,16.8239237 17.7614237,19.0625 15,19.0625 C12.2385763,19.0625 10,16.8239237 10,14.0625 L10,14.0625 L10,7.5 C10,4.73857625 12.2385763,2.5 15,2.5 Z M15,4.375 C13.2741102,4.375 11.875,5.77411016 11.875,7.5 L11.875,7.5 L11.875,14.0625 C11.875,15.7883898 13.2741102,17.1875 15,17.1875 C16.7258898,17.1875 18.125,15.7883898 18.125,14.0625 L18.125,14.0625 L18.125,7.5 C18.125,5.77411016 16.7258898,4.375 15,4.375 Z"
id="path-1"></path>
</defs>
<g
id="ic_public_voice_置灰"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd">
<mask
id="mask-2"
fill="#8c8c8c">
<use xlink:href="#path-1"></use>
</mask>
<use
id="形状结合"
fill="#FFFFFF"
fill-rule="nonzero"
opacity="0.4"
xlink:href="#path-1"></use>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -18,7 +18,7 @@
*/
import CallServiceProxy from '../../model/CallServiceProxy';
import HiLog from '../utils/Hilog';
import LogUtils from '../utils/LogUtils';
const TAG = "BottomBtn";
@ -29,8 +29,8 @@ export default struct BottomBtn {
private mCallServiceProxy: CallServiceProxy;
private imageList;
public aboutToAppear(callData, callList, callTimeList): void {
HiLog.i(TAG, "aboutToAppear :");
public aboutToAppear() {
LogUtils.i(TAG, "aboutToAppear :");
this.getImageList();
this.mCallServiceProxy = CallServiceProxy.getInstance();
}
@ -60,7 +60,7 @@ export default struct BottomBtn {
*/
onHangUp() {
this.mCallServiceProxy.hangUpCall(this.callData.callId);
HiLog.i(TAG, "onHangUp this.callData.callId : %s", this.callData.callId);
LogUtils.i(TAG, "onHangUp this.callData.callId : " + this.callData.callId);
}
/**

View File

@ -17,21 +17,23 @@
* @file: Header information display component
*/
import callList from '../components/CallList';
import Utils from '../utils/utils';
import LogUtils from '../utils/LogUtils';
import callStateConst from '../constant/CallStateConst';
import HiLog from '../utils/Hilog';
import Utils from '../utils/utils'
const TAG = "contactCard";
/**
* call global variable
* call global variable 会黑屏
*/
/*
let callTimeList;
let defaultTemp = globalThis.exports.default;
if (defaultTemp != undefined) {
callTimeList = defaultTemp.data.callTimeList;
}
*/
@Component
export default struct ContactCard {
@ -40,29 +42,40 @@ export default struct ContactCard {
@Prop isShowKeyboard: boolean;
@Link callList: Array<any>;
@Link callData: any;
@StorageLink("TextInput") textInput: string = '';
@StorageLink("TextInputValue") textInputValue: string = '';
@StorageLink("CallTimeList") callTimeList: any = [];
@StorageLink("AccountNumber") accountNumber: string = '';
@StorageLink("IsEmergencyPhoneNumber") isEmergencyPhoneNumber: boolean = false;
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");
public aboutToAppear(): void {
LogUtils.i(TAG, "aboutToAppear");
this.mUtils = Utils.getInstance();
this.callTimeList = [];
this.timer = setInterval(() => {
if (this.dialing === '...') {
this.dialing = '';
}
this.dialing += '.';
},500)
}, 500)
if (this.callData.callState === 3) {
clearInterval(this.timer)
}
}
/**
* Determine whether to display the call list or the input box
*
* @return {boolean} - return success true fail false
*/
private isShowCard() {
return this.callList.length === 1 || (this.callList.length > 1 && this.callList.some((v) =>
v.callState === callStateConst.CALL_STATUS_WAITING));
}
/**
* Call status
*
@ -81,16 +94,6 @@ export default struct ContactCard {
return this.callState() === callStateConst.CALL_STATUS_ACTIVE && this.callList.length === 1;
}
/**
* Determine whether to display the call list or the input box
*
* @return {boolean} - return success true fail false
*/
private isShowCard() {
return this.callList.length === 1 || (this.callList.length > 1 && this.callList.some((v) =>
v.callState === callStateConst.CALL_STATUS_WAITING));
}
build() {
GridContainer({ gutter: 24, margin: 24 }) {
Column() {
@ -195,6 +198,7 @@ export default struct ContactCard {
if (this.isShowTime()) {
Column() {
Text(this.callTimeList[0].callTime)
// Text('00:56 ')
.fontSize(14)
.height(19)
.lineHeight(19)

View File

@ -14,7 +14,7 @@
*/
import CallServiceProxy from "../../model/CallServiceProxy";
import HiLog from '../utils/Hilog';
import LogUtils from '../utils/LogUtils';
const TAG = "DtmfBtn";
@ -31,7 +31,7 @@ export default struct DtmfBtn {
public aboutToAppear(): void {
this.textInput = "";
HiLog.i(TAG, "aboutToAppear");
LogUtils.i(TAG, "aboutToAppear");
this.mCallServiceProxy = new CallServiceProxy();
}
@ -42,7 +42,7 @@ export default struct DtmfBtn {
*/
onBtnTouchStart(obj) {
this.mCallServiceProxy.startDTMF(this.callData.callId, String(obj.value));
HiLog.i(TAG, "onBtnTouchStart :");
LogUtils.i(TAG, "onBtnTouchStart :");
}
/**
@ -52,7 +52,7 @@ export default struct DtmfBtn {
*/
onBtnTouchEnd() {
this.mCallServiceProxy.stopDTMF(this.callData.callId);
HiLog.i(TAG, "onBtnTouchEnd :");
LogUtils.i(TAG, "onBtnTouchEnd :");
}
build() {
@ -90,7 +90,7 @@ export default struct DtmfBtn {
}
AppStorage.SetOrCreate("textInputValue", this.textInputValue)
AppStorage.SetOrCreate("TextInput", this.textInput)
HiLog.i(TAG, "textInputValue + TextInput : %s" + JSON.stringify(AppStorage.Get("textInputValue")) + JSON.stringify(AppStorage.Get("TextInput")));
LogUtils.i(TAG, "textInputValue + TextInput : %s" + JSON.stringify(AppStorage.Get("textInputValue")) + JSON.stringify(AppStorage.Get("TextInput")));
this.onBtnTouchStart(this.item)
}
if (event.type === TouchType.Up) {

View File

@ -14,7 +14,7 @@
*/
import Method from '../utils/Method';
import HiLog from '../utils/Hilog';
import LogUtils from '../utils/LogUtils';
const TAG = "FuncBtn";
@ -37,7 +37,7 @@ export default struct FuncBtn {
*/
iconUrl() {
if (this.isDisable && this.iconDisableUrl) {
HiLog.i(TAG, "iconUrl this.isDisable : %s" + this.isDisable);
LogUtils.i(TAG, "iconUrl this.isDisable : " + this.isDisable);
return this.iconDisableUrl;
}
return this.isActive && this.iconDefaultUrl ? this.iconActiveUrl : this.iconDefaultUrl;
@ -47,7 +47,7 @@ export default struct FuncBtn {
* Button group change picture
*/
changeBtn(type) {
HiLog.i(TAG, "changeBtn type : %s" + type);
LogUtils.i(TAG, "changeBtn type : " + type);
const BtnName = ['record', 'video', 'mute'];
if (Method.includes(BtnName, type)) {
this.isActive = !this.isActive;
@ -73,12 +73,12 @@ export default struct FuncBtn {
return '';
}
this.textColor = 'rgb(255, 255, 255)';
HiLog.i(TAG, "iconClassName this.isDisable :");
LogUtils.i(TAG, "iconClassName this.isDisable :");
return 'default';
}
private aboutToAppear(): void {
HiLog.i(TAG, "aboutToAppear");
aboutToAppear() {
LogUtils.i(TAG, "aboutToAppear");
this.iconClassName();
}

View File

@ -15,13 +15,12 @@
import Method from '../utils/Method';
import FuncBtn from './FuncBtn';
import FA from '@ohos.ability.featureAbility';
import CallStateConst from '../constant/CallStateConst';
import CallServiceProxy from '../../model/CallServiceProxy';
import Clone from '../utils/clone';
import ConferenceConst from '../constant/ConferenceConst';
import BtnGroupConfig from '../configs/BtnGroupConfig';
import HiLog from '../utils/Hilog';
import LogUtils from '../utils/LogUtils';
const TAG = 'FuncBtnGroup';
const textMap =
@ -53,7 +52,7 @@ export default struct FuncBtnGroup {
private btnListCall;
private btnListDialing;
private aboutToAppear(): void {
aboutToAppear() {
this.mClone = Clone.getInstance()
this.mCallServiceProxy = CallServiceProxy.getInstance();
this.mBtnGroupConfig.btnGroupList.forEach((v) => {
@ -66,20 +65,20 @@ export default struct FuncBtnGroup {
this.getBtnListCall()
this.btnList = this.btnListCall
this.updateBtnList()
HiLog.i(TAG, "aboutToAppear :");
LogUtils.i(TAG, "aboutToAppear :");
}
/**
* Switching BtnList Based on CallStatus
*/
updateBtnList() {
if (this.callData.callState === CallStateConst.CALL_STATUS_DIALING|| this.callData.callState === CallStateConst.CALL_STATUS_ALERTING) {
if (this.callData.callState === CallStateConst.CALL_STATUS_DIALING || this.callData.callState === CallStateConst.CALL_STATUS_ALERTING) {
this.btnList = this.btnListDialing
}else{
} else {
this.btnList = this.btnListCall
}
this.onCallStateChange(this.callData.callState)
HiLog.i(TAG, "upData BtnList");
LogUtils.i(TAG, "upData BtnList");
}
/**
@ -89,7 +88,6 @@ export default struct FuncBtnGroup {
this.btnListDialing = this.mClone.clone(this.mBtnGroupConfig.btnGroupList);
this.btnListDialing[1].isDisable = true
this.btnListDialing[2].isDisable = true
HiLog.i(TAG, "get btnListCall");
}
/**
@ -98,7 +96,7 @@ export default struct FuncBtnGroup {
* @param {Object} callData - call data
*/
onCallStateChange(newVal) {
HiLog.i(TAG, "Calling status changed : %s" + JSON.stringify(newVal));
LogUtils.i(TAG, "Calling status changed newState : " + JSON.stringify(newVal));
const BtnName= ['video', 'record', 'add', 'contact']
if (newVal === CallStateConst.CALL_STATUS_ACTIVE || newVal === CallStateConst.CALL_STATUS_HOLDING) {
this.btnList.forEach((item) => {
@ -114,7 +112,7 @@ export default struct FuncBtnGroup {
} else {
this.btnList.forEach((item) => {
if (item.type === 'contact') {
item.isDisable = true;
item.isDisable = false;
}
});
}
@ -126,7 +124,7 @@ export default struct FuncBtnGroup {
* @param {Object} obj - object
*/
btnClick(obj) {
HiLog.i(TAG, "btnClick get icon type : %s" + JSON.stringify(obj));
LogUtils.i(TAG, "btnClick get icon type : " + JSON.stringify(obj));
const BtnName= ['record', 'video', 'mute']
const type = obj.type;
const { callId } = this.callData;
@ -156,14 +154,12 @@ export default struct FuncBtnGroup {
this.mCallServiceProxy.switchCall(callId);
break;
case 'add':
FA.startAbility({
want: {
globalThis.calluiAbilityContext.startAbility({
bundleName: 'com.ohos.contacts',
abilityName: 'com.ohos.contacts.MainAbility',
parameters: {
pageFlag : 'page_flag_dialer'
}
}
});
break;
case 'video':
@ -172,14 +168,12 @@ export default struct FuncBtnGroup {
this.muteHandle('mute');
break;
case 'contact':
FA.startAbility({
want: {
globalThis.calluiAbilityContext.startAbility({
bundleName: 'com.ohos.contacts',
abilityName: 'com.ohos.contacts.MainAbility',
parameters: {
pageFlag: "page_flag_choose_contacts"
}
}
});
break;
case 'merge':
@ -197,7 +191,7 @@ export default struct FuncBtnGroup {
*/
keepHandle(type) {
const awaitIsActive = this.btnList.find((v) => v.type === type).isActive;
HiLog.i(TAG, "keep handle");
LogUtils.i(TAG, "keep handle awaitIsActive : " + !awaitIsActive);
!awaitIsActive ? this.mCallServiceProxy.holdCall(this.callData.callId) : this.mCallServiceProxy.unHoldCall(this.callData.callId);
}
@ -208,7 +202,7 @@ export default struct FuncBtnGroup {
*/
muteHandle(type) {
const awaitIsActive = this.btnList.find((v) => v.type === type).isActive;
HiLog.i(TAG, "mute Handle");
LogUtils.i(TAG, "mute Handle awaitIsActive : " + awaitIsActive);
awaitIsActive ? this.mCallServiceProxy.setMuted() : this.mCallServiceProxy.cancelMuted();
}
@ -216,7 +210,7 @@ export default struct FuncBtnGroup {
* Clear timer
*/
onDestroy() {
HiLog.i(TAG, "onDestroy");
LogUtils.i(TAG, "onDestroy");
this.timer && clearInterval(this.timer);
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import HiLog from '../utils/Hilog';
import LogUtils from '../utils/LogUtils';
const TAG = 'InComDialog';
@ -54,7 +54,7 @@ export default struct InComDialog {
.onClick(() => {
this.controller.close();
this.confirm(item)
HiLog.i(TAG, "onClick and confirm");
LogUtils.i(TAG, "onClick and confirm");
})
if (item.id !== 4) {
@ -73,7 +73,7 @@ export default struct InComDialog {
}
.margin({ top: 8, bottom: 16 })
.onClick(() => {
HiLog.i(TAG, "onClick");
LogUtils.i(TAG, "onClick");
this.controller.close();
})
}

View File

@ -21,7 +21,7 @@ import CallServiceProxy from '../../model/CallServiceProxy';
import sms from '@ohos.telephony.sms';
import resourceManager from '@ohos.resourceManager';
import prompt from '@system.prompt';
import HiLog from '../utils/Hilog';
import LogUtils from '../utils/LogUtils';
const TAG = "IncomingCom";
const SMS_REJECTION = `${ImagePathConst.BASE_URL}ic_public_message.svg`;
@ -51,10 +51,10 @@ const SEND_SMS_FAILURE_SERVICE_UNAVAILABLE = 3;
export default struct IncomingCom {
@State SendResult: any = {};
@Link callData: any;
private btnList= [];
private btnList = [];
private msgList = [];
private remindList= [];
mCallServiceProxy: CallServiceProxy= null;
private remindList = [];
mCallServiceProxy: CallServiceProxy = null;
msgDialogController: CustomDialogController = new CustomDialogController
({
builder: InComDialog({
@ -74,7 +74,7 @@ export default struct IncomingCom {
alignment: (globalThis.deviceTypeInfo === "phone" || globalThis.deviceTypeInfo === "default") ? DialogAlignment.Bottom : DialogAlignment.Default
});
private aboutToAppear(): void {
aboutToAppear() {
this.mCallServiceProxy = CallServiceProxy.getInstance();
this.getMsgList();
this.getBtnList();
@ -92,7 +92,7 @@ export default struct IncomingCom {
resourceManager.getResourceManager().then(result => {
result.getString(obj.msg.id, (err, typeName) => {
content = typeName
HiLog.i(TAG, "sendMessage resourceManager.getResourceManager :");
LogUtils.i(TAG, "sendMessage resourceManager.getResourceManager :");
return new Promise(function (resolve, reject) {
sms.sendMessage({
slotId: slotId,
@ -164,14 +164,14 @@ export default struct IncomingCom {
if (this.SendResult) {
resourceManager.getResourceManager().then(result => {
result.getString($r("app.string.SMS_Sent")
.id, (err, typeName) => {
.id, (err, typeName) => {
Content = typeName
prompt.showToast({
message: this.callData.contactName ? Content + `${this.callData.contactName}` : Content + `${this.callData.accountNumber}`,
duration: 2000,
});
this.mCallServiceProxy.rejectCall(this.callData.callId, obj.msg);
HiLog.i(TAG, "msgItemClick :");
LogUtils.i(TAG, "msgItemClick :");
})
})
} else {
@ -194,10 +194,10 @@ export default struct IncomingCom {
const {callId, callState} = this.callData;
if (callState !== CallStateConst.CALL_STATUS_WAITING) {
this.mCallServiceProxy.rejectCall(callId);
HiLog.i(TAG, "onReject this.mCallServiceProxy.rejectCall :");
LogUtils.i(TAG, "onReject this.mCallServiceProxy.rejectCall :");
} else {
this.mCallServiceProxy.hangUpCall(callId);
HiLog.i(TAG, "onReject this.mCallServiceProxy.hangUpCall :");
LogUtils.i(TAG, "onReject this.mCallServiceProxy.hangUpCall :");
}
}
@ -205,7 +205,7 @@ export default struct IncomingCom {
* Enable the SMS reply pop-up
*/
private btnClick(type) {
HiLog.i(TAG, "btnClick : %s" + JSON.stringify(type));
LogUtils.i(TAG, "btnClick : %s" + JSON.stringify(type));
if (type === 'msg') {
this.msgDialogController.open();
}
@ -215,7 +215,7 @@ export default struct IncomingCom {
* Answer the phone interface
*/
private onAnswer() {
HiLog.i(TAG, "onAnswer :");
LogUtils.i(TAG, "onAnswer :");
this.mCallServiceProxy.acceptCall(this.callData.callId);
}

View File

@ -20,7 +20,7 @@
import CallStateConst from '../constant/CallStateConst';
import CallServiceProxy from '../../model/CallServiceProxy';
import app from '@system.app';
import HiLog from '../utils/Hilog';
import LogUtils from '../utils/LogUtils';
const TAG = "CallList";
const font_color = "rgba(255, 255, 255, 0.60)";
@ -36,7 +36,7 @@ export default struct callList {
private mCallServiceProxy: CallServiceProxy;
public aboutToAppear(): void {
HiLog.i(TAG, "aboutToAppear");
LogUtils.i(TAG, "aboutToAppear");
this.mCallStateConst = new CallStateConst();
this.mCallServiceProxy = CallServiceProxy.getInstance();
}
@ -88,7 +88,9 @@ export default struct callList {
public onHangUp(callId) {
this.mCallServiceProxy.hangUpCall(callId);
if (this.callList.length === 1) {
app.terminate();
globalThis.calluiAbilityContext.terminateSelf().then((data) => {
LogUtils.i(TAG, "onHangUp terminateSelfCallBack");
});
}
}

View File

@ -36,7 +36,7 @@ const deepType = [mapType, setType, arrayType, objectType, argsType];
export default class Getclone {
private static getclone: Getclone = new Getclone();
public static getInstance(): Getclone{
public static getInstance(): Getclone {
return this.getclone;
}

View File

@ -24,36 +24,29 @@
* 5. the function execute many times can not print.
* 6. uniqueness.
*/
export default class HiLog {
private static readonly IS_DEBUG_ON: boolean = false;
private static readonly CALLUI: string = "callui";
private static readonly SLASH: string = "/";
private static readonly COLON: string = ": ";
constructor() {
}
private static prefix(tag: string) {
return this.CALLUI + this.SLASH + tag + this.COLON;
}
static d(tag: string, msg: string, ...args: any[]) {
if (this.IS_DEBUG_ON) {
console.info(this.prefix(tag) + msg, args);
} else {
console.debug(this.prefix(tag) + msg, args);
/**
* log package tool class
*/
export class LogUtils {
d(TAG, msg): void {
console.debug("[callui:]" + TAG + ":" + msg);
}
}
static i(tag: string, msg: string, ...args: any[]) {
console.info(this.prefix(tag) + msg, args);
}
i(TAG, msg): void {
console.info("[callui:]" + TAG + ":" + msg);
}
static w(tag: string, msg: string, ...args: any[]) {
console.warn(this.prefix(tag) + msg, args);
}
w(TAG, msg): void {
console.warn("[callui:]" + TAG + ":" + msg);
}
static e(tag: string, msg: string, ...args: any[]) {
console.error(this.prefix(tag) + msg, args);
}
e(TAG, msg): void {
console.error("[callui:]" + TAG + ":" + msg);
}
}
let mLogUtil = new LogUtils();
export default mLogUtil as LogUtils;

View File

@ -18,9 +18,8 @@
*/
import CallStateManager from './CallStateManager';
import CallStateConst from '../common/constant/CallStateConst';
import app from '@system.app';
import NotificationManager from '../model/NotificationManager';
import HiLog from '../common/utils/Hilog';
import LogUtils from '../common/utils/LogUtils';
const TAG = "CallDataManager";
@ -28,7 +27,7 @@ const TAG = "CallDataManager";
* class CallDataManager
*/
export default class CallDataManager {
callData: any= {};
callData: any = {};
callList: any = [];
callTimeList: any = [];
private callStateChange: any;
@ -47,17 +46,22 @@ export default class CallDataManager {
/**
* update callList and callData callTimeList
*`
*
* @param { object } callData
*/
public update(callData) {
const { callState, callId } = callData;
const targetObj = this.callList.find((v) => v.callId === callId);
HiLog.i(TAG, "update :")
LogUtils.i(TAG, "update :")
if (targetObj) {
const { oldCallState } = targetObj;
Object.assign(targetObj, {
...callData
});
if (oldCallState != callState) {
AppStorage.Get<NotificationManager>('notificationManager').sendCapsuleNotification(callData, globalThis.appInactiveState);
}
} else {
this.addCallList({
...callData
@ -80,7 +84,10 @@ export default class CallDataManager {
if (this.callList.length === 1) {
this.NotificationManager.cancelNotification();
AppStorage.Get<NotificationManager>('notificationManager').sendCapsuleNotification(callData, true);
app.terminate();
AppStorage.Delete("CallTimeList");
globalThis.calluiAbilityContext.terminateSelf().then((data) => {
LogUtils.i(TAG, "calluiAbility terminateSelf");
});
} else {
this.removeCallById(callId);
const activeCallData = this.callList.find((v) => v.callState === CallStateConst.CALL_STATUS_ACTIVE);
@ -124,7 +131,7 @@ export default class CallDataManager {
*/
updateCallTimeList(callData) {
const CallTimeObj = this.callTimeList.find((v) => v.callId === callData.callId);
HiLog.i(TAG, "updateCallTimeList : %s" + JSON.stringify(CallTimeObj))
LogUtils.i(TAG, "updateCallTimeList : " + JSON.stringify(CallTimeObj))
if (!CallTimeObj && callData.callState === CallStateConst.CALL_STATUS_ACTIVE) {
const obj = {
callId: callData.callId,
@ -134,7 +141,7 @@ export default class CallDataManager {
};
this.callTimeList.push(obj);
AppStorage.SetOrCreate("CallTimeList", this.callTimeList)
HiLog.i(TAG, "updateCallTimeList : %s" + JSON.stringify(this.callTimeList))
LogUtils.i(TAG, "updateCallTimeList : " + JSON.stringify(this.callTimeList))
}
}
}

View File

@ -19,10 +19,9 @@
import CallDataManager from './CallDataManager';
import Utils from '../common/utils/utils';
import commonEvent from '@ohos.commonEvent';
import featureAbility from '@ohos.ability.featureAbility';
import CallServiceProxy from './CallServiceProxy';
import ContactManager from './ContactManager';
import HiLog from '../common/utils/Hilog';
import LogUtils from '../common/utils/LogUtils'
import call from '@ohos.telephony.call';
import CallStateConst from '../common/constant/CallStateConst';
@ -66,20 +65,15 @@ export default class CallManager {
* init CallData
*/
private initCallData() {
featureAbility.getWant().then((want) => {
if (want && want.parameters && ('callState' in want.parameters)) {
this.update(want.parameters);
HiLog.i(TAG, "initCallData featureAbility.getWant :")
} else {
this.mCallServiceProxy.publish({
key: 'getInitCallData',
params: []
});
}
})
.catch((error) => {
HiLog.i(TAG, "initCallData catch error : %s" + JSON.stringify(error))
if (globalThis.abilityWant && globalThis.abilityWant.parameters && ('callState' in globalThis.abilityWant.parameters)) {
this.update(globalThis.abilityWant.parameters);
LogUtils.i(TAG, "initCallData featureAbility.getWant :")
} else {
this.mCallServiceProxy.publish({
key: 'getInitCallData',
params: []
});
}
}
/*
@ -99,13 +93,13 @@ export default class CallManager {
commonEvent.subscribe(subscriber, (err, res) => {
if (err.code === 0) {
const callData = JSON.parse(res.data);
HiLog.i(TAG, "commonEvent subscribe : %s" + JSON.stringify(subscriber))
LogUtils.i(TAG, "commonEvent subscribe : %s" + JSON.stringify(subscriber))
if (callData) {
this.callData = callData
this.update(callData);
}
} else {
HiLog.i(TAG, "commonEvent.subscribe err : %s" + JSON.stringify(err))
LogUtils.i(TAG, "commonEvent.subscribe err : %s" + JSON.stringify(err))
}
});
}
@ -116,7 +110,7 @@ export default class CallManager {
private unsubscribe() {
commonEvent.unsubscribe(subscriber, (err) => {
if (err.code !== 0) {
HiLog.i(TAG, "commonEvent.unsubscribe err: %s" + JSON.stringify(err))
LogUtils.i(TAG, "commonEvent.unsubscribe err: %s" + JSON.stringify(err))
}
});
}
@ -137,7 +131,7 @@ export default class CallManager {
}
});
this.isEmergencyPhoneNumber(callData.accountNumber)
HiLog.i(TAG, "update :")
LogUtils.i(TAG, "update :")
}
/**
@ -148,13 +142,15 @@ export default class CallManager {
* @return { boolean } - return success true fail false
*/
private isEmergencyPhoneNumber = (phoneNumber) => new Promise((resolve, reject) => {
call.isEmergencyPhoneNumber(phoneNumber, {slotId: 0}).then((res) => {
call.isEmergencyPhoneNumber(phoneNumber, {
slotId: 0
}).then((res) => {
resolve(res);
AppStorage.SetOrCreate("IsEmergencyPhoneNumber", res)
HiLog.i(TAG, "then:isEmergencyPhoneNumber : %s" + JSON.stringify(res))
LogUtils.i(TAG, "then:isEmergencyPhoneNumber : %s" + JSON.stringify(res))
}).catch((err) => {
reject(err);
HiLog.i(TAG, "catch:isEmergencyPhoneNumber : %s" + JSON.stringify(err))
LogUtils.i(TAG, "catch:isEmergencyPhoneNumber : %s" + JSON.stringify(err))
});
});

View File

@ -26,7 +26,7 @@
import commonEvent from '@ohos.commonEvent';
import call from '@ohos.telephony.call';
import app from '@system.app';
import HiLog from '../common/utils/Hilog';
import LogUtils from '../common/utils/LogUtils';
const TAG = "CallServiceProxy";
const prefixLog = 'callUI app:@ohos.telephony.call:';
@ -46,7 +46,7 @@ export default class CallServiceProxy {
* Make a phone call
*/
public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) {
HiLog.i(TAG, "dialCall phoneNumber :")
LogUtils.i(TAG, "dialCall phoneNumber :")
return call.dial(phoneNumber, {
accountId,
videoState,
@ -68,9 +68,9 @@ export default class CallServiceProxy {
*/
public acceptCall = function (callId) {
call.answer(callId).then((res) => {
HiLog.i(TAG, prefixLog + "call.answer : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "call.answer : %s" + JSON.stringify(callId))
}).catch((err) => {
HiLog.i(TAG, prefixLog + "call.answer catch : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "call.answer catch : %s" + JSON.stringify(err))
});
};
@ -86,10 +86,10 @@ export default class CallServiceProxy {
public rejectCall = function (callId, isSendSms = false, msg = '') {
const rejectCallPromise = isSendSms ? call.reject(callId, {messageContent: msg}) : call.reject(callId);
rejectCallPromise.then((res) => {
HiLog.i(TAG,prefixLog + "then:rejectCall")
LogUtils.i(TAG,prefixLog + "then:rejectCall")
})
.catch((err) => {
HiLog.i(TAG, prefixLog + "catch:rejectCall : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:rejectCall : %s" + JSON.stringify(err))
});
};
@ -103,10 +103,10 @@ export default class CallServiceProxy {
public hangUpCall = (callId) => new Promise((resolve, reject) => {
call.hangup(callId).then((res) => {
resolve(res);
HiLog.i(TAG, prefixLog + "then:hangUpCall : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "then:hangUpCall : %s" + JSON.stringify(callId))
}).catch((err) => {
reject(err);
HiLog.i(TAG, prefixLog + "catch:hangUpCall : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:hangUpCall : %s" + JSON.stringify(err))
});
});
@ -120,11 +120,11 @@ export default class CallServiceProxy {
public holdCall = (callId) => new Promise((resolve, reject) => {
call.holdCall(callId).then((res) => {
resolve(res);
HiLog.i(TAG, prefixLog + "then:holdCall : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "then:holdCall : %s" + JSON.stringify(callId))
})
.catch((err) => {
reject(err);
HiLog.i(TAG, prefixLog + "catch:holdCall : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:holdCall : %s" + JSON.stringify(err))
});
});
@ -138,11 +138,11 @@ export default class CallServiceProxy {
public unHoldCall = (callId) => new Promise((resolve, reject) => {
call.unHoldCall(callId).then((res) => {
resolve(res);
HiLog.i(TAG, prefixLog + "then:unholdCall : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "then:unholdCall : %s" + JSON.stringify(callId))
})
.catch((err) => {
reject(err);
HiLog.i(TAG, prefixLog + "catch:unHoldCall : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:unHoldCall : %s" + JSON.stringify(err))
});
});
@ -156,11 +156,11 @@ export default class CallServiceProxy {
*/
public setAudioDevice = (device = 1) => new Promise((resolve, reject) => {
call.setAudioDevice(device).then((res) => {
HiLog.i(TAG, prefixLog + "then:setAudioDevice : %s" + JSON.stringify(device))
LogUtils.i(TAG, prefixLog + "then:setAudioDevice : %s" + JSON.stringify(device))
resolve(res);
}).catch((err) => {
reject(err);
HiLog.i(TAG, prefixLog + "catch:setAudioDevice : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:setAudioDevice : %s" + JSON.stringify(err))
});
});
@ -169,9 +169,9 @@ export default class CallServiceProxy {
*/
public setMuted() {
call.setMuted().then((res) => {
HiLog.i(TAG, prefixLog + "then:setMute")
LogUtils.i(TAG, prefixLog + "then:setMute")
}).catch((err) => {
HiLog.i(TAG,prefixLog + "catch:setMute : %s" + JSON.stringify(err))
LogUtils.i(TAG,prefixLog + "catch:setMute : %s" + JSON.stringify(err))
});
};
@ -180,9 +180,9 @@ export default class CallServiceProxy {
*/
public cancelMuted() {
call.cancelMuted().then((res) => {
HiLog.i(TAG,prefixLog + "then:cancelMuted")
LogUtils.i(TAG,prefixLog + "then:cancelMuted")
}).catch((err) => {
HiLog.i(TAG, prefixLog + "catch:cancelMuted : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:cancelMuted : %s" + JSON.stringify(err))
});
};
@ -196,11 +196,11 @@ export default class CallServiceProxy {
public switchCall = (callId) => new Promise((resolve, reject) => {
call.switchCall(callId).then((res) => {
resolve(res);
HiLog.i(TAG, prefixLog + "then:switchCall : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "then:switchCall : %s" + JSON.stringify(callId))
})
.catch((err) => {
reject(err);
HiLog.i(TAG, prefixLog + "catch:switchCall : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:switchCall : %s" + JSON.stringify(err))
});
});
@ -212,10 +212,10 @@ export default class CallServiceProxy {
public registerCallStateCallback(callBack) {
call.on('callDetailsChange', (data) => {
if (!data) {
HiLog.i(TAG, prefixLog + "call.on registerCallStateCallback")
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback")
return;
}
HiLog.i(TAG, prefixLog + "call.on registerCallStateCallback callState")
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback callState")
callBack(data);
});
}
@ -226,10 +226,10 @@ export default class CallServiceProxy {
public unRegisterCallStateCallback() {
call.off('callDetailsChange', (data) => {
if (!data) {
HiLog.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
return;
}
HiLog.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
});
}
@ -239,9 +239,9 @@ export default class CallServiceProxy {
public registerCallEventCallback() {
call.on('callEventChange', (data) => {
if (!data) {
HiLog.i(TAG, prefixLog + "call.on callEventChange")
LogUtils.i(TAG, prefixLog + "call.on callEventChange")
} else {
HiLog.i(TAG, prefixLog + "call.on callEventChange")
LogUtils.i(TAG, prefixLog + "call.on callEventChange")
}
});
}
@ -252,9 +252,9 @@ export default class CallServiceProxy {
public unRegisterCallEventCallback() {
call.off('callEventChange', (data) => {
if (!data) {
HiLog.i(TAG,prefixLog + "call.off unRegisterCallEventCallback : %s")
LogUtils.i(TAG,prefixLog + "call.off unRegisterCallEventCallback : %s")
} else {
HiLog.i(TAG,prefixLog + "call.off unRegisterCallEventCallback : %s")
LogUtils.i(TAG,prefixLog + "call.off unRegisterCallEventCallback : %s")
}
});
}
@ -268,9 +268,9 @@ export default class CallServiceProxy {
*/
public startDTMF = (callId, str) => {
call.startDTMF(callId, str).then((res) => {
HiLog.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) => {
HiLog.i(TAG, prefixLog + "catch:startDtmf : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:startDtmf : %s" + JSON.stringify(err))
});
};
@ -281,9 +281,9 @@ export default class CallServiceProxy {
*/
public stopDTMF = (callId) => {
call.stopDTMF(callId).then((res) => {
HiLog.i(TAG, prefixLog + "then:stopDtmf : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "then:stopDtmf : %s" + JSON.stringify(callId))
}).catch((err) => {
HiLog.i(TAG, prefixLog + "then:startDtmf : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "then:startDtmf : %s" + JSON.stringify(err))
});
};
@ -294,22 +294,22 @@ export default class CallServiceProxy {
*/
public combineConference = (callId) => {
call.combineConference(callId).then((res) => {
HiLog.i(TAG, prefixLog + "then:combineConference : %s" + JSON.stringify(callId))
LogUtils.i(TAG, prefixLog + "then:combineConference : %s" + JSON.stringify(callId))
}).catch((err) => {
HiLog.i(TAG, prefixLog + "catch:combineConference : %s" + JSON.stringify(err))
LogUtils.i(TAG, prefixLog + "catch:combineConference : %s" + JSON.stringify(err))
});
};
public publish(data) {
HiLog.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,
data: JSON.stringify(data)
}, (res) => {
HiLog.i(TAG, prefixLog + "callui.event.callEvent success")
LogUtils.i(TAG, prefixLog + "callui.event.callEvent success")
});
HiLog.i(TAG, prefixLog + "callui.event.callEvent publish end")
LogUtils.i(TAG, prefixLog + "callui.event.callEvent publish end")
}
}

View File

@ -33,7 +33,7 @@ export default class CallStateManager {
*
* @param { Object } data - callData
*/
public static getInstance():CallStateManager{
public static getInstance(): CallStateManager {
return CallStateManager.sCallStateManager;
}

View File

@ -0,0 +1,55 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file: Contact management
*/
import featureAbility from '@ohos.ability.featureAbility';
import dataAbility from '@ohos.data.dataAbility';
import LogUtils from '../common/utils/LogUtils';
const TAG = "ContactManager";
const DBbaseUri = 'dataability:///com.ohos.contactsdataability';
const DBUri = DBbaseUri + '/contacts/contact_data';
/**
* class ContactManager
*/
export default class ContactManager {
/**
* get contact info
*
* @param { Object } callData -Object
*/
async getContactInfo(callData) {
try {
const columns = ['id', 'display_name', 'detail_info'];
const predicates = new dataAbility.DataAbilityPredicates();
predicates.equalTo('detail_info', callData.accountNumber);
predicates.equalTo('is_deleted', 0);
const dataAbilityHelper = await featureAbility.acquireDataAbilityHelper(globalThis.calluiAbilityContext, DBbaseUri);
const resSet = await dataAbilityHelper.query(DBUri, columns, predicates);
LogUtils.i(TAG, "getContactInfo resSet : " + JSON.stringify(resSet))
if (resSet.rowCount > 0) {
resSet.goToFirstRow();
callData.contactName = resSet.getString(resSet.getColumnIndex('display_name'));
LogUtils.i(TAG, "getContactInfo callData.contactName:" + callData.contactName);
}
} catch (err) {
LogUtils.i(TAG, "getContactInfo catch err : %s" + JSON.stringify(err))
}
}
}

View File

@ -21,7 +21,7 @@ import wantAgent from '@ohos.wantAgent';
import notification from '@ohos.notification';
import commonEvent from '@ohos.commonEvent';
import callStateConst from '../common/constant/CallStateConst';
import HiLog from '../common/utils/Hilog';
import LogUtils from '../common/utils/LogUtils';
import resourceManager from '@ohos.resourceManager';
const TAG = "NotificationManager";
@ -79,28 +79,29 @@ export default class NotificationManager {
callId, btnType: key
};
const wantAgentObj = await this.getWantAgent(data, SEND_COMMON_EVENT);
resourceManager.getResourceManager((error, mgr) => {
globalThis.calluiAbilityContext.resourceManager.getString(textMap[key].id, (error, value) => {
if (error != null) {
return;
LogUtils.i(TAG, "sendNotification getResourceManager getString err")
} else {
LogUtils.i(TAG, "sendNotification getResourceManager getString value" + value)
notificationRequest.actionButtons.push({
title: value,
wantAgent: wantAgentObj
});
Object.assign(notificationRequest.content.longText, {
title: text,
expandedTitle: text
});
notification.publish(notificationRequest).then((data) => {
LogUtils.i(TAG, "sendNotification publish success")
}).catch((err) => {
LogUtils.i(TAG, "sendNotification public err" + JSON.stringify(err))
});
}
mgr.getString(textMap[key].id, (error, value) => {
if (error != null) {
} else {
notificationRequest.actionButtons.push({
title: value,
wantAgent: wantAgentObj
});
Object.assign(notificationRequest.content.longText, {
title: text,
expandedTitle: text
});
notification.publish(notificationRequest);
}
});
});
}
}
HiLog.i(TAG, "sendNotification end :")
LogUtils.i(TAG, "sendNotification end :")
}
/**
@ -108,22 +109,22 @@ export default class NotificationManager {
* @param callState
*/
getMapObj(callState) {
if (callState===callStateConst.CALL_STATUS_INCOMING) {
if (callState === callStateConst.CALL_STATUS_INCOMING) {
return ['answer', 'reject']
}
if (callState===callStateConst.CALL_STATUS_ACTIVE) {
if (callState === callStateConst.CALL_STATUS_ACTIVE) {
return ['hangUp']
}
if (callState===callStateConst.CALL_STATUS_HOLDING) {
if (callState === callStateConst.CALL_STATUS_HOLDING) {
return ['hangUp']
}
if (callState===callStateConst.CALL_STATUS_ALERTING) {
if (callState === callStateConst.CALL_STATUS_ALERTING) {
return ['hangUp']
}
if (callState===callStateConst.CALL_STATUS_DIALING) {
if (callState === callStateConst.CALL_STATUS_DIALING) {
return ['hangUp']
}
if (callState===callStateConst.CALL_STATUS_WAITING) {
if (callState === callStateConst.CALL_STATUS_WAITING) {
return ['answer', 'reject']
}
}
@ -157,11 +158,11 @@ export default class NotificationManager {
* Cancel notice
*/
cancelNotification() {
HiLog.i(TAG, "cancelNotification")
LogUtils.i(TAG, "cancelNotification")
notification.cancel(ID).then((res) => {
HiLog.i(TAG, "notify.cancel res data : %s" + JSON.stringify(res))
LogUtils.i(TAG, "notify.cancel res data : %s" + JSON.stringify(res))
}).catch((err) => {
HiLog.i(TAG, "notify.cancel err data : %s" + JSON.stringify(err))
LogUtils.i(TAG, "notify.cancel err data : %s" + JSON.stringify(err))
});
}
@ -173,22 +174,28 @@ export default class NotificationManager {
* @param {boolean} isBackground - is background
*/
sendCapsuleNotification(callData, isBackground) {
HiLog.i(TAG, "sendCapsuleNotification isBackground : %s" + JSON.stringify(isBackground))
LogUtils.i(TAG, "sendCapsuleNotification isBackground : " + JSON.stringify(isBackground))
callData.startTime = (callData.startTime)
HiLog.i(TAG, "sendCapsuleNotification callData.startTime :")
LogUtils.i(TAG, "sendCapsuleNotification callData.startTime :")
const {callState, startTime} = callData;
commonEvent.publish('CAPSULE_EVENT_CALL_UI', {
bundleName: 'com.ohos.callui',
let commonEventPublishData = {
bundleName: 'com.ohos.systemui',
isOrdered: false,
data: JSON.stringify({
callState,
startTime: startTime*1000,
startTime: startTime * 1000,
isBackground,
wantBundleName: CALL_BUNDLE_NAME,
wantAbilityName: CALL_ABILITY_NAME
})
}, (res) => {
HiLog.i(TAG, "callUI app commonEvent.publish CAPSULE_EVENT_CALL_UI callback res : %s" + JSON.stringify(res))
});
}
commonEvent.publish('CAPSULE_EVENT_CALL_UI', commonEventPublishData, (err, data) => {
if (err) {
LogUtils.i(TAG, "sendCapsuleNotification publish launcher err:" + JSON.stringify(err))
} else {
LogUtils.i(TAG, "sendCapsuleNotification publish launcher success:" + JSON.stringify(data))
}
})
}
}

View File

@ -1,189 +1,164 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file: Main interface
*/
import ContactCard from '../common/components/ContactCard';
import FuncBtnGroup from '../common/components/FuncBtnGroup';
import Keyboard from '../common/components/Keyboard';
import BottomBtn from '../common/components/BottomBtn';
import IncomingCom from '../common/components/IncomingCom';
import CallStateConst from '../common/constant/CallStateConst';
import NotificationManager from '../model/NotificationManager';
import call from '@ohos.telephony.call';
import CallManager from '../model/CallManager';
import HiLog from '../common/utils/Hilog';
import bundle from '@ohos.bundle';
import abilityAccessCtrl from "@ohos.abilityAccessCtrl";
import featureAbility from "@ohos.ability.featureAbility"
import byTrace from "@ohos.bytrace"
const TAG = "Index";
const prefixLog = 'callUI app:@ohos.telephony.call:';
const SIM_CARD_DELAYED_DISPLAY = 100;
const textMap =
{
'answer': $r('app.string.answer'),
'reject': $r('app.string.reject'),
'hangUp': $r('app.string.hangUp'),
'mute': $r('app.string.mute'),
'callHold': $r('app.string.callHold'),
};
/**
* @file: Main interface
*/
@Entry
@Component
export default struct Index {
@StorageLink("InputNum") inputNum: any = [];
@State callData: any = CallStateConst.defaultCallData;
@State isShowKeyboard: boolean = false;
private appInactiveState = false
@State callList: Array<any> = [];
private consoleTxt: '';
private callStateConst;
private notificationManager: NotificationManager;
/**
* Call status
*
* @return {number} - callState
*/
private callState() {
return this.callData.callState;
}
/**
* method to control the display of DTMF keyboard
*
* parent component pass by value child component
*/
public showKeyboard() {
this.isShowKeyboard = !this.isShowKeyboard;
}
/**
* Dialing function
*/
public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) {
HiLog.i(TAG, "dialCall phoneNumber :")
call.dial(phoneNumber, {
accountId,
videoState,
dialScene
});
}
aboutToAppear(): void {
HiLog.i(TAG, "aboutToAppear :")
byTrace.startTrace('aboutToAppear', 0);
this.callStateConst = new CallStateConst();
this.notificationManager = new NotificationManager();
globalThis.callManager = new CallManager(this)
AppStorage.SetOrCreate<NotificationManager>('notificationManager', this.notificationManager);
let delayMethod = setTimeout(() => {
clearTimeout(delayMethod);
}, SIM_CARD_DELAYED_DISPLAY);
byTrace.finishTrace('aboutToAppear', 0);
}
onPageShow() {
HiLog.i(TAG, "onPageShow : ")
byTrace.startTrace('onPageShow', 1);
this.appInactiveState = false;
this.notificationManager.cancelNotification();
this.notificationManager.sendCapsuleNotification(this.callData, false);
byTrace.finishTrace('onPageShow', 1);
HiLog.i(TAG, "onPageShow end : ")
}
onPageHide() {
HiLog.i(TAG, "onPageHide :")
this.appInactiveState = true;
const {callState, accountNumber, contactName, callId} = this.callData;
let fool = (callState !== CallStateConst.callStateObj.CALL_STATUS_DISCONNECTED && callId)
if (callState !== CallStateConst.callStateObj.CALL_STATUS_DISCONNECTED && callId) {
let text = contactName + ' ' + accountNumber + ' ';
if (!contactName) {
text = accountNumber + ' ' ;
}
this.notificationManager.sendNotification(text, this.callData);
this.notificationManager.sendCapsuleNotification(this.callData, true);
HiLog.i(TAG, "onPageHide end : ")
}
}
build() {
Column() {
Stack() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column() {
ContactCard({
callData: $callData,
isShowKeyboard: this.isShowKeyboard,
callList: $callList
})
}
.margin({ top: 56 })
if (this.callState() !== CallStateConst.callStateObj.CALL_STATUS_WAITING
&& this.callState() !== CallStateConst.callStateObj.CALL_STATUS_INCOMING) {
Column() {
Column() {
Column() {
FuncBtnGroup({ callData: $callData, callList: $callList })
}
.margin({ bottom: 29.5 })
}
.visibility(!this.isShowKeyboard ? Visibility.Visible : Visibility.None)
Column() {
Column() {
Keyboard({ callData: $callData })
}
.margin({ bottom: 32 })
}
.visibility(this.isShowKeyboard ? Visibility.Visible : Visibility.None)
Column() {
BottomBtn({
callData: $callData,
onItemClick: () => {
this.showKeyboard()
}
})
}
}
.margin({ bottom: 106 })
} else {
Column() {
IncomingCom({
callData: $callData,
})
}
.margin({ bottom: 106 })
}
}
}
}
.width("100%")
.height("100%")
.backgroundImage('assets/picture/wallpaper.png', ImageRepeat.NoRepeat)
.backgroundImageSize(ImageSize.Cover)
}
}
import ContactCard from '../common/components/ContactCard';
import FuncBtnGroup from '../common/components/FuncBtnGroup';
import BottomBtn from '../common/components/BottomBtn';
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 NotificationManager from '../model/NotificationManager';
import call from '@ohos.telephony.call';
import CallManager from '../model/CallManager';
import notification from '@ohos.notification';
const TAG = "MainAbility Index";
const SIM_CARD_DELAYED_DISPLAY = 100;
/**
* @file: Main interface
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
@StorageLink("InputNum") inputNum: any = [];
@State callData: any = CallStateConst.defaultCallData;
@State isShowKeyboard: boolean = false;
@State callList: Array<any> = [];
private consoleTxt: '';
private callStateConst;
private notificationManager: NotificationManager;
aboutToAppear(): void {
LogUtils.i(TAG, "aboutToAppear :")
byTrace.startTrace('aboutToAppear', 0);
this.callStateConst = new CallStateConst();
this.notificationManager = new NotificationManager();
globalThis.callManager = new CallManager(this)
AppStorage.SetOrCreate<NotificationManager>('notificationManager', this.notificationManager);
let delayMethod = setTimeout(() => {
clearTimeout(delayMethod);
}, SIM_CARD_DELAYED_DISPLAY);
byTrace.finishTrace('aboutToAppear', 0);
}
onPageShow() {
LogUtils.i(TAG, "onPageShow : ")
byTrace.startTrace('onPageShow', 1);
globalThis.appInactiveState = false;
this.notificationManager.cancelNotification();
this.notificationManager.sendCapsuleNotification(this.callData, false);
byTrace.finishTrace('onPageShow', 1);
LogUtils.i(TAG, "onPageShow end : ")
}
onPageHide() {
LogUtils.i(TAG, "onPageHide :")
globalThis.appInactiveState = true;
const {callState, accountNumber, contactName, callId} = this.callData;
let fool = (callState !== CallStateConst.callStateObj.CALL_STATUS_DISCONNECTED && callId)
if (callState !== CallStateConst.callStateObj.CALL_STATUS_DISCONNECTED && callId) {
let text = contactName + ' ' + accountNumber + ' ';
if (!contactName) {
text = accountNumber + ' ';
}
this.notificationManager.sendNotification(text, this.callData);
this.notificationManager.sendCapsuleNotification(this.callData, true);
LogUtils.i(TAG, "onPageHide end : ")
}
}
/**
* method to control the display of DTMF keyboard
*
* parent component pass by value child component
*/
public showKeyboard() {
this.isShowKeyboard = !this.isShowKeyboard;
}
/**
* Call status
*
* @return {number} - callState
*/
private callState() {
LogUtils.i(TAG, "callState : " + this.callData.callState)
return this.callData.callState;
}
/**
* Dialing function
*/
public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) {
LogUtils.i(TAG, "dialCall phoneNumber :")
call.dial(phoneNumber, {
accountId,
videoState,
dialScene
});
}
build() {
Column() {
Stack() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.SpaceBetween
}) {
Column() {
ContactCard({
callData: $callData,
isShowKeyboard: this.isShowKeyboard,
callList: $callList
})
}
.margin({ top: 56 })
if (this.callState() !== CallStateConst.callStateObj.CALL_STATUS_WAITING
&& this.callState() !== CallStateConst.callStateObj.CALL_STATUS_INCOMING) {
Column() {
Column() {
Column() {
FuncBtnGroup({ callData: $callData, callList: $callList })
}
.margin({ bottom: 29.5 })
}
.visibility(!this.isShowKeyboard ? Visibility.Visible : Visibility.None)
Column() {
Column() {
Keyboard({ callData: $callData })
}
.margin({ bottom: 32 })
}
.visibility(this.isShowKeyboard ? Visibility.Visible : Visibility.None)
Column() {
BottomBtn({
callData: $callData,
onItemClick: () => {
this.showKeyboard()
}
})
}
}
.margin({ bottom: 106 })
} else {
Column() {
IncomingCom({
callData: $callData,
})
}
.margin({ bottom: 106 })
}
}
}
}
.width("100%")
.height("100%")
.backgroundImage('assets/picture/wallpaper.png', ImageRepeat.NoRepeat)
.backgroundImageSize(ImageSize.Cover)
}
}

View File

@ -0,0 +1,67 @@
{
"module": {
"name": "com.ohos.callui",
"type": "entry",
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
"description": "$string:callui_description",
"mainElement": "com.ohos.callui.ServiceAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "com.ohos.callui.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:callui_description",
"icon": "$media:icon",
"label": "$string:callui_description",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:black",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "com.ohos.callui.ServiceAbility",
"icon": "$media:app_icon",
"description": "service",
"type": "service",
"visible": true,
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:callui_description"
}
],
"requestPermissions": [
{
"name": "ohos.permission.READ_CONTACTS"
},
{
"name": "ohos.permission.SEND_MESSAGES"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.SET_TELEPHONY_STATE"
},
{
"name": "ohos.permission.GET_TELEPHONY_STATE"
}
]
}
}

View File

@ -0,0 +1,12 @@
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
},
{
"name": "black",
"value": "#000000"
}
]
}

View File

@ -1,212 +1,208 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "通话"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
},
{
"name": "sms",
"value": "Message"
},
{
"name": "remind",
"value": "Reminder"
},
{
"name": "hangUpReply",
"value": "Respond with"
},
{
"name": "backLater",
"value": "I'll call you back."
},
{
"name": "answerThePhone",
"value": "Sorry, I can't talk right now."
},
{
"name": "contactMeLater",
"value": "I'm in a meeting. I'll get back to you ASAP."
},
{
"name": "beThereSoon",
"value": "I'm on my way."
},
{
"name": "customSMS",
"value": "Custom..."
},
{
"name": "cancel",
"value": "CANCEL"
},
{
"name": "callBackReminder",
"value": "Callback reminder"
},
{
"name": "minutes",
"value": "In 30 minutes"
},
{
"name": "oneHourLater",
"value": "In 1 hour"
},
{
"name": "twoHoursLater",
"value": "In 2 hours"
},
{
"name": "dialing",
"value": "Dialing"
},
{
"name": "calling",
"value": "calling"
},
{
"name": "callHold",
"value": "Call hold"
},
{
"name": "hangUpCompleted",
"value": "Hang up completed"
},
{
"name": "hangingUp",
"value": "Hanging up"
},
{
"name": "recording",
"value": "Record"
},
{
"name": "keep",
"value": "Hold"
},
{
"name": "addCall",
"value": "Add call"
},
{
"name": "videoCall",
"value": "Video call"
},
{
"name": "mute",
"value": "Mute"
},
{
"name": "contactPerson",
"value": "Contacts"
},
{
"name": "partyIsRinging",
"value": "Ringing"
},
{
"name": "saveNumber",
"value": "Save number"
},
{
"name": "addToBlacklist",
"value": "add to blacklist"
},
{
"name": "shutDown",
"value": "shut down"
},
{
"name": "speaker",
"value": "Speaker"
},
{
"name": "phoneHandset",
"value": "Handset earpiece"
},
{
"name": "mobileNetwork",
"value": "Unable to access the mobile network."
},
{
"name": "gotIt",
"value": "Got it"
},
{
"name": "currentCall",
"value": "Current cal"
},
{
"name": "hangUp",
"value": "hang up"
},
{
"name": "handsFree",
"value": "Hands-free"
},
{
"name": "incomingCall",
"value": "Incoming call"
},
{
"name": "reject",
"value": "DECLINE"
},
{
"name": "answer",
"value": "ANSWER"
},
{
"name": "maintain",
"value": "On hold"
},
{
"name": "exchange",
"value": "Swap"
},
{
"name": "mergeCall",
"value": "Merge calls"
},
{
"name": "manageUsers",
"value": "Manage users"
},
{
"name": "telephoneConference",
"value": "Conference"
},
{
"name": "unknownNumber",
"value": "Unknown number"
},
{
"name": "noCard",
"value": "Can't access mobile network"
},
{
"name": "telephone_Conference",
"value": "Conference"
},
{
"name": "message_Failed",
"value": "message failed to send"
},
{
"name": "SMS_Sent",
"value": "SMS sent to"
},
{
"name": "SMS_Authorization_Notification",
"value": "Go to settings for SMS Authorization"
},
{
"name": "emergency",
"value": "Emergency"
}
]
{
"string": [
{
"name": "callui_description",
"value": "Phone"
},
{
"name": "sms",
"value": "Message"
},
{
"name": "remind",
"value": "Reminder"
},
{
"name": "hangUpReply",
"value": "Respond with"
},
{
"name": "backLater",
"value": "I'll call you back."
},
{
"name": "answerThePhone",
"value": "Sorry, I can't talk right now."
},
{
"name": "contactMeLater",
"value": "I'm in a meeting. I'll get back to you ASAP."
},
{
"name": "beThereSoon",
"value": "I'm on my way."
},
{
"name": "customSMS",
"value": "Custom..."
},
{
"name": "cancel",
"value": "CANCEL"
},
{
"name": "callBackReminder",
"value": "Callback reminder"
},
{
"name": "minutes",
"value": "In 30 minutes"
},
{
"name": "oneHourLater",
"value": "In 1 hour"
},
{
"name": "twoHoursLater",
"value": "In 2 hours"
},
{
"name": "dialing",
"value": "Dialing"
},
{
"name": "calling",
"value": "calling"
},
{
"name": "callHold",
"value": "Call hold"
},
{
"name": "hangUpCompleted",
"value": "Hang up completed"
},
{
"name": "hangingUp",
"value": "Hanging up"
},
{
"name": "recording",
"value": "Record"
},
{
"name": "keep",
"value": "Hold"
},
{
"name": "addCall",
"value": "Add call"
},
{
"name": "videoCall",
"value": "Video call"
},
{
"name": "mute",
"value": "Mute"
},
{
"name": "contactPerson",
"value": "Contacts"
},
{
"name": "partyIsRinging",
"value": "Ringing"
},
{
"name": "saveNumber",
"value": "Save number"
},
{
"name": "addToBlacklist",
"value": "add to blacklist"
},
{
"name": "shutDown",
"value": "shut down"
},
{
"name": "speaker",
"value": "Speaker"
},
{
"name": "phoneHandset",
"value": "Handset earpiece"
},
{
"name": "mobileNetwork",
"value": "Unable to access the mobile network."
},
{
"name": "gotIt",
"value": "Got it"
},
{
"name": "currentCall",
"value": "Current cal"
},
{
"name": "hangUp",
"value": "hang up"
},
{
"name": "handsFree",
"value": "Hands-free"
},
{
"name": "incomingCall",
"value": "Incoming call"
},
{
"name": "reject",
"value": "DECLINE"
},
{
"name": "answer",
"value": "ANSWER"
},
{
"name": "maintain",
"value": "On hold"
},
{
"name": "exchange",
"value": "Swap"
},
{
"name": "mergeCall",
"value": "Merge calls"
},
{
"name": "manageUsers",
"value": "Manage users"
},
{
"name": "telephoneConference",
"value": "Conference"
},
{
"name": "unknownNumber",
"value": "Unknown number"
},
{
"name": "noCard",
"value": "Can't access mobile network"
},
{
"name": "telephone_Conference",
"value": "Conference"
},
{
"name": "message_Failed",
"value": "message failed to send"
},
{
"name": "SMS_Sent",
"value": "SMS sent to"
},
{
"name": "SMS_Authorization_Notification",
"value": "Go to settings for SMS Authorization"
},
{
"name": "emergency",
"value": "Emergency"
}
]
}

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 493 B

After

Width:  |  Height:  |  Size: 493 B

Some files were not shown because too many files have changed in this diff Show More