1/** 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { CallLog } from '../entity/CallLog'; 17import Calls from '../contract/Calls'; 18 19export default class CallLogDelta { 20 readonly callLog: CallLog; 21 constructor(callLog: CallLog) { 22 this.callLog = callLog; 23 } 24 25 createValuesBucket(): {} { 26 if (!this.callLog) { 27 return []; 28 } 29 30 return { 31 [Calls.PHONE_NUMBER]: this.callLog.phoneNumber, 32 [Calls.DISPLAY_NAME]: this.callLog.displayName, 33 [Calls.CALL_DIRECTION]: this.callLog.callDirection, 34 [Calls.VOICEMAIL_URI]: this.callLog.voicemailUri, 35 [Calls.SIM_TYPE]: this.callLog.simType, 36 [Calls.IS_HD]: this.callLog.isHD, 37 [Calls.IS_READ]: this.callLog.isRead, 38 [Calls.RING_DURATION]: this.callLog.ringDuration, 39 [Calls.TALK_DURATION]: this.callLog.talkDuration, 40 [Calls.FORMAT_NUMBER]: this.callLog.formattedNumber, 41 [Calls.QUICK_SEARCH_KEY]: this.callLog.quickSearchKey, 42 [Calls.NUMBER_TYPE]: this.callLog.numberType, 43 [Calls.BEGIN_TIME]: this.callLog.beginTime, 44 [Calls.END_TIME]: this.callLog.endTime, 45 [Calls.ANSWER_STATE]: this.callLog.answerState, 46 [Calls.CREATE_TIME]: this.callLog.createTime, 47 [Calls.NUMBER_LOCATION]: this.callLog.numberLocation, 48 [Calls.PHOTO_ID]: this.callLog.photoId, 49 [Calls.PHOTO_URI]: this.callLog.photoUri, 50 [Calls.COUNTRY_ISO_CODE]: this.callLog.countryIsoCode, 51 }; 52 } 53}