• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 RawContact from './RawContact';
17import ContactBuilder from './ContactBuilder';
18
19export default class Contact {
20  readonly id: number;
21  readonly nameRawContactId: number;
22  readonly quickSearchKey: string;
23  readonly photoId: number;
24  readonly photoFileId: number;
25  readonly personalRingtone: string;
26  readonly personalNotificationRingtone: string;
27  readonly isTransferVoiceMail: boolean;
28  readonly company: string;
29  readonly position: string;
30  readonly hasDisplayName: boolean;
31  readonly hasPhoneNumber: boolean;
32  readonly readOnly: boolean;
33  readonly hasGroup: boolean;
34  readonly hasEmail: boolean;
35  readonly rowContacts: RawContact[];
36
37  constructor(contactBuilder: ContactBuilder) {
38    this.id = contactBuilder.id;
39    this.nameRawContactId = contactBuilder.nameRawContactId;
40    this.quickSearchKey = contactBuilder.quickSearchKey;
41    this.photoId = contactBuilder.photoId;
42    this.photoFileId = contactBuilder.photoFileId;
43    this.personalRingtone = contactBuilder.personalRingtone;
44    this.personalNotificationRingtone = contactBuilder.personalNotificationRingtone;
45    this.isTransferVoiceMail = contactBuilder.isTransferVoiceMail;
46    this.company = contactBuilder.company;
47    this.position = contactBuilder.position;
48    this.hasDisplayName = contactBuilder.hasDisplayName;
49    this.hasPhoneNumber = contactBuilder.hasPhoneNumber;
50    this.readOnly = contactBuilder.readOnly;
51    this.hasGroup = contactBuilder.hasGroup;
52    this.hasEmail = contactBuilder.hasEmail;
53    this.rowContacts = contactBuilder.rowContacts;
54  }
55
56  addToBlackList() {
57    return;
58  }
59
60  removeFromBlackList() {
61    return;
62  }
63
64  isInBlackList() {
65    return false;
66  }
67
68  star() {
69    return false;
70  }
71
72  unStar() {
73    return false;
74  }
75
76  protected getSharedText() {
77    return "我是被分享的文本";
78  }
79
80  protected getSharedQRCode() {
81    return "我是被分享的二维码";
82  }
83
84  protected getSharedVcard() {
85    return "我是被分享的Vcard";
86  }
87  /**
88   * type:
89   * 1: 二维码
90   * 2:vCard
91   * 3:文本
92   */
93  shareContactByType(type: number) {
94  }
95
96  addBirthDayToCalendar() {
97
98  }
99
100  clearPhotos() {
101    return false;
102  }
103
104  getPhoto() {
105    return {};
106  }
107
108  isReadOnly() {
109    return false;
110  }
111}
112
113