Update Contacts code
Signed-off-by: zhuchao <zhuchaoa.zhuchao@huawei.com>
@@ -1,4 +1,4 @@
|
||||
Apache License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
@@ -174,28 +174,3 @@
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
<!-- 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.
|
||||
@@ -14,56 +14,100 @@
|
||||
limitations under the License.
|
||||
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
|
||||
All configurations in this file will be merged to OAT-Default.xml, if you have any questions or concerns, please create issue in OpenHarmony/tools_oat and @jalenchen or chenyaxun.
|
||||
|
||||
licensefile:
|
||||
1.If the project don't have "LICENSE" in root dir, please define all the license files in this project in , OAT will check license files according to this rule.
|
||||
|
||||
policylist:
|
||||
1. policy: If the OAT-Default.xml policies do not meet your requirements, please add policies here.
|
||||
2. policyitem: The fields type, name, path, desc is required, and the fields rule, group, filefilter is optional,the default value is:
|
||||
<policyitem type="" name="" path="" desc="" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter"/>
|
||||
3. policyitem type:
|
||||
"compatibility" is used to check license compatibility in the specified path;
|
||||
"license" is used to check source license header in the specified path;
|
||||
"copyright" is used to check source copyright header in the specified path;
|
||||
"import" is used to check source dependency in the specified path, such as import ... ,include ...
|
||||
"filetype" is used to check file type in the specified path, supported file types: archive, binary
|
||||
"filename" is used to check whether the specified file exists in the specified path(projectroot means the root dir of the project), supported file names: LICENSE, README, README.OpenSource
|
||||
4. policyitem name: This field is used for define the license, copyright, "*" means match all, the "!" prefix means could not match this value. For example, "!GPL" means can not use GPL license.
|
||||
5. policyitem path: This field is used for define the source file scope to apply this policyitem, the "!" prefix means exclude the files. For example, "!.*/lib/.*" means files in lib dir will be exclude while process this policyitem.
|
||||
6. policyitem rule and group: These two fields are used together to merge policy results. "may" policyitems in the same group means any one in this group passed, the result will be passed.
|
||||
7. policyitem filefilter: Used to bind filefilter which define filter rules.
|
||||
7. policyitem desc: Used to describe the reason of this policy item, committers will check this while merging the code.
|
||||
8. filefilter: Filter rules, the type filename is used to filter file name, the type filepath is used to filter file path.
|
||||
|
||||
Note:If the text contains special characters, please escape them according to the following rules:
|
||||
" == >
|
||||
& == >
|
||||
' == >
|
||||
< == >
|
||||
> == >
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile></licensefile>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Copyright 2015 the original author or authors." path="gradlew" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="file generated by development tool"/>
|
||||
<policyitem type="copyright" name="Copyright 2015 the original author or authors." path="gradlew.bat" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="file generated by development tool"/>
|
||||
<policy
|
||||
desc=""
|
||||
name="projectPolicy">
|
||||
<!--policyitem type="compatibility" name="GPL-2.0+" path="abc/.*" desc="Process that runs independently, invoked by the X process."/-->
|
||||
<!--policyitem type="license" name="LGPL" path="abc/.*" desc="Dynamically linked by module X"/-->
|
||||
<!--policyitem type="copyright" name="xxx" path="abc/.*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed by X Company"/-->
|
||||
</policy>
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filepath" name="entry/src/main/js/default/res/image/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="entry/src/main/js/default/res/image/.*.jpg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="entry/src/main/js/default/res/image/.*.svg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="entry/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="entry/src/ohosTest/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="doc/image/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="entry/src/main/js/default/base/base_color.scss" desc="color scss"/>
|
||||
<filteritem type="filepath" name="gradle/wrapper/gradle-wrapper.jar" desc="gradle jar"/>
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
<filefilterlist>
|
||||
<filefilter
|
||||
desc="Files that do not need to be scanned"
|
||||
name="defaultFilter">
|
||||
<filteritem
|
||||
desc="out put files"
|
||||
name="gradle/wrapper/.*.jar"
|
||||
type="filepath"/>
|
||||
<filteritem
|
||||
desc="out put files"
|
||||
name="sign/.*"
|
||||
type="filepath"/>
|
||||
</filefilter>
|
||||
<filefilter
|
||||
desc="Filters for compatibility,license header policies"
|
||||
name="defaultPolicyFilter">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter
|
||||
desc="Filters for copyright header policies"
|
||||
name="copyrightPolicyFilter">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter
|
||||
desc="Filters for LICENSE file policies"
|
||||
name="licenseFileNamePolicyFilter">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter
|
||||
desc="Filters for README file policies"
|
||||
name="readmeFileNamePolicyFilter">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter
|
||||
desc="Filters for README.OpenSource file policies"
|
||||
name="readmeOpenSourcefileNamePolicyFilter">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter
|
||||
desc="Filters for binary file policies"
|
||||
name="binaryFileTypePolicyFilter">
|
||||
<filteritem
|
||||
desc="self developed image"
|
||||
name="doc/image/.*.png"
|
||||
type="filepath"/>
|
||||
<filteritem
|
||||
desc="self developed image"
|
||||
name="entry/src/main/resources/base/media/.*.png"
|
||||
type="filepath"/>
|
||||
<filteritem
|
||||
desc="self developed image"
|
||||
name="entry/src/main/resources/base/media/.*.svg"
|
||||
type="filepath"/>
|
||||
<filteritem
|
||||
desc="self developed audio"
|
||||
name="entry/src/main/resources/rawfile/.*.ogg"
|
||||
type="filepath"/>
|
||||
</filefilter>
|
||||
|
||||
</filefilterlist>
|
||||
<licensematcherlist>
|
||||
<!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped.">
|
||||
<licensetext name="
|
||||
uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
" desc=""/>
|
||||
<licensetext name="
|
||||
uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
" desc=""/>
|
||||
</licensematcher-->
|
||||
</licensematcherlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
||||
@@ -1,36 +1,45 @@
|
||||
# applications_contacts
|
||||
# 联系人
|
||||
|
||||
#### Description
|
||||
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
|
||||
### 简介
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
Contacts应用是OpenHarmony中预置的系统应用,主要的功能包含拨号盘、通话记录查看、通话记录批量删除、联系人列表、详情查看、联系人的新建等功能;
|
||||
|
||||
#### Installation
|
||||
### 架构图
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||

