Merge remote-tracking branch 'origin/master'

This commit is contained in:
fengshiyi
2025-09-08 11:56:18 +08:00
21 changed files with 81 additions and 62 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ class ExportClass {
appUseDataWorker: string = 'appUseDataWorker';
event: EventClass = new EventClass();
storage: StorageClass = new StorageClass();
config: ConfigClass = {
public config: ConfigClass = {
useDataWorker: false,
needCache: false
};
@@ -27,7 +27,7 @@ class CallLogObj{
callType:CallType = CallType.MISSED;
timeDetail:string = '';
formatNumber:string = '';
simId:number = -1;
public simId:number = -1;
public talkTime:string = '';
constructor(dateDetail: string) {
this.dateDetail = dateDetail;
@@ -25,7 +25,7 @@ export const simId_TWO: number = 1;
const TAG = 'SimCardState';
class SimCardState {
mListener: () => void = () => {
public mListener: () => void = () => {
};
mSimStateArray: Array<telephonySim.SimState> =
[telephonySim.SimState.SIM_STATE_UNKNOWN, telephonySim.SimState.SIM_STATE_UNKNOWN];
@@ -130,24 +130,24 @@ class ContactAbilityModel {
* @param {Object} addParams Contact Information
* @param {boolean} isCard Indicates whether the information is a business card.
*/
dealParam(DAHelper: dataShare.DataShareHelper | null, addParams: ContactInfo, isCard: boolean,
dealParam(daHelper: dataShare.DataShareHelper | null, addParams: ContactInfo, isCard: boolean,
callBack: Function | undefined) {
if (DAHelper != null || DAHelper != undefined) {
if (daHelper != null || daHelper != undefined) {
let result = addParams.id;
let uri = isCard ? PROFILE_CONTACT_DATA_URI : Data.CONTENT_URI;
this.dataContact(addParams, DAHelper, result, uri);
this.organizationContact(addParams, DAHelper, result, uri);
this.noteContact(addParams, DAHelper, result, uri);
this.phoneContact(addParams, DAHelper, result, uri);
this.emailContact(addParams, DAHelper, result, uri);
this.postalContact(addParams, DAHelper, result, uri);
this.eventContact(addParams, DAHelper, result, uri);
this.imContact(addParams, DAHelper, result, uri);
this.groupsContact(addParams, DAHelper, result, uri);
this.websiteContact(addParams, DAHelper, result, uri);
this.nickContact(addParams, DAHelper, result, uri);
this.relationsContact(addParams, DAHelper, result, uri);
this.dataContact(addParams, daHelper, result, uri);
this.organizationContact(addParams, daHelper, result, uri);
this.noteContact(addParams, daHelper, result, uri);
this.phoneContact(addParams, daHelper, result, uri);
this.emailContact(addParams, daHelper, result, uri);
this.postalContact(addParams, daHelper, result, uri);
this.eventContact(addParams, daHelper, result, uri);
this.imContact(addParams, daHelper, result, uri);
this.groupsContact(addParams, daHelper, result, uri);
this.websiteContact(addParams, daHelper, result, uri);
this.nickContact(addParams, daHelper, result, uri);
this.relationsContact(addParams, daHelper, result, uri);
if (callBack != undefined) {
HiLog.d(TAG, 'Start the callback function.');
@@ -623,12 +623,14 @@ class ContactAbilityModel {
* @param {Object} callBack 回调
* @param {Object} addParams Contact Information
*/
getAllContactWithPhoneNumbers(callBack: Function, addParams: AllContactWithPhoneNumbersGetParam, context?: common.UIAbilityContext | Context) {
getAllContactWithPhoneNumbers(callBack: Function, addParams: AllContactWithPhoneNumbersGetParam,
context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'Start to query all contacts with PhoneNumbers');
if (context) {
ContactRepository.getInstance().init(context);
}
ContactRepository.getInstance().findByPhoneIsNotNull(addParams.favorite, addParams.editContact, (contactList: ContactVo[]) => {
ContactRepository.getInstance().findByPhoneIsNotNull(addParams.favorite, addParams.editContact,
(contactList: ContactVo[]) => {
if (ArrayUtil.isEmpty(contactList)) {
HiLog.i(TAG, 'getAllContactWithPhoneNumbers-SelectcontactsModel queryContact resultSet is empty!');
let emptyResult: ContactVo[] = [];
@@ -710,7 +712,8 @@ class ContactAbilityModel {
}
break;
case DataItemType.EMAIL:
let email_element: EmailBean = new EmailBean(dataItem.getLabelId() as string, dataItem.getData() as string, dataItem.getLabelName() as string);
let email_element: EmailBean = new EmailBean(dataItem.getLabelId() as string, dataItem.getData() as string,
dataItem.getLabelName() as string);
if (contactDetailInfo.emails) {
contactDetailInfo.emails.push(email_element);
} else {
@@ -777,7 +780,8 @@ class ContactAbilityModel {
* @param {Object} addParams Contact Information
* @param {Object} callBack Contact ID
*/
async updateContact(DAHelper: dataShare.DataShareHelper | null, addParams: ContactInfo, callBack: Function, context?: common.UIAbilityContext | Context) {
async updateContact(DAHelper: dataShare.DataShareHelper | null, addParams: ContactInfo, callBack: Function,
context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'Start to update contacts.');
try {
if (DAHelper == undefined || DAHelper == null) {
@@ -849,7 +853,8 @@ class ContactAbilityModel {
* @param {Object} addParams Contact Information
* @param {Object} callBack Contact ID
*/
async updateFavorite(daHelper: dataShare.DataShareHelper | null, addParams: Record<string, string | number>, callBack: Function,
async updateFavorite(daHelper: dataShare.DataShareHelper | null, addParams: Record<string, string | number>,
callBack: Function,
context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'updateFavorite start.');
if (daHelper == undefined || daHelper == null) {
@@ -943,11 +948,13 @@ class ContactAbilityModel {
* @param {Object} addParams Contact Information
* @param {Object} callBack Contact Information
*/
async getDisplayNamesFindUsually(displayName: ValueType[], usuallyPhone: ValueType[], callBack: Function, context?: common.UIAbilityContext | Context) {
async getDisplayNamesFindUsually(displayName: ValueType[], usuallyPhone: ValueType[], callBack: Function, context?:
common.UIAbilityContext | Context) {
HiLog.i(TAG, 'getDisplayNamesFindUsually start.');
if (context) {
ContactRepository.getInstance().init(context);
ContactRepository.getInstance().getDisplayNameByFavorite(displayName, usuallyPhone, (favoriteList: ContactUsuallyListItem[]) => {
ContactRepository.getInstance().getDisplayNameByFavorite(displayName, usuallyPhone, (favoriteList:
ContactUsuallyListItem[]) => {
if (ArrayUtil.isEmpty(favoriteList)) {
let emptyResult: FavoriteBean[] = [];
callBack(emptyResult);
@@ -982,7 +989,8 @@ class ContactAbilityModel {
* @param {Object} addParams Contact Information
* @param {Object} callBack favoriteOrder
*/
async moveSortFavorite(DAHelper: dataShare.DataShareHelper | null, addParams: LooseObject, callBack: Function, context?: common.UIAbilityContext | Context) {
async moveSortFavorite(DAHelper: dataShare.DataShareHelper | null, addParams: LooseObject, callBack: Function,
context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'moveSortFavorite start.');
if (DAHelper == undefined || DAHelper == null) {
DAHelper = await dataShare.createDataShareHelper(context ? context : globalThis.context, Contacts.CONTENT_URI);
@@ -1015,7 +1023,8 @@ class ContactAbilityModel {
* @param {string} DAHelper
* @param {Object} callBack
*/
async getSearchContact(actionData: IContactSearchParams, callBack: Function, context?: common.UIAbilityContext | Context) {
async getSearchContact(actionData: IContactSearchParams, callBack: Function, context?:
common.UIAbilityContext | Context) {
HiLog.i(TAG, 'getSearchContact start.');
if (context) {
ContactRepository.getInstance().init(context);
@@ -1052,7 +1061,8 @@ class ContactAbilityModel {
HiLog.i(TAG, 'getSearchContact end.');
})
}
getQueryT9PhoneNumbers(callBack: Function, addParams: IT9PhoneNumbersQueryParams, context?: common.UIAbilityContext | Context) {
getQueryT9PhoneNumbers(callBack: Function, addParams: IT9PhoneNumbersQueryParams, context?:
common.UIAbilityContext | Context) {
if (context) {
ContactRepository.getInstance().init(context);
}
@@ -41,8 +41,9 @@ export class ContactInfo {
otherLanLastName: string = '';
otherLanFirstName: string = '';
constructor(id: string, display_name: string, nickname: string, phones: PhoneNumBean[], emails: EmailBean[], position: string, company: string,
remarks: string, aims: AIMBean[], houses: HouseBean[], websites: string[], relationships: AssociatedPersonBean[], events: EventBean[], groups: GroupBean[],
constructor(id: string, display_name: string, nickname: string, phones: PhoneNumBean[], emails: EmailBean[],
position: string, company: string, remarks: string, aims: AIMBean[], houses: HouseBean[], websites: string[],
relationships: AssociatedPersonBean[], events: EventBean[], groups: GroupBean[],
favorite: number, phoneticName: string, otherLanLastName: string, otherLanFirstName: string) {
this.id = id;
this.display_name = display_name;
+2 -2
View File
@@ -1,6 +1,6 @@
import { ContactVo } from "./bean/ContactVo";
import { ContactVo } from './bean/ContactVo';
import common from '@ohos.app.ability.common';
import { RichContactInfo } from "./bean/RichContactInfo";
import { RichContactInfo } from './bean/RichContactInfo';
export interface BatchSelectContact {
showIndex: boolean,
@@ -231,7 +231,7 @@ export class ContackPhoneSubInfoModel extends BaseContackSubInfoModel {
phoneAddress?: string | Resource;
primary?: boolean;
dataId?: number;
formatNum?: string;
public formatNum?: string;
}
export class FavoriteFormType {
@@ -32,10 +32,10 @@ class paramsObj {
class LooseObject {
showTitle: string = '';
callLog: CallLogBean = new CallLogBean('', '', '', '');
public callLog: CallLogBean = new CallLogBean('', '', '', '');
}
class callLog {
class CallLog {
}
const TAG = 'ContactDetail';
@@ -19,8 +19,8 @@ import DialerPresenter from '../../presenter/dialer/DialerPresenter';
import EnvironmentProp from '../../feature/EnvironmentProp';
class CallmenuFn {
value: string = '';
action: () => void = ()=>{}
public value: string = '';
public action: () => void = ()=>{}
constructor(value:string,action:() => void) {
this.value = value;
this.action = action;
@@ -34,7 +34,7 @@ class Favorite{
public selectFavoriteBean: FavoriteBean|undefined = undefined;
}
class extraParamsObj{
class ExtraParamsObj{
public insertIndex:number = 0;
}
@@ -202,7 +202,7 @@ struct FavoriteContent {
.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
.onDrop((event: DragEvent, extraParams: string) => {
let jsonString = JSON.parse(extraParams) as extraParamsObj;
let jsonString = JSON.parse(extraParams) as ExtraParamsObj;
if (jsonString.insertIndex >= this.favoriteNumber) {
return;
}
+1 -1
View File
@@ -33,7 +33,7 @@ const TAG = 'Index ';
class DeviceObj{
windowHeight:number = -1;
screenDensity:number = -1;
data:string[] = [];
public data:string[] = [];
}
@@ -71,9 +71,9 @@ export default class ContactListPresenter {
inputKeyword: string = '';
contactList: ContactVo[] = [];
alphabetIndexPresenter: AlphabetIndexerPresenter = AlphabetIndexerPresenter.getInstance();
refreshState?: () => void = () => {
public refreshState?: () => void = () => {
}
onContactChange = () => {
public onContactChange = () => {
HiLog.i(TAG, 'onContactChange refresh');
this.setDelayTask();
}
@@ -306,7 +306,7 @@ export default class AccountantsPresenter {
}
public getArray(array: Array<LooseObject>): Array<LooseObject> {
let itemList: Array<LooseObject> = array;
let itemList: LooseObject[] = array;
if (ArrayUtil.isEmpty(itemList)) {
itemList = [];
}
@@ -454,7 +454,7 @@ export default class BatchSelectContactsPresenter {
onRecentItemClicked(index: number) {
HiLog.i(TAG, 'onRecentItemClicked index is %s', index.toString());
this.checkStateChange(index,
new eventObj(0,0,!(this.callLogTemp[index].checked))
new EventObj(0,0,!(this.callLogTemp[index].checked))
);
}
@@ -472,12 +472,13 @@ export default class BatchSelectContactsPresenter {
onContactItemClicked(index: number, indexChild: number) {
HiLog.i(TAG, 'onContactItemClicked index is ' + index);
HiLog.i(TAG, 'onContactItemClicked indexChild is ' + indexChild);
let event = new eventObj(index,indexChild,this.searchLayoutShow ? !(this.searchContactList[index].phoneNumbers[indexChild].checked)
let event = new EventObj(index,indexChild,this.searchLayoutShow ? !(this.searchContactList[index].
phoneNumbers[indexChild].checked)
: !(this.contactsList[index].phoneNumbers[indexChild].checked));
this.checkStateChange(index, event);
}
checkStateChange(index:number, event:eventObj) {
checkStateChange(index:number, event:EventObj) {
HiLog.i(TAG, 'checkStateChange event: ' + JSON.stringify(event));
switch (this.tabInfo.tabIndex) {
case 0:
@@ -492,11 +493,11 @@ export default class BatchSelectContactsPresenter {
this.refreshPageMessage();
}
changeContactState(event:eventObj) {
changeContactState(event:EventObj) {
this.checkStateChange(event.contactIndex, event);
}
changeCallLogItemState(index:number, event:eventObj) {
changeCallLogItemState(index:number, event:EventObj) {
HiLog.i(TAG, 'changeCallLogItemState event : ' + JSON.stringify(event));
if (this.callLogTemp[index]) {
this.callLogTemp[index].checked = event.checked;
@@ -512,7 +513,7 @@ export default class BatchSelectContactsPresenter {
}
}
changeContactsItemState(index:number, event:eventObj) {
changeContactsItemState(index:number, event:EventObj) {
HiLog.i(TAG, 'SHOW changeContactsItemState searchLayoutShow');
let contactId = '';
if (!this.contactsInfo.searchLayoutShow) {
@@ -523,7 +524,7 @@ export default class BatchSelectContactsPresenter {
this.checkContactsCount(event, contactId);
}
checkContactsCount(event:eventObj, contactId:string) {
checkContactsCount(event:EventObj, contactId:string) {
HiLog.i(TAG, 'SHOW checkContactsCount searchLayoutShow');
if (this.contactsInfo.searchLayoutShow) {
this.contactsInfo.searchContactList.forEach(element => {
@@ -933,7 +934,7 @@ class childEle{
public phoneNumber:string = '';
}
class eventObj{
class EventObj{
public fullName:string = '';
public namePrefix:string = '';
public nameSuffix:string = '';
@@ -422,8 +422,9 @@ export default class DetailPresenter {
/* Encapsulate the attributes required on the detail page based on the obtained raw call record data. */
}
// Processing Initialization Data
this.showNameLastMenu = (this.contactForm.displayName != undefined && this.contactForm.displayName.toString().length > 6)
? this.subStringWithEllipsis(this.contactForm.displayName.toString(), 7) : this.contactForm.displayName.toString();
this.showNameLastMenu = (this.contactForm.displayName != undefined && this.contactForm.displayName.toString().
length > 6)? this.subStringWithEllipsis(this.contactForm.displayName.toString(), 7) : this.contactForm.
displayName.toString();
}
// Obtains call records and assembles parameters when the call is not a contact.
@@ -755,5 +756,5 @@ saveExistingContact() {
class MenusObj{
value:string = '';
action: () => void = ()=>{}
public action: () => void = ()=>{}
}
@@ -49,7 +49,7 @@ export default class CallRecordPresenter {
tabIndex: number = 0;
initStarted: boolean = false;
taskId: number = -1;
onCallsChange = () => {
public onCallsChange = () => {
HiLog.i(TAG, 'onCallsChange refresh');
this.setDelayTask();
}
@@ -73,7 +73,8 @@ export class DataWorkerTask extends WorkerTask {
HiLog.i(TAG, `runInWorker ${request}`)
switch (request) {
case DataWorkerConstant[DataWorkerConstant.getAllCalls]:
CallLog.getAllCalls(JSON.parse(param?.favoriteForm), param?.actionData, param?.mergeRule, (data: CallInfoGetParamsInCallback) => {
CallLog.getAllCalls(JSON.parse(param?.favoriteForm), param?.actionData, param?.mergeRule,
(data: CallInfoGetParamsInCallback) => {
HiLog.i(TAG, `getAllCalls result: ${JSON.stringify(data).length}`)
callBack(data);
}, param?.context);
@@ -144,7 +145,8 @@ export class DataWorkerTask extends WorkerTask {
}, param?.context)
break
case DataWorkerConstant[DataWorkerConstant.getDisplayNamesFindUsually]:
ContactAbilityModel.getDisplayNamesFindUsually(param?.displayName, param?.usuallyPhone, (result: FavoriteBean[]) => {
ContactAbilityModel.getDisplayNamesFindUsually(param?.displayName, param?.usuallyPhone,
(result: FavoriteBean[]) => {
callBack(result);
}, param?.context)
break
@@ -18,7 +18,7 @@ import { CallLog } from '../entity/CallLog';
@Observed
export default class MergedCallLog {
id: number;
createTime: string | Resource = "";
createTime: string | Resource = '';
count: number = 0;
ids: number[];
isHD: boolean;
@@ -42,7 +42,8 @@ export class MissedCallNotifyData {
createTime?: number;
ringDuration?: number;
constructor(id: number, displayName: string, phoneNumber: string, count: number, createTime: number, ringDuration: number) {
constructor(id: number, displayName: string, phoneNumber: string, count: number,
createTime: number, ringDuration: number) {
this.id = id;
this.displayName = displayName;
this.phoneNumber = phoneNumber;
@@ -248,7 +249,8 @@ const parameters: LooseObject = JSON.parse(JSON.stringify(missCallData));
for (let i = 0; i < parameters.phoneNumberList.length; i++) {
const missedPhoneNumber = parameters.phoneNumberList[i] as string
if (i === (parameters.phoneNumberList.length - 1)) {
this.UnReadMissedCallData = new MissedCallNotifyData(i, missedPhoneNumber, missedPhoneNumber, count, createTime, ringDuration);
this.UnReadMissedCallData = new MissedCallNotifyData(i, missedPhoneNumber, missedPhoneNumber, count,
createTime, ringDuration);
} else {
this.UnReadMissedCallData = new MissedCallNotifyData(i, missedPhoneNumber, missedPhoneNumber, count, createTime, 0);
}
@@ -144,7 +144,8 @@ export class CallLogRepository implements ICallLogRepository {
this.getDataAbilityHelper().then((dataAbilityHelper: dataShare.DataShareHelper) => {
let condition = new dataSharePredicates.DataSharePredicates();
let offset =
actionData.page != undefined && actionData.page < 3 ? (actionData.page - 1) * 50 : (actionData.page != undefined ? actionData.page - 2 : 1) * 500 + 50;
actionData.page != undefined && actionData.page < 3 ? (actionData.page - 1) * 50 :
(actionData.page != undefined ? actionData.page - 2 : 1) * 500 + 50;
condition.limit(actionData.limit, offset);
condition.orderByDesc(Calls.CREATE_TIME);
dataAbilityHelper.query(Calls.CALL_LOG_URI, condition, null).then((resultSet: DataShareResultSet) => {
@@ -20,8 +20,9 @@ import DataShareResultSet from '@ohos.data.DataShareResultSet';
export default class SearchContactListItem {
static readonly COLUMNS: string[] = [SearchContacts.ID, SearchContacts.ACCOUNT_ID, SearchContacts.CONTACT_ID,
SearchContacts.ROW_CONTACT_ID, SearchContacts.SEARCH_NAME, SearchContacts.DISPLAY_NAME, SearchContacts.PHONETIC_NAME,
SearchContacts.PHOTO_ID, SearchContacts.PHOTO_FILE_ID, SearchContacts.IS_DELETED, SearchContacts.POSITION,
SearchContacts.ROW_CONTACT_ID, SearchContacts.SEARCH_NAME, SearchContacts.DISPLAY_NAME,
SearchContacts.PHONETIC_NAME,SearchContacts.PHOTO_ID, SearchContacts.PHOTO_FILE_ID,
SearchContacts.IS_DELETED, SearchContacts.POSITION,
SearchContacts.PHOTO_FIRST_NAME, SearchContacts.SORT_FIRST_LETTER, SearchContacts.CUSTOM_DATA,
SearchContacts.DETAIL_INFO, SearchContacts.CONTENT_TYPE, SearchContacts.HAS_PHONE_NUMBER];
readonly id: number;