mirror of
https://gitee.com/openharmony/applications_call
synced 2024-11-23 06:19:44 +00:00
callui compile with the version
Signed-off-by: ohos-lsw <lishiwei6@huawei.com>
This commit is contained in:
parent
4015d0afdf
commit
87bea8beae
13
AppScope/app.json
Normal file
13
AppScope/app.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.callui",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true,
|
||||
"minAPIVersion": 9,
|
||||
"targetAPIVersion": 9
|
||||
}
|
||||
}
|
@ -21,6 +21,8 @@
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true
|
||||
},
|
||||
"distributedNotificationEnabled": true,
|
||||
"minAPIVersion": 9,
|
||||
"targetAPIVersion": 9
|
||||
}
|
||||
}
|
||||
|
67
BUILD.gn
Normal file
67
BUILD.gn
Normal file
@ -0,0 +1,67 @@
|
||||
# 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("//build/ohos.gni")
|
||||
|
||||
ohos_hap("callui_hap") {
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
deps = [
|
||||
":callui_js_assets",
|
||||
":callui_resources",
|
||||
]
|
||||
certificate_profile = "signature/callui.p7b"
|
||||
hap_name = "CallUI"
|
||||
subsystem_name = "applications"
|
||||
part_name = "prebuilt_hap"
|
||||
module_install_dir = "app/com.ohos.callui"
|
||||
}
|
||||
|
||||
ohos_js_assets("callui_js_assets") {
|
||||
ets2abc = true
|
||||
source_dir = "entry/src/main/ets"
|
||||
}
|
||||
|
||||
ohos_app_scope("callui_app_profile") {
|
||||
app_profile = "AppScope/app.json"
|
||||
sources = [ "AppScope/resources" ]
|
||||
}
|
||||
|
||||
ohos_resources("callui_resources") {
|
||||
sources = [ "entry/src/main/resources" ]
|
||||
deps = [ ":callui_app_profile" ]
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
}
|
||||
|
||||
ohos_hap("mobileDataSettings_hap") {
|
||||
hap_profile = "mobiledatasettings/src/main/module.json"
|
||||
deps = [
|
||||
":mobiledatasettings_js_assets",
|
||||
":mobiledatasettings_resources",
|
||||
]
|
||||
certificate_profile = "signature/callui.p7b"
|
||||
hap_name = "MobileDataSettings"
|
||||
subsystem_name = "applications"
|
||||
part_name = "prebuilt_hap"
|
||||
module_install_dir = "app/com.ohos.callui"
|
||||
}
|
||||
|
||||
ohos_js_assets("mobiledatasettings_js_assets") {
|
||||
ets2abc = true
|
||||
source_dir = "mobiledatasettings/src/main/ets"
|
||||
}
|
||||
|
||||
ohos_resources("mobiledatasettings_resources") {
|
||||
sources = [ "mobiledatasettings/src/main/resources" ]
|
||||
deps = [ ":callui_app_profile" ]
|
||||
hap_profile = "mobiledatasettings/src/main/module.json"
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
import CallStateManager from './CallStateManager';
|
||||
import CallStateConst from '../common/constant/CallStateConst';
|
||||
import ContactManager from './ContactManager';
|
||||
import NotificationManager from '../model/NotificationManager';
|
||||
import LogUtils from '../common/utils/LogUtils';
|
||||
import getSingleInstance from '../common/utils/SingleInstanceHelper'
|
||||
@ -34,7 +35,8 @@ export default class CallDataManager {
|
||||
callTimeList: any = [];
|
||||
private callStateChange: any;
|
||||
private mCallStateManager: CallStateManager ;
|
||||
private NotificationManager ;
|
||||
private NotificationManager;
|
||||
private contactManager;
|
||||
|
||||
public static getInstance():CallDataManager {
|
||||
return getSingleInstance(CallDataManager, CALL_DATA_MANAGER_KEY);
|
||||
@ -44,7 +46,8 @@ export default class CallDataManager {
|
||||
* Init data.
|
||||
*/
|
||||
public init(callData, callList, callTimeList) {
|
||||
this.NotificationManager = new NotificationManager()
|
||||
this.NotificationManager = new NotificationManager();
|
||||
this.contactManager = new ContactManager();
|
||||
this.mCallStateManager = CallStateManager.getInstance()
|
||||
this.callData = callData;
|
||||
this.callList = callList;
|
||||
@ -74,6 +77,11 @@ export default class CallDataManager {
|
||||
this.addCallList({
|
||||
...callData
|
||||
});
|
||||
|
||||
// use setTimeout to avoid block ui show
|
||||
setTimeout(() => {
|
||||
this.contactManager.getContactInfo(callData)
|
||||
}, 0);
|
||||
}
|
||||
|
||||
if (callData.callState === CallStateConst.CALL_STATUS_ACTIVE) {
|
||||
|
@ -20,7 +20,6 @@ import CallDataManager from './CallDataManager';
|
||||
import Utils from '../common/utils/utils';
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
import CallServiceProxy from './CallServiceProxy';
|
||||
import ContactManager from './ContactManager';
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
import call from '@ohos.telephony.call';
|
||||
import CallStateConst from '../common/constant/CallStateConst';
|
||||
@ -42,12 +41,10 @@ export default class CallManager {
|
||||
private mCallDataManager: CallDataManager;
|
||||
private mCallServiceProxy: CallServiceProxy ;
|
||||
private mUtils: Utils;
|
||||
private contactManager;
|
||||
private diffSeconds
|
||||
private mTimeMeter
|
||||
|
||||
constructor(ctx) {
|
||||
this.contactManager = new ContactManager();
|
||||
this.mCallServiceProxy = CallServiceProxy.getInstance();
|
||||
this.mUtils = Utils.getInstance();
|
||||
this.callData = ctx.callData;
|
||||
@ -62,12 +59,13 @@ export default class CallManager {
|
||||
this.initCallData();
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* init CallData
|
||||
*/
|
||||
private initCallData() {
|
||||
if (globalThis.abilityWant && globalThis.abilityWant.parameters && ('callState' in globalThis.abilityWant.parameters)) {
|
||||
this.update(globalThis.abilityWant.parameters);
|
||||
this.callData = this.getCallDataFromWant(globalThis.abilityWant.parameters);
|
||||
this.update(this.callData);
|
||||
LogUtils.i(TAG, "initCallData featureAbility.getWant :")
|
||||
} else {
|
||||
this.mCallServiceProxy.publish({
|
||||
@ -77,7 +75,23 @@ export default class CallManager {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* get callData from want parameters
|
||||
*/
|
||||
private getCallDataFromWant(parameters) {
|
||||
return Object.assign({}, {
|
||||
accountId: parameters.accountId,
|
||||
accountNumber: parameters.accountNumber,
|
||||
callId: parameters.callId,
|
||||
callState: parameters.callState,
|
||||
callType: parameters.callType,
|
||||
conferenceState: parameters.conferenceState,
|
||||
isEcc: parameters.isEcc,
|
||||
startTime: parameters.startTime,
|
||||
videoState: parameters.videoState});
|
||||
}
|
||||
|
||||
/**
|
||||
* Registered subscribers
|
||||
*/
|
||||
private async registerSubscriber() {
|
||||
@ -123,7 +137,6 @@ export default class CallManager {
|
||||
* @param { Object } callData -Object
|
||||
*/
|
||||
async update(callData) {
|
||||
await this.contactManager.getContactInfo(callData)
|
||||
this.mCallDataManager.update(callData);
|
||||
call.formatPhoneNumber(callData.accountNumber, (err, data) => {
|
||||
if (data === undefined) {
|
||||
|
@ -33,19 +33,24 @@ export default class ContactManager {
|
||||
*
|
||||
* @param { Object } callData -Object
|
||||
*/
|
||||
async getContactInfo(callData) {
|
||||
getContactInfo(callData) {
|
||||
if (callData.contactName) {
|
||||
return;
|
||||
}
|
||||
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.rowCount))
|
||||
if (resSet.rowCount > 0) {
|
||||
resSet.goToFirstRow();
|
||||
callData.contactName = resSet.getString(resSet.getColumnIndex('display_name'));
|
||||
}
|
||||
const dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.calluiAbilityContext, DBbaseUri);
|
||||
dataAbilityHelper.query(DBUri, columns, predicates, (err, resSet) => {
|
||||
LogUtils.i(TAG, "getContactInfo resSet : " + JSON.stringify(resSet.rowCount))
|
||||
if (resSet.rowCount > 0) {
|
||||
resSet.goToFirstRow();
|
||||
callData.contactName = resSet.getString(resSet.getColumnIndex('display_name'));
|
||||
globalThis.callManager.update(callData);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
LogUtils.i(TAG, "getContactInfo catch err : %s" + JSON.stringify(err))
|
||||
}
|
||||
|
81
entry/src/main/module.json
Normal file
81
entry/src/main/module.json
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "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:app_icon",
|
||||
"label": "$string:callui_description",
|
||||
"startWindowIcon": "$media:app_icon",
|
||||
"startWindowBackground": "$color:black",
|
||||
"visible": true,
|
||||
"minWindowHeight": 700,
|
||||
"minWindowWidth": 320,
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"backgroundModes": [
|
||||
"voip"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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.GET_TELEPHONY_STATE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.NOTIFICATION_CONTROLLER"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.ANSWER_CALL"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
36
mobiledatasettings/src/main/module.json
Normal file
36
mobiledatasettings/src/main/module.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "mobiledatasettings",
|
||||
"type": "feature",
|
||||
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
|
||||
"description": "$string:app_name",
|
||||
"mainElement": "com.ohos.mobiledatasettings.MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "com.ohos.mobiledatasettings.MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:mainability_description",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:mainability_description",
|
||||
"startWindowIcon": "$media:app_icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"visible": true
|
||||
}
|
||||
],
|
||||
"requestPermissions" : [
|
||||
{
|
||||
"name": "ohos.permission.GET_NETWORK_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.SET_TELEPHONY_STATE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user