|
||||
|
||||
### 目录
|
||||
|
||||
~~~
|
||||
/Contacts/
|
||||
├── doc # 资料
|
||||
├── entry
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ └── ets # js代码目录
|
||||
│ └── MainAbility # 公共页面样式
|
||||
│ ├── account # 联系人账号
|
||||
│ ├── call # 通话记录
|
||||
│ ├── component # 组件封装
|
||||
│ ├── contact # 联系人
|
||||
│ ├── contact # 存储契约
|
||||
│ ├── entity # 实体
|
||||
│ └── repo # 仓库
|
||||
│ ├── dialpad # 拨号盘
|
||||
│ ├── feature # 特性集合
|
||||
│ |── model # 模型
|
||||
│ |── pages # TS声明式页面/组件
|
||||
│ |── presenter # 页面展示逻辑
|
||||
│ |── util # 工具类
|
||||
│ └── workers # JS多线程服务
|
||||
│ └── app.ets # 应用生命周期/公共方法存放
|
||||
│ ├── resources # 资源配置文件存放目录
|
||||
│ └── config.json # 全局配置文件
|
||||
├── signs # 签名
|
||||
├── LICENSE
|
||||
~~~
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
# Contacts<a name="ZH-CN_TOPIC_0000001103421572"></a>
|
||||
|
||||
- [简介](#section11660541593)
|
||||
- [架构图](#section48896451454)
|
||||
|
||||
- [目录](#section161941989596)
|
||||
- [使用说明](#section123459000)
|
||||
- [相关仓](#section1371113476307)
|
||||
|
||||
## 简介<a name="section11660541593"></a>
|
||||
|
||||
Contacts应用是OpenHarmony中预置的系统运用,主要的功能包含拨号盘、通话记录查看、通话记录批量删除、联系人列表、详情查看、联系人的新建等功能
|
||||
|
||||
### 架构图<a name="section48896451454"></a>
|
||||
|
||||

|
||||
|
||||
## 目录<a name="section161941989596"></a>
|
||||
|
||||
```
|
||||
/applications/standard/contacts
|
||||
├── doc # 架构图目录
|
||||
├── entry
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── config.json # 全局配置文件
|
||||
│ ├── resources # 资源配置文件存放目录
|
||||
│ └── js # js代码目录
|
||||
│ └── base # 公共css样式
|
||||
│ └── common # 公共页面样式
|
||||
│ └── i18n # 国际化
|
||||
│ └── model # 页面数据Model
|
||||
│ └── pages # 页面/js逻辑样式
|
||||
│ └── res # 资源文件
|
||||
│ └── utils # 工具类
|
||||
│ └── ServiceAbility # 服务ability
|
||||
│ └── app.js # 应用生命周期/公共方法存放
|
||||
├── LICENSE
|
||||
```
|
||||
## 使用说明 <a name="section123459000"></a>
|
||||
|
||||
参见使用说明([使用说明](./doc/Instructions.md))
|
||||
|
||||
## 相关仓<a name="section1371113476307"></a>
|
||||
|
||||
系统应用
|
||||
|
||||
**applications\_standard\_contacts**
|
||||
|
||||
@@ -1,35 +1,52 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
apply plugin: 'com.huawei.ohos.app'
|
||||
apply from: this.file('global.gradle')
|
||||
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
compileSdkVersion 7
|
||||
compileSdkVersion 8
|
||||
supportSystem "standard"
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 7
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('sign\\OpenHarmony.p12')
|
||||
storePassword '00000016415DCB8BDB5D691A90749335FF8E25F1806A4C11AF9FB4BE8C598A979D787FF01BDB'
|
||||
keyAlias = 'OpenHarmony Application CA'
|
||||
keyPassword '00000016929E7CB9E098D907A36A4346625D55CC1DC412040BDB794E0CEAF760FDB68B0E8966'
|
||||
signAlg = 'SHA256withECDSA'
|
||||
profile file('sign\\com.ohos.contacts.p7b')
|
||||
certpath file('sign\\IDE.cer')
|
||||
}
|
||||
release {
|
||||
initWith(signingConfigs.debug)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://repo.huaweicloud.com/repository/maven/'
|
||||
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
maven {
|
||||
url 'https://developer.huawei.com/repo/'
|
||||
url 'http://mirrors.tools.huawei.com/maven/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.huawei.ohos:hap:3.0.3.4'
|
||||
classpath 'com.huawei.ohos:hap:3.0.6.4'
|
||||
classpath 'com.huawei.ohos:decctest:3.0.4.3'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://repo.huaweicloud.com/repository/maven/'
|
||||
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
maven {
|
||||
url 'https://developer.huawei.com/repo/'
|
||||
url 'http://mirrors.tools.huawei.com/maven/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
# Contacts 使用说明
|
||||
## 代码使用
|
||||
### 代码下载
|
||||
#### 配置码云ssh
|
||||
1. 打开本地git bash窗口
|
||||
2. 进入到.ssh 目录:cd ~/.ssh
|
||||
3. 找到id_rsa.pub文件:ls
|
||||
4. 查看公钥:cat id_rsa.pub
|
||||
5. 在码云个人设置-安全设置-ssh公钥中配置公钥
|
||||
|
||||
#### 下载代码
|
||||
1. 打开码云MMS地址([下载地址](https://gitee.com/openharmony/applications_contacts))。
|
||||
2. 选择克隆/下载 - ssh方式 -复制下载地址
|
||||
3. 本机git bash 中执行:
|
||||
```
|
||||
git clone '复制的下载地址'
|
||||
```
|
||||
|
||||
### 环境搭建
|
||||
打开DevEco Studio链接下载安装,安装步骤及安装说明详见下载见官网
|
||||
|
||||
## 基础开发说明
|
||||
### 系统接口调用
|
||||
### 异步回调的使用
|
||||
- 在需要回调操作的js文件中创建回调函数
|
||||
```JavaScript
|
||||
subscribeCallback(err, data){
|
||||
// do something
|
||||
},
|
||||
```
|
||||
- 调用应用内部封装的接口,并传入回调函数
|
||||
```JavaScript
|
||||
Notification.subscribe(mSubscriber, this.subscribeCallback.bind(this));
|
||||
```
|
||||
- 在AsyncCallback返回数据时可以获取到错误信息或目标数据
|
||||
```JavaScript
|
||||
subscribeCallback(err, data) {
|
||||
Log.showInfo(TAG, 'subscribeCallback finished ====================' + JSON.stringify(data));
|
||||
}
|
||||
```
|
||||
### 如何引用资源文件
|
||||
- 在i18n/zh-CN.json文件中,可直接通过$t()引用资源
|
||||
```` JavaScript
|
||||
this.title = this.$t('app.string.hello_world');
|
||||
````
|
||||
|
||||
## 典型接口的使用
|
||||
```
|
||||
import dataStorage from '@ohos.data.storage';
|
||||
onCreate() {
|
||||
LOG.info(TAG + 'AceApplication onCreate');
|
||||
this.initDataStorage();
|
||||
},
|
||||
async initDataStorage() {
|
||||
let context = featureAbility.getContext();
|
||||
let path = await context.getFilesDir();
|
||||
this.globalData.storage = dataStorage.getStorageSync(path + this.globalData.path);
|
||||
},
|
||||
```
|
||||
## 签名打包
|
||||
### 签名
|
||||
#### 签名文件的获取
|
||||
1. 拷贝OpenHarmony标准版工程的 prebuilts\signcenter 目录到操作目录
|
||||
2. 拷贝applications_contacts工程的 signature\contacts.p7b 到该目录下
|
||||
#### 签名文件的配置
|
||||
打开项目工程,选择 File → Project Structure
|
||||
|
||||

|
||||
|
||||
选择 Modules → Signing Configs,将对应的签名文件配置如下,完成后点击Apply,再点击OK。
|
||||
|
||||

|
||||
|
||||
配置完成后,对应的build.gradle文件中会出现如下内容
|
||||
|
||||

|
||||
### 打包
|
||||
DevEco Studio 支持 debug 与 release 两种打包类型。可以在 OhosBuild Variants 窗口中进行切换。
|
||||
|
||||

|
||||
|
||||
#### debug打包
|
||||
1. 代码准备完成后,在 OhosBuild Variants 窗口的 Selected Variant 中选择 debug。
|
||||
|
||||

|
||||
|
||||
2. 选择Build → Build Haps(s)/APP(s) → Build Hap(s)
|
||||
|
||||

|
||||
|
||||
3. 编译完成后,hap包会生成在工程目录下的 `\build\outputs\hap\debug\phone\`路径下(如果没有配置签名,则只会生成未签名的hap包)
|
||||
|
||||

|
||||
#### release打包
|
||||
1. 代码准备完成后,在 OhosBuild Variants 窗口的 Selected Variant 中选择 release
|
||||
|
||||

|
||||
|
||||
2. 选择Build → Build Haps(s)/APP(s) → Build Hap(s)
|
||||
|
||||

|
||||
|
||||
3. 编译完成后,hap包会生成在工程目录下的 `\build\outputs\hap\release\phone\`路径下(配置好签名后,生成的hap包会显示signed)
|
||||
|
||||

|
||||
## 安装、运行、调试
|
||||
## 应用安装
|
||||
配置 hdc:
|
||||
进入SDK目录中的toolchains文件夹下,获取文件路径:
|
||||
|
||||

|
||||
|
||||
> 注意,此处的hdc.exe如果版本较老,可能不能正常使用,需要获取新的hdc.exe文件
|
||||
> hdc命令介绍与下载详见:[hdc仓库地址](https://gitee.com/openharmony/developtools_hdc_standard)
|
||||
|
||||
|
||||
并将此路径配置到环境变量中:
|
||||
|
||||

|
||||
|
||||
重启电脑使环境变量生效
|
||||
|
||||
连接开发板,打开cmd命令窗口,执行hdc list targets,弹出窗口如下:
|
||||
|
||||

|
||||
|
||||
等待一段时间后,窗口出现如下打印,可回到输入 hdc list targets 的命令窗口继续操作:
|
||||
|
||||

|
||||
|
||||
再次输入hdc list targets,出现如下结果,说明hdc连接成功
|
||||
|
||||

|
||||
|
||||
获取读写权限:
|
||||
|
||||
```
|
||||
hdc target mount
|
||||
```
|
||||
将签名好的 hap 包放入设备的 `/system/app` 目录下,并修改hap包的权限
|
||||
|
||||
```
|
||||
hdc file send 本地路径 /system/app/hap包名称
|
||||
例如:hdc file send Contacts.hap /system/app/Contacts.hap
|
||||
```
|
||||
> 注意,如果设备不存在 `/system/app` 目录,则需要手动创建该目录并修改权限。
|
||||
> ```
|
||||
> hdc shell
|
||||
> cd system
|
||||
> mkdir app
|
||||
> chmod 777 app
|
||||
> ```
|
||||
> `/system/app` 目录放置系统应用,例如:Contacts 等。
|
||||
>
|
||||
> 但hap包需要在该目录下手动设置权限
|
||||
> ```
|
||||
> chmod 666 hap包名
|
||||
> ```
|
||||
> 此目录应用不用手动安装,系统自动拉起。
|
||||
## 应用运行
|
||||
MMS属于系统应用,在将签名的 hap 包放入 `/system/app` 目录后,重启系统,应用会自动拉起。
|
||||
```
|
||||
hdc shell
|
||||
reboot
|
||||
(不可以直接执行hdc reboot,命令是无效的)
|
||||
```
|
||||
> 注意,如果设备之前安装过系统应用,则需要执行如下两条命令清除设备中存储的应用信息才能够在设备重启的时候将我们装入设备的新 hap 包正常拉起。
|
||||
> ```
|
||||
> hdc shell rm -rf /data/misc_de/0/mdds/0/default/bundle_manager_service
|
||||
> hdc shell rm -rf /data/accounts
|
||||
> ```
|
||||
## 应用调试
|
||||
### log打印
|
||||
- 在程序中添加 log
|
||||
```JS
|
||||
console.info("contacts log info");
|
||||
```
|
||||
### log获取及过滤
|
||||
- log获取
|
||||
|
||||
将log输出至文件
|
||||
```
|
||||
hdc shell hilog > 输出文件名称
|
||||
```
|
||||
|
||||
例:
|
||||
在真实环境查看log,将全log输出到当前目录的hilog.log文件中
|
||||
```
|
||||
hdc shell hilog > hilog.log
|
||||
```
|
||||
|
||||
- log过滤
|
||||
|
||||
在命令行窗口中过滤log
|
||||
```
|
||||
hilog │ grep 过滤信息
|
||||
```
|
||||
|
||||
例:过滤包含信息 Label 的 hilog
|
||||
```
|
||||
hilog │ grep Label
|
||||
```
|
||||
## 贡献代码
|
||||
### Fork 代码仓库
|
||||
1. 在码云上打开 MMS 代码仓库([仓库地址](https://gitee.com/openharmony/applications_contacts))。
|
||||
|
||||
2. 点击仓库右上角的 Forked 按钮,在弹出的画面中,选择将仓库 fork 到哪里,点击确认。
|
||||
|
||||
3. Fork 成功之后,会在自己的账号下看见 fork 的代码仓库。
|
||||
|
||||
### 提交代码
|
||||
1. 访问我们自己在码云账号上 fork 的代码仓库,点击“克隆/下载”按钮,选择 SSH,点击“复制”按钮。
|
||||
|
||||
2. 在本地新建 Contacts 目录,在 Contacts 目录中执行如下命令
|
||||
```
|
||||
git clone 步骤1中复制的地址
|
||||
```
|
||||
|
||||
3. 修改代码。
|
||||
> 将代码引入工程,以及编译工程等相关内容请参见 **3. 代码使用** 部分的相关内容。
|
||||
4. 提交代码到 fork 仓库。
|
||||
> 修改后的代码,首先执行 `git add` 命令,然后执行 `git commit` 命令与 `git push` 命令,将代码 push 到我们自己的 fork 仓中。
|
||||
> 关于代码提交的这部分内容涉及 git 的使用,可以参照 [git官网](https://git-scm.com/) 的内容,在此不再赘述。
|
||||
|
||||
### 发起 Pull Request (PR)
|
||||
在将代码提交到 fork 仓之后,我们可以通过发起 Pull Request(PR)的方式来为 OpenHarmony 的相关项目贡献代码。
|
||||
|
||||
1. 打开 fork 仓库。选择 `Pull Requests` → `新建 Pull Request`
|
||||
|
||||
2. 在 `新建 Pull Request` 画面填入标题与说明,点击 `创建` 按钮。
|
||||
|
||||
3. 创建 Pull Request 完成。 PR 创建完成后,会有专门的代码审查人员对代码进行评审,评审通过之后会合入相应的代码库。
|
||||
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 162 KiB |
|
Before Width: | Height: | Size: 233 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 17 KiB |
@@ -1 +1,2 @@
|
||||
/build
|
||||
/node_modules
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
apply plugin: 'com.huawei.ohos.hap'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
signingConfigs {
|
||||
debug {
|
||||
storePassword rootProject.ext.debugSignConfigs.storePassword
|
||||
keyAlias rootProject.ext.debugSignConfigs.keyAlias
|
||||
keyPassword rootProject.ext.debugSignConfigs.keyPassword
|
||||
signAlg rootProject.ext.debugSignConfigs.signAlg
|
||||
storeFile file(rootProject.ext.debugSignConfigs.storeFile)
|
||||
profile file(rootProject.ext.debugSignConfigs.profile)
|
||||
certpath file(rootProject.ext.debugSignConfigs.cerPath)
|
||||
}
|
||||
release {
|
||||
storePassword rootProject.ext.signConfigs.storePassword
|
||||
keyAlias rootProject.ext.signConfigs.keyAlias
|
||||
keyPassword rootProject.ext.signConfigs.keyPassword
|
||||
signAlg rootProject.ext.signConfigs.signAlg
|
||||
storeFile file(rootProject.ext.signConfigs.storeFile)
|
||||
profile file(rootProject.ext.signConfigs.profile)
|
||||
certpath file(rootProject.ext.signConfigs.cerPath)
|
||||
}
|
||||
}
|
||||
compileSdkVersion 7
|
||||
compileSdkVersion 8
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 7
|
||||
compatibleSdkVersion 8
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -32,8 +13,9 @@ ohos {
|
||||
}
|
||||
}
|
||||
}
|
||||
arkEnabled false
|
||||
}
|
||||
|
||||
dependencies {}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
|
||||
testImplementation 'junit:junit:4.13.1'
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
"module": {
|
||||
"package": "com.ohos.contacts",
|
||||
"name": ".MyApplication",
|
||||
"mainAbility": ".MainAbility",
|
||||
"srcPath": "",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
@@ -18,7 +20,7 @@
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "entry",
|
||||
"moduleType": "entry",
|
||||
"installationFree": true
|
||||
"installationFree": false
|
||||
},
|
||||
"abilities": [
|
||||
{
|
||||
@@ -32,70 +34,67 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"visible": true,
|
||||
"orientation": "unspecified",
|
||||
"name": "com.ohos.contacts.MainAbility",
|
||||
"icon": "$media:app_icon",
|
||||
"visible": true,
|
||||
"srcPath": "MainAbility",
|
||||
"name": ".MainAbility",
|
||||
"srcLanguage": "ets",
|
||||
"icon": "$media:ic_contact_icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:app_name",
|
||||
"formsEnabled": false,
|
||||
"type": "page",
|
||||
"launchType": "singleton",
|
||||
"srcPath": "default",
|
||||
"srcLanguage": "js"
|
||||
},
|
||||
{
|
||||
"srcPath": "ServiceAbility",
|
||||
"name": ".ServiceAbility",
|
||||
"icon": "$media:icon",
|
||||
"srcLanguage": "js",
|
||||
"description": "service",
|
||||
"type": "service"
|
||||
"launchType": "singleton"
|
||||
}
|
||||
],
|
||||
"js": [
|
||||
{
|
||||
"mode": {
|
||||
"syntax": "ets",
|
||||
"type": "pageAbility"
|
||||
},
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/navigation/navigation",
|
||||
"pages/contacts/contacts",
|
||||
"pages/contacts/contactDetail/contactDetail",
|
||||
"pages/contacts/accountants/accountants",
|
||||
"pages/contacts/accountants/takephone/takephone",
|
||||
"pages/dialer/speeddial/speeddial",
|
||||
"pages/dialer/speeddial/selectcontact/selectcontact",
|
||||
"pages/contacts/settings/settings",
|
||||
"pages/contacts/settings/about/about",
|
||||
"pages/contacts/settings/manage/manage",
|
||||
"pages/contacts/settings/manage/merge/merge",
|
||||
"pages/contacts/settings/manage/recentlydel/recentlydel",
|
||||
"pages/contacts/settings/manage/recentlydel/recover/recover",
|
||||
"pages/contacts/settings/imorexport/imorexport",
|
||||
"pages/contacts/settings/display/display",
|
||||
"pages/contacts/settings/display/customize/customize",
|
||||
"pages/contacts/settings/about/license/license",
|
||||
"pages/contacts/settings/shareContactsList/shareContactsList",
|
||||
"pages/contacts/groups/groups",
|
||||
"pages/contacts/groups/groupMembersList/groupMembersList",
|
||||
"pages/contacts/groups/deleteGroup/deleteGroup",
|
||||
"pages/contacts/groups/selectGroupMembers/selectGroupMembers",
|
||||
"pages/contacts/groups/recentContacts/recentContacts",
|
||||
"pages/contacts/groups/recentContacts/recentContactsList/recentContactsList",
|
||||
"pages/contacts/batchselectcontacts/batchselectcontacts",
|
||||
"pages/contacts/groups/groupListWithContacts/groupListWithContacts",
|
||||
"pages/contacts/card/card",
|
||||
"pages/contacts/contacts",
|
||||
"pages/contacts/selectContactsList/selectContactsList",
|
||||
"pages/dialer/calllogdelete/calllogdelete",
|
||||
"pages/dialer/greeting/greeting",
|
||||
"pages/dialer/voicemailsettings/voicemailsettings",
|
||||
"pages/index_demo/index"
|
||||
"pages/Index",
|
||||
"pages/contacts/accountants/Accountants",
|
||||
"pages/dialer/callRecord/CallRecord",
|
||||
"pages/contacts/details/ContactDetail",
|
||||
"pages/dialer/DialerTablet",
|
||||
"pages/contacts/batchselectcontacts/BatchSelectContactsPage"
|
||||
],
|
||||
"name": "default",
|
||||
"name": ".MainAbility",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"defPermissions": [
|
||||
{
|
||||
"name": "com.ohos.contacts.DataAbilityShellProvider.PROVIDER"
|
||||
}
|
||||
],
|
||||
"reqPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.VIBRATE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_CONTACTS"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.WRITE_CONTACTS"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.MANAGE_VOICEMAIL"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_CALL_LOG"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.PLACE_CALL"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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 IAccountTypeService from './IAccountTypeService';
|
||||
import PhoneAccountType from './type/PhoneAccountType';
|
||||
import AccountType from './type/AccountType';
|
||||
|
||||
|
||||
/**
|
||||
* 账户类型服务类,账户类型持有联系人详情如何展示等账号特征信息
|
||||
*/
|
||||
export default class AccountTypeService implements IAccountTypeService {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
getAccountType(accountType: string) {
|
||||
return new PhoneAccountType();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 AccountType from './type/AccountType';
|
||||
|
||||
/**
|
||||
* 账户类型服务类,账户类型持有联系人详情如何展示等账号特征信息
|
||||
*/
|
||||
export default interface AccountTypeService {
|
||||
getAccountType: (accountType: string) => AccountType;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 基础账户类型
|
||||
*/
|
||||
export default abstract class AccountType {
|
||||
static readonly PHONE_ACCOUNT_TYPE: string = "com.android.huawei.phone";
|
||||
static readonly PAGE_SETTING_TYPE: string = "com.android.huawei.setting";
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
@@ -12,13 +12,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import app from '@system.app'
|
||||
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
|
||||
|
||||
describe('appInfoTest', function () {
|
||||
it('app_info_test_001', 0, function () {
|
||||
var info = app.getInfo()
|
||||
expect(info.versionName).assertEqual('1.0')
|
||||
expect(info.versionCode).assertEqual('3')
|
||||
})
|
||||
})
|
||||
import EditType from './EditType';
|
||||
|
||||
/**
|
||||
* 描述如何展示和编辑联系人单条Data数据
|
||||
*/
|
||||
export default class DataKind {
|
||||
readonly mimeType: string;
|
||||
readonly typeList: EditType[] = [];
|
||||
|
||||
constructor(mineType: string, typeList: EditType[]) {
|
||||
this.mimeType = mineType;
|
||||
this.typeList = typeList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 描述联系人数据类型中的一项,包括国际化资源,类型对应在数据库中的值
|
||||
*/
|
||||
export default class EditType {
|
||||
readonly rawValue: number;
|
||||
readonly labelRes: Resource;
|
||||
|
||||
constructor(rawValue: number, labelRes: Resource) {
|
||||
this.rawValue = rawValue;
|
||||
this.labelRes = labelRes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* 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 AccountType from './AccountType';
|
||||
import DataKind from './DataKind';
|
||||
import EditType from './EditType';
|
||||
import Phone from '../../contact/contract/Phone';
|
||||
import Email from '../../contact/contract/Email';
|
||||
import House from '../../contact/contract/House';
|
||||
import Birthday from '../../contact/contract/Birthday';
|
||||
import Aim from '../../contact/contract/Aim';
|
||||
import Im from '../../contact/contract/Im';
|
||||
import StructuredPostal from '../../contact/contract/StructuredPostal';
|
||||
import Event from '../../contact/contract/Event';
|
||||
import Relation from '../../contact/contract/Relation';
|
||||
|
||||
/**
|
||||
* 电话账户类型
|
||||
*/
|
||||
export default class PhoneAccountType extends AccountType {
|
||||
static readonly TYPE_KEY: string = AccountType.PHONE_ACCOUNT_TYPE;
|
||||
readonly mineKinds: Map<string, DataKind> = new Map();
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.init();
|
||||
}
|
||||
|
||||
private init() {
|
||||
this.addDataKindPhone();
|
||||
this.addDataKindEmail();
|
||||
this.addDataKindIm();
|
||||
this.addDataKindStructuredPostal();
|
||||
this.addDataKindEvent();
|
||||
this.addDataKindRelation();
|
||||
this.addDataKindAim();
|
||||
this.addDataKindBirthday();
|
||||
this.addDataKindHouse();
|
||||
}
|
||||
|
||||
private addDataKindPhone() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_MOBILE));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_WORK));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_HOME));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_MAIN));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_FAX_WORK));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_FAX_HOME));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_PAGER));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_OTHER));
|
||||
typeList.push(this.buildPhoneType(Phone.TYPE_CUSTOM));
|
||||
let kind = new DataKind(Phone.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(Phone.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindEmail() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildEmailType(Email.TYPE_HOME));
|
||||
typeList.push(this.buildEmailType(Email.TYPE_WORK));
|
||||
typeList.push(this.buildEmailType(Email.TYPE_OTHER));
|
||||
typeList.push(this.buildEmailType(Email.TYPE_CUSTOM));
|
||||
let kind = new DataKind(Email.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(Email.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindIm() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildImType(Im.TYPE_AIM));
|
||||
typeList.push(this.buildImType(Im.TYPE_MSN));
|
||||
typeList.push(this.buildImType(Im.TYPE_YAHOO));
|
||||
typeList.push(this.buildImType(Im.TYPE_SKYPE));
|
||||
typeList.push(this.buildImType(Im.TYPE_QQ));
|
||||
typeList.push(this.buildImType(Im.TYPE_GOOGLE_TALK));
|
||||
typeList.push(this.buildImType(Im.TYPE_JABBER));
|
||||
typeList.push(this.buildImType(Im.TYPE_CUSTOM));
|
||||
let kind = new DataKind(Im.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(Im.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindStructuredPostal() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildEmailType(StructuredPostal.TYPE_HOME));
|
||||
typeList.push(this.buildEmailType(StructuredPostal.TYPE_WORK));
|
||||
typeList.push(this.buildEmailType(StructuredPostal.TYPE_OTHER));
|
||||
typeList.push(this.buildEmailType(StructuredPostal.TYPE_CUSTOM));
|
||||
let kind = new DataKind(StructuredPostal.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(StructuredPostal.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindEvent() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildEventType(Event.TYPE_BIRTHDAY));
|
||||
typeList.push(this.buildEventType(Event.TYPE_LUNARBIRTHDAY));
|
||||
typeList.push(this.buildEventType(Event.TYPE_ANNIVERSARY));
|
||||
typeList.push(this.buildEventType(Event.TYPE_OTHER));
|
||||
typeList.push(this.buildEventType(Event.TYPE_CUSTOM));
|
||||
let kind = new DataKind(Event.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(Event.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindAim() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildAimType(Aim.TYPE_AIM));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_WINDOWSLIVE));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_YAHOO));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_SKYPE));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_QQ));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_HANGOUTS));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_ICQ));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_JABBER));
|
||||
typeList.push(this.buildAimType(Aim.TYPE_CUSTOM));
|
||||
|
||||
let kind = new DataKind(Aim.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(Aim.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindRelation() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_ASSISTANT));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_BROTHER));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_CHILD));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_DOMESTIC_PARTNER));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_FATHER));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_MANAGER));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_MOTHER));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_PARENTS));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_PARTNER));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_REFERRED_BY));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_RELATIVE));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_SISTERS));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_SPOUSES));
|
||||
typeList.push(this.buildRelationType(Relation.TYPE_CUSTOM));
|
||||
let kind = new DataKind(Relation.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(Relation.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindBirthday() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildBirthdayType(Birthday.TYPE_GREBIRTHDAY));
|
||||
typeList.push(this.buildBirthdayType(Birthday.TYPE_LUNARBIRTHDAY));
|
||||
typeList.push(this.buildBirthdayType(Birthday.TYPE_ANNIVERSARIES));
|
||||
typeList.push(this.buildBirthdayType(Birthday.TYPE_OTHER));
|
||||
|
||||
let kind = new DataKind(Birthday.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(Birthday.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private addDataKindHouse() {
|
||||
let typeList: EditType[] = [];
|
||||
typeList.push(this.buildHouseType(House.TYPE_DWELLING));
|
||||
typeList.push(this.buildHouseType(House.TYPE_POSITION));
|
||||
typeList.push(this.buildHouseType(House.TYPE_OTHER));
|
||||
typeList.push(this.buildHouseType(House.TYPE_CUSTOM));
|
||||
|
||||
let kind = new DataKind(House.CONTENT_ITEM_TYPE, typeList);
|
||||
this.mineKinds.set(House.CONTENT_ITEM_TYPE, kind);
|
||||
}
|
||||
|
||||
private buildHouseType(type: number) {
|
||||
return new EditType(type, House.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildPhoneType(type: number) {
|
||||
return new EditType(type, Phone.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildEmailType(type: number) {
|
||||
return new EditType(type, Email.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildImType(type: number) {
|
||||
return new EditType(type, Im.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildStructuredPostalType(type: number) {
|
||||
return new EditType(type, StructuredPostal.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildEventType(type: number) {
|
||||
return new EditType(type, Event.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildBirthdayType(type: number) {
|
||||
return new EditType(type, Birthday.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildAimType(type: number) {
|
||||
return new EditType(type, Aim.getTypeLabelResource(type));
|
||||
}
|
||||
|
||||
private buildRelationType(type: number) {
|
||||
return new EditType(type, Relation.getTypeLabelResource(type));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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 AppStorageUtil from './util/AppStorageUtil';
|
||||
import HiLog from './util/HiLog';
|
||||
|
||||
const TAG = "APP ";
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
HiLog.i(TAG, 'Application onCreate');
|
||||
AppStorageUtil.initData();
|
||||
},
|
||||
onDestroy() {
|
||||
HiLog.i(TAG, 'Application onDestroy');
|
||||
},
|
||||
}
|
||||
|
||||
export interface LooseObject {
|
||||
[key: string]: any
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
/**
|
||||
* 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 ICallLogService from './ICallLogService';
|
||||
import CallLog from './entity/CallLog';
|
||||
import {CallType} from './entity/CallLog';
|
||||
import ArrayUtil from '../util/ArrayUtil';
|
||||
import MergedCallLog from './entity/MergedCallLog';
|
||||
import StringUtil from '../util/StringUtil';
|
||||
|
||||
|
||||
/**
|
||||
* 账户类型服务类,账户类型持有联系人详情如何展示等账号特征信息
|
||||
*/
|
||||
export default class CallLogService implements ICallLogService {
|
||||
private static instance: CallLogService;
|
||||
|
||||
private constructor() {
|
||||
}
|
||||
|
||||
public static getInstance(): CallLogService {
|
||||
if (!CallLogService.instance) {
|
||||
CallLogService.instance = new CallLogService()
|
||||
}
|
||||
return CallLogService.instance
|
||||
}
|
||||
|
||||
/**
|
||||
* 按时间合并情况下,在原通话记录数据基础上完善通话记录业务数据后处理
|
||||
*
|
||||
* @param callLogList 通话记录
|
||||
* @return
|
||||
*/
|
||||
mergeByTime(callLogList: CallLog[]) {
|
||||
var resultList = [];
|
||||
if (ArrayUtil.isEmpty(callLogList)) {
|
||||
return resultList;
|
||||
}
|
||||
let tempElement = new MergedCallLog(callLogList[0]); // 从第一条记录开始,缓存通话记录
|
||||
var tempCallTime = callLogList[0].createTime; // 保留最近一条记录的创建时间,在通话记录合并后,显示该时间。
|
||||
var tempCallType = callLogList[0].callType; // 保留最近一条记录的通话记录类型,在通话记录合并后,显示该类型。
|
||||
var num = 1;
|
||||
var ids = [];
|
||||
ids.push(callLogList[0].id);
|
||||
for (var i = 1; i < callLogList.length; i++) {
|
||||
var element = callLogList[i];
|
||||
if (this.callLogMergeCheck(tempElement, element)) { // 缓存字段与当前字段校验是否需要合并
|
||||
num++;
|
||||
ids.push(element.id); // 将最新记录id放入合并数组
|
||||
} else {
|
||||
/* 最新数据和缓存不一致,则替换缓存数据的num及ids数据,并将缓存的数据记录放入结果集*/
|
||||
tempElement.count = num;
|
||||
tempElement.ids = ids;
|
||||
tempElement.createTime = this.formatTime(tempCallTime); // 显示已保存的最近一条记录的创建时间
|
||||
tempElement.callType = tempCallType;
|
||||
resultList.push(tempElement);
|
||||
/* 重置num及ids为最新计数及记录 ,重置tempCallTime为下条记录的最新创建时间*/
|
||||
num = 1;
|
||||
ids = [];
|
||||
tempCallTime = element.createTime;
|
||||
tempCallType = element.callType;
|
||||
ids.push(element.id);
|
||||
}
|
||||
tempElement = new MergedCallLog(element);
|
||||
}
|
||||
/* 将最后一条缓存数据放入结果集*/
|
||||
if (tempElement != null) {
|
||||
tempElement.count = num;
|
||||
tempElement.ids = ids;
|
||||
tempElement.createTime = this.formatTime(tempCallTime);
|
||||
tempElement.callType = tempCallType;
|
||||
resultList.push(tempElement);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按联系人合并的情况下,在原通话记录数据基础上完善通话记录业务数据后处理
|
||||
*
|
||||
* @param {Array} callLogList 通话记录
|
||||
* @return {Array} 通话记录
|
||||
*/
|
||||
mergeByContact(callLogs: CallLog[]) {
|
||||
var resultList = [];
|
||||
if (ArrayUtil.isEmpty(callLogs)) {
|
||||
return resultList;
|
||||
}
|
||||
var contactTempMap = new Map();
|
||||
var phoneNumberMap = new Map();
|
||||
for (var i = 0; i < callLogs.length; i++) {
|
||||
var element = new MergedCallLog(callLogs[i]);
|
||||
element.createTime = this.formatTime(callLogs[i].createTime);
|
||||
element.count = 1; // 按联系人合并的情况下,合并记录条目固定为1
|
||||
element.ids = [callLogs[i].id]; // 按联系人合并的情况下,合并记录ids固定为本身id
|
||||
if (StringUtil.isEmpty(element.quickSearchKey)) { // 没有联系人的通话记录,按照电话号码合并
|
||||
if (!phoneNumberMap.has(element.phoneNumber)) {
|
||||
resultList.push(element);
|
||||
phoneNumberMap.set(element.phoneNumber, callLogs[i].phoneNumber);
|
||||
}
|
||||
} else { // 有联系人的通话记录,按照联系人合并
|
||||
let isContactKey = contactTempMap.has(element.quickSearchKey);
|
||||
if (!isContactKey) {
|
||||
resultList.push(element);
|
||||
contactTempMap.set(element.quickSearchKey, callLogs[i].quickSearchKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通话时间
|
||||
*
|
||||
* @param date 通话记录创建时间戳
|
||||
* @return {object} 通话时间
|
||||
*/
|
||||
formatTime(date) {
|
||||
let result = "";
|
||||
if (isNaN(date)) { // 非数字时,不进行解析
|
||||
return date;
|
||||
}
|
||||
var timestamp = parseInt(date) * 1000;
|
||||
// 通话时间
|
||||
let callTime = new Date(timestamp);
|
||||
// 当前时间
|
||||
let now = new Date();
|
||||
if (callTime.getTime() > now.getTime()) {
|
||||
result = callTime.getFullYear() + '/' + (callTime.getMonth() + 1) + '/' + callTime.getDate();
|
||||
} else if (callTime.getFullYear() == now.getFullYear()) {
|
||||
// 同年
|
||||
if (callTime.getMonth() == now.getMonth()) {
|
||||
// 同年同月
|
||||
let timeDiff = parseInt(((now.getTime() - callTime.getTime()) / 60000).toString());
|
||||
let dayDiff = now.getDate() - callTime.getDate();
|
||||
if (dayDiff == 0) {
|
||||
// 同天
|
||||
if (timeDiff == 0) {
|
||||
result = '刚刚';
|
||||
} else if (timeDiff < 60) {
|
||||
result = timeDiff + '分钟前';
|
||||
} else {
|
||||
// 'hh:mm'
|
||||
result = callTime.getHours()
|
||||
+ ':' + (callTime.getMinutes() < 10 ? '0' + callTime.getMinutes() : callTime.getMinutes());
|
||||
}
|
||||
} else if (dayDiff == 1) {
|
||||
// 昨天
|
||||
result = '昨天';
|
||||
} else {
|
||||
result = (callTime.getMonth() + 1) + '/' + callTime.getDate(); // 'MM/dd'
|
||||
}
|
||||
} else {
|
||||
result = (callTime.getMonth() + 1) + '/' + callTime.getDate();
|
||||
}
|
||||
} else {
|
||||
// 'yyyy/MM/dd'
|
||||
result = callTime.getFullYear() + '/' + (callTime.getMonth() + 1) + '/' + callTime.getDate();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按时间合并情况下,校验两条通话记录是否需要合并,需要合并返回true,否则返回false
|
||||
*
|
||||
* @param oldElement 合并前通话记录
|
||||
* @param newElement 合并后通话记录
|
||||
* @return
|
||||
*/
|
||||
private callLogMergeCheck(oldElement: MergedCallLog, newElement: CallLog) {
|
||||
/* 合并规则:
|
||||
1.电话号码相同前提下才会合并。
|
||||
2.号码相同的前提下,呼叫类型为1,2或3,5则合并。1,2和3,5类型不合并。
|
||||
*/
|
||||
if (oldElement.phoneNumber.trim() == newElement.phoneNumber.trim()) { // 电话号码相同
|
||||
if (oldElement.callType == CallType.IN || oldElement.callType == CallType.OUT) {
|
||||
if (newElement.callType == CallType.IN || newElement.callType == CallType.OUT) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (newElement.callType == CallType.MISSED || newElement.callType == CallType.REJECTED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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 CallLog from './entity/CallLog';
|
||||
import MergedCallLog from '../call/entity/MergedCallLog';
|
||||
|
||||
/**
|
||||
* 通话记录服务类,仅包含通话记录相关,非拨号盘
|
||||
*/
|
||||
export default interface ICallLogService {
|
||||
mergeByTime: (callLogs: CallLog[]) => MergedCallLog[];
|
||||
mergeByContact: (callLogs: CallLog[]) => MergedCallLog[];
|
||||
formatTime: (date :number) => string;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export enum AnswerState {
|
||||
MISSED = 0,
|
||||
RECEIVED = 1,
|
||||
REJECT = 2
|
||||
}
|
||||
|
||||
export enum Direction {
|
||||
IN = 0,
|
||||
OUT = 1
|
||||
}
|
||||
|
||||
export default class Calls {
|
||||
static readonly CONTENT_URI: string = "dataability:///com.ohos.calllogability";
|
||||
|
||||
static readonly CALL_LOG_URI: string = Calls.CONTENT_URI + "/calls/calllog";
|
||||
|
||||
static readonly ID: string = "id";
|
||||
|
||||
static readonly PHONE_NUMBER: string = "phone_number";
|
||||
|
||||
static readonly DISPLAY_NAME: string = "display_name";
|
||||
|
||||
static readonly CALL_DIRECTION: string = "call_direction";
|
||||
|
||||
static readonly VOICEMAIL_URI: string = "voicemail_uri";
|
||||
|
||||
static readonly SIM_TYPE: string = "sim_type";
|
||||
|
||||
static readonly IS_HD: string = "is_hd";
|
||||
|
||||
static readonly IS_READ: string = "is_read";
|
||||
|
||||
static readonly RING_DURATION: string = "ring_duration";
|
||||
|
||||
static readonly TALK_DURATION: string = "talk_duration";
|
||||
|
||||
static readonly FORMAT_NUMBER: string = "format_number";
|
||||
|
||||
static readonly QUICK_SEARCH_KEY: string = "quicksearch_key";
|
||||
|
||||
static readonly NUMBER_TYPE: string = "number_type";
|
||||
|
||||
static readonly NUMBER_TYPE_NAME: string = "number_type_name";
|
||||
|
||||
static readonly BEGIN_TIME: string = "begin_time";
|
||||
|
||||
static readonly END_TIME: string = "end_time";
|
||||
|
||||
static readonly ANSWER_STATE: string = "answer_state";
|
||||
|
||||
static readonly CREATE_TIME: string = "create_time";
|
||||
|
||||
static readonly NUMBER_LOCATION: string = "number_location";
|
||||
|
||||
static readonly PHOTO_ID: string = "photo_id";
|
||||
|
||||
static readonly PHOTO_URI: string = "photo_uri";
|
||||
|
||||
static readonly COUNTRY_ISO_CODE: string = "country_iso_code";
|
||||
|
||||
static readonly EXTRA1: string = "extra1";
|
||||
|
||||
static readonly EXTRA2: string = "extra2";
|
||||
|
||||
static readonly EXTRA3: string = "extra3";
|
||||
|
||||
static readonly EXTRA4: string = "extra4";
|
||||
|
||||
static readonly EXTRA5: string = "extra5";
|
||||
|
||||
static readonly EXTRA6: string = "extra6";
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export default class VoiceMail {
|
||||
static readonly CONTACT_URI: string = "dataability:///com.ohos.voicemailability";
|
||||
|
||||
static readonly ID: string = "id";
|
||||
|
||||
static readonly PHONE_NUMBER: string = "phone_number";
|
||||
|
||||
static readonly QUICK_SEARCH_KEY: string = "quicksearch_key";
|
||||
|
||||
static readonly DISPLAY_NAME: string = "display_name";
|
||||
|
||||
static readonly VOICEMAIL_URI: string = "voicemail_uri";
|
||||
|
||||
static readonly VOICEMAIL_TYPE: string = "voicemail_type";
|
||||
|
||||
static readonly VOICE_FILE_SIZE: string = "voice_file_size";
|
||||
|
||||
static readonly VOICE_DURATION: string = "voice_duration";
|
||||
|
||||
static readonly VOICE_STATUS: string = "voice_status";
|
||||
|
||||
static readonly ORIGIN_TYPE: string = "origin_type";
|
||||
|
||||
static readonly CREATE_TIME: string = "create_time";
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* 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 CallLogBuilder from '../entity/CallLogBuilder';
|
||||
import {Direction, AnswerState} from '../contract/Calls';
|
||||
|
||||
export enum CallType {
|
||||
IN = 1,
|
||||
OUT = 2,
|
||||
VOICEMAIL = 4,
|
||||
MISSED = 3,
|
||||
REJECTED = 5
|
||||
}
|
||||
|
||||
export default class CallLog {
|
||||
readonly id: number = -1;
|
||||
readonly phoneNumber: string;
|
||||
readonly displayName: string;
|
||||
readonly callDirection: number;
|
||||
readonly voicemailUri: string;
|
||||
readonly simType: number;
|
||||
readonly isHD: boolean;
|
||||
readonly isRead: boolean;
|
||||
readonly ringDuration: number;
|
||||
readonly talkDuration: number;
|
||||
readonly formattedNumber: string;
|
||||
readonly quickSearchKey: string;
|
||||
readonly numberType: number;
|
||||
readonly numberTypeName: string;
|
||||
readonly beginTime: number;
|
||||
readonly endTime: number;
|
||||
readonly answerState: number;
|
||||
readonly createTime: number;
|
||||
readonly numberLocation: string;
|
||||
readonly photoId: number;
|
||||
readonly photoUri: string;
|
||||
readonly countryIsoCode: number;
|
||||
readonly callType: number;
|
||||
|
||||
constructor(builder: CallLogBuilder) {
|
||||
this.id = builder.id;
|
||||
this.phoneNumber = builder.phoneNumber;
|
||||
this.displayName = builder.displayName;
|
||||
this.callDirection = builder.callDirection;
|
||||
this.simType = builder.simType;
|
||||
this.isHD = builder.isHD;
|
||||
this.isRead = builder.isRead;
|
||||
this.ringDuration = builder.ringDuration;
|
||||
this.talkDuration = builder.talkDuration;
|
||||
this.formattedNumber = builder.formattedNumber;
|
||||
this.quickSearchKey = builder.quickSearchKey;
|
||||
this.numberType = builder.numberType;
|
||||
this.numberTypeName = builder.numberTypeName;
|
||||
this.beginTime = builder.beginTime;
|
||||
this.endTime = builder.endTime;
|
||||
this.answerState = builder.answerState;
|
||||
this.createTime = builder.createTime;
|
||||
this.numberLocation = builder.numberLocation;
|
||||
this.photoId = builder.photoId;
|
||||
this.photoUri = builder.photoUri;
|
||||
this.countryIsoCode = builder.countryIsoCode;
|
||||
this.callType = this.getCallLogType();
|
||||
}
|
||||
|
||||
private getCallLogType() {
|
||||
if (this.callDirection == Direction.IN) {
|
||||
if (this.answerState == AnswerState.RECEIVED) {
|
||||
return CallType.IN;
|
||||
}
|
||||
if (this.answerState == AnswerState.MISSED) {
|
||||
return CallType.MISSED;
|
||||
}
|
||||
if (this.answerState == AnswerState.REJECT) {
|
||||
return CallType.REJECTED;
|
||||
}
|
||||
} else {
|
||||
return CallType.OUT;
|
||||
}
|
||||
}
|
||||
|
||||
linkContact() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 将通话记录配置为已读
|
||||
*/
|
||||
read() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* 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 Calls from '../contract/Calls';
|
||||
|
||||
export default class CallLogBuilder {
|
||||
readonly id: number = -1;
|
||||
readonly phoneNumber: string;
|
||||
displayName: string;
|
||||
callDirection: number;
|
||||
voicemailUri: string;
|
||||
simType: number;
|
||||
isHD: boolean;
|
||||
isRead: boolean;
|
||||
ringDuration: number;
|
||||
talkDuration: number;
|
||||
formattedNumber: string;
|
||||
quickSearchKey: string;
|
||||
numberType: number;
|
||||
numberTypeName: string;
|
||||
beginTime: number;
|
||||
endTime: number;
|
||||
answerState: number;
|
||||
createTime: number;
|
||||
numberLocation: string;
|
||||
photoId: number;
|
||||
photoUri: string;
|
||||
countryIsoCode: number;
|
||||
|
||||
constructor(id: number, phoneNumber: string) {
|
||||
this.id = id;
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
static fromResultSet(resultSet: any): CallLogBuilder{
|
||||
let callLogBuilder = new CallLogBuilder(resultSet.getLong(resultSet.getColumnIndex(Calls.ID)),
|
||||
resultSet.getString(resultSet.getColumnIndex(Calls.PHONE_NUMBER)));
|
||||
callLogBuilder.setDisplayName(resultSet.getString(resultSet.getColumnIndex(Calls.DISPLAY_NAME)));
|
||||
callLogBuilder.setCallDirection(resultSet.getLong(resultSet.getColumnIndex(Calls.CALL_DIRECTION)));
|
||||
callLogBuilder.setDisplayName(resultSet.getString(resultSet.getColumnIndex(Calls.DISPLAY_NAME)));
|
||||
callLogBuilder.setVoicemailUri(resultSet.getString(resultSet.getColumnIndex(Calls.VOICEMAIL_URI)));
|
||||
callLogBuilder.setSimType(resultSet.getLong(resultSet.getColumnIndex(Calls.SIM_TYPE)));
|
||||
callLogBuilder.setIsHD(resultSet.getLong(resultSet.getColumnIndex(Calls.IS_HD)) > 0 ? true : false);
|
||||
callLogBuilder.setIsRead(resultSet.getLong(resultSet.getColumnIndex(Calls.IS_READ)) > 0 ? true : false);
|
||||
callLogBuilder.setRingDuration(resultSet.getLong(resultSet.getColumnIndex(Calls.RING_DURATION)));
|
||||
callLogBuilder.setTalkDuration(resultSet.getLong(resultSet.getColumnIndex(Calls.TALK_DURATION)));
|
||||
callLogBuilder.setFormattedNumber(resultSet.getString(resultSet.getColumnIndex(Calls.FORMAT_NUMBER)));
|
||||
callLogBuilder.setQuickSearchKey(resultSet.getString(resultSet.getColumnIndex(Calls.QUICK_SEARCH_KEY)));
|
||||
callLogBuilder.setNumberType(resultSet.getLong(resultSet.getColumnIndex(Calls.NUMBER_TYPE)));
|
||||
callLogBuilder.setNumberTypeName(resultSet.getString(resultSet.getColumnIndex(Calls.NUMBER_TYPE_NAME)));
|
||||
callLogBuilder.setBeginTime(resultSet.getLong(resultSet.getColumnIndex(Calls.BEGIN_TIME)));
|
||||
callLogBuilder.setEndTime(resultSet.getLong(resultSet.getColumnIndex(Calls.END_TIME)));
|
||||
callLogBuilder.setAnswerState(resultSet.getLong(resultSet.getColumnIndex(Calls.ANSWER_STATE)));
|
||||
callLogBuilder.setCreateTime(resultSet.getLong(resultSet.getColumnIndex(Calls.CREATE_TIME)));
|
||||
callLogBuilder.setNumberLocation(resultSet.getString(resultSet.getColumnIndex(Calls.NUMBER_LOCATION)));
|
||||
callLogBuilder.setPhotoUri(resultSet.getString(resultSet.getColumnIndex(Calls.PHOTO_URI)));
|
||||
callLogBuilder.setPhotoId(resultSet.getLong(resultSet.getColumnIndex(Calls.PHOTO_ID)));
|
||||
callLogBuilder.setCountryIsoCode(resultSet.getLong(resultSet.getColumnIndex(Calls.COUNTRY_ISO_CODE)));
|
||||
return callLogBuilder;
|
||||
}
|
||||
|
||||
setDisplayName(displayName: string) {
|
||||
this.displayName = displayName;
|
||||
return this;
|
||||
}
|
||||
|
||||
setCallDirection(callDirection: number) {
|
||||
this.callDirection = callDirection;
|
||||
return this;
|
||||
}
|
||||
|
||||
setVoicemailUri(voicemailUri: string) {
|
||||
this.voicemailUri = voicemailUri;
|
||||
return this;
|
||||
}
|
||||
|
||||
setSimType(simType: number) {
|
||||
this.simType = simType;
|
||||
return this;
|
||||
}
|
||||
|
||||
setIsHD(isHD: boolean) {
|
||||
this.isHD = isHD;
|
||||
return this;
|
||||
}
|
||||
|
||||
setIsRead(isRead: boolean) {
|
||||
this.isRead = isRead;
|
||||
return this;
|
||||
}
|
||||
|
||||
setRingDuration(ringDuration: number) {
|
||||
this.ringDuration = ringDuration;
|
||||
return this;
|
||||
}
|
||||
|
||||
setTalkDuration(talkDuration: number) {
|
||||
this.talkDuration = talkDuration;
|
||||
return this;
|
||||
}
|
||||
|
||||
setFormattedNumber(formattedNumber: string) {
|
||||
this.formattedNumber = formattedNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
setQuickSearchKey(quickSearchKey: string) {
|
||||
this.quickSearchKey = quickSearchKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
setNumberType(numberType: number) {
|
||||
this.numberType = numberType;
|
||||
return this;
|
||||
}
|
||||
|
||||
setNumberTypeName(numberTypeName: string) {
|
||||
this.numberTypeName = numberTypeName;
|
||||
return this;
|
||||
}
|
||||
|
||||
setBeginTime(beginTime: number) {
|
||||
this.beginTime = beginTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
setEndTime(endTime: number) {
|
||||
this.endTime = endTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
setAnswerState(answerState: number) {
|
||||
this.answerState = answerState;
|
||||
return this;
|
||||
}
|
||||
|
||||
setCreateTime(createTime: number) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
setNumberLocation(numberLocation: string) {
|
||||
this.numberLocation = numberLocation;
|
||||
return this;
|
||||
}
|
||||
|
||||
setPhotoId(photoId: number) {
|
||||
this.photoId = photoId;
|
||||
return this;
|
||||
}
|
||||
|
||||
setPhotoUri(photoUri: string) {
|
||||
this.photoUri = photoUri;
|
||||
return this;
|
||||
}
|
||||
|
||||
setCountryIsoCode(countryIsoCode: number) {
|
||||
this.countryIsoCode = countryIsoCode;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 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 CallLog from '../entity/CallLog';
|
||||
|
||||
export default class MergedCallLog {
|
||||
id: number;
|
||||
createTime: string;
|
||||
count: number;
|
||||
ids: number[];
|
||||
callType: number;
|
||||
phoneNumber: string;
|
||||
displayName: string;
|
||||
quickSearchKey: string;
|
||||
numberLocation: string;
|
||||
formattedNumber: string;
|
||||
simType: number;
|
||||
|
||||
constructor(callLog: CallLog) {
|
||||
this.id = callLog.id;
|
||||
this.callType = callLog.callType;
|
||||
this.phoneNumber = callLog.phoneNumber;
|
||||
this.displayName = callLog.displayName;
|
||||
this.quickSearchKey = callLog.quickSearchKey;
|
||||
this.numberLocation = callLog.numberLocation;
|
||||
this.formattedNumber = callLog.formattedNumber;
|
||||
this.simType = callLog.simType;
|
||||
this.ids = [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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 CallLog from '../entity/CallLog';
|
||||
import Calls from '../contract/Calls';
|
||||
|
||||
export default class CallLogDelta {
|
||||
readonly callLog: CallLog;
|
||||
constructor(callLog: CallLog) {
|
||||
this.callLog = callLog;
|
||||
}
|
||||
|
||||
createValuesBucket(): {} {
|
||||
if (!this.callLog) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return {
|
||||
[Calls.PHONE_NUMBER]: this.callLog.phoneNumber,
|
||||
[Calls.DISPLAY_NAME]: this.callLog.displayName,
|
||||
[Calls.CALL_DIRECTION]: this.callLog.callDirection,
|
||||
[Calls.VOICEMAIL_URI]: this.callLog.voicemailUri,
|
||||
[Calls.SIM_TYPE]: this.callLog.simType,
|
||||
[Calls.IS_HD]: this.callLog.isHD,
|
||||
[Calls.IS_READ]: this.callLog.isRead,
|
||||
[Calls.RING_DURATION]: this.callLog.ringDuration,
|
||||
[Calls.TALK_DURATION]: this.callLog.talkDuration,
|
||||
[Calls.FORMAT_NUMBER]: this.callLog.formattedNumber,
|
||||
[Calls.QUICK_SEARCH_KEY]: this.callLog.quickSearchKey,
|
||||
[Calls.NUMBER_TYPE]: this.callLog.numberType,
|
||||
[Calls.BEGIN_TIME]: this.callLog.beginTime,
|
||||
[Calls.END_TIME]: this.callLog.endTime,
|
||||
[Calls.ANSWER_STATE]: this.callLog.answerState,
|
||||
[Calls.CREATE_TIME]: this.callLog.createTime,
|
||||
[Calls.NUMBER_LOCATION]: this.callLog.numberLocation,
|
||||
[Calls.PHOTO_ID]: this.callLog.photoId,
|
||||
[Calls.PHOTO_URI]: this.callLog.photoUri,
|
||||
[Calls.COUNTRY_ISO_CODE]: this.callLog.countryIsoCode,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* 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 ICallLogRepository from './ICallLogRepository';
|
||||
import CallLog from '../entity/CallLog';
|
||||
import CallLogBuilder from '../entity/CallLogBuilder';
|
||||
import Calls from '../contract/Calls';
|
||||
import CallLogDelta from './CallLogDelta';
|
||||
import FeatureAbility from '@ohos.ability.featureAbility';
|
||||
import HiLog from '../../util/HiLog';
|
||||
import ArrayUtil from '../../util/ArrayUtil';
|
||||
import StringUtil from '../../util/StringUtil';
|
||||
import DataAbility from '@ohos.data.dataAbility';
|
||||
|
||||
const TAG = "CallLogRepository";
|
||||
|
||||
/**
|
||||
* 账户类型服务类,账户类型持有联系人详情如何展示等账号特征信息
|
||||
*/
|
||||
export default class CallLogRepository implements ICallLogRepository {
|
||||
private static instance: CallLogRepository;
|
||||
private _dataAbilityHelper = FeatureAbility.acquireDataAbilityHelper(Calls.CONTENT_URI);
|
||||
|
||||
private constructor() {
|
||||
}
|
||||
|
||||
public static getInstance(): CallLogRepository {
|
||||
if (!CallLogRepository.instance) {
|
||||
CallLogRepository.instance = new CallLogRepository()
|
||||
}
|
||||
return CallLogRepository.instance
|
||||
}
|
||||
|
||||
private getDataAbilityHelper(){
|
||||
if (this._dataAbilityHelper == undefined || this._dataAbilityHelper == null || this._dataAbilityHelper.length == 0) {
|
||||
this._dataAbilityHelper = FeatureAbility.acquireDataAbilityHelper(Calls.CONTENT_URI);
|
||||
}
|
||||
return this._dataAbilityHelper;
|
||||
}
|
||||
|
||||
// 保存单个通话记录,当前无此场景,仅用于测试
|
||||
saveOne(callLog: CallLog) {
|
||||
let dataAbilityHelper = this.getDataAbilityHelper();
|
||||
return new Promise<number>(function (resolve, reject) {
|
||||
if (callLog.id <= 0) {
|
||||
let callLogDelta = new CallLogDelta(callLog);
|
||||
dataAbilityHelper.insert(Calls.CALL_LOG_URI, callLogDelta.createValuesBucket()).then(data => {
|
||||
resolve(data);
|
||||
}).catch(error => {
|
||||
HiLog.w(TAG, 'saveOne error:' + error);
|
||||
reject();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
save(callLogs: CallLog[]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
clear() {
|
||||
let dataAbilityHelper = this.getDataAbilityHelper();
|
||||
return new Promise<number>(function (resolve, reject) {
|
||||
let condition = new DataAbility.DataAbilityPredicates();
|
||||
dataAbilityHelper.delete(Calls.CALL_LOG_URI, condition).then(data => {
|
||||
resolve(data);
|
||||
}).catch(error => {
|
||||
HiLog.w(TAG, 'clear error:' + error);
|
||||
reject();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
deleteById(id: number) {
|
||||
return false;
|
||||
}
|
||||
|
||||
deleteByIdIn(ids: number[]) {
|
||||
let dataAbilityHelper = this.getDataAbilityHelper();
|
||||
return new Promise<number>(function (resolve, reject) {
|
||||
if (ArrayUtil.isEmpty(ids)) {
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
let condition = new DataAbility.DataAbilityPredicates();
|
||||
condition.in(Calls.ID, ids);
|
||||
dataAbilityHelper.delete(Calls.CALL_LOG_URI, condition).then(data => {
|
||||
resolve(data);
|
||||
}).catch(error => {
|
||||
HiLog.w(TAG, 'deleteByIdIn error:' + error);
|
||||
reject();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
deleteByNumber(number: string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
deleteByLookupUri(number: string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
readByNumber(number: string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
readById(id: number) {
|
||||
return false;
|
||||
}
|
||||
|
||||
findByCallDirectionIn(callTypes: number[]) {
|
||||
return new Promise<CallLog[]>(function (resolve, reject) {
|
||||
resolve([]);
|
||||
});
|
||||
}
|
||||
|
||||
findAll() {
|
||||
let dataAbilityHelper = this.getDataAbilityHelper();
|
||||
return new Promise<CallLog[]>(function (resolve, reject) {
|
||||
let condition = new DataAbility.DataAbilityPredicates();
|
||||
condition.limitAs(2000);
|
||||
condition.orderByDesc(Calls.CREATE_TIME);
|
||||
condition.offsetAs(0);
|
||||
dataAbilityHelper.query(Calls.CALL_LOG_URI, null, condition).then(resultSet => {
|
||||
let rst: CallLog[] = [];
|
||||
resultSet.goToFirstRow();
|
||||
do {
|
||||
let builder = CallLogBuilder.fromResultSet(resultSet);
|
||||
if (builder.id > 0) {
|
||||
rst.push(new CallLog(builder));
|
||||
}
|
||||
} while (resultSet.goToNextRow());
|
||||
resultSet.close();
|
||||
resolve(rst);
|
||||
}).catch(error => {
|
||||
HiLog.w(TAG, +'findAll error:' + error);
|
||||
reject();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
findByFeature(feature: number) {
|
||||
return [];
|
||||
}
|
||||
|
||||
findByNumberIn(numbers: number[]) {
|
||||
let dataAbilityHelper = this.getDataAbilityHelper();
|
||||
return new Promise<CallLog[]>(function (resolve, reject) {
|
||||
if (ArrayUtil.isEmpty(numbers)) {
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
let realPhoneNumbers = [];
|
||||
for (let key in numbers) {
|
||||
var phoneNumber = StringUtil.removeSpace(numbers[key].toString());
|
||||
realPhoneNumbers.push(phoneNumber);
|
||||
}
|
||||
let condition = new DataAbility.DataAbilityPredicates();
|
||||
condition.in(Calls.PHONE_NUMBER, realPhoneNumbers);
|
||||
condition.orderByDesc(Calls.CREATE_TIME);
|
||||
dataAbilityHelper.query(Calls.CALL_LOG_URI, null, condition).then(resultSet => {
|
||||
let rst: CallLog[] = [];
|
||||
resultSet.goToFirstRow();
|
||||
do {
|
||||
let builder = CallLogBuilder.fromResultSet(resultSet);
|
||||
if (builder.id > 0) {
|
||||
rst.push(new CallLog(builder));
|
||||
}
|
||||
} while (resultSet.goToNextRow());
|
||||
resultSet.close();
|
||||
resolve(rst);
|
||||
}).catch(error => {
|
||||
HiLog.w(TAG, +'findByNumberIn error:' + error);
|
||||
reject();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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 CallLog from '../entity/CallLog';
|
||||
|
||||
/**
|
||||
* 通话记录仓库操作接口,提供数据库操作方法,屏蔽持久层逻辑
|
||||
*/
|
||||
export default interface ICallLogRepository {
|
||||
saveOne: (callLog: CallLog) => Promise<number>;
|
||||
save: (callLogs: CallLog[]) => boolean;
|
||||
clear: () => Promise<number>;
|
||||
deleteById: (id: number) => boolean;
|
||||
deleteByIdIn: (ids: number[]) => Promise<number>;
|
||||
deleteByNumber: (number: string) => boolean;
|
||||
deleteByLookupUri: (lookupUri: string) => boolean;
|
||||
readByNumber: (number: string) => boolean;
|
||||
readById: (id: number) => boolean;
|
||||
findAll: () => Promise<CallLog[]>;
|
||||
findByCallDirectionIn: (callTypes: number[]) => Promise<CallLog[]>;
|
||||
findByFeature: (feature: number) => CallLog[];
|
||||
findByNumberIn: (numbers: number[]) => Promise<CallLog[]>;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* 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 ContactListPresenter from '../../presenter/contact/ContactListPresenter';
|
||||
import {ContactClickType} from '../../presenter/contact/ContactListPresenter';
|
||||
|
||||
const TAG = 'ContactEmptyPage ';
|
||||
|
||||
/**
|
||||
* 联系人没有查询到的空界面;
|
||||
*/
|
||||
@Entry
|
||||
@Component
|
||||
export default struct ContactEmptyPage {
|
||||
presenter: ContactListPresenter;
|
||||
/**
|
||||
* 底部四个buttonitem控件抽取
|
||||
*/
|
||||
@Builder BottonItem(title: Resource, type: ContactClickType) {
|
||||
Button(title)
|
||||
.width(192)
|
||||
.height($r("app.float.contact_emptypage_button_item_height"))
|
||||
.borderRadius($r("app.float.contact_emptypage_button_radius"))
|
||||
// .backgroundColor($r("app.color.colorControlNormal"))
|
||||
.backgroundColor("#19000000")
|
||||
.margin({ bottom: $r("app.float.contact_emptypage_bottom") })
|
||||
// .fontColor($r("app.color.colorConnected"))
|
||||
.fontColor('#00CB87')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
// .fontSize($r("sys.float.id_text_size_body1"))
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.onClick(() => {
|
||||
switch (type) {
|
||||
case ContactClickType.LOGIN_IN:
|
||||
this.presenter.loginAccount();
|
||||
break;
|
||||
case ContactClickType.IMPORT_CONTACT:
|
||||
this.presenter.importContact();
|
||||
break;
|
||||
case ContactClickType.CREATE_CONTACT:
|
||||
this.presenter.createContact();
|
||||
break;
|
||||
case ContactClickType.SCAN_CARD:
|
||||
this.presenter.scanCard();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Center }) {
|
||||
Text($r("app.string.contact"))
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
// .fontColor($r("app.color.textColorPrimary"))
|
||||
.fontColor('#182431')
|
||||
.margin({ left: $r("app.float.common_margin"), right: $r("app.float.common_margin") })
|
||||
}
|
||||
.width('100%')
|
||||
.height($r("app.float.contact_title_height"))
|
||||
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
alignItems: ItemAlign.Center,
|
||||
justifyContent: FlexAlign.Center
|
||||
}) {
|
||||
Image($r('app.media.no_contacts_illustration'))
|
||||
.objectFit(ImageFit.Contain)
|
||||
.width($r("app.float.contact_emptyview_image_width_height"))
|
||||
.height($r("app.float.contact_emptyview_image_width_height"))
|
||||
.margin({ bottom: 8 })
|
||||
Text($r("app.string.no_contacts"))
|
||||
.fontSize($r("app.float.contact_text_size_body2"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
// .fontColor($r("app.color.textColorTertiary"))
|
||||
.fontColor('#66182431')
|
||||
.height(19)
|
||||
.textAlign(TextAlign.Center)
|
||||
}
|
||||
.width('100%')
|
||||
.layoutWeight(1)
|
||||
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Start,
|
||||
alignItems: ItemAlign.Center }) {
|
||||
|
||||
this.BottonItem($r("app.string.create_contact"), ContactClickType.CREATE_CONTACT);
|
||||
}
|
||||
.width('100%')
|
||||
.height($r("app.float.contact_empty_list_all_bottom_height"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* 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 router from '@system.router';
|
||||
import DeleteDialogEx from '../../pages/dialog/DeleteDialogEx';
|
||||
import ShareDialogEx from '../../pages/dialog/ShareDialogEx';
|
||||
import {ContactVo} from '../../model/bean/ContactVo';
|
||||
import Utils from '../../util/Utils';
|
||||
import HiLog from '../../util/HiLog';
|
||||
import ContactListPresenter from '../../presenter/contact/ContactListPresenter';
|
||||
import ContactRepository from '../../contact/repo/ContactRepository';
|
||||
import ContactDelta from '../../contact/repo/ContactDelta';
|
||||
|
||||
const TAG = 'ContactListItemView ';
|
||||
|
||||
/**
|
||||
* 联系人item组件,主要负责单个联系人的显示;
|
||||
*/
|
||||
@Component
|
||||
export default struct ContactListItemView {
|
||||
private presenter: ContactListPresenter = ContactListPresenter.getInstance();
|
||||
@State item: any = {};
|
||||
private index: number;
|
||||
shareDialogControler: CustomDialogController = new CustomDialogController({
|
||||
builder: ShareDialogEx({
|
||||
itemList: this.presenter.shareList,
|
||||
cancel: () => {
|
||||
this.presenter.onShareDialogCancel();
|
||||
},
|
||||
title: $r("app.string.dialog_share"),
|
||||
cancelText: $r("app.string.dialog_cancel")
|
||||
}),
|
||||
autoCancel: true,
|
||||
offset: { dx: 0, dy: -15 },
|
||||
alignment: DialogAlignment.Bottom
|
||||
});
|
||||
deleteDialogControler: CustomDialogController= new CustomDialogController({
|
||||
builder: DeleteDialogEx({
|
||||
cancel: () => {
|
||||
this.presenter.onDeleteDialogCancel();
|
||||
},
|
||||
confirm: () => {
|
||||
this.presenter.onDeleteDialogConfirm(this.item);
|
||||
},
|
||||
title: $r("app.string.delete_dialog_title"),
|
||||
cancalText: $r("app.string.dialog_cancel"),
|
||||
confrimText: $r("app.string.dialog_delete")
|
||||
}),
|
||||
autoCancel: true,
|
||||
offset: { dx: 0, dy: -15 },
|
||||
alignment: DialogAlignment.Bottom
|
||||
});
|
||||
|
||||
onDeleteClick() {
|
||||
HiLog.i(TAG, 'onDeleteClick');
|
||||
this.deleteDialogControler.open();
|
||||
}
|
||||
|
||||
onShareClick() {
|
||||
HiLog.i(TAG, 'onShareClick');
|
||||
this.shareDialogControler.open();
|
||||
}
|
||||
|
||||
@Builder MenuBuilder() {
|
||||
Flex({ direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: ItemAlign.Start }) {
|
||||
|
||||
Text(Utils.isEmpty(this.item.showName) ? this.item.phoneNum : this.item.showName)
|
||||
.textAlign(TextAlign.Start)
|
||||
.fontSize($r("app.float.contact_text_size_headline8"))
|
||||
.fontColor('#182431')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 10, bottom: 10 })
|
||||
.width('100%')
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
.visibility(Utils.isEmpty(this.item.showName) ? Visibility.None : Visibility.Visible)
|
||||
|
||||
Text($r("app.string.delete"))
|
||||
.width('100%')
|
||||
.height($r("app.float.contact_listitem_index_height"))
|
||||
.textAlign(TextAlign.Start)
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontColor('#182431')
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({ top: 5 })
|
||||
.onClick(() => {
|
||||
this.presenter.setCurItem(this.item);
|
||||
ContextMenu.close();
|
||||
this.deleteDialogControler.open();
|
||||
})
|
||||
}
|
||||
.borderRadius($r("app.float.contact_emptypage_button_radius"))
|
||||
.width($r("app.float.contact_longpress_dialog_width"))
|
||||
.padding({ top: 4, bottom: 4 })
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
|
||||
Row() {
|
||||
Text(this.item.emptyNameData.substr(this.item.emptyNameData.length - 1, 1))
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor(Color.White)
|
||||
.backgroundColor(this.item.portraitColor)
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.textAlign(TextAlign.Center)
|
||||
.border({ width: 0, color: Color.White, radius: 40 })
|
||||
.visibility((!Utils.isEmpty(this.item.portraitPath) || (Utils.isEmpty(this.item.portraitPath) && Utils.isEmpty(this.item.showName) && Utils.isEmpty(this.item.phoneNum))) ? Visibility.None : Visibility.Visible)
|
||||
|
||||
Image(Utils.isEmpty(this.item.portraitPath) ? $r("app.media.avatar_filled_honor") : this.item.portraitPath)
|
||||
.width(40)
|
||||
.height(40)
|
||||
.objectFit(ImageFit.Contain)
|
||||
.visibility((!Utils.isEmpty(this.item.portraitPath) || (Utils.isEmpty(this.item.portraitPath) && Utils.isEmpty(this.item.showName) && Utils.isEmpty(this.item.phoneNum))) ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.margin({ left: $r("app.float.common_margin") })
|
||||
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Center }) {
|
||||
Text(Utils.isEmpty(this.item.showName) ? this.item.phoneNum : this.item.showName)
|
||||
// .fontColor($r("app.color.textColorPrimary"))
|
||||
.fontColor('#182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 12, bottom: 2 })
|
||||
|
||||
Text((Utils.isEmpty(this.item.company) ? '' : this.item.company + ' ') + (Utils.isEmpty(this.item.position) ? '' : this.item.position))
|
||||
// .fontColor($r("app.color.textColorTertiary"))
|
||||
.fontColor('#66182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.visibility((Utils.isEmpty(this.item.company) && Utils.isEmpty(this.item.position)) ? Visibility.None : Visibility.Visible)
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
}
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
.width('100%')
|
||||
.backgroundColor(Color.White)
|
||||
.onClick(() => {
|
||||
router.push(
|
||||
{
|
||||
uri: "pages/contacts/details/ContactDetail",
|
||||
params: {
|
||||
contactId: this.item.contactId,
|
||||
isNewSource: true
|
||||
}
|
||||
}
|
||||
);
|
||||
})
|
||||
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* 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 ContactListItemView from './ContactListItemView';
|
||||
import {ContactVo} from '../../model/bean/ContactVo';
|
||||
import HiLog from '../../util/HiLog';
|
||||
|
||||
/**
|
||||
* 搜索联系人界面;
|
||||
*/
|
||||
@Component
|
||||
export default struct ContactSearchPage {
|
||||
@Link private showSearch: boolean;
|
||||
@Link private isSearched: boolean;
|
||||
@State private mSerchText: string = "";
|
||||
private mContactList: ContactVo[] = [new ContactVo("1", "5", "12345", "公司", "职位", "#FF53804D", false, "", ""),
|
||||
new ContactVo("2", "5", "12345", "公司", "职位", "#FF53804D", false, "", ""),
|
||||
new ContactVo("3", "5", "12345", "公司", "职位", "#FF53804D", false, "", ""),
|
||||
new ContactVo("4", "5", "12345", "公司", "职位", "#FF53804D", false, "", ""),
|
||||
new ContactVo("5", "5", "12345", "公司", "职位", "#FF53804D", false, "", "")];
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
|
||||
Guide({ searchText: $mSerchText, showSearch: $showSearch, isSearched: $isSearched })
|
||||
if (this.showSearch && this.mSerchText.length > 0) {
|
||||
if (this.mSerchText.length > 0) {
|
||||
SearchContactList({ list: this.mContactList });
|
||||
} else {
|
||||
NoContact();
|
||||
}
|
||||
} else {
|
||||
TranslateBg();
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct Guide {
|
||||
@Link private searchText: string;
|
||||
@Link private showSearch: boolean;
|
||||
@Link private isSearched: boolean;
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
|
||||
Image($r("app.media.ic_public_back"))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.objectFit(ImageFit.Fill)
|
||||
.margin({ left: 25 })
|
||||
.onClick(() => {
|
||||
this.showSearch = false;
|
||||
this.isSearched = false;
|
||||
})
|
||||
TextInput({ placeholder: $r("app.string.contact_list_search") })
|
||||
.height(40)
|
||||
.width('75%')
|
||||
.margin({ left: 20 })
|
||||
.type(InputType.Normal)
|
||||
.placeholderColor(Color.Gray)
|
||||
.placeholderFont({ size: 18, weight: 2 })
|
||||
.enterKeyType(EnterKeyType.Search)
|
||||
.caretColor(Color.Green)
|
||||
.borderRadius(20)
|
||||
.onChange(value => {
|
||||
this.searchText = value;
|
||||
if (this.searchText.length > 0) {
|
||||
this.isSearched = true;
|
||||
} else {
|
||||
this.isSearched = false;
|
||||
}
|
||||
})
|
||||
.onTouch(event => {
|
||||
if (event.type == TouchType.Down) {
|
||||
this.showSearch = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height(50)
|
||||
.backgroundColor(Color.White)
|
||||
.opacity(1)
|
||||
.margin({ bottom: 5 })
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct TranslateBg {
|
||||
build() {
|
||||
Flex() {
|
||||
}.width('100%').flexGrow(1).opacity(0.2).backgroundColor(Color.Gray)
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct NoContact {
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Image($r("app.media.no_contacts_illustration"))
|
||||
.width(px2vp(210))
|
||||
.height(px2vp(210))
|
||||
.objectFit(ImageFit.Contain)
|
||||
.margin(20)
|
||||
Text($r("app.string.contact_list_search_empty"))
|
||||
.fontSize(px2fp(28))
|
||||
.fontColor('#999')
|
||||
.fontWeight(400)
|
||||
}.width('100%').height('85%')
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct SearchContactList {
|
||||
private list: ContactVo[];
|
||||
|
||||
build() {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
alignItems: ItemAlign.Start,
|
||||
justifyContent: FlexAlign.Start
|
||||
}) {
|
||||
Text($r("app.string.contact_list_search"))
|
||||
.width('100%')
|
||||
.height(45)
|
||||
.fontSize(px2fp(40))
|
||||
.fontWeight(500)
|
||||
.fontColor('#747474')
|
||||
.padding({ left: 25 })
|
||||
|
||||
List({ initialIndex: 0, space: 5 }) {
|
||||
ForEach(this.list, (item, index) => {
|
||||
ListItem() {
|
||||
ContactListItemView({ item: item, index: index })
|
||||
}.enabled(true)
|
||||
}, (item: ContactVo) => item.contactId.toString())
|
||||
}
|
||||
.width("90%")
|
||||
.listDirection(Axis.Vertical)
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
.onScrollIndex((fristIndex: number, lastIndex: number) => {
|
||||
})
|
||||
.editMode(true)
|
||||
.onItemDelete((index: number) => {
|
||||
return true;
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.flexGrow(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* 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 {ContactVo} from '../../../model/bean/ContactVo';
|
||||
import Utils from '../../../util/Utils';
|
||||
|
||||
const TAG = 'BatchSelectRecentItemView ';
|
||||
|
||||
/**
|
||||
* 选择联系人item组件,主要负责单个联系人的显示;
|
||||
*/
|
||||
@Component
|
||||
export default struct BatchSelectRecentItemView {
|
||||
@State private item: any = {};
|
||||
private onContactItemClicked: Function;
|
||||
private index: number;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
|
||||
Row() {
|
||||
Text(this.item.name.nameSuffix)
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor(Color.White)
|
||||
.backgroundColor(this.item.portraitColor)
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.textAlign(TextAlign.Center)
|
||||
.clip(new Circle({ width: 40, height: 40 }))
|
||||
.border({ width: 0, color: Color.White, radius: 40 })
|
||||
.visibility((!Utils.isEmpty(this.item.portraitPath) || (Utils.isEmpty(this.item.portraitPath) && Utils.isEmpty(this.item.showName) && Utils.isEmpty(this.item.phoneNum))) ? Visibility.None : Visibility.Visible)
|
||||
|
||||
Image(Utils.isEmpty(this.item.portraitPath) ? $r("app.media.avatar_filled_honor") : this.item.portraitPath)
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.clip(new Circle({ width: 40, height: 40 }))
|
||||
.objectFit(ImageFit.Contain)
|
||||
.visibility((!Utils.isEmpty(this.item.portraitPath) || (Utils.isEmpty(this.item.portraitPath) && Utils.isEmpty(this.item.showName) && Utils.isEmpty(this.item.phoneNum))) ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.margin({ left: $r("app.float.common_margin") })
|
||||
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Center }) {
|
||||
Text(this.item.emptyNameData)
|
||||
// .fontColor($r("app.color.textColorPrimary"))
|
||||
.fontColor('#182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 12, bottom: 2 })
|
||||
|
||||
Text(Utils.isEmpty(this.item.phoneNumbers[0].labelName) ? '' : this.item.phoneNumbers[0].labelName + ' ' + this.item.phoneNumbers[0].phoneNumber)
|
||||
// .fontColor($r("app.color.textColorTertiary"))
|
||||
.fontColor('#66182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
// .visibility((Utils.isEmpty(this.item.company) && Utils.isEmpty(this.item.position)) ? Visibility.None : Visibility.Visible)
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
.flexGrow(1)
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
|
||||
Toggle({
|
||||
type: ToggleType.Checkbox,
|
||||
isOn: (this.item.phoneNumbers[0].checked == undefined) ? false : this.item.phoneNumbers[0].checked
|
||||
})
|
||||
.width($r("app.float.contact_samll_image_width_height"))
|
||||
.height($r("app.float.contact_samll_image_width_height"))
|
||||
.enabled(false)
|
||||
.margin({ left: $r("app.float.common_margin"), right: $r("app.float.common_margin") })
|
||||
}
|
||||
.width('100%')
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
.onClick(() => {
|
||||
this.onContactItemClicked(this.index, 0);
|
||||
})
|
||||
|
||||
ForEach(this.item.phoneNumbers, (item, index) => {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
|
||||
Row() {
|
||||
}
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.margin({ left: $r("app.float.common_margin") })
|
||||
.visibility(Visibility.Hidden)
|
||||
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Center }) {
|
||||
|
||||
Text(Utils.isEmpty(item.labelName) ? '' : item.labelName + ' ' + item.phoneNumber)
|
||||
// .fontColor($r("app.color.textColorTertiary"))
|
||||
.fontColor('#66182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
.flexGrow(1)
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: (item.checked == undefined) ? false : item.checked })
|
||||
.width($r("app.float.contact_samll_image_width_height"))
|
||||
.height($r("app.float.contact_samll_image_width_height"))
|
||||
.enabled(false)
|
||||
.margin({ left: $r("app.float.common_margin"), right: $r("app.float.common_margin") })
|
||||
}
|
||||
.width('100%')
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
.visibility(index == 0 ? Visibility.None : Visibility.Visible)
|
||||
.onClick(() => {
|
||||
this.onContactItemClicked(this.index, index);
|
||||
})
|
||||
}, (item, index) => item.toString())
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* 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 BatchSelectContactsPresenter from '../../../presenter/contact/batchselectcontacts/BatchSelectContactsPresenter';
|
||||
import {CallBean} from '../../../model/bean/CallBean';
|
||||
import Utils from '../../../util/Utils';
|
||||
import HiLog from '../../../util/HiLog';
|
||||
|
||||
const TAG = 'BatchSelectRecentItemView ';
|
||||
|
||||
/**
|
||||
* 选择联系人item组件,主要负责单个联系人的显示;
|
||||
*/
|
||||
@Component
|
||||
export default struct BatchSelectRecentItemView {
|
||||
private onRecentItemClicked: Function;
|
||||
@State private item: any = {};
|
||||
private index: number;
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
|
||||
Row() {
|
||||
Text(this.item.suffix)
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor(Color.White)
|
||||
.backgroundColor(this.item.portraitColor)
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.textAlign(TextAlign.Center)
|
||||
.clip(new Circle({ width: 40, height: 40 }))
|
||||
.border({ width: 0, color: Color.White, radius: 40 })
|
||||
.visibility(Utils.isEmpty(this.item.suffix) ? Visibility.None : Visibility.Visible)
|
||||
|
||||
Image($r("app.media.avatar_filled_honor"))
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.backgroundColor(this.item.portraitColor)
|
||||
.clip(new Circle({ width: 40, height: 40 }))
|
||||
.border({ width: 0, color: Color.White, radius: 40 })
|
||||
.objectFit(ImageFit.Contain)
|
||||
.visibility(Utils.isEmpty(this.item.suffix) ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.width($r("app.float.contact_listpage_icon_width_height"))
|
||||
.height($r("app.float.contact_listpage_icon_width_height"))
|
||||
.margin({ left: $r("app.float.common_margin") })
|
||||
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Center }) {
|
||||
Text(Utils.isEmpty(this.item.displayName) ? this.item.phoneNumber : this.item.displayName)
|
||||
// .fontColor($r("app.color.textColorPrimary"))
|
||||
.fontColor('#182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 12, bottom: 2 })
|
||||
|
||||
Row() {
|
||||
Text(this.item.formattedNumber)
|
||||
// .fontColor($r("app.color.textColorTertiary"))
|
||||
.fontColor('#66182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.visibility(Utils.isEmpty(this.item.formattedNumber) ? Visibility.None : Visibility.Visible)
|
||||
.margin({ left: 12 })
|
||||
|
||||
Text(this.item.numberLocation)
|
||||
// .fontColor($r("app.color.textColorTertiary"))
|
||||
.fontColor('#66182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.visibility(Utils.isEmpty(this.item.numberLocation) ? Visibility.None : Visibility.Visible)
|
||||
.margin({ left: 12 })
|
||||
|
||||
if (Utils.isEmpty(this.item.displayName) && Utils.isEmpty(this.item.numberLocation)) {
|
||||
Text($r("app.string.unknow_location"))
|
||||
// .fontColor($r("app.color.textColorTertiary"))
|
||||
.fontColor('#66182431')
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
}
|
||||
}
|
||||
.flexGrow(1)
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: this.item.checked })
|
||||
.width($r("app.float.contact_samll_image_width_height"))
|
||||
.height($r("app.float.contact_samll_image_width_height"))
|
||||
.enabled(false)
|
||||
.margin({ left: $r("app.float.common_margin"), right: $r("app.float.common_margin") })
|
||||
|
||||
}
|
||||
.height($r("app.float.contact_listitem_height"))
|
||||
.width('100%')
|
||||
.onClick(() => {
|
||||
this.onRecentItemClicked(this.index);
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* 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 BatchSelectContactsPresenter from '../../../presenter/contact/batchselectcontacts/BatchSelectContactsPresenter';
|
||||
import HiLog from '../../../util/HiLog';
|
||||
|
||||
const TAG = 'BatchTabGuide ';
|
||||
|
||||
@Component
|
||||
export default struct BatchTabGuide {
|
||||
@State presenter: BatchSelectContactsPresenter = BatchSelectContactsPresenter.getInstance();
|
||||
@Link currentIndex: number;
|
||||
private controller: TabsController;
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Row,
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: ItemAlign.Center }) {
|
||||
|
||||
ForEach(this.presenter.tabTextSrc, (item, index) => {
|
||||
Flex({ direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.End,
|
||||
alignItems: ItemAlign.Center }) {
|
||||
Text(item)
|
||||
.fontSize($r("app.float.contact_text_size_body1"))
|
||||
.fontColor(this.currentIndex == index ? $r("app.color.colorConnected") : $r("app.color.textColorTertiary"))
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ bottom: 5 })
|
||||
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color($r("app.color.colorConnected"))
|
||||
.visibility(this.currentIndex == index ? Visibility.Visible : Visibility.Hidden)
|
||||
}
|
||||
.width(60)
|
||||
.height($r("app.float.contact_titleguide_height"))
|
||||
.margin({ left: 5, right: 5 })
|
||||
.onClick(() => {
|
||||
HiLog.i(TAG, "item clicked currentIndex is " + this.currentIndex + " index is %d", index);
|
||||
if (this.currentIndex != index) {
|
||||
this.controller.changeIndex(index);
|
||||
}
|
||||
})
|
||||
|
||||
}, (item, index) => item.toString())
|
||||
|
||||
}
|
||||
.width('100%')
|
||||
.height($r("app.float.contact_titleguide_height"))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
* 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 Utils from '../../util/Utils';
|
||||
import HiLog from '../../util/HiLog';
|
||||
import detailModel from '../../model/contactDetailModel';
|
||||
import DialUtil from '../../util/DialUtil';
|
||||
|
||||
const TAG = "ContactDetail-calllog"
|
||||
|
||||
/**
|
||||
* 通话记录
|
||||
*/
|
||||
@Component
|
||||
struct CallLogListItem {
|
||||
private message: string;
|
||||
private title: string;
|
||||
private detailtime: string;
|
||||
private phonenumber: string;
|
||||
private talkTime: string;
|
||||
private imgRes: Resource;
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
aboutToAppear() {
|
||||
this.title = JSON.parse(this.message).timeDetail;
|
||||
this.phonenumber = JSON.parse(this.message).formatNumber;
|
||||
this.talkTime = JSON.parse(this.message).talkTime;
|
||||
switch (JSON.parse(this.message).callType) {
|
||||
case 1:
|
||||
this.imgRes = $r('app.media.ic_contacts_call_in_mini');
|
||||
break;
|
||||
case 2:
|
||||
this.imgRes = $r('app.media.ic_contacts_callout_mini');
|
||||
break;
|
||||
case 3:
|
||||
this.imgRes = $r('app.media.ic_contacts_call_missed_mini');
|
||||
break;
|
||||
case 5:
|
||||
this.imgRes = $r('app.media.ic_contacts_call_rejected_mini');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start, }) {
|
||||
Text(this.title)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize(16)
|
||||
.fontColor(JSON.parse(this.message).callType == "3" ||
|
||||
JSON.parse(this.message).callType == "5" ? Color.Red : Color.Black)
|
||||
.height("22vp")
|
||||
|
||||
Row() {
|
||||
Image(this.imgRes)
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width("12vp")
|
||||
.height("12vp")
|
||||
Text(this.phonenumber)
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor('#182431')
|
||||
.margin({ left: 1 })
|
||||
}
|
||||
.height("19vp")
|
||||
.opacity(0.4)
|
||||
.margin({ top: 2 })
|
||||
}
|
||||
|
||||
Blank();
|
||||
|
||||
Row() {
|
||||
Text($r('app.string.noAnswer'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize(14)
|
||||
.opacity(0.4)
|
||||
.visibility(JSON.parse(this.message).callType == "3" ? Visibility.Visible : Visibility.None)
|
||||
|
||||
Text(this.talkTime)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize(14)
|
||||
.opacity(0.4)
|
||||
}
|
||||
.height("19vp")
|
||||
}
|
||||
.width('100%')
|
||||
.height("64vp")
|
||||
.padding({ top: 5, bottom: 5 })
|
||||
.onClick(() => {
|
||||
DialUtil.getInstance().dial(this.phonenumber, (data, err, value) => {
|
||||
HiLog.i(TAG, 'dial isEmergencyPhoneNumber : ' + data + ' err : ' + err + ' value : ' + value);
|
||||
});
|
||||
})
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
}))
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 通话记录
|
||||
*/
|
||||
@Component
|
||||
export default struct DetailCalllog {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Column().width('100%').height('8vp').backgroundColor($r('app.color.gray_divider'))
|
||||
|
||||
Row() {
|
||||
Text($r('app.string.dialer_calllog'))
|
||||
.fontSize(16)
|
||||
.opacity(0.6)
|
||||
.margin({ left: 24 })
|
||||
|
||||
Blank();
|
||||
|
||||
Text($r('app.string.clear'))
|
||||
.fontSize(16)
|
||||
.fontColor($r('app.color.colorConnected'))
|
||||
.margin({ right: 24 })
|
||||
.onClick(() => {
|
||||
this.mDetailModel.clearPhoneRecords()
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height('40vp')
|
||||
|
||||
List() {
|
||||
ForEach(this.mDetailModel.contactForm.numRecords, (item, index) => {
|
||||
ListItem() {
|
||||
CallLogListItem({ message: JSON.stringify(item), mDetailModel: $mDetailModel });
|
||||
}
|
||||
|
||||
if (index < this.mDetailModel.contactForm.numRecords.length - 1) {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
}
|
||||
}, item => item.id.toString())
|
||||
}.margin({ left: 24, right: 24 })
|
||||
}
|
||||
.width("100%")
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.numRecords) ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@Component
|
||||
export default struct DetailInfoListItemView {
|
||||
private title: string;
|
||||
private content: string | Resource;
|
||||
private hasRow: boolean;
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
|
||||
Text(this.title)
|
||||
.fontSize(16)
|
||||
Text(this.content)
|
||||
.fontSize(14)
|
||||
.fontColor($r('app.color.gray'))
|
||||
}
|
||||
|
||||
Blank();
|
||||
|
||||
Image($r('app.media.ic_contacts_arrow_up'))
|
||||
.align(Alignment.Center)
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.visibility(this.hasRow ? Visibility.Visible : Visibility.None)
|
||||
.opacity(0.2)
|
||||
}
|
||||
.width('100%')
|
||||
.height("60vp")
|
||||
.padding({ top: 5, bottom: 5 })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,779 @@
|
||||
/**
|
||||
* 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 contactDetailModel from '../../model/contactDetailModel';
|
||||
import HiLog from '../../util/HiLog';
|
||||
import Utils from '../../util/Utils';
|
||||
import DetailInfoListItemView from './DetailInfoListItemView';
|
||||
import DialUtil from '../../util/DialUtil';
|
||||
|
||||
const TAG = "ContactDetail-detailInfoList"
|
||||
|
||||
@Component
|
||||
export default struct DetailInfoListView {
|
||||
@Link mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
// 电话列表
|
||||
TelList({ mDetailModel: $mDetailModel });
|
||||
|
||||
if (!this.mDetailModel.contactForm.isNewNumber) {
|
||||
// 邮箱列表
|
||||
EmailList({ mDetailModel: $mDetailModel });
|
||||
|
||||
// AIM列表
|
||||
AIMList({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 昵称
|
||||
NickName({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 网站列表
|
||||
WebSiteList({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 住址列表
|
||||
HouseList({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 生日和纪念日
|
||||
RemembranceDay({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 群组
|
||||
Group({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 姓名拼音
|
||||
PinyinName({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 关联人
|
||||
Relationships({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 备注
|
||||
Remarks({ mDetailModel: $mDetailModel });
|
||||
|
||||
// 更多选项
|
||||
MoreOptions({ mDetailModel: $mDetailModel });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 电话列表
|
||||
*/
|
||||
@Component
|
||||
struct TelList {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
List() {
|
||||
ForEach(this.mDetailModel.contactForm.phones, (item) => {
|
||||
ListItem() {
|
||||
TelListItem({ message: JSON.stringify(item), mDetailModel: $mDetailModel });
|
||||
}
|
||||
}, item => (item.id).toString())
|
||||
}
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.phones) ? Visibility.None : Visibility.Visible)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 电话item
|
||||
*/
|
||||
@Component
|
||||
struct TelListItem {
|
||||
private message: string
|
||||
private title: string
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
aboutToAppear() {
|
||||
this.title = this.mDetailModel.newNumberContactDetail.callTag;
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
|
||||
Text(JSON.parse(this.message).num)
|
||||
.fontSize('16fp')
|
||||
Row() {
|
||||
Text(JSON.parse(this.message)
|
||||
.labelName)
|
||||
.fontSize('14fp')
|
||||
.fontColor($r('app.color.textColorPrimary'))
|
||||
.visibility(Utils.isEmpty(JSON.parse(this.message)
|
||||
.labelName) ? Visibility.None : Visibility.Visible)
|
||||
Text(" - ")
|
||||
.fontSize('14fp')
|
||||
.fontColor($r('app.color.textColorPrimary'))
|
||||
.visibility(Utils.isEmpty(JSON.parse(this.message)
|
||||
.labelName) ? Visibility.None : Visibility.Visible)
|
||||
Text(JSON.parse(this.message).phoneAddress)
|
||||
.fontSize('14fp')
|
||||
.fontColor($r('app.color.textColorPrimary'))
|
||||
}
|
||||
}
|
||||
|
||||
Blank();
|
||||
|
||||
Image($r("app.media.ic_public_phone_filled"))
|
||||
.objectFit(ImageFit.Contain)
|
||||
.height("24vp")
|
||||
.width("24vp")
|
||||
.margin({ right: '24vp' })
|
||||
.onClick(() => {
|
||||
DialUtil.getInstance().dial(Utils.removeSpace(JSON.parse(this.message).num), (data, err, value) => {
|
||||
HiLog.i(TAG, 'dial isEmergencyPhoneNumber : ' + data + ' err : ' + err + ' value : ' + value);
|
||||
});
|
||||
})
|
||||
|
||||
Image($r("app.media.ic_public_message_filled"))
|
||||
.objectFit(ImageFit.Contain)
|
||||
.height("24vp")
|
||||
.width("24vp")
|
||||
.onClick(() => {
|
||||
this.mDetailModel.sendMessage(JSON.parse(this.message)
|
||||
.num, this.mDetailModel.showNameLast);
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height("60vp")
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
this.mDetailModel.listItemOnLongPressNumber(JSON.parse(this.message)
|
||||
.id);
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮件列表
|
||||
*/
|
||||
@Component
|
||||
struct EmailList {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
List() {
|
||||
ForEach(this.mDetailModel.contactForm.emails, item => {
|
||||
ListItem() {
|
||||
EmailListItem({ message: JSON.stringify(item), mDetailModel: $mDetailModel });
|
||||
}
|
||||
}, item => item.id.toString())
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.emails) ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮件item
|
||||
*/
|
||||
@Component
|
||||
struct EmailListItem {
|
||||
private message: string;
|
||||
private title: string;
|
||||
private content: Resource;
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
aboutToAppear() {
|
||||
this.title = JSON.parse(this.message).address;
|
||||
this.content = JSON.parse(this.message).labelName;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
DetailInfoListItemView({ title: this.title, content: this.content, hasRow: true })
|
||||
}
|
||||
.onClick(() => {
|
||||
|
||||
})
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AIM列表
|
||||
*/
|
||||
@Component
|
||||
struct AIMList {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
List() {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
|
||||
ForEach(this.mDetailModel.contactForm.aims, (item, index) => {
|
||||
ListItem() {
|
||||
AIMListItem({ message: JSON.stringify(item), mDetailModel: $mDetailModel });
|
||||
}
|
||||
if (index < this.mDetailModel.contactForm.websites.length - 1) {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.aims) ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AIMlListItem
|
||||
*/
|
||||
@Component
|
||||
struct AIMListItem {
|
||||
private message: string;
|
||||
private title: string;
|
||||
private content: Resource;
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
aboutToAppear() {
|
||||
this.title = JSON.parse(this.message).aimId;
|
||||
this.content = JSON.parse(this.message).aimType;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
DetailInfoListItemView({ title: this.title, content: this.content, hasRow: true })
|
||||
}
|
||||
.onClick(() => {
|
||||
|
||||
})
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Component
|
||||
struct NickName {
|
||||
@Link private mDetailModel: any;
|
||||
private hasRow:Boolean = false;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
|
||||
Text(this.mDetailModel.contactForm.nickname)
|
||||
.fontSize(16)
|
||||
Text($r('app.string.nickname'))
|
||||
.fontSize(14)
|
||||
.fontColor($r('app.color.gray'))
|
||||
}
|
||||
|
||||
Blank();
|
||||
|
||||
Image($r('app.media.ic_contacts_arrow_up'))
|
||||
.align(Alignment.Center)
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.visibility(this.hasRow ? Visibility.Visible : Visibility.None)
|
||||
.opacity(0.2)
|
||||
}
|
||||
.width('100%')
|
||||
.height("60vp")
|
||||
.padding({ top: 5, bottom: 5 })
|
||||
}
|
||||
.visibility(Utils.isEmpty(this.mDetailModel.contactForm.nickname) ? Visibility.None : Visibility.Visible)
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 网站列表
|
||||
*/
|
||||
@Component
|
||||
struct WebSiteList {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
List() {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
|
||||
ForEach(this.mDetailModel.contactForm.websites, (item, index) => {
|
||||
ListItem() {
|
||||
WebSiteListItem({ message: item, mDetailModel: $mDetailModel });
|
||||
}
|
||||
|
||||
if (index < this.mDetailModel.contactForm.websites.length - 1) {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.websites) ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 网站item
|
||||
*/
|
||||
@Component
|
||||
struct WebSiteListItem {
|
||||
private message: string;
|
||||
private title: string;
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
DetailInfoListItemView({ title: this.message, content: $r('app.string.website'), hasRow: true })
|
||||
}
|
||||
.onClick(() => {
|
||||
})
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址列表
|
||||
*/
|
||||
@Component
|
||||
struct HouseList {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
List() {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
|
||||
ForEach(this.mDetailModel.contactForm.houses, (item, index) => {
|
||||
ListItem() {
|
||||
HouseListItem({ message: JSON.stringify(item), mDetailModel: $mDetailModel });
|
||||
}
|
||||
|
||||
if (index < this.mDetailModel.contactForm.websites.length - 1) {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.houses) ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 住址item
|
||||
*/
|
||||
@Component
|
||||
struct HouseListItem {
|
||||
private message: string;
|
||||
private title: string;
|
||||
private content: Resource;
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
aboutToAppear() {
|
||||
this.title = JSON.parse(this.message).houseId;
|
||||
this.content = JSON.parse(this.message).houseType;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
DetailInfoListItemView({ title: this.title, content: this.content, hasRow: true })
|
||||
}
|
||||
.onClick(() => {
|
||||
|
||||
})
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 纪念日
|
||||
*/
|
||||
@Component
|
||||
struct RemembranceDay {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
List() {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
|
||||
ForEach(this.mDetailModel.contactForm.events, (item, index) => {
|
||||
ListItem() {
|
||||
RemembranceDayItem({ message: JSON.stringify(item), mDetailModel: $mDetailModel });
|
||||
}
|
||||
|
||||
if (index < this.mDetailModel.contactForm.websites.length - 1) {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
}
|
||||
}, item => item.id.toString())
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.events) ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 纪念日item
|
||||
*/
|
||||
@Component
|
||||
struct RemembranceDayItem {
|
||||
private message: string;
|
||||
private title: string;
|
||||
private content: Resource;
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
aboutToAppear() {
|
||||
this.title = JSON.parse(this.message).data;
|
||||
this.content = JSON.parse(this.message).eventName;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
DetailInfoListItemView({ title: this.title, content: this.content, hasRow: true })
|
||||
}
|
||||
.onClick(() => {
|
||||
this.mDetailModel.openCalenderApp(JSON.parse(this.message).id);
|
||||
})
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 群组
|
||||
*/
|
||||
@Component
|
||||
struct Group {
|
||||
@Link private mDetailModel: any;
|
||||
private hasRow:Boolean = false;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
|
||||
Text(this.mDetailModel.contactForm.showGroupsString)
|
||||
.fontSize(16)
|
||||
Text($r('app.string.group'))
|
||||
.fontSize(14)
|
||||
.fontColor($r('app.color.gray'))
|
||||
}
|
||||
|
||||
Blank();
|
||||
|
||||
Image($r('app.media.ic_contacts_arrow_up'))
|
||||
.align(Alignment.Center)
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.visibility(this.hasRow ? Visibility.Visible : Visibility.None)
|
||||
.opacity(0.2)
|
||||
}
|
||||
.width('100%')
|
||||
.height("60vp")
|
||||
.padding({ top: 5, bottom: 5 })
|
||||
}
|
||||
.visibility(Utils.isEmpty(this.mDetailModel.contactForm.showGroupsString) ? Visibility.None : Visibility.Visible)
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 姓名拼音
|
||||
*/
|
||||
@Component
|
||||
struct PinyinName {
|
||||
@Link private mDetailModel: any;
|
||||
private hasRow:Boolean = false;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
|
||||
Text(this.mDetailModel.contactForm.pinYinName)
|
||||
.fontSize(16)
|
||||
Text($r('app.string.name_pinyin'))
|
||||
.fontSize(14)
|
||||
.fontColor($r('app.color.gray'))
|
||||
}
|
||||
|
||||
Blank();
|
||||
|
||||
Image($r('app.media.ic_contacts_arrow_up'))
|
||||
.align(Alignment.Center)
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.visibility(this.hasRow ? Visibility.Visible : Visibility.None)
|
||||
.opacity(0.2)
|
||||
}
|
||||
.width('100%')
|
||||
.height("60vp")
|
||||
.padding({ top: 5, bottom: 5 })
|
||||
}
|
||||
.visibility(Utils.isEmpty(this.mDetailModel.contactForm.pinYinName) ? Visibility.None : Visibility.Visible)
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联人
|
||||
*/
|
||||
@Component
|
||||
struct Relationships {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
List() {
|
||||
ListItem() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
}
|
||||
|
||||
ForEach(this.mDetailModel.contactForm.relationships, item => {
|
||||
ListItem() {
|
||||
RelationshipsItem({ message: JSON.stringify(item), mDetailModel: $mDetailModel });
|
||||
}
|
||||
}, item => item.id.toString())
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.visibility(Utils.isEmptyList(this.mDetailModel.contactForm.relationships) ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联人item
|
||||
*/
|
||||
@Component
|
||||
struct RelationshipsItem {
|
||||
private message: string;
|
||||
private title: string;
|
||||
private content: Resource;
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
aboutToAppear() {
|
||||
this.title = JSON.parse(this.message).associatedPersonId;
|
||||
this.content = JSON.parse(this.message).associatedType;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
DetailInfoListItemView({ title: this.title, content: this.content, hasRow: true })
|
||||
}
|
||||
.onClick(() => {
|
||||
|
||||
})
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Component
|
||||
struct Remarks {
|
||||
@Link private mDetailModel: any;
|
||||
private hasRow:Boolean = false;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth('1vp')
|
||||
.color(Color.Gray)
|
||||
.opacity(0.6)
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
|
||||
Text(this.mDetailModel.contactForm.remarks)
|
||||
.fontSize(16)
|
||||
Text($r('app.string.remarks'))
|
||||
.fontSize(14)
|
||||
.fontColor($r('app.color.gray'))
|
||||
}
|
||||
|
||||
Blank();
|
||||
|
||||
Image($r('app.media.ic_contacts_arrow_up'))
|
||||
.align(Alignment.Center)
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.visibility(this.hasRow ? Visibility.Visible : Visibility.None)
|
||||
.opacity(0.2)
|
||||
}
|
||||
.width('100%')
|
||||
.height("60vp")
|
||||
.padding({ top: 5, bottom: 5 })
|
||||
}
|
||||
.visibility(Utils.isEmpty(this.mDetailModel.contactForm.remarks) ? Visibility.None : Visibility.Visible)
|
||||
.gesture(LongPressGesture({ fingers: 1, repeat: false, duration: 500 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
|
||||
})
|
||||
.onActionEnd(() => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更多选项
|
||||
*/
|
||||
@Component
|
||||
struct MoreOptions {
|
||||
@Link private mDetailModel: any;
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Text($r('app.string.more'))
|
||||
.fontSize(15)
|
||||
.margin({ right: 5 })
|
||||
.fontColor($r('app.color.font_color_more'))
|
||||
|
||||
Image($r('app.media.ic_contacts_details_arrow_down'))
|
||||
.objectFit(ImageFit.Contain)
|
||||
.height(16)
|
||||
.width(16)
|
||||
}
|
||||
.height('40vp')
|
||||
.visibility(this.mDetailModel.contactForm.showMoreButton ? Visibility.Visible : Visibility.None)
|
||||
.onClick(() => {
|
||||
this.mDetailModel.getMore();
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@Component
|
||||
export struct CallLogTabs {
|
||||
private controller: TabsController
|
||||
@Link bottomTabIndex: number
|
||||
|
||||
build() {
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
alignItems: ItemAlign.Center,
|
||||
justifyContent: FlexAlign.Center
|
||||
}) {
|
||||
Column() {
|
||||
Text($r("app.string.all_call_logs"))
|
||||
.fontSize('16vp')
|
||||
.lineHeight('22vp')
|
||||
.fontColor(this.bottomTabIndex == 0 ? '#00CB87' : '#99182431')
|
||||
.margin({ top: 17, bottom: 6 })
|
||||
|
||||
Row()
|
||||
.width('64vp')
|
||||
.height('2vp')
|
||||
.backgroundColor('#00CB87')
|
||||
.visibility(this.bottomTabIndex == 0 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.width('84vp')
|
||||
.height('56vp')
|
||||
.margin({ right: 50 })
|
||||
.onClick(() => {
|
||||
if (this.bottomTabIndex != 0) {
|
||||
this.controller.changeIndex(0)
|
||||
}
|
||||
})
|
||||
|
||||
Column() {
|
||||
Text($r("app.string.missed_call"))
|
||||
.fontSize('16vp')
|
||||
.lineHeight('22vp')
|
||||
.fontColor(this.bottomTabIndex == 1 ? '#00CB87' : '#99182431')
|
||||
.margin({ top: 17, bottom: 6 })
|
||||
|
||||
Row()
|
||||
.width('64vp')
|
||||
.height('2vp')
|
||||
.backgroundColor('#00CB87')
|
||||
.visibility(this.bottomTabIndex == 1 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.width('84vp')
|
||||
.height('56vp')
|
||||
.onClick(() => {
|
||||
if (this.bottomTabIndex != 1) {
|
||||
this.controller.changeIndex(1)
|
||||
}
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height('56vp')
|
||||
.zIndex(3)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 电话数据类型-即时消息
|
||||
*/
|
||||
export default class Aim {
|
||||
static readonly CONTENT_ITEM_TYPE: string = "vnd.android.cursor.item/aim_v2";
|
||||
static readonly TYPE_AIM: number = 1;
|
||||
static readonly TYPE_WINDOWSLIVE: number = 2;
|
||||
static readonly TYPE_YAHOO: number = 3;
|
||||
static readonly TYPE_SKYPE: number = 4;
|
||||
static readonly TYPE_QQ: number= 5;
|
||||
static readonly TYPE_HANGOUTS: number = 6;
|
||||
static readonly TYPE_ICQ: number = 7;
|
||||
static readonly TYPE_JABBER: number = 8
|
||||
static readonly TYPE_CUSTOM: number = 0;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case Aim.TYPE_AIM:
|
||||
return $r("app.string.instant_type_aim");
|
||||
case Aim.TYPE_WINDOWSLIVE:
|
||||
return $r("app.string.instant_type_windowslive");
|
||||
case Aim.TYPE_YAHOO:
|
||||
return $r("app.string.instant_type_yahoo");
|
||||
case Aim.TYPE_SKYPE:
|
||||
return $r("app.string.instant_type_skype");
|
||||
case Aim.TYPE_QQ:
|
||||
return $r("app.string.instant_type_qq");
|
||||
case Aim.TYPE_HANGOUTS:
|
||||
return $r("app.string.instant_type_hangouts");
|
||||
case Aim.TYPE_ICQ:
|
||||
return $r("app.string.instant_type_icq");
|
||||
case Aim.TYPE_JABBER:
|
||||
return $r("app.string.instant_type_jabber");
|
||||
case Aim.TYPE_CUSTOM:
|
||||
return $r("app.string.instant_type_custom");
|
||||
default:
|
||||
return $r("app.string.instant_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
@@ -12,12 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 100px;
|
||||
}
|
||||
/**
|
||||
* 表基本字段常量
|
||||
*/
|
||||
export default class BaseColumns {
|
||||
static readonly ID: string = "id";
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 电话数据类型-生日
|
||||
*/
|
||||
export default class Birthday {
|
||||
static readonly CONTENT_ITEM_TYPE: string = "vnd.android.cursor.item/birthday_v2";
|
||||
static readonly TYPE_GREBIRTHDAY: number = 1;
|
||||
static readonly TYPE_LUNARBIRTHDAY: number = 2;
|
||||
static readonly TYPE_ANNIVERSARIES: number = 3;
|
||||
static readonly TYPE_OTHER: number = 0;
|
||||
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case Birthday.TYPE_GREBIRTHDAY:
|
||||
return $r("app.string.birthday_type_grebirthday");
|
||||
case Birthday.TYPE_LUNARBIRTHDAY:
|
||||
return $r("app.string.birthday_type_lunarbirthday");
|
||||
case Birthday.TYPE_ANNIVERSARIES:
|
||||
return $r("app.string.birthday_type_anniversaries");
|
||||
case Birthday.TYPE_OTHER:
|
||||
return $r("app.string.birthday_type_other");
|
||||
default:
|
||||
return $r("app.string.birthday_type_other");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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 ContactsColumns from './ContactsColumns.ets';
|
||||
|
||||
/**
|
||||
* rawContact数据类型
|
||||
*/
|
||||
export default class Contacts extends ContactsColumns{
|
||||
static readonly CONTENT_URI: string = "dataability:///com.ohos.contactsdataability";
|
||||
static readonly CONTACT_URI: string = Contacts.CONTENT_URI + "/contacts/contact";
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* 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 BaseColumns from './BaseColumns.ets';
|
||||
|
||||
/**
|
||||
* 联系人contact表字段常量
|
||||
*/
|
||||
export default class ContactsColumns extends BaseColumns {
|
||||
static readonly NAME_RAW_CONTACT_ID: string = "name_raw_contact_id";
|
||||
|
||||
static readonly PHOTO_ID: string = "photo_id";
|
||||
|
||||
static readonly PHOTO_FILE_ID: string = "photo_file_id";
|
||||
|
||||
static readonly PERSONAL_RINGTONE: string = "personal_ringtone";
|
||||
|
||||
static readonly IS_TRANSFER_VOICEMAIL: string = "is_transfer_voicemail";
|
||||
|
||||
static readonly COMPANY: string = "company";
|
||||
|
||||
static readonly POSITION: string = "position";
|
||||
|
||||
static readonly QUICK_SEARCH_KEY: string = "quick_search_key";
|
||||
|
||||
static readonly READ_ONLY: string = "read_only";
|
||||
|
||||
static readonly PERSONAL_NOTIFICATION_RINGTONE: string = "personal_notification_ringtone";
|
||||
|
||||
static readonly HAS_PHONE_NUMBER: string = "has_phone_number";
|
||||
|
||||
static readonly HAS_DISPLAY_NAME: string = "has_display_name";
|
||||
|
||||
static readonly HAS_EMAIL: string = "has_email";
|
||||
|
||||
static readonly HAS_GROUP: string = "has_group";
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import Contacts from './Contacts';
|
||||
|
||||
/**
|
||||
* rawContact数据类型
|
||||
*/
|
||||
export default class Data extends DataColumns {
|
||||
static readonly CONTENT_URI: string = Contacts.CONTENT_URI + "/contacts/contact_data";
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 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 BaseColumns from './BaseColumns.ets';
|
||||
|
||||
/**
|
||||
* 联系人data表字段常量
|
||||
*/
|
||||
export default class DataColumns extends BaseColumns {
|
||||
static readonly TYPE_ID: string = "type_id";
|
||||
static readonly RAW_CONTACT_ID: string = "raw_contact_id";
|
||||
static readonly READ_ONLY: string = "read_only";
|
||||
static readonly VERSION: string = "version";
|
||||
static readonly IS_PREFERRED_NUMBER: string = "is_preferred_number";
|
||||
static readonly DETAIL_INFO: string = "detail_info";
|
||||
static readonly FAMILY_NAME: string = "family_name";
|
||||
static readonly MIDDLE_NAME_PHONETIC: string = "middle_name_phonetic";
|
||||
static readonly GIVEN_NAME: string = "given_name";
|
||||
static readonly GIVEN_NAME_PHONETIC: string = "given_name_phonetic";
|
||||
static readonly ALIAS_DETAIL_INTO: string = "alias_detail_info";
|
||||
static readonly PHONETIC_NAME: string = "phonetic_name";
|
||||
static readonly POSITION: string = "position";
|
||||
static readonly EXTEND1: string = "extend1";
|
||||
static readonly EXTEND2: string = "extend2";
|
||||
static readonly EXTEND3: string = "extend3";
|
||||
static readonly EXTEND4: string = "extend4";
|
||||
static readonly CITY: string = "city";
|
||||
static readonly COUNTRY: string = "country";
|
||||
static readonly NEIGHBORHOOD: string = "neighborhood";
|
||||
static readonly POBOX: string = "pobox";
|
||||
static readonly POSTCODE: string = "postcode";
|
||||
static readonly REGION: string = "region";
|
||||
static readonly STREET: string = "street";
|
||||
static readonly ALPHA_NAME: string = "alpha_name";
|
||||
static readonly OTHER_LAN_LAST_NAME: string = "other_lan_last_name";
|
||||
static readonly OTHER_LAN_FIRST_NAME: string = "other_lan_first_name";
|
||||
static readonly EXTEND5: string = "extend5";
|
||||
static readonly LAN_STYLE: string = "lan_style";
|
||||
static readonly CUSTOM_DATA: string = "custom_data";
|
||||
static readonly EXTEND6: string = "extend6";
|
||||
static readonly EXTEND7: string = "extend7";
|
||||
static readonly BLOB_DATA: string = "blob_data";
|
||||
static readonly SYN_1: string = "syn_1";
|
||||
static readonly SYN_2: string = "syn_2";
|
||||
static readonly SYN_3: string = "syn_3";
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
|
||||
export enum DataItemType {
|
||||
EMAIL = 1,
|
||||
IM = 2,
|
||||
NICKNAME = 3,
|
||||
ORGANIZATION = 4,
|
||||
PHONE = 5,
|
||||
NAME = 6,
|
||||
STRUCTURED_POSTAL = 7,
|
||||
PHOTO = 8,
|
||||
GROUP_MEMBERSHIP = 9,
|
||||
NOTE = 10,
|
||||
EVENT = 11,
|
||||
WEBSITE = 12,
|
||||
RELATION = 13,
|
||||
CONTACT_MISC = 14,
|
||||
HI_CALL_DEVICE = 15,
|
||||
CAM_CARD = 16,
|
||||
SIP_ADDRESS = 17
|
||||
}
|
||||
|
||||
/**
|
||||
* 基本数据类型
|
||||
*/
|
||||
export default class DataType {
|
||||
static readonly TYPE_CUSTOM: number = 0;
|
||||
static readonly TYPE_INVALID: number = -1;
|
||||
static readonly DATA: string = DataColumns.DETAIL_INFO;
|
||||
static readonly LABEL_ID: string = DataColumns.EXTEND7;
|
||||
static readonly LABEL_NAME: string = DataColumns.CUSTOM_DATA;
|
||||
|
||||
static getCont
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 邮箱数据类型
|
||||
*/
|
||||
export default class Email extends DataType{
|
||||
static readonly CONTENT_ITEM_TYPE: string = "email";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.EMAIL;
|
||||
static readonly ADDRESS: string = DataType.DATA;
|
||||
static readonly DISPLAY_NAME: string = DataColumns.ALIAS_DETAIL_INTO;
|
||||
static readonly TYPE_HOME: number = 1;
|
||||
static readonly TYPE_WORK: number = 2;
|
||||
static readonly TYPE_OTHER: number = 3;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case Email.TYPE_HOME: return $r("app.string.email_type_home");
|
||||
case Email.TYPE_WORK: return $r("app.string.email_type_work");
|
||||
case Email.TYPE_OTHER: return $r("app.string.email_type_other");
|
||||
default: return $r("app.string.email_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 重要节日数据类型
|
||||
*/
|
||||
export default class Event extends DataType {
|
||||
static readonly CONTENT_ITEM_TYPE: string = "contact_event";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.EVENT;
|
||||
static readonly START_DATE: string = DataType.DATA;
|
||||
static readonly TYPE_ANNIVERSARY: number = 1;
|
||||
static readonly TYPE_OTHER: number = 2;
|
||||
static readonly TYPE_BIRTHDAY: number = 3;
|
||||
static readonly TYPE_LUNARBIRTHDAY: number = 4;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case Event.TYPE_ANNIVERSARY: return $r("app.string.phone_type_home");
|
||||
case Event.TYPE_BIRTHDAY: return $r("app.string.phone_type_mobile");
|
||||
case Event.TYPE_OTHER: return $r("app.string.phone_type_work");
|
||||
default: return $r("app.string.phone_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 电话数据类型-地址
|
||||
*/
|
||||
export default class House {
|
||||
static readonly CONTENT_ITEM_TYPE: string = "vnd.android.cursor.item/house_v2";
|
||||
static readonly TYPE_DWELLING: number = 1;
|
||||
static readonly TYPE_POSITION: number = 2;
|
||||
static readonly TYPE_OTHER: number = 3;
|
||||
static readonly TYPE_CUSTOM: number = 0;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case House.TYPE_DWELLING:
|
||||
return $r("app.string.house_type_dwelling");
|
||||
case House.TYPE_POSITION:
|
||||
return $r("app.string.house_type_position");
|
||||
case House.TYPE_OTHER:
|
||||
return $r("app.string.house_type_other");
|
||||
case House.TYPE_CUSTOM:
|
||||
return $r("app.string.house_type_custom");
|
||||
default:
|
||||
return $r("app.string.house_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 即时通讯数据类型
|
||||
*/
|
||||
export default class Im extends DataType{
|
||||
static readonly CONTENT_ITEM_TYPE: string = "im";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.IM;
|
||||
static readonly PROTOCOL: string = DataType.DATA;
|
||||
|
||||
static readonly TYPE_CUSTOM: number = -1;
|
||||
static readonly TYPE_AIM: number = 0;
|
||||
static readonly TYPE_MSN: number = 1;
|
||||
static readonly TYPE_YAHOO: number = 2;
|
||||
static readonly TYPE_SKYPE: number = 3;
|
||||
static readonly TYPE_QQ: number = 4;
|
||||
static readonly TYPE_GOOGLE_TALK: number = 5;
|
||||
static readonly TYPE_ICQ: number = 6;
|
||||
static readonly TYPE_JABBER: number = 7;
|
||||
static readonly TYPE_INVALID: number = -2;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case Im.TYPE_CUSTOM: return $r("app.string.email_type_home");
|
||||
case Im.TYPE_AIM: return $r("app.string.email_type_work");
|
||||
case Im.TYPE_MSN: return $r("app.string.email_type_other");
|
||||
default: return $r("app.string.email_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 昵称数据类型
|
||||
*/
|
||||
export default class Nickname extends DataType {
|
||||
static readonly CONTENT_ITEM_TYPE: string = "nickname";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.NICKNAME;
|
||||
static readonly NAME: string = DataType.DATA;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 备注数据类型
|
||||
*/
|
||||
export default class Nickname extends DataType {
|
||||
static readonly CONTENT_ITEM_TYPE: string = "note";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.NOTE;
|
||||
static readonly NOTE: string = DataType.DATA;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 组织数据类型
|
||||
*/
|
||||
export default class Organization extends DataType{
|
||||
static readonly CONTENT_ITEM_TYPE: string = "organization";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.ORGANIZATION;
|
||||
static readonly COMPANY: string = DataType.DATA;
|
||||
static readonly TITLE: string = DataColumns.POSITION;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 电话数据类型
|
||||
*/
|
||||
export default class Phone extends DataType {
|
||||
static readonly CONTENT_ITEM_TYPE: string = "phone";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.PHONE;
|
||||
static readonly NUMBER: string = DataType.DATA;
|
||||
static readonly TYPE_HOME: number = 1;
|
||||
static readonly TYPE_MOBILE: number = 2;
|
||||
static readonly TYPE_WORK: number = 3;
|
||||
static readonly TYPE_FAX_WORK: number = 4;
|
||||
static readonly TYPE_FAX_HOME: number = 5;
|
||||
static readonly TYPE_PAGER: number = 6;
|
||||
static readonly TYPE_OTHER: number = 7;
|
||||
static readonly TYPE_MAIN: number = 12;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case Phone.TYPE_HOME: return $r("app.string.phone_type_home");
|
||||
case Phone.TYPE_MOBILE: return $r("app.string.phone_type_mobile");
|
||||
case Phone.TYPE_WORK: return $r("app.string.phone_type_work");
|
||||
case Phone.TYPE_FAX_WORK: return $r("app.string.phone_type_fax_work");
|
||||
case Phone.TYPE_FAX_HOME: return $r("app.string.phone_type_fax_home");
|
||||
case Phone.TYPE_PAGER: return $r("app.string.phone_type_pager");
|
||||
case Phone.TYPE_OTHER: return $r("app.string.phone_type_other");
|
||||
case Phone.TYPE_MAIN: return $r("app.string.phone_type_main");
|
||||
default: return $r("app.string.phone_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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 BaseColumns from './BaseColumns.ets';
|
||||
import RawContactsColumns from './RawContactsColumns.ets';
|
||||
|
||||
/**
|
||||
* rawContact数据类型
|
||||
*/
|
||||
export default class RawContacts extends RawContactsColumns{
|
||||
static readonly CONTENT_URI: string = "dataability:///com.ohos.contactsdataability/contacts/raw_contact";
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* 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 BaseColumns from './BaseColumns.ets';
|
||||
|
||||
/**
|
||||
* 联系人rawcontact表字段常量
|
||||
*/
|
||||
export default class RawContactsColumns extends BaseColumns {
|
||||
static readonly CONTACT_ID: string = "contact_id";
|
||||
|
||||
static readonly PHOTO_ID: string = "photo_id";
|
||||
|
||||
static readonly PHOTO_FILE_ID: string = "photo_file_id";
|
||||
|
||||
static readonly IS_TRANSFER_VOICEMAIL: string = "is_transfer_voicemail";
|
||||
|
||||
static readonly PERSONAL_RINGTONE: string = "personal_ringtone";
|
||||
|
||||
static readonly IS_DELETED: string = "is_deleted";
|
||||
|
||||
static readonly PERSONAL_NOTIFICATION_RINGTONE: string = "personal_notification_ringtone";
|
||||
|
||||
static readonly PHOTO_FIRST_NAME: string = "photo_first_name";
|
||||
|
||||
static readonly ACCOUNT_ID: string = "account_id";
|
||||
|
||||
static readonly VERSION: string = "version";
|
||||
|
||||
static readonly DISPLAY_NAME: string = "display_name";
|
||||
|
||||
static readonly SORT: string = "sort";
|
||||
|
||||
static readonly CONTACTED_COUNT: string = "contacted_count";
|
||||
|
||||
static readonly LASTEST_CONTACTED_TIME: string = "lastest_contacted_time";
|
||||
|
||||
static readonly FAVORITE: string = "favorite";
|
||||
|
||||
static readonly FAVORITE_ORDER: string = "favorite_order";
|
||||
|
||||
static readonly PHONETIC_NAME: string = "phonetic_name";
|
||||
|
||||
static readonly PHONETIC_NAME_TYPE: string = "phonetic_name_type";
|
||||
|
||||
static readonly COMPANY: string = "company";
|
||||
|
||||
static readonly POSITION: string = "position";
|
||||
|
||||
static readonly READ_ONLY: string = "read_only";
|
||||
|
||||
static readonly SORT_FIRST_LETTER: string = "sort_first_letter";
|
||||
|
||||
static readonly MERGE_MODE: string = "merge_mode";
|
||||
|
||||
static readonly IS_NEED_MERGE: string = "is_need_merge";
|
||||
|
||||
static readonly MERGE_STATUS: string = "merge_status";
|
||||
|
||||
static readonly IS_MERGE_TARGET: string = "is_merge_target";
|
||||
|
||||
static readonly VIBRATION_SETTING: string = "vibration_setting";
|
||||
|
||||
static readonly SYNC_ID: string = "sync_id";
|
||||
|
||||
static readonly SYNC_1: string = "syn_1";
|
||||
|
||||
static readonly SYNC_2: string = "syn_2";
|
||||
|
||||
static readonly SYNC_3: string = "syn_3";
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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 BaseColumns from './BaseColumns.ets';
|
||||
|
||||
/**
|
||||
* rawContact数据类型
|
||||
*/
|
||||
export default class RawContactsEntity {
|
||||
static readonly _ID: string = BaseColumns.ID;
|
||||
static readonly CONTENT_URI: string = "dataability:///com.ohos.contactsdataability/raw_contact_entities";
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* 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 DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 电话数据类型-关系人
|
||||
*/
|
||||
export default class Relation extends DataType{
|
||||
static readonly CONTENT_ITEM_TYPE: string = "relation";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.RELATION;
|
||||
static readonly NAME: string = DataType.DATA;
|
||||
static readonly TYPE_ASSISTANT: number = 1;
|
||||
static readonly TYPE_BROTHER: number = 2;
|
||||
static readonly TYPE_CHILD: number = 3;
|
||||
static readonly TYPE_PARTNER: number = 4;
|
||||
static readonly TYPE_FATHER: number= 5;
|
||||
static readonly TYPE_FRIEND: number = 6;
|
||||
static readonly TYPE_MANAGER: number = 7;
|
||||
static readonly TYPE_MOTHER: number = 8
|
||||
static readonly TYPE_PARENTS: number = 9;
|
||||
static readonly TYPE_DOMESTIC_PARTNER: number = 10;
|
||||
static readonly TYPE_REFERRED_BY: number = 11;
|
||||
static readonly TYPE_RELATIVE: number = 12;
|
||||
static readonly TYPE_SISTERS: number = 13;
|
||||
static readonly TYPE_SPOUSES: number = 14;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case Relation.TYPE_CHILD:
|
||||
return $r("app.string.relationship_type_children");
|
||||
case Relation.TYPE_DOMESTIC_PARTNER:
|
||||
return $r("app.string.relationship_type_partner");
|
||||
case Relation.TYPE_ASSISTANT:
|
||||
return $r("app.string.relationship_type_assistant");
|
||||
case Relation.TYPE_BROTHER:
|
||||
return $r("app.string.relationship_type_brother");
|
||||
case Relation.TYPE_PARTNER:
|
||||
return $r("app.string.relationship_type_mates");
|
||||
case Relation.TYPE_FATHER:
|
||||
return $r("app.string.relationship_type_father");
|
||||
case Relation.TYPE_FRIEND:
|
||||
return $r("app.string.relationship_type_friend");
|
||||
case Relation.TYPE_MANAGER:
|
||||
return $r("app.string.relationship_type_bosses");
|
||||
case Relation.TYPE_MOTHER:
|
||||
return $r("app.string.relationship_type_mother");
|
||||
case Relation.TYPE_PARENTS:
|
||||
return $r("app.string.relationship_type_parents");
|
||||
case Relation.TYPE_REFERRED_BY:
|
||||
return $r("app.string.relationship_type_introducer");
|
||||
case Relation.TYPE_RELATIVE:
|
||||
return $r("app.string.relationship_type_kinship");
|
||||
case Relation.TYPE_SISTERS:
|
||||
return $r("app.string.relationship_type_sisters");
|
||||
case Relation.TYPE_SPOUSES:
|
||||
return $r("app.string.relationship_type_spouses");
|
||||
case Relation.TYPE_CUSTOM:
|
||||
return $r("app.string.relationship_type_custom");
|
||||
default:
|
||||
return $r("app.string.relationship_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 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 DataColumns from './DataColumns';
|
||||
import DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 地址数据类型
|
||||
*/
|
||||
export default class StructuredPostal extends DataType{
|
||||
static readonly CONTENT_ITEM_TYPE: string = "postal_address";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.STRUCTURED_POSTAL;
|
||||
static readonly FORMATTED_ADDRESS: string = DataType.DATA;
|
||||
static readonly STREET: string = DataColumns.STREET;
|
||||
static readonly POBOX: string = DataColumns.POBOX;
|
||||
static readonly NEIGHBORHOOD: string = DataColumns.NEIGHBORHOOD;
|
||||
static readonly CITY: string = DataColumns.CITY;
|
||||
static readonly REGION: string = DataColumns.REGION;
|
||||
static readonly POSTCODE: string = DataColumns.POSTCODE;
|
||||
static readonly COUNTRY: string = DataColumns.COUNTRY;
|
||||
static readonly TYPE_HOME: number = 1;
|
||||
static readonly TYPE_WORK: number = 2;
|
||||
static readonly TYPE_OTHER: number = 3;
|
||||
|
||||
static getTypeLabelResource(type: number) {
|
||||
switch (type) {
|
||||
case StructuredPostal.TYPE_HOME: return $r("app.string.email_type_home");
|
||||
case StructuredPostal.TYPE_WORK: return $r("app.string.email_type_work");
|
||||
case StructuredPostal.TYPE_OTHER: return $r("app.string.email_type_other");
|
||||
default: return $r("app.string.email_type_custom");
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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 DataType from './DataType';
|
||||
import {DataItemType} from './DataType';
|
||||
|
||||
/**
|
||||
* 网站数据类型
|
||||
*/
|
||||
export default class Website extends DataType{
|
||||
static readonly CONTENT_ITEM_TYPE: string = "website";
|
||||
static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.WEBSITE;
|
||||
static readonly URL: string = DataType.DATA;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* 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 AccountType from '../../account/type/AccountType';
|
||||
import RawContact from './RawContact';
|
||||
import ContactBuilder from './ContactBuilder';
|
||||
import ContactDelta from '../repo/ContactDelta';
|
||||
|
||||
export default class Contact {
|
||||
readonly id: number;
|
||||
readonly nameRawContactId: number;
|
||||
readonly quickSearchKey: string;
|
||||
readonly photoId: number;
|
||||
readonly photoFileId: number;
|
||||
readonly personalRingtone: string;
|
||||
readonly personalNotificationRingtone: string;
|
||||
readonly isTransferVoiceMail: boolean;
|
||||
readonly company: string;
|
||||
readonly position: string;
|
||||
readonly hasDisplayName: boolean;
|
||||
readonly hasPhoneNumber: boolean;
|
||||
readonly readOnly: boolean;
|
||||
readonly hasGroup: boolean;
|
||||
readonly hasEmail: boolean;
|
||||
readonly rowContacts: RawContact[];
|
||||
readonly accountTypes: AccountType[];
|
||||
|
||||
constructor(contactBuilder: ContactBuilder) {
|
||||
this.id = contactBuilder.id;
|
||||
this.nameRawContactId = contactBuilder.nameRawContactId;
|
||||
this.quickSearchKey = contactBuilder.quickSearchKey;
|
||||
this.photoId = contactBuilder.photoId;
|
||||
this.photoFileId = contactBuilder.photoFileId;
|
||||
this.personalRingtone = contactBuilder.personalRingtone;
|
||||
this.personalNotificationRingtone = contactBuilder.personalNotificationRingtone;
|
||||
this.isTransferVoiceMail = contactBuilder.isTransferVoiceMail;
|
||||
this.company = contactBuilder.company;
|
||||
this.position = contactBuilder.position;
|
||||
this.hasDisplayName = contactBuilder.hasDisplayName;
|
||||
this.hasPhoneNumber = contactBuilder.hasPhoneNumber;
|
||||
this.readOnly = contactBuilder.readOnly;
|
||||
this.hasGroup = contactBuilder.hasGroup;
|
||||
this.hasEmail = contactBuilder.hasEmail;
|
||||
this.rowContacts = contactBuilder.rowContacts;
|
||||
this.accountTypes = contactBuilder.accountTypes;
|
||||
}
|
||||
|
||||
addToBlackList() {
|
||||
return;
|
||||
}
|
||||
|
||||
removeFromBlackList() {
|
||||
return;
|
||||
}
|
||||
|
||||
isInBlackList() {
|
||||
return false;
|
||||
}
|
||||
|
||||
star() {
|
||||
return false;
|
||||
}
|
||||
|
||||
unStar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected getSharedText() {
|
||||
return "我是被分享的文本";
|
||||
}
|
||||
|
||||
protected getSharedQRCode() {
|
||||
return "我是被分享的二维码";
|
||||
}
|
||||
|
||||
protected getSharedVcard() {
|
||||
return "我是被分享的Vcard";
|
||||
}
|
||||
/**
|
||||
* type:
|
||||
* 1: 二维码
|
||||
* 2:vCard
|
||||
* 3:文本
|
||||
*/
|
||||
shareContactByType(type: number) {
|
||||
}
|
||||
|
||||
// 照理这个联系人不应该关心,但是日历模块太小,先放这
|
||||
addBirthDayToCalendar() {
|
||||
|
||||
}
|
||||
|
||||
clearPhotos() {
|
||||
return false;
|
||||
}
|
||||
|
||||
getPhoto() {
|
||||
return {};
|
||||
}
|
||||
|
||||
isReadOnly() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* 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 AccountType from '../../account/type/AccountType';
|
||||
import RawContact from './RawContact';
|
||||
import Contact from './Contact';
|
||||
import Contacts from '../contract/Contacts';
|
||||
import Data from '../contract/Data';
|
||||
import RawContacts from '../contract/RawContacts';
|
||||
|
||||
/**
|
||||
* 通话记录构造器
|
||||
*/
|
||||
export default class ContactBuilder {
|
||||
readonly id: number;
|
||||
nameRawContactId: number;
|
||||
quickSearchKey: string;
|
||||
photoId: number;
|
||||
photoFileId: number;
|
||||
personalRingtone: string;
|
||||
personalNotificationRingtone: string;
|
||||
isTransferVoiceMail: boolean;
|
||||
company: string;
|
||||
position: string;
|
||||
hasDisplayName: boolean;
|
||||
hasPhoneNumber: boolean;
|
||||
readOnly: boolean;
|
||||
hasGroup: boolean;
|
||||
hasEmail: boolean;
|
||||
rowContacts: RawContact[];
|
||||
accountTypes: AccountType[];
|
||||
|
||||
constructor(id: number) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
static fromResultSet(resultSet: any): ContactBuilder{
|
||||
let contactBuilder = new ContactBuilder(resultSet.getLong(resultSet.getColumnIndex(RawContacts.CONTACT_ID)));
|
||||
contactBuilder.setNameRawContactId(resultSet.getLong(resultSet.getColumnIndex(Data.RAW_CONTACT_ID)));
|
||||
contactBuilder.setQuickSearchKey(resultSet.getString(resultSet.getColumnIndex(Contacts.QUICK_SEARCH_KEY)));
|
||||
contactBuilder.setPhotoId(resultSet.getLong(resultSet.getColumnIndex(Contacts.PHOTO_ID)));
|
||||
contactBuilder.setPhotoFileId(resultSet.getLong(resultSet.getColumnIndex(Contacts.PHOTO_FILE_ID)));
|
||||
contactBuilder.setPersonalRingtone(resultSet.getString(resultSet.getColumnIndex(Contacts.PERSONAL_RINGTONE)));
|
||||
contactBuilder.setPersonalNotificationRingtone(resultSet.getString(resultSet.getColumnIndex(Contacts.PERSONAL_NOTIFICATION_RINGTONE)));
|
||||
contactBuilder.setIsTransferVoiceMail(resultSet.getLong(resultSet.getColumnIndex(Contacts.IS_TRANSFER_VOICEMAIL)) > 0 ? true : false);
|
||||
contactBuilder.setCompany(resultSet.getString(resultSet.getColumnIndex(Contacts.COMPANY)));
|
||||
contactBuilder.setPosition(resultSet.getString(resultSet.getColumnIndex(Contacts.POSITION)));
|
||||
contactBuilder.setHasDisplayName(resultSet.getLong(resultSet.getColumnIndex(Contacts.HAS_DISPLAY_NAME)) > 0 ? true : false);
|
||||
contactBuilder.setHasEmail(resultSet.getLong(resultSet.getColumnIndex(Contacts.IS_TRANSFER_VOICEMAIL)) > 0 ? true : false);
|
||||
contactBuilder.setHasGroup(resultSet.getLong(resultSet.getColumnIndex(Contacts.HAS_GROUP)) > 0 ? true : false);
|
||||
contactBuilder.setHasPhoneNumber(resultSet.getLong(resultSet.getColumnIndex(Contacts.HAS_PHONE_NUMBER)) > 0 ? true : false);
|
||||
contactBuilder.setReadOnly(resultSet.getLong(resultSet.getColumnIndex(Contacts.READ_ONLY)) > 0 ? true : false);
|
||||
contactBuilder.setRowContacts([]);
|
||||
contactBuilder.setAccountTypes([]);
|
||||
return contactBuilder;
|
||||
}
|
||||
|
||||
setNameRawContactId(nameRawContactId: number) {
|
||||
this.nameRawContactId = nameRawContactId;
|
||||
return this;
|
||||
}
|
||||
|
||||
setPhotoId(photoId: number) {
|
||||
this.photoId = photoId;
|
||||
return this;
|
||||
}
|
||||
|
||||
setPhotoFileId(photoFileId: number) {
|
||||
this.photoFileId = photoFileId;
|
||||
return this;
|
||||
}
|
||||
|
||||
setQuickSearchKey(quickSearchKey: string) {
|
||||
this.quickSearchKey = quickSearchKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
setPersonalNotificationRingtone(personalNotificationRingtone: string) {
|
||||
this.personalNotificationRingtone = personalNotificationRingtone;
|
||||
return this;
|
||||
}
|
||||
|
||||
setPersonalRingtone(personalRingtone: string) {
|
||||
this.personalRingtone = personalRingtone;
|
||||
return this;
|
||||
}
|
||||
|
||||
setIsTransferVoiceMail(isTransferVoiceMail: boolean) {
|
||||
this.isTransferVoiceMail = isTransferVoiceMail;
|
||||
return this;
|
||||
}
|
||||
|
||||
setCompany(company: string) {
|
||||
this.company = company;
|
||||
return this;
|
||||
}
|
||||
|
||||
setPosition(position: string) {
|
||||
this.position = position;
|
||||
return this;
|
||||
}
|
||||
|
||||
setHasDisplayName(hasDisplayName: boolean) {
|
||||
this.hasDisplayName = hasDisplayName;
|
||||
return this;
|
||||
}
|
||||
|
||||
setReadOnly(readOnly: boolean) {
|
||||
this.readOnly = readOnly;
|
||||
return this;
|
||||
}
|
||||
|
||||
setHasPhoneNumber(hasPhoneNumber: boolean) {
|
||||
this.hasPhoneNumber = hasPhoneNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
setHasGroup(hasGroup: boolean) {
|
||||
this.hasGroup = hasGroup;
|
||||
return this;
|
||||
}
|
||||
|
||||
setHasEmail(hasEmail: boolean) {
|
||||
this.hasEmail = hasEmail;
|
||||
return this;
|
||||
}
|
||||
|
||||
setRowContacts(rowContacts: RawContact[]) {
|
||||
this.rowContacts = rowContacts;
|
||||
return this;
|
||||
}
|
||||
|
||||
setAccountTypes(accountTypes: AccountType[]) {
|
||||
this.accountTypes = accountTypes;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildContact() {
|
||||
return new Contact(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* 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 DataColumns from '../contract/DataColumns';
|
||||
import Data from '../contract/Data';
|
||||
import DataType from '../contract/DataType';
|
||||
|
||||
/**
|
||||
* 联系人data数据
|
||||
*/
|
||||
export default class DataItem {
|
||||
readonly values: Map<string, any>;
|
||||
constructor(values: Map<string, any>) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
static fromResultSet(resultSet: any): DataItem{
|
||||
let contentValues: Map<string, any> = new Map();
|
||||
contentValues.set(Data.ID, resultSet.getLong(resultSet.getColumnIndex(Data.ID)));
|
||||
contentValues.set(Data.TYPE_ID, resultSet.getLong(resultSet.getColumnIndex(Data.TYPE_ID)));
|
||||
contentValues.set(Data.RAW_CONTACT_ID, resultSet.getLong(resultSet.getColumnIndex(Data.RAW_CONTACT_ID)));
|
||||
contentValues.set(Data.READ_ONLY, resultSet.getLong(resultSet.getColumnIndex(Data.READ_ONLY)) > 0 ? true : false);
|
||||
contentValues.set(Data.DETAIL_INFO, resultSet.getString(resultSet.getColumnIndex(Data.DETAIL_INFO)));
|
||||
contentValues.set(Data.FAMILY_NAME, resultSet.getString(resultSet.getColumnIndex(Data.FAMILY_NAME)));
|
||||
contentValues.set(Data.MIDDLE_NAME_PHONETIC, resultSet.getString(resultSet.getColumnIndex(Data.MIDDLE_NAME_PHONETIC)));
|
||||
contentValues.set(Data.IS_PREFERRED_NUMBER, resultSet.getLong(resultSet.getColumnIndex(Data.IS_PREFERRED_NUMBER)));
|
||||
contentValues.set(Data.GIVEN_NAME, resultSet.getString(resultSet.getColumnIndex(Data.GIVEN_NAME)));
|
||||
contentValues.set(Data.GIVEN_NAME_PHONETIC, resultSet.getString(resultSet.getColumnIndex(Data.GIVEN_NAME_PHONETIC)));
|
||||
contentValues.set(Data.ALIAS_DETAIL_INTO, resultSet.getString(resultSet.getColumnIndex(Data.ALIAS_DETAIL_INTO)));
|
||||
contentValues.set(Data.PHONETIC_NAME, resultSet.getString(resultSet.getColumnIndex(Data.PHONETIC_NAME)));
|
||||
contentValues.set(Data.POSITION, resultSet.getString(resultSet.getColumnIndex(Data.POSITION)));
|
||||
contentValues.set(Data.CITY, resultSet.getString(resultSet.getColumnIndex(Data.CITY)));
|
||||
contentValues.set(Data.COUNTRY, resultSet.getString(resultSet.getColumnIndex(Data.COUNTRY)));
|
||||
contentValues.set(Data.NEIGHBORHOOD, resultSet.getString(resultSet.getColumnIndex(Data.NEIGHBORHOOD)));
|
||||
contentValues.set(Data.POBOX, resultSet.getString(resultSet.getColumnIndex(Data.POBOX)));
|
||||
contentValues.set(Data.POSTCODE, resultSet.getString(resultSet.getColumnIndex(Data.POSTCODE)));
|
||||
contentValues.set(Data.REGION, resultSet.getString(resultSet.getColumnIndex(Data.REGION)));
|
||||
contentValues.set(Data.STREET, resultSet.getString(resultSet.getColumnIndex(Data.STREET)));
|
||||
contentValues.set(Data.ALPHA_NAME, resultSet.getString(resultSet.getColumnIndex(Data.ALPHA_NAME)));
|
||||
contentValues.set(Data.OTHER_LAN_LAST_NAME, resultSet.getString(resultSet.getColumnIndex(Data.OTHER_LAN_LAST_NAME)));
|
||||
contentValues.set(Data.OTHER_LAN_FIRST_NAME, resultSet.getString(resultSet.getColumnIndex(Data.OTHER_LAN_FIRST_NAME)));
|
||||
contentValues.set(Data.LAN_STYLE, resultSet.getString(resultSet.getColumnIndex(Data.LAN_STYLE)));
|
||||
contentValues.set(Data.CUSTOM_DATA, resultSet.getString(resultSet.getColumnIndex(Data.CUSTOM_DATA)));
|
||||
contentValues.set(Data.BLOB_DATA, resultSet.getString(resultSet.getColumnIndex(Data.BLOB_DATA)));
|
||||
contentValues.set(Data.EXTEND1, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND1)));
|
||||
contentValues.set(Data.EXTEND2, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND2)));
|
||||
contentValues.set(Data.EXTEND3, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND3)));
|
||||
contentValues.set(Data.EXTEND4, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND4)));
|
||||
contentValues.set(Data.EXTEND5, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND5)));
|
||||
contentValues.set(Data.EXTEND6, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND6)));
|
||||
contentValues.set(Data.EXTEND7, resultSet.getString(resultSet.getColumnIndex(Data.EXTEND7)));
|
||||
contentValues.set(Data.SYN_1, resultSet.getString(resultSet.getColumnIndex(Data.SYN_1)));
|
||||
contentValues.set(Data.SYN_2, resultSet.getString(resultSet.getColumnIndex(Data.SYN_2)));
|
||||
contentValues.set(Data.SYN_3, resultSet.getString(resultSet.getColumnIndex(Data.SYN_3)));
|
||||
return new DataItem(contentValues);
|
||||
}
|
||||
|
||||
getId() {
|
||||
return this.values.get(Data.ID);
|
||||
}
|
||||
|
||||
getContentTypeId() {
|
||||
return this.values.get(Data.TYPE_ID);
|
||||
}
|
||||
|
||||
getData() {
|
||||
return this.values.get(DataType.DATA);
|
||||
}
|
||||
|
||||
getLabelId() {
|
||||
return this.values.get(DataType.LABEL_ID);
|
||||
}
|
||||
|
||||
getLabelName() {
|
||||
return this.values.get(DataType.LABEL_NAME);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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 DataItem from './DataItem';
|
||||
import Email from '../contract/Email';
|
||||
|
||||
export default class EmailDateItem extends DataItem {
|
||||
readonly values: Map<string, any>;
|
||||
|
||||
constructor(values: Map<string, any>) {
|
||||
super(values);
|
||||
}
|
||||
|
||||
getAddress() {
|
||||
return this.values.get(Email.ADDRESS);
|
||||
}
|
||||
|
||||
getDisplayName() {
|
||||
return this.values.get(Email.DISPLAY_NAME);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 DataItem from './DataItem';
|
||||
import Event from '../contract/Event';
|
||||
|
||||
export default class EventDateItem extends DataItem {
|
||||
readonly values: Map<string, any>;
|
||||
|
||||
constructor(values: Map<string, any>) {
|
||||
super(values);
|
||||
}
|
||||
|
||||
getStartDate() {
|
||||
return this.values.get(Event.START_DATE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 DataItem from './DataItem';
|
||||
import Im from '../contract/Im';
|
||||
|
||||
export default class ImDateItem extends DataItem {
|
||||
readonly values: Map<string, any>;
|
||||
|
||||
constructor(values: Map<string, any>) {
|
||||
super(values);
|
||||
}
|
||||
|
||||
getProtocol() {
|
||||
return this.values.get(Im.PROTOCOL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 DataItem from './DataItem';
|
||||
import Nickname from '../contract/Nickname';
|
||||
|
||||
export default class NicknameDateItem extends DataItem {
|
||||
readonly values: Map<string, any>;
|
||||
|
||||
constructor(values: Map<string, any>) {
|
||||
super(values);
|
||||
}
|
||||
|
||||
getName() {
|
||||
return this.values.get(Nickname.NAME);
|
||||
}
|
||||
}
|
||||