• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2023 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 { StringUtil } from '../../../../../../common/src/main/ets/util/StringUtil';
17
18/**
19 * Favorite List Data Structure Entity
20 */
21export class FavoriteBean {
22  contactId: string;
23  /**
24   * 0 Favorite 1 Usually
25   */
26  isCommonUseType: number;
27  /**
28   * Contact Name
29   */
30  displayName: string;
31  phoneNum: string;
32  nameSuffix: string;
33  namePrefix: string;
34  portraitColor: string;
35  /**
36   * Display Usually
37   */
38  isUsuallyShow: boolean;
39  portraitPath: string;
40  isEditSelect: boolean
41  favorite: number;
42  company: string;
43  position: string;
44  show: boolean;
45  showName: string;
46  phoneNumbers: object[];
47  title: string;
48  subTitle: string;
49  favoriteOrder: string;
50
51  constructor(
52    contactId: string,
53    isCommonUseType: number,
54    displayName: string,
55    phoneNum: string,
56    nameSuffix: string,
57    namePrefix: string,
58    portraitColor: string,
59    isUsuallyShow: boolean,
60    portraitPath: string,
61    isEditSelect: boolean,
62    favorite: number,
63    favoriteOrder: string,
64  ) {
65    this.contactId = contactId;
66    this.isCommonUseType = isCommonUseType;
67    this.displayName = displayName;
68    this.phoneNum = phoneNum;
69    this.nameSuffix = nameSuffix;
70    this.namePrefix = namePrefix;
71    this.portraitColor = portraitColor;
72    this.isUsuallyShow = isUsuallyShow;
73    this.portraitPath = portraitPath;
74    this.isEditSelect = isEditSelect;
75    this.favorite = favorite;
76    this.favoriteOrder = favoriteOrder;
77  }
78
79  public setShowName() {
80    this.showName = !StringUtil.isEmpty(this.displayName) ? this.displayName : (!StringUtil.isEmpty(this.company) ? this.company : (!StringUtil.isEmpty(this.position) ? this.position : ""))
81  }
82}
83