diff --git a/LICENSE b/LICENSE
index 0210352ae2ade0dd7b4c841cb6e8ba08b4780038..18795a48d6b12fcdc1aa7bac9a9cb99f83815267 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
- Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved.
+ Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.en.md b/README.en.md
index 4ff59d569211d014d4de256f55952e7c7a45f87b..8853aa584fc6879b2816117cbee57ef85cae8a44 100644
--- a/README.en.md
+++ b/README.en.md
@@ -1,30 +1,55 @@
-# Distributed Mail
+# Realization of distributed mail function based on application connection
-### Introduction
+## Overview
-This codelab implements the distributed mail app based on functions such as application continuation, distributed data objects, and distributed file systems. It provides the following functions:
+Based on application connection and distributed data objects, this Codelab implements distributed mail applications. It mainly includes the following functions:
-1. Uses distributed data objects to transmit data across devices.
-2. Allows you to tap the Dock to continue the app and transmit data.
-3. Uses the distributed file system to transfer files across devices.
+1. Transfer data across devices through distributed data objects.
+2. By clicking on the system Dock bar, the application can be connected and data can be transmitted.
-
+## Preview
-### Permissions
+
-NA
+## How to Use
-### How to Use
+1. Enter the home page of the application, and you can enter the corresponding contents in the recipient, sender and subject text boxes.
+2. Open the distributed mail application on the local side, and a distributed mail application icon will be added in the Dock bar of the opposite device. Click the distributed mail application, and the local application will be connected to the opposite device.
-1. On the app home page, enter the recipient, sender, and subject in the text boxes.
-2. Open the distributed mail app on your local device. The distributed mail app icon will appear on the Dock of your peer device. Click the app icon, and you can continue with operations in the app on your peer device.
+## Project Directory
-### Constraints
+```
+├──entry/src/main/ets
+│ ├──entryability
+│ │ └──EntryAbility.ets // Entry file
+│ ├──pages
+│ │ └──MailHomePage.ets // Mail home page
+│ └──utils
+│ └──MailInfoManager.ets // Mail information management class
+└──entry/src/main/resources // Resource file
+```
+
+## How to Implement
+
+1. Configure the migrate tag, and configure the sustainable tag in "src/main/module.json5": true means migration is supported, false means migration is not supported, and the default value is false.
+2. Call the distributedDataObject.create() interface to create a distributed data object, and fill the data to be migrated into the distributed data object data.
+3. Call the distributedDataObject.genSessionid() interface to generate the networking id of the data object, and use this id to call setSessionId() to join the networking and activate the distributed data object.
+4. Call the distributedDataObject.save () interface to persist the activated distributed data object.
+5. Call setMissionContinueState() to set the migration status to ACTIVE and create an empty distributed data object to receive the recovered data.
+6. Read the networking id of distributed data objects from want, call setSessionId() to join the networking, and activate the distributed data objects.
+7. Register the on() interface to monitor data changes. When receiving the callback of the event with the status of restore, obtain the basic information of the mail saved when the A device exits through the distributed data object, and save it in AppStorage for the B device to obtain and use.
+8. Manually load the page to be restored in the onWindowStageRestore() life cycle.
+
+## Permissions
+
+N/A.
+
+## Constraints
1. The sample is only supported on Huawei phones with standard systems.
-2. HarmonyOS: HarmonyOS 5.0.5 Release or later.
-3. DevEco Studio: DevEco Studio 5.0.5 Release or later.
-4. HarmonyOS SDK: HarmonyOS 5.0.5 Release SDK or later.
-5. Both devices must be logged in with the same HUAWEI ID.
-6. Wi-Fi and Bluetooth must be enabled on both devices. If possible, it is advisable to connect both devices to the same LAN, which makes data transmission faster.
-7. Application continuation can be triggered only between the same application (UIAbility) of both devices, that is, the application must have been installed on both devices.
+2. The HarmonyOS version must be HarmonyOS 5.1.1 Release or later.
+3. The DevEco Studio version must be DevEco Studio 5.1.1 Release or later.
+4. The HarmonyOS SDK version must be HarmonyOS 5.1.1 Release SDK or later.
+5. Double-ended devices need to log in to the same Huawei account, so it is recommended to turn on the device finding function.
+6. Double-ended devices need to turn on the Wi-Fi and Bluetooth switches. When conditions permit, it is recommended to connect to the same LAN.
+7. Both end devices need this application.
diff --git a/README.md b/README.md
index 976c7728fce85b50b256d620f4d143e8f3719977..ca1b4de93ee84947cb6db11602b406b6f08723b7 100644
--- a/README.md
+++ b/README.md
@@ -1,30 +1,55 @@
-# 数据和文件-分布式邮件
+# 基于应用接续实现分布式邮件功能
-### 简介
+## 项目简介
-本篇Codelab基于应用接续、分布式数据对象、分布式文件系统等功能,实现分布式邮件应用。主要包含以下功能:
+本篇Codelab基于应用接续、分布式数据对象,实现分布式邮件应用。主要包含以下功能:
1. 通过分布式数据对象跨设备传输数据。
2. 通过点击系统Dock栏,使应用接续并进行数据传输。
-3. 使用分布式文件系统跨设备传输文件。
-
+## 效果预览
-### 相关权限
+
-不涉及
-
-### 使用说明
+## 使用说明
1. 进入应用首页,可以在收件人、发件人、主题文本框输入相应内容。
2. 本端打开分布式邮件应用,对端设备的Dock栏中会新增分布式邮件应用图标,点击分布式邮件应用,本端应用会接续到对端设备上去。
-### 约束与限制
+## 工程目录
+
+```
+├──entry/src/main/ets
+│ ├──entryability
+│ │ └──EntryAbility.ets // 入口文件
+│ ├──pages
+│ │ └──MailHomePage.ets // 邮件首页
+│ └──utils
+│ └──MailInfoManager.ets // 邮件信息管理类
+└──entry/src/main/resources // 资源文件
+```
+
+## 具体实现
+
+1. 配置可迁移标签,在"src/main/module.json5"中配置continuable标签:true表示支持迁移,false表示不支持,默认为false。
+2. 调用[distributedDataObject.create()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-data-distributedobject#distributeddataobjectcreate9)接口创建分布式数据对象,将所要迁移的数据填充到分布式数据对象数据中。
+3. 调用[distributedDataObject.genSessionId()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-data-distributedobject#distributeddataobjectgensessionid)接口生成数据对象组网id,并使用该id调用[setSessionId()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-data-distributedobject#setsessionid9)加入组网,激活分布式数据对象。
+4. 调用[distributedDataObject.save()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-data-distributedobject#save9)接口将已激活的分布式数据对象持久化。
+5. 调用[setMissionContinueState()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-inner-application-uiabilitycontext#setmissioncontinuestate10)将迁移状态设置为ACTIVE,并创建空的分布式数据对象,用于接收恢复的数据。
+6. 从want中读取分布式数据对象组网id,调用[setSessionId()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-data-distributedobject#setsessionid9)加入组网,激活分布式数据对象。
+7. 注册on()接口监听数据变更,在收到status为restore的事件的回调中,通过分布式数据对象获取A设备退出时所保存的邮件基本信息,并保存在AppStorage中,供B设备获取使用。
+8. 在[onWindowStageRestore()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-app-ability-abilitylifecyclecallback#onwindowstagerestore12)生命周期中手动加载要恢复的页面。
+
+## 相关权限
+
+不涉及
+
+## 约束与限制
1. 本示例仅支持标准系统上运行,支持设备:华为手机。
-2. HarmonyOS系统:HarmonyOS 5.0.5 Release及以上。
-3. DevEco Studio版本:DevEco Studio 5.0.5 Release及以上。
-4. HarmonyOS SDK版本:HarmonyOS 5.0.5 Release SDK及以上。
-5. 双端设备需要登录同一华为账号。
-6. 双端设备需要打开Wi-Fi和蓝牙开关。条件允许时,建议双端设备接入同一个局域网,可提升数据传输的速度。
+2. HarmonyOS系统:HarmonyOS 5.1.1 Release及以上。
+3. DevEco Studio版本:DevEco Studio 5.1.1 Release及以上。
+4. HarmonyOS SDK版本:HarmonyOS 5.1.1 Release SDK及以上。
+5. 双端设备需要登录同一华为账号。
+6. 双端设备需要打开Wi-Fi和蓝牙开关。条件允许时,建议双端设备接入同一个局域网,可提升数据传输的速度。
7. 应用接续只能在同应用(UIAbility)之间触发,双端设备都需要有该应用。
diff --git a/build-profile.json5 b/build-profile.json5
index 28db7ad2ea4faaba762bec70bd26b2a21148dc47..578d98f2ccce40227be1c5c1765d6a998e9a5b76 100644
--- a/build-profile.json5
+++ b/build-profile.json5
@@ -5,8 +5,8 @@
{
"name": "default",
"signingConfig": "default",
- "compatibleSdkVersion": "5.0.5(17)",
- "targetSdkVersion": "5.0.5(17)",
+ "targetSdkVersion": "5.1.1(19)",
+ "compatibleSdkVersion": "5.1.1(19)",
"runtimeOS": "HarmonyOS"
}
],
diff --git a/code-linter.json5 b/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..eaa4bb5eb40a6bccd365319fa01a5da9907b3efa
--- /dev/null
+++ b/code-linter.json5
@@ -0,0 +1,33 @@
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error",
+ "@typescript-eslint/semi": "error"
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets
deleted file mode 100644
index 9bb045f470604cf4b8eb4fdbbf250cc1f3e8529f..0000000000000000000000000000000000000000
--- a/entry/src/main/ets/common/constants/CommonConstants.ets
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2023 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 class CommonConstants {
-
- /**
- * The maximum component width.
- */
- static readonly PERCENTAGE_MAX: string = '100%';
-
- /**
- * Distributed mail image storage location.
- */
- static readonly MAIL_DISTRIBUTED_PATH: string = '/data/storage/el2/distributedfiles/';
-
- /**
- * File name for storing cross-end photos.
- */
- static readonly PICTURE_NAME: string = 'pictureName';
-
- /**
- * Supports transfer.
- */
- static readonly CAN_CONTINUATION: string = 'true';
-
- /**
- * Forwarding is not supported.
- */
- static readonly NO_CONTINUATION: string = 'false';
-
- /**
- * With picture streaming.
- */
- static readonly CAN_PHOTO: string = 'true';
-
- /**
- * Transfer without picture.
- */
- static readonly NO_PHOTO: string = 'false';
-
- /**
- * Image stream size.
- */
- static readonly IMAGE_STREAM_SIZE: number = 10240000;
-
- /**
- * Bottom toolbar picture spacing.
- */
- static readonly BOTTOM_IMAGE_SPACE: number = 24;
-
- static readonly FILE_BUFFER_SIZE: number = 4096;
-
- static readonly APPENDIX_LIST_SPACE: number = 5;
-
- static readonly APPENDIX_LIST_START_MARGIN: number = 15;
-
- static readonly APPENDIX_LIST_END_MARGIN: number = 15;
-}
-
-
-
diff --git a/entry/src/main/ets/common/utils/Logger.ets b/entry/src/main/ets/common/utils/Logger.ets
deleted file mode 100644
index 53c08d6841ca474f4d24f7802f310eba0086005e..0000000000000000000000000000000000000000
--- a/entry/src/main/ets/common/utils/Logger.ets
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2023 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 { hilog } from '@kit.PerformanceAnalysisKit';
-
-/**
- * Log printing tool class.
- */
-class Logger {
- private domain: number;
- private prefix: string;
- private format: string = '%{public}s, %{public}s';
-
- /**
- * Constructor.
- *
- * @param Prefix Identifies the log tag.
- * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
- */
- constructor(prefix: string = 'MyApp', domain: number = 0xFF00) {
- this.prefix = prefix;
- this.domain = domain;
- }
-
- debug(...args: string[]): void {
- hilog.debug(this.domain, this.prefix, this.format, args);
- }
-
- info(...args: string[]): void {
- hilog.info(this.domain, this.prefix, this.format, args);
- }
-
- warn(...args: string[]): void {
- hilog.warn(this.domain, this.prefix, this.format, args);
- }
-
- error(...args: string[]): void {
- hilog.error(this.domain, this.prefix, this.format, args);
- }
-}
-
-export default new Logger('[DistributedMail]');
\ No newline at end of file
diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets
index 34d025c2d0904c466242f9bd496984c4db3978c4..cb4634f40a19f52198d1b4d13b4752597472407b 100644
--- a/entry/src/main/ets/entryability/EntryAbility.ets
+++ b/entry/src/main/ets/entryability/EntryAbility.ets
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2023 Huawei Device Co., Ltd.
+* Copyright (c) 2025 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
@@ -13,29 +13,32 @@
* limitations under the License.
*/
-import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
-import { commonType, distributedDataObject } from '@kit.ArkData';
+import { distributedDataObject } from '@kit.ArkData';
import { window } from '@kit.ArkUI';
-import Logger from '../common/utils/Logger';
-import { CommonConstants } from '../common/constants/CommonConstants';
-import { AppendixBean } from '../viewmodel/AppendixItem';
-import { MailInfo } from '../viewmodel/MailInfo';
-import { fileIo, fileUri } from '@kit.CoreFileKit';
import { JSON } from '@kit.ArkTS';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { MailInfoManager } from '../utils/MailInfoManager';
-let uiContext: UIContext | undefined = undefined;
+const DOMAIN = 0x0000;
export default class EntryAbility extends UIAbility {
private distributedObject: distributedDataObject.DataObject | undefined = undefined;
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
- Logger.info('EntryAbility', 'Ability onCreate');
- this.restoreDistributedObject(want, launchParam);
+ try {
+ this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
+ hilog.info(DOMAIN, 'EntryAbility', '%{public}s', 'Ability onCreate');
+ this.restoreDistributedObject(want, launchParam);
+ } catch (error) {
+ hilog.error(0x0000, 'EntryAbility', `getApplicationContext error. Code:${error.code},message: ${error.message}`);
+ return error.code;
+ }
}
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
- Logger.info('EntryAbility', 'Ability onNewWant');
+ hilog.info(0x0000, 'EntryAbility', `Ability onNewWant`);
this.restoreDistributedObject(want, launchParam);
}
@@ -46,167 +49,102 @@ export default class EntryAbility extends UIAbility {
* @returns
*/
async restoreDistributedObject(want: Want, launchParam: AbilityConstant.LaunchParam): Promise {
+ this.context.setMissionContinueState(AbilityConstant.ContinueState.INACTIVE, (result) => {
+ hilog.info(0x0000, 'EntryAbility', `setMissionContinueState: ${JSON.stringify(result)}`);
+ });
if (launchParam.launchReason !== AbilityConstant.LaunchReason.CONTINUATION) {
return;
}
- AppStorage.setOrCreate('isContinuation', CommonConstants.CAN_CONTINUATION);
- AppStorage.setOrCreate>('appendix', JSON.parse(want.parameters?.appendix as string) as Array);
// Obtain the session ID of a distributed data object.
-
- let mailInfo: MailInfo = new MailInfo(undefined, undefined, undefined, undefined, undefined);
- this.distributedObject = distributedDataObject.create(this.context, mailInfo);
+ let mailInfoManager: MailInfoManager = new MailInfoManager(undefined, undefined, undefined, undefined);
+ this.distributedObject = distributedDataObject.create(this.context, mailInfoManager);
// Add a data restored listener.
- this.distributedObject.on('status', (sessionId: string, networkId: string, status: 'online' | 'offline' | 'restored') => {
- Logger.info('EntryAbility', 'status changed ' + sessionId + ' ' + status + ' ' + networkId);
- if (status === 'restored') {
- if (!this.distributedObject) {
- return;
- }
- AppStorage.setOrCreate('recipient', this.distributedObject['recipient']);
- AppStorage.setOrCreate('sender', this.distributedObject['sender']);
- AppStorage.setOrCreate('subject', this.distributedObject['subject']);
- AppStorage.setOrCreate('emailContent', this.distributedObject['emailContent']);
- AppStorage.setOrCreate('attachments', this.distributedObject['attachments']);
- let attachments = this.distributedObject['attachments'] as commonType.Assets;
- Logger.info('this.distributedObject[attachments] ' + JSON.stringify(this.distributedObject['attachments']))
- for (const attachment of attachments) {
- this.fileCopy(attachment);
- }
- }
- });
- let sessionId : string = want.parameters?.distributedSessionId as string;
- Logger.info('sessionId' + sessionId);
- this.distributedObject.setSessionId(sessionId);
- this.context.restoreWindowStage(new LocalStorage());
+ try {
+ this.distributedObject.on('status',
+ (sessionId: string, networkId: string, status: 'online' | 'offline' | 'restored') => {
+ hilog.info(0x0000, 'EntryAbility', 'status changed ' + sessionId + ' ' + status + ' ' + networkId);
+ if (status === 'restored') {
+ if (!this.distributedObject) {
+ return;
+ }
+ AppStorage.setOrCreate('recipient', this.distributedObject['recipient']);
+ AppStorage.setOrCreate('sender', this.distributedObject['sender']);
+ AppStorage.setOrCreate('subject', this.distributedObject['subject']);
+ AppStorage.setOrCreate('emailContent', this.distributedObject['emailContent']);
+ }
+ });
+ let sessionId: string = want.parameters?.distributedSessionId as string;
+ hilog.info(0x0000, 'EntryAbility', 'sessionId' + sessionId);
+ this.distributedObject.setSessionId(sessionId).catch((err: BusinessError) => {
+ hilog.error(0x0000, 'EntryAbility', `setSessionId error .Code:${err.code},message: ${err.message}`);
+ });
+ this.context.restoreWindowStage(new LocalStorage());
+ } catch (error) {
+ hilog.error(0x0000, 'EntryAbility', `have error. Code:${error.code}, message: ${error.message}`);
+ }
}
onWindowStageRestore(windowStage: window.WindowStage): void {
- Logger.info('EntryAbility', 'Ability onWindowStageRestore');
+ hilog.info(0x0000, 'EntryAbility', 'Ability onWindowStageRestore');
windowStage.loadContent('pages/MailHomePage', (err, data) => {
if (err.code) {
- Logger.error('EntryAbility', 'Failed to load the content, ', `Catch err: ${err}`);
+ hilog.error(0x0000, 'EntryAbility', `ailed to load the content, Code:${err.code},message: ${err.message}`);
return;
}
- Logger.info('EntryAbility', 'Succeeded in loading the content, ', `Data: ${data}`);
+ hilog.info(0x0000, 'EntryAbility', 'Succeeded in loading the content, ', `Data: ${data}`);
});
}
async onContinue(wantParam: Record): Promise {
- wantParam.appendix = JSON.stringify(AppStorage.get>('appendix'));
try {
// Generate the session ID of the distributed data object.
let sessionId: string = distributedDataObject.genSessionId();
wantParam.distributedSessionId = sessionId;
- let appendix = AppStorage.get>('appendix');
- let assets: commonType.Assets = [];
- if (appendix) {
- for (let i = 0; i < appendix.length; i++) {
- let append = appendix[i];
- let attachment: commonType.Asset = this.getAssetInfo(append);
- assets.push(attachment);
- }
- }
-
- let mailInfo: MailInfo = new MailInfo(AppStorage.get('recipient'), AppStorage.get('sender'),
- AppStorage.get('subject'), AppStorage.get('emailContent'), assets);
- let source = mailInfo.flatAssets();
- this.distributedObject = distributedDataObject.create(this.context, source);
- this.distributedObject.setSessionId(sessionId);
+ let mailInfoManager: MailInfoManager = new MailInfoManager(AppStorage.get('recipient'), AppStorage.get('sender'),
+ AppStorage.get('subject'), AppStorage.get('emailContent'));
+ this.distributedObject = distributedDataObject.create(this.context, mailInfoManager);
+ this.distributedObject.setSessionId(sessionId).catch((err: BusinessError) => {
+ hilog.error(0x0000, 'EntryAbility', `setSessionId error. Code:${err.code},message: ${err.message}`);
+ });
await this.distributedObject.save(wantParam.targetDevice as string).then(() => {
- Logger.info('onContinue distributedObject save success');
+ hilog.info(0x0000, 'EntryAbility', 'onContinue distributedObject save success');
}).catch((err: BusinessError) => {
- Logger.error(`Failed to save. Code:${err.code},message:${err.message}`);
+ hilog.error(0x0000, 'EntryAbility', `Failed to save. Code:${err.code}, message:${err.message}`);
});
- } catch (error) {
- Logger.error('EntryAbility', 'distributedDataObject failed', `code ${(error as BusinessError).code}`);
+ } catch (err) {
+ hilog.error(0x0000, 'EntryAbility', `distributedDataObject failed, Code:${err.code}, message:${err.message}`);
}
return AbilityConstant.OnContinueResult.AGREE;
}
- /**
- * Copy distributed files.
- * @param attachmentRecord
- * @param key
- */
- private fileCopy(attachment: commonType.Asset) {
- let filePath: string = this.context.distributedFilesDir + '/' + attachment.name;
- let savePath: string = this.context.filesDir + '/' + attachment.name;
- try {
- if (fileIo.accessSync(filePath)) {
- let saveFile = fileIo.openSync(savePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
- let file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE);
- let buf: ArrayBuffer = new ArrayBuffer(CommonConstants.FILE_BUFFER_SIZE);
- let readSize = 0;
- let readLen = fileIo.readSync(file.fd, buf, {
- offset: readSize
- });
- while (readLen > 0) {
- readSize += readLen;
- fileIo.writeSync(saveFile.fd, buf);
- readLen = fileIo.readSync(file.fd, buf, {
- offset: readSize
- });
- }
- fileIo.closeSync(file);
- fileIo.closeSync(saveFile);
- Logger.info('EntryAbility', attachment.name + 'synchronized successfully.');
- }
- } catch (error) {
- let err: BusinessError = error as BusinessError;
- Logger.error(`DocumentViewPicker failed with err: ${JSON.stringify(err)}`);
- }
- }
-
- /**
- * Obtain distributed file asset information.
- * @param append
- * @returns
- */
- private getAssetInfo(append: AppendixBean) {
- let filePath = uiContext!.getHostContext()!.distributedFilesDir + '/' + append.fileName;
- fileIo.statSync(filePath);
- let uri: string = fileUri.getUriFromPath(filePath);
- let stat = fileIo.statSync(filePath);
- let attachment: commonType.Asset = {
- name: append.fileName,
- uri: uri,
- path: filePath,
- createTime: stat.ctime.toString(),
- modifyTime: stat.ctime.toString(),
- size: stat.size.toString()
- };
- return attachment;
- }
-
onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created, set main page for this ability.
- Logger.info('EntryAbility', 'Ability onWindowStageCreate');
+ hilog.info(0x0000, 'EntryAbility', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/MailHomePage', (err, data) => {
if (err.code) {
- Logger.error('EntryAbility', 'Failed to load the content, ', `Catch err: ${err}`);
+ hilog.error(0x0000, 'EntryAbility', `Failed to load the content, Code: ${err.code} message:${err.message}`);
return;
}
- Logger.info('EntryAbility', 'Succeeded in loading the content, ', `Data: ${data}`);
- uiContext = windowStage.getMainWindowSync().getUIContext();
+ hilog.info(0x0000, 'EntryAbility', 'Succeeded in loading the content, ', `Data: ${data}`);
});
}
onWindowStageDestroy() {
- Logger.info('EntryAbility', 'Ability onWindowStageDestroy');
+ hilog.info(DOMAIN, 'EntryAbility', 'Ability onWindowStageDestroy');
}
onForeground() {
- Logger.info('EntryAbility', 'Ability onForeground');
+ hilog.info(DOMAIN, 'EntryAbility', 'Ability onForeground');
}
onBackground() {
- Logger.info('EntryAbility', 'Ability onBackground');
+ hilog.info(DOMAIN, 'EntryAbility', 'Ability onBackground');
}
onDestroy() {
- Logger.info('EntryAbility', 'Ability onDestroy');
+ hilog.info(DOMAIN, 'EntryAbility', 'Ability onDestroy');
}
}
diff --git a/entry/src/main/ets/pages/MailHomePage.ets b/entry/src/main/ets/pages/MailHomePage.ets
index 258306d42c2821f5abd12a812c4b0a5b9ea4b9c6..359bc7fce0e01666e07f3d98999ecf7f44cd8c75 100644
--- a/entry/src/main/ets/pages/MailHomePage.ets
+++ b/entry/src/main/ets/pages/MailHomePage.ets
@@ -1,27 +1,20 @@
/*
- * Copyright (c) 2023 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
+ * Copyright (c) 2025 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
+ * 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.
+ * 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 { BusinessError } from '@kit.BasicServicesKit';
-import { common } from '@kit.AbilityKit';
-import { fileIo, picker } from '@kit.CoreFileKit';
-import { image } from '@kit.ImageKit';
-import { promptAction } from '@kit.ArkUI';
-import Logger from '../common/utils/Logger';
-import { CommonConstants } from '../common/constants/CommonConstants';
-import { AppendixBean, FileType } from '../viewmodel/AppendixItem';
-import { imageIndex } from '../viewmodel/AppendixIndexModel';
+import { AbilityConstant, common } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
@Entry
@Component
@@ -30,116 +23,65 @@ struct MailHomePage {
@StorageLink('sender') sender: string = '';
@StorageLink('subject') subject: string = '';
@StorageLink('emailContent') emailContent: string = '';
- @StorageLink('isContinuation') isContinuation: string = CommonConstants.NO_CONTINUATION;
- @State crossEndPicture: PixelMap | undefined = undefined;
- @StorageLink('appendix') appendix: Array = [];
- @StorageLink('attachments') attachments: Object = [];
- private appContext: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
- private distributedPath: string = CommonConstants.MAIL_DISTRIBUTED_PATH;
+ private context = this.getUIContext().getHostContext() as common.UIAbilityContext;
- build() {
- Column() {
- this.NavigationTitle()
- this.EmailContent()
- this.NavigationToolbar()
- }
- .width(CommonConstants.PERCENTAGE_MAX)
- .height(CommonConstants.PERCENTAGE_MAX)
- .backgroundColor($r('app.color.input_textarea_background'))
- .justifyContent(FlexAlign.SpaceBetween)
+ onPageShow(): void {
+ this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {
+ hilog.info(0x0000, 'MailHomePage', 'setMissionContinueState ACTIVE result: ', JSON.stringify(result));
+ });
}
- @Builder AddAppendix() {
- Menu() {
- MenuItem({startIcon: $r('app.media.ic_files_grid_txt'), content: $r('app.string.add_txt_file')})
- .onClick(() => {
- this.documentSelect(FileType.TXT);
- })
-
- MenuItem({startIcon: $r('app.media.ic_files_documents'), content: $r('app.string.add_doc_file')})
- .onClick(() => {
- this.documentSelect(FileType.DOC);
- })
-
- MenuItem({startIcon: $r('app.media.ic_files_pdf'), content: $r('app.string.add_pdf_file')})
- .onClick(() => {
- this.documentSelect(FileType.PDF);
- })
+ onBackPress(): void {
+ this.context.setMissionContinueState(AbilityConstant.ContinueState.INACTIVE, (result) => {
+ hilog.info(0x0000, 'MailHomePage', 'setMissionContinueState INACTIVE result: ', JSON.stringify(result));
+ });
+ }
- MenuItem({startIcon: $r('app.media.ic_files_unknown'), content: $r('app.string.add_other_file')})
- .enabled(false)
+ build() {
+ Column() {
+ this.NavigationTitle();
+ this.EmailContent();
}
+ .width('100%')
+ .height('100%')
+ .padding({ left: 16, right: 16 })
+ .backgroundColor('#FFF1F3F5')
+ .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
/**
* Top navigation title bar.
*/
- @Builder NavigationTitle() {
- Row() {
+ @Builder
+ NavigationTitle() {
+ Flex({ alignItems: ItemAlign.Center }) {
+
+ Text($r('app.string.new_email_text'))
+ .fontSize(20)
+ .fontWeight(700)
+ .lineHeight(27)
+ .fontColor('rgba(0, 0, 0, 0.9)')
+ .flexGrow(1)
+
Row() {
- Image($r('app.media.ic_public_back'))
- .width($r('app.float.common_image_size'))
- .height($r('app.float.common_image_size'))
- .margin({
- right: $r('app.float.navigation_image_margin')
- })
- .onClick(() => {
- this.appContext.terminateSelf();
- })
- Text($r('app.string.new_email_text'))
- .fontColor($r('app.color.text_cursor_color'))
- .fontSize($r('app.float.email_title_size'))
- .fontWeight(FontWeight.Bold)
+ SymbolGlyph($r('sys.symbol.paperplane'))
+ .fontSize(24)
+ .fontWeight(400)
}
+ .alignItems(VerticalAlign.Center)
+ .justifyContent(FlexAlign.Center)
+ .width(40)
+ .height(40)
+ .backgroundColor('rgba(0, 0, 0, 0.05)')
+ .borderRadius(40)
+ .margin({ right: 8 })
- Image($r('app.media.ic_send'))
- .width($r('app.float.common_image_size'))
- .height($r('app.float.common_image_size'))
- }
- .width(CommonConstants.PERCENTAGE_MAX)
- .height($r('app.float.navigation_height'))
- .justifyContent(FlexAlign.SpaceBetween)
- .padding({
- left: $r('app.float.common_padding_margin'),
- right: $r('app.float.common_padding_margin')
- })
- }
-
- /**
- * Bottom toolbar area.
- */
- @Builder NavigationToolbar() {
- Row({ space: CommonConstants.BOTTOM_IMAGE_SPACE }) {
- Image($r('app.media.ic_files_new_folder'))
- .width($r('app.float.common_image_size'))
- .height($r('app.float.common_image_size'))
- .bindMenu(this.AddAppendix)
- Image($r('app.media.ic_photo'))
- .enabled(false)
- .width($r('app.float.common_image_size'))
- .height($r('app.float.common_image_size'))
- Image($r('app.media.ic_at'))
- .width($r('app.float.common_image_size'))
- .height($r('app.float.common_image_size'))
- Image($r('app.media.ic_upload'))
- .width($r('app.float.common_image_size'))
- .height($r('app.float.common_image_size'))
}
- .width(CommonConstants.PERCENTAGE_MAX)
- .height($r('app.float.navigation_height'))
- .padding({
- left: $r('app.float.common_padding_margin'),
- right: $r('app.float.common_padding_margin')
- })
- .border({
- width: {
- top: $r('app.float.border_divider_width')
- },
- color: $r('app.color.border_divider_color')
- })
+ .height(56)
}
- @Builder EmailContent() {
+ @Builder
+ EmailContent() {
Column() {
// Recipient
Row() {
@@ -149,7 +91,7 @@ struct MailHomePage {
.focusable(true)
TextInput({ text: this.recipient })
.type(InputType.Email)
- .width(CommonConstants.PERCENTAGE_MAX)
+ .width('100%')
.backgroundColor($r('app.color.input_textarea_background'))
.caretColor($r('app.color.text_cursor_color'))
.onChange((recipientName: string) => {
@@ -157,11 +99,11 @@ struct MailHomePage {
AppStorage.set('recipient', recipientName);
})
}
- .width(CommonConstants.PERCENTAGE_MAX)
- .height($r('app.float.content_box_height'))
+ .width('100%')
+ .height(56)
.border({
- width: { bottom: $r('app.float.border_divider_width') },
- color: $r('app.color.border_divider_color')
+ width: { bottom: 1 },
+ color: 'rgba(0, 0, 0, 0.2)'
})
// Sender
@@ -171,7 +113,7 @@ struct MailHomePage {
.fontSize($r('app.float.text_font_size'))
TextInput({ text: this.sender })
.type(InputType.Email)
- .width(CommonConstants.PERCENTAGE_MAX)
+ .width('100%')
.backgroundColor($r('app.color.input_textarea_background'))
.caretColor($r('app.color.text_cursor_color'))
.onChange((senderName: string) => {
@@ -179,11 +121,11 @@ struct MailHomePage {
AppStorage.set('sender', senderName);
})
}
- .width(CommonConstants.PERCENTAGE_MAX)
- .height($r('app.float.content_box_height'))
+ .width('100%')
+ .height(56)
.border({
- width: { bottom: $r('app.float.border_divider_width') },
- color: $r('app.color.border_divider_color')
+ width: { bottom: 1 },
+ color: 'rgba(0, 0, 0, 0.2)'
})
// Subject
@@ -192,7 +134,7 @@ struct MailHomePage {
.fontColor($r('app.color.content_text_color'))
.fontSize($r('app.float.text_font_size'))
TextInput({ text: this.subject })
- .width(CommonConstants.PERCENTAGE_MAX)
+ .width('100%')
.backgroundColor($r('app.color.input_textarea_background'))
.caretColor($r('app.color.text_cursor_color'))
.onChange((subjectInfo: string) => {
@@ -200,56 +142,20 @@ struct MailHomePage {
AppStorage.set('subject', subjectInfo);
})
}
- .width(CommonConstants.PERCENTAGE_MAX)
- .height($r('app.float.content_box_height'))
+ .width('100%')
+ .height(56)
.border({
- width: { bottom: $r('app.float.border_divider_width') },
- color: $r('app.color.border_divider_color')
+ width: { bottom: 1 },
+ color: 'rgba(0, 0, 0, 0.2)'
})
- // Appendix
- if (this.appendix.length > 0) {
- Row() {
- Text($r('app.string.appendix_text'))
- .fontColor($r('app.color.content_text_color'))
- .fontSize($r('app.float.text_font_size'))
- List({ space: CommonConstants.APPENDIX_LIST_SPACE }) {
- ForEach(this.appendix, (item: AppendixBean) => {
- ListItem() {
- Row() {
- Image(imageIndex[item.iconIndex].icon)
- .width($r('app.float.appendix_list_item_width'))
- .aspectRatio(1)
- .margin({ right: $r('app.float.appendix_list_item_margin_right')})
- Text(item.fileName)
- .fontSize($r('app.float.appendix_file_name_font_size'))
- }
- }
- })
- }
- .listDirection(Axis.Horizontal)
- .alignListItem(ListItemAlign.Center)
- .divider({
- strokeWidth: 1,
- color: Color.Grey,
- startMargin: CommonConstants.APPENDIX_LIST_START_MARGIN,
- endMargin: CommonConstants.APPENDIX_LIST_END_MARGIN
- })
- .scrollBar(BarState.Off)
- }
- .width(CommonConstants.PERCENTAGE_MAX)
- .height($r('app.float.content_box_height'))
- .border({
- width: { bottom: $r('app.float.border_divider_width') },
- color: $r('app.color.border_divider_color')
- })
- }
-
// Message content area.
Row() {
TextArea({ text: this.emailContent })
- .height(CommonConstants.PERCENTAGE_MAX)
+ .height('100%')
+ .padding(0)
.backgroundColor($r('app.color.input_textarea_background'))
+ .borderRadius(0)
.caretColor($r('app.color.text_cursor_color'))
.onChange((emailContent: string) => {
this.emailContent = emailContent;
@@ -258,91 +164,14 @@ struct MailHomePage {
}
.layoutWeight(1)
.alignItems(VerticalAlign.Top)
- .width(CommonConstants.PERCENTAGE_MAX)
+ .width('100%')
.margin({
top: $r('app.float.text_image_margin'),
bottom: $r('app.float.navigation_height')
})
-
- // Image display area.
- Row() {
- if (this.crossEndPicture) {
- Image(this.crossEndPicture)
- .height($r('app.float.photo_picture_height'))
- .objectFit(ImageFit.ScaleDown)
- .borderRadius($r('app.float.photo_picture_radius'))
- }
- }
- .width(CommonConstants.PERCENTAGE_MAX)
- .justifyContent(FlexAlign.Start)
}
- .width(CommonConstants.PERCENTAGE_MAX)
+ .width('100%')
.layoutWeight(1)
- .padding({
- left: $r('app.float.common_padding_margin'),
- right: $r('app.float.common_padding_margin')
- })
- .margin({ top: $r('app.float.email_content_margin') })
- }
-
- /**
- * Rendering pictures.
- *
- * @param buffer Returned image stream of cross-end photographing.
- */
- createPicture(buffer: ArrayBuffer): void {
- let imageSource = image.createImageSource(buffer);
- imageSource.createPixelMap().then((pixelMap) => {
- this.crossEndPicture = pixelMap;
- })
- }
-
- /**
- * Add appendix from file manager.
- *
- * @param fileType
- */
- documentSelect(fileType: number): void {
- try {
- let DocumentSelectOptions = new picker.DocumentSelectOptions();
- let documentPicker = new picker.DocumentViewPicker();
- documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult: Array) => {
- for (let documentSelectResultElement of DocumentSelectResult) {
- let buf = new ArrayBuffer(CommonConstants.FILE_BUFFER_SIZE);
- let readSize = 0;
- let file = fileIo.openSync(documentSelectResultElement, fileIo.OpenMode.READ_ONLY);
- let readLen = fileIo.readSync(file.fd, buf, { offset: readSize });
- // File name is not supported chinese name.
- let fileName = file.name;
- if (!fileName.endsWith(imageIndex[fileType].fileType) ||
- new RegExp("\[\\u4E00-\\u9FA5]|[\\uFE30-\\uFFA0]", "gi").test(fileName)) {
- this.getUIContext().getPromptAction().showToast({
- message: $r('app.string.alert_message_chinese')
- })
- return;
- }
- let destination = fileIo.openSync(this.getUIContext().getHostContext()!
- .filesDir + '/' + fileName, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
- let destinationDistribute = fileIo.openSync(this.getUIContext().getHostContext()!
- .distributedFilesDir + '/' + fileName, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
- while (readLen > 0) {
- readSize += readLen;
- fileIo.writeSync(destination.fd, buf);
- fileIo.writeSync(destinationDistribute.fd, buf);
- readLen = fileIo.readSync(file.fd, buf, { offset: readSize });
- }
- fileIo.closeSync(file);
- fileIo.closeSync(destination);
- fileIo.closeSync(destinationDistribute);
- this.appendix.push({ iconIndex: fileType, fileName: fileName });
- }
- Logger.info(`DocumentViewPicker.select successfully, DocumentSelectResult uri: ${JSON.stringify(DocumentSelectResult)}`);
- }).catch((err: BusinessError) => {
- Logger.error(`DocumentViewPicker.select failed with err: ${JSON.stringify(err)}`);
- });
- } catch (error) {
- let err: BusinessError = error as BusinessError;
- Logger.error(`DocumentViewPicker failed with err: ${JSON.stringify(err)}`);
- }
+ .padding({ left: 8, right: 8 })
}
}
\ No newline at end of file
diff --git a/entry/src/main/ets/viewmodel/MailInfo.ets b/entry/src/main/ets/utils/MailInfoManager.ets
similarity index 44%
rename from entry/src/main/ets/viewmodel/MailInfo.ets
rename to entry/src/main/ets/utils/MailInfoManager.ets
index 38bbdd1f70f99c199ee4c2e608e99aff2816f387..7dab9664ab02098ceaf65124cdb1b27d8a06ee19 100644
--- a/entry/src/main/ets/viewmodel/MailInfo.ets
+++ b/entry/src/main/ets/utils/MailInfoManager.ets
@@ -1,45 +1,30 @@
/*
- * Copyright (c) 2023 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
+ * Copyright (c) 2025 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
+ * 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.
+ * 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 { commonType } from '@kit.ArkData';
-
-export class MailInfo {
+export class MailInfoManager {
private recipient: string | undefined;
private sender: string | undefined;
private subject: string | undefined;
private emailContent: string | undefined;
- private attachments: commonType.Assets | undefined;
constructor(recipient: string | undefined, sender: string | undefined, subject: string | undefined,
- emailContent: string | undefined, attachments: commonType.Assets | undefined) {
+ emailContent: string | undefined) {
this.recipient = recipient;
this.sender = sender;
this.subject = subject;
this.emailContent = emailContent;
- this.attachments = attachments;
- }
-
- flatAssets(): object {
- let obj: object = this;
- if (!this.attachments) {
- return obj;
- }
- for (let i = 0; i < this.attachments.length; i++) {
- obj[`attachments${i}`] = this.attachments[i];
- }
- return obj;
}
getRecipient(): string | undefined {
@@ -73,12 +58,4 @@ export class MailInfo {
setEmailContent(value: string | undefined) {
this.emailContent = value;
}
-
- getAttachments(): commonType.Assets | undefined {
- return this.attachments;
- }
-
- setAttachments(value: commonType.Assets) {
- this.attachments = value;
- }
}
\ No newline at end of file
diff --git a/entry/src/main/ets/viewmodel/AppendixIndexModel.ets b/entry/src/main/ets/viewmodel/AppendixIndexModel.ets
deleted file mode 100644
index 7a4d527351194aaf5d8065c167c8f8c28e0660cf..0000000000000000000000000000000000000000
--- a/entry/src/main/ets/viewmodel/AppendixIndexModel.ets
+++ /dev/null
@@ -1,7 +0,0 @@
-import { AppendixFile, FileType } from './AppendixItem';
-
-export const imageIndex: Array = [
- { index: FileType.TXT, fileType: 'txt', icon: $r('app.media.ic_files_grid_txt') },
- { index: FileType.DOC, fileType: 'doc', icon: $r('app.media.ic_files_documents') },
- { index: FileType.PDF, fileType: 'pdf', icon: $r('app.media.ic_files_pdf') }
-];
\ No newline at end of file
diff --git a/entry/src/main/ets/viewmodel/AppendixItem.ets b/entry/src/main/ets/viewmodel/AppendixItem.ets
deleted file mode 100644
index 6c4f27ea6f86c520853501c27bc906f05db435be..0000000000000000000000000000000000000000
--- a/entry/src/main/ets/viewmodel/AppendixItem.ets
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2023 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 interface AppendixBean {
- /**
- * Icon index.
- */
- iconIndex: number;
-
- /**
- * File name.
- */
- fileName: string;
-}
-
-export interface AppendixFile {
- /**
- * Index.
- */
- index: number;
-
- /**
- * File type.
- */
- fileType: string;
-
- /**
- * File type icon.
- */
- icon: Resource;
-}
-
-export enum FileType {
- /**
- * Txt file.
- */
- TXT,
-
- /**
- * Doc file.
- */
- DOC,
-
- /**
- * Pdf file.
- */
- PDF
-}
\ No newline at end of file
diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5
index 635c303894c102a48ec08032d214f094be4e92d2..e479acbb626d5ce56b2a75cdd777c8c24a59a3a7 100644
--- a/entry/src/main/module.json5
+++ b/entry/src/main/module.json5
@@ -5,9 +5,7 @@
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
- "phone",
- "tablet",
- "2in1"
+ "phone"
],
"deliveryWithInstall": true,
"installationFree": false,
@@ -35,6 +33,18 @@
"continuable": true,
"launchType": "singleton"
}
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.DISTRIBUTED_DATASYNC",
+ "reason": "$string:distributed_data_sync_reason",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ }
]
}
}
\ No newline at end of file
diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json
index 397b7857b87fc081e08b5c7c26f8ef24488636e1..9ecfdd37ae4e57c1a841ae328ff3105e2e13f12e 100644
--- a/entry/src/main/resources/base/element/string.json
+++ b/entry/src/main/resources/base/element/string.json
@@ -59,6 +59,10 @@
{
"name": "alert_message_chinese",
"value": "Not Supported Chinese Or File Type Not Match."
+ },
+ {
+ "name": "distributed_data_sync_reason",
+ "value": "Allow the permission for data exchange between different devices in distributed communication wheel scenarios."
}
]
}
\ No newline at end of file
diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json
index 397b7857b87fc081e08b5c7c26f8ef24488636e1..9ecfdd37ae4e57c1a841ae328ff3105e2e13f12e 100644
--- a/entry/src/main/resources/en_US/element/string.json
+++ b/entry/src/main/resources/en_US/element/string.json
@@ -59,6 +59,10 @@
{
"name": "alert_message_chinese",
"value": "Not Supported Chinese Or File Type Not Match."
+ },
+ {
+ "name": "distributed_data_sync_reason",
+ "value": "Allow the permission for data exchange between different devices in distributed communication wheel scenarios."
}
]
}
\ No newline at end of file
diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json
index 027107d124883b2a98e33d18f8dfebce359797a7..52612ea8914b23c5415027b5d35f744fba9792ea 100644
--- a/entry/src/main/resources/zh_CN/element/string.json
+++ b/entry/src/main/resources/zh_CN/element/string.json
@@ -59,6 +59,10 @@
{
"name": "alert_message_chinese",
"value": "不支持中文名称文件或者文件类型不匹配。"
+ },
+ {
+ "name": "distributed_data_sync_reason",
+ "value": "允许分布式通讯轮场景使用不同设备间的数据交换的权限。"
}
]
}
\ No newline at end of file
diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5
index f70ecd4112d94f9aa555adf898d53f18bf58f3e9..15d67aed764b51dba0123a18eb90a184f3fd8c3a 100644
--- a/hvigor/hvigor-config.json5
+++ b/hvigor/hvigor-config.json5
@@ -1,5 +1,5 @@
{
- "modelVersion": "5.0.0",
+ "modelVersion": "5.1.1",
"dependencies": {
}
}
\ No newline at end of file
diff --git a/oh-package.json5 b/oh-package.json5
index 0cd9ae65abe3270c28c82d345e21d0a03a9b47c4..d478da1cef4113edc57459959f4384011fb737cf 100644
--- a/oh-package.json5
+++ b/oh-package.json5
@@ -1,5 +1,5 @@
{
- "modelVersion": "5.0.0",
+ "modelVersion": "5.1.1",
"license": "",
"devDependencies": {
},
diff --git a/screenshots/device/DistributedMail.gif b/screenshots/device/DistributedMail.gif
deleted file mode 100644
index fc75bed89529353e70c6ac4f0403822c4247b586..0000000000000000000000000000000000000000
Binary files a/screenshots/device/DistributedMail.gif and /dev/null differ
diff --git a/screenshots/devices/email.en.gif b/screenshots/devices/email.en.gif
new file mode 100644
index 0000000000000000000000000000000000000000..d2569c83e46a1a0375897c0bdeee54ed4322c550
Binary files /dev/null and b/screenshots/devices/email.en.gif differ
diff --git a/screenshots/device/DistributedMail.en.gif b/screenshots/devices/email.gif
similarity index 33%
rename from screenshots/device/DistributedMail.en.gif
rename to screenshots/devices/email.gif
index 2c7b220dcd272ff234e05b524a2d36022ccb68c1..fb6e64e4721eeab06609463326c6173747baf7bf 100644
Binary files a/screenshots/device/DistributedMail.en.gif and b/screenshots/devices/email.gif differ