diff --git a/HarmonyOS_NEXT/DownloadNotification/entry/src/main/ets/entryability/EntryAbility.ts b/HarmonyOS_NEXT/DownloadNotification/entry/src/main/ets/entryability/EntryAbility.ets similarity index 100% rename from HarmonyOS_NEXT/DownloadNotification/entry/src/main/ets/entryability/EntryAbility.ts rename to HarmonyOS_NEXT/DownloadNotification/entry/src/main/ets/entryability/EntryAbility.ets diff --git a/HarmonyOS_NEXT/DownloadNotification/entry/src/main/module.json5 b/HarmonyOS_NEXT/DownloadNotification/entry/src/main/module.json5 index bf200cf76105205a9bfd171943debd39ecac28de..3800d8e5f16b3f5d69bfa6dc050ca574b22f5238 100644 --- a/HarmonyOS_NEXT/DownloadNotification/entry/src/main/module.json5 +++ b/HarmonyOS_NEXT/DownloadNotification/entry/src/main/module.json5 @@ -13,7 +13,7 @@ "abilities": [ { "name": "EntryAbility", - "srcEntry": "./ets/entryability/EntryAbility.ts", + "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", "icon": "$media:icon", "label": "$string:EntryAbility_label", diff --git a/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/entryability/EntryAbility.ts b/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/entryability/EntryAbility.ts index da85789f0fd4d00c69a8a95edc2f904b3c61984f..31341488854442ec1d5f43e334a1ddf37f456cac 100644 --- a/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/entryability/EntryAbility.ts +++ b/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/entryability/EntryAbility.ts @@ -31,9 +31,8 @@ export default class EntryAbility extends UIAbility { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); const permissions: Array = [ - 'ohos.permission.READ_MEDIA', - 'ohos.permission.WRITE_MEDIA', - 'ohos.permission.MEDIA_LOCATION' + 'ohos.permission.WRITE_IMAGEVIDEO', + ]; const atManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(this.context, permissions, (err, data) => { diff --git a/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/pages/HomePage.ets b/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/pages/HomePage.ets index a0f3dff6be08c16518ccc12907a1de63e7dc2051..8aeb956134c5a1aa3a833c4e8cdccef705c7ca74 100644 --- a/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/pages/HomePage.ets +++ b/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/pages/HomePage.ets @@ -14,6 +14,8 @@ */ import image from '@ohos.multimedia.image'; +import photoAccessHelper from '@ohos.file.photoAccessHelper' +import fs from '@ohos.file.fs'; import { IconStatus } from '../viewModel/IconListViewModel'; import AdjustContentView from '../view/AdjustContentView'; import { cropIconChangeList, menuIconList } from '../viewModel/IconListViewModel'; @@ -57,6 +59,7 @@ struct HomePage { @State currentIndex: number = 0; @State currentCropIndex: number = 0; @Provide pixelMap?: image.PixelMap = undefined; + @State ImgData?: ArrayBuffer =undefined; @State tempPixelMap?: image.PixelMap = undefined; originalPixelMap?: PixelMap; @Provide imageInfo: image.ImageInfo = { size: { height: 0, width: 0 }, density: 0 }; @@ -172,7 +175,6 @@ struct HomePage { .onClick(() => { this.pixelInit(); }) - Button() { Image($r("app.media.ic_save")) .width($r('app.float.title_image_width')) diff --git a/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/utils/EncodeUtil.ets b/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/utils/EncodeUtil.ets index da4934bbb1ff069c9501753ef52f7e4c372e574a..6e84e0784f34faeb48eff6218af9924e88b001e0 100644 --- a/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/utils/EncodeUtil.ets +++ b/HarmonyOS_NEXT/ImageEdit/entry/src/main/ets/utils/EncodeUtil.ets @@ -13,14 +13,16 @@ * limitations under the License. */ -import mediaLibrary from '@ohos.multimedia.mediaLibrary'; +import photoAccessHelper from '@ohos.file.photoAccessHelper'; import fs from '@ohos.file.fs'; import image from '@ohos.multimedia.image'; import Logger from './LoggerUtil'; import { CommonConstants } from '../common/constant/CommonConstants'; +import AdjustContentView from '../view/AdjustContentView'; const TAG: string = 'imageEdit_Encode'; - +const context = getContext(this); +let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context); /** * Pack the image. * @@ -38,21 +40,21 @@ export async function encode(component: Object, pixelMap: PixelMap) { Logger.info(TAG, `imageData's length is ${imageData.byteLength}`); // Get album's path. const context = getContext(component); - const media = mediaLibrary.getMediaLibrary(context); - const publicPath = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE); - const currentTime = new Date().getTime(); + // Create image asset. - const imageAssetInfo = await media.createAsset( - mediaLibrary.MediaType.IMAGE, - `${CommonConstants.IMAGE_PREFIX}_${currentTime}${CommonConstants.IMAGE_FORMAT}`, - publicPath - ); - const imageFd = await imageAssetInfo.open(CommonConstants.ENCODE_FILE_PERMISSION); - await fs.write(imageFd, imageData); - // Image resource release. - await imageAssetInfo.close(imageFd); - imagePackerApi.release(); - await media.release(); + console.info('createAssetDemo'); + let photoType: photoAccessHelper.PhotoType = photoAccessHelper.PhotoType.IMAGE; + let extension: string = 'jpg'; + phAccessHelper.createAsset(photoType, extension, (err, uri) => { + if (uri != undefined) { + console.info('createAsset uri' + uri); + console.info('createAsset successfully'); + let file = fs.openSync(uri, fs.OpenMode.READ_WRITE); + fs.writeSync(file.fd, imageData); + fs.close(file.fd); + } else { + console.error('createAsset failed, message = ', err); + } + }); } - diff --git a/HarmonyOS_NEXT/ImageEdit/entry/src/main/module.json5 b/HarmonyOS_NEXT/ImageEdit/entry/src/main/module.json5 index e0ec104c89ab54aa6fef8ee5e350c19b23c8f179..66817197f6f9688d85f5d4daeccd8b51b22860d7 100644 --- a/HarmonyOS_NEXT/ImageEdit/entry/src/main/module.json5 +++ b/HarmonyOS_NEXT/ImageEdit/entry/src/main/module.json5 @@ -69,6 +69,16 @@ ], "when": "inuse" } + }, + { + "name": "ohos.permission.WRITE_IMAGEVIDEO", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } } ] } diff --git a/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets index 5015eedb210f4bbd7e4caa3e3eb957fb61f990cb..cb5cac950daf8d60bfdb4c298f5105a31d4def13 100644 --- a/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets +++ b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import NewsTypeBean from '../../viewmodel/NewsTypeBean'; +import NewsTypeModel from '../../viewmodel/NewsTypeModel'; export class CommonConstant { @@ -96,7 +96,7 @@ export class CommonConstant { static readonly TabBars_BAR_HEIGHT: string = '7.2%'; static readonly TabBars_HORIZONTAL_PADDING: string = '2.2%'; static readonly TabBars_BAR_WIDTH: string = '100%'; - static readonly TabBars_DEFAULT_NEWS_TYPES: Array = [ + static readonly TabBars_DEFAULT_NEWS_TYPES: Array = [ { id: 0, name: '全部' }, { id: 1, name: '国内' }, { id: 2, name: '国际' }, diff --git a/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/view/TabBar.ets b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/view/TabBar.ets index 70f1303b2139b44acaff7f828ebe9a058b3cbdbe..4a4c0bc453c20c287bfc72f7b0daea62bafc75df 100644 --- a/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/view/TabBar.ets +++ b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/view/TabBar.ets @@ -15,7 +15,7 @@ import NewsList from '../view/newslist'; import { CommonConstant as Const } from '../common/constant/CommonConstant'; -import NewsTypeBean from '../viewmodel/NewsTypeBean'; +import NewsTypeModel from '../viewmodel/NewsTypeModel'; import NewsViewModel from '../viewmodel/NewsViewModel'; /** @@ -23,7 +23,7 @@ import NewsViewModel from '../viewmodel/NewsViewModel'; */ @Component export default struct TabBar { - @State tabBarArray: NewsTypeBean[] = NewsViewModel.getDefaultTypeList(); + @State tabBarArray: NewsTypeModel[] = NewsViewModel.getDefaultTypeList(); @State currentIndex: number = 0; @State currentPage: number = 1; @@ -40,23 +40,23 @@ export default struct TabBar { aboutToAppear() { // Request news category. - NewsViewModel.getNewsTypeList().then((typeList: NewsTypeBean[]) => { + NewsViewModel.getNewsTypeList().then((typeList: NewsTypeModel[]) => { this.tabBarArray = typeList; - }).catch((typeList: NewsTypeBean[]) => { + }).catch((typeList: NewsTypeModel[]) => { this.tabBarArray = typeList; }); } build() { Tabs() { - ForEach(this.tabBarArray, (tabsItem: NewsTypeBean) => { + ForEach(this.tabBarArray, (tabsItem: NewsTypeModel) => { TabContent() { Column() { NewsList({ currentIndex: $currentIndex }) } } .tabBar(this.TabBuilder(tabsItem.id)) - }, (item: NewsTypeBean) => JSON.stringify(item)); + }, (item: NewsTypeModel) => JSON.stringify(item)); } .barHeight(Const.TabBars_BAR_HEIGHT) .barMode(BarMode.Scrollable) diff --git a/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsTypeModel.ets b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsTypeModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..026c0fef2b0ebc66499234f587b7edb06ac94978 --- /dev/null +++ b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsTypeModel.ets @@ -0,0 +1,19 @@ +/* + * 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 default class NewsTypeModel { + id: number = 0; + name: ResourceStr = ''; +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets index fcf3752d10d40c597f295e3c9067b05673e78197..afca5a941e350c884c47f4f11251572548c22805 100644 --- a/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets +++ b/HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets @@ -15,7 +15,7 @@ import { CommonConstant as Const } from '../common/constant/CommonConstant'; import { NewsData } from './NewsData'; -import NewsTypeBean from './NewsTypeBean'; +import NewsTypeModel from './NewsTypeModel'; import { httpRequestGet } from '../common/utils/HttpUtil'; import Logger from '../common/utils/Logger'; import ResponseResult from './ResponseResult'; @@ -26,7 +26,7 @@ class NewsViewModel { * * @return NewsTypeBean[] newsTypeList */ - getNewsTypeList(): Promise { + getNewsTypeList(): Promise { return new Promise((resolve: Function) => { let url = `${Const.SERVER}/${Const.GET_NEWS_TYPE}`; httpRequestGet(url).then((data: ResponseResult) => { @@ -46,7 +46,7 @@ class NewsViewModel { * * @return NewsTypeBean[] newsTypeList */ - getDefaultTypeList(): NewsTypeBean[] { + getDefaultTypeList(): NewsTypeModel[] { return Const.TabBars_DEFAULT_NEWS_TYPES; } diff --git a/HarmonyOS_NEXT/README.md b/HarmonyOS_NEXT/README.md index 2367bc5cfc6d321bc78268bcebb964a59ce2833c..8f4bcad12a44ece8a02a7e9e44d22aedc8d05e97 100644 --- a/HarmonyOS_NEXT/README.md +++ b/HarmonyOS_NEXT/README.md @@ -1,4 +1,4 @@ -# Codelabs +# Codelabs 为了方便开发者针对重点功能或场景进行开发,本页面对当前有的Codelabs资源进行了汇总,如下表所示: @@ -210,8 +210,9 @@

基于窗口管理,实现一个验证码登录案例。

-

媒体

+

媒体

+

视频播放器(ArkTS)

@@ -228,6 +229,11 @@

基于ArkUI框架,实现一个简单视频播放器,可支持海报轮播、视频播放等功能。

+

录音机(ArkTS)

+ +

本篇Codelab使用AVPlayer和AVRecorder实现了一个录音机,可以录制并播放音频文件。

+ +

网络与连接

@@ -252,6 +258,7 @@

+

关系型数据库(ArkTS)

@@ -278,9 +285,9 @@

本篇Codelab以通讯录为例,介绍分布式键值数据库的创建、数据的增加/删除/修改/查询/同步等操作方法。

-

分布式邮件(ArkTS)

+

分布式邮件(ArkTS)

-

本片Codelab以分布式邮件为例,介绍分布式数据对象、分布式文件如何使用。

+

本片Codelab以分布式邮件为例,介绍分布式数据对象、分布式文件如何使用。

设备管理

diff --git a/HarmonyOS_NEXT/Recorder/AppScope/app.json5 b/HarmonyOS_NEXT/Recorder/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..daed030c9795f132fca504b6fd50a22d6566bb4c --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.recorder", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/HarmonyOS_NEXT/Recorder/AppScope/resources/base/element/string.json b/HarmonyOS_NEXT/Recorder/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..73266617e70a1eca794aa12f1450eb851f659af5 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Recorder" + } + ] +} diff --git a/HarmonyOS_NEXT/Recorder/AppScope/resources/base/media/app_icon.png b/HarmonyOS_NEXT/Recorder/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/AppScope/resources/base/media/app_icon.png differ diff --git a/HarmonyOS_NEXT/Recorder/LICENSE b/HarmonyOS_NEXT/Recorder/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + 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. diff --git a/HarmonyOS_NEXT/Recorder/build-profile.json5 b/HarmonyOS_NEXT/Recorder/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..386917f8ac955fea7891027ccfc12f97a38a7686 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/build-profile.json5 @@ -0,0 +1,37 @@ +{ + "app": { + "signingConfigs": [ + ], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compileSdkVersion": "4.0.0(10)", + "compatibleSdkVersion": "4.0.0(10)", + "runtimeOS": "HarmonyOS", + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/dependencies/hvigor-3.0.9-s.tgz b/HarmonyOS_NEXT/Recorder/dependencies/hvigor-3.0.9-s.tgz new file mode 100644 index 0000000000000000000000000000000000000000..65b0d24f94d2aecc1099f8f8220beec695bfb779 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/dependencies/hvigor-3.0.9-s.tgz differ diff --git a/HarmonyOS_NEXT/Recorder/dependencies/hvigor-ohos-arkui-x-plugin-2.1.7-s.tgz b/HarmonyOS_NEXT/Recorder/dependencies/hvigor-ohos-arkui-x-plugin-2.1.7-s.tgz new file mode 100644 index 0000000000000000000000000000000000000000..233a449cbfef6be702d861744254dd89ce633fb7 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/dependencies/hvigor-ohos-arkui-x-plugin-2.1.7-s.tgz differ diff --git a/HarmonyOS_NEXT/Recorder/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz b/HarmonyOS_NEXT/Recorder/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz new file mode 100644 index 0000000000000000000000000000000000000000..e2e499e18dfcd05e1e275579d11697640eb80323 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/dependencies/hvigor-ohos-plugin-3.0.9-s.tgz differ diff --git a/HarmonyOS_NEXT/Recorder/dependencies/rollup.tgz b/HarmonyOS_NEXT/Recorder/dependencies/rollup.tgz new file mode 100644 index 0000000000000000000000000000000000000000..b224a37a5f69fd22f58c7a28151742eafe7e6317 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/dependencies/rollup.tgz differ diff --git a/HarmonyOS_NEXT/Recorder/entry/build-profile.json5 b/HarmonyOS_NEXT/Recorder/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/hvigorfile.ts b/HarmonyOS_NEXT/Recorder/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/HarmonyOS_NEXT/Recorder/entry/oh-package.json5 b/HarmonyOS_NEXT/Recorder/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/constants/CommonConstants.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c0409b10eca10ce3da80fc37adb2445331f44e9 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/constants/CommonConstants.ets @@ -0,0 +1,95 @@ +/* + * 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 { Permissions } from '@ohos.abilityAccessCtrl'; + +/** + * Common constants. + */ +export class CommonConstants { + /** + * Permissions. + */ + static readonly INTERNET: Permissions = 'ohos.permission.INTERNET'; + static readonly MEDIA_LOCATION: Permissions = 'ohos.permission.MEDIA_LOCATION'; + static readonly READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA'; + static readonly WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA'; + static readonly MICROPHONE: Permissions = 'ohos.permission.MICROPHONE'; + + /** + * State of player or recorder. + */ + static readonly IDLE: string = 'idle'; + static readonly INITIALIZED: string = 'initialized'; + static readonly PREPARED: string = 'prepared'; + static readonly PLAYING: string = 'playing'; + static readonly PAUSED: string = 'paused'; + static readonly COMPLETED: string = 'completed'; + static readonly STARTED: string = 'started'; + static readonly STOPPED: string = 'stopped'; + static readonly RELEASED: string = 'released'; + static readonly ERROR: string = 'error'; + + /** + * Config of recorder. + */ + static readonly BIT_RATE: number = 48000; + static readonly CHANNEL: number = 2; + static readonly SAMPLE_RATE: number = 48000; + static readonly LATITUDE: number = 30; + static readonly LONGITUDE: number = 130; + + /** + * Constants of time. + */ + static readonly TIME_10: number = 10; + static readonly TIME_60: number = 60; + static readonly TIME_1000: number = 1000; + static readonly TIME_3600: number = 3600; + static readonly TIME_60000: number = 60000; + static readonly NUMBER_2: number = 2; + static readonly NUMBER_3: number = 3; + static readonly STRING_0: string = '0'; + static readonly STRING_SLASH: string = '/'; + static readonly STRING_COLON: string = ':'; + static readonly STRING_COLON_0: string = ':0'; + static readonly STRING_TIME: string = '00:00:00'; + + /** + * Initial value of time scale. + */ + static readonly TIME_SCALE: Array = ['00:00', '00:01', '00:02', '00:03', '00:04']; + + /** + * Constants of checking permissions. + */ + static readonly NUMBER_5: number = 5; + static readonly TITLE: string = '警告'; + static readonly MESSAGE: string = '没有权限,请自行去<设置>添加权限'; + + /** + * Size of components. + */ + static readonly FULL_SIZE: string = '100%'; + static readonly POSITION_X: string = '50%'; + static readonly POSITION_Y: string = '90%'; + static readonly ICON_POSITION_X: string = '75%'; + static readonly ICON_POSITION_Y: string = '92%'; + static readonly TIME_SLIDER_WIDTH: string = '20%'; + static readonly TIME_SLIDER_IMAGE_WIDTH: string = '120%'; + static readonly INIT_TRANSLATE: string = '0%'; + static readonly TRANSLATE_TEXT: string = '20%'; // + static readonly TRANSLATE_IMAGE: string = '16.6%'; // +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Logger.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a98b148c04d993b1e331834bd5857fcc0db8dc8 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Logger.ets @@ -0,0 +1,54 @@ +/* + * 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 '@ohos.hilog'; + +/** + * 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('[Recorder]', 0xFF00); \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Utils.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d8a932f622fef9da93af4eab0e6eb0791d22c70 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Utils.ets @@ -0,0 +1,165 @@ +/* + * 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 { CommonConstants as Const } from '../constants/CommonConstants'; + +export default class Utils { + /** + * Convert timestamp to time. + * @param timestamp + * @returns time + */ + static timestamp2Time(timestamp: number): string { + let date = new Date(timestamp * Const.TIME_1000); + let year = date.getFullYear() + Const.STRING_SLASH; + let month = (date.getMonth() + 1 < Const.TIME_10 + ? Const.STRING_0 + (date.getMonth() + 1) : date.getMonth() + 1) + Const.STRING_SLASH; + let day = date.getDate() < Const.TIME_10 ? Const.STRING_0 + date.getDate() : date.getDate(); + return year + month + day; + } + + /** + * Convert duration to time. + * @param duration + * @returns time + */ + static duration2Time(duration: number): string { + let temp = Math.floor(duration / Const.TIME_1000); + let second = temp % Const.TIME_60 < Const.TIME_10 + ? Const.STRING_0 + temp % Const.TIME_60 : (temp % Const.TIME_60).toString(); + let minute = (Math.floor(temp / Const.TIME_60) % Const.TIME_60 < Const.TIME_10 + ? Const.STRING_0 + Math.floor(temp / Const.TIME_60) % Const.TIME_60 + : (Math.floor(temp / Const.TIME_60) % Const.TIME_60).toString()) + Const.STRING_COLON; + let hour = (Math.floor(temp / Const.TIME_60 / Const.TIME_60) < Const.TIME_10 + ? Const.STRING_0 + Math.floor(temp / Const.TIME_60 / Const.TIME_60) + : (Math.floor(temp / Const.TIME_60 / Const.TIME_60)).toString()) + Const.STRING_COLON; + return hour + minute + second; + } + + /** + * Update time slider. + * @param time + * @param index + * @returns time + */ + static updateSlider(time: number, index: number): string { + let result = time + index - Const.NUMBER_2; + if (result < 0) { + return ''; + } + if (result % Const.TIME_60 < Const.TIME_10) { + return Const.STRING_0 + Math.floor(result / Const.TIME_60) + Const.STRING_COLON_0 + (result % Const.TIME_60); + } + if (result % Const.TIME_60 >= Const.TIME_10) { + return Const.STRING_0 + Math.floor(result / Const.TIME_60) + Const.STRING_COLON + (result % Const.TIME_60); + } + return ''; + } + + /** + * Update time. + * @param millisecond + * @returns time + */ + static updateTime(millisecond: number): string { + /* + if (millisecond < 0) { + return '00:00:00' + }*/ + let hour = Math.floor((millisecond / Const.TIME_60000 / Const.TIME_60)); + let minute = Math.floor((millisecond / Const.TIME_60000 - hour * Const.TIME_60)); + let second = Math.floor((millisecond / Const.TIME_1000 - hour * Const.TIME_3600 - minute * Const.TIME_60)); + let hourStr = '' + hour; + let minuteStr = '' + minute; + let secondStr = '' + second; + if (hour < Const.TIME_10) { + hourStr = Const.STRING_0 + hour; + } + if (minute < Const.TIME_10) { + minuteStr = Const.STRING_0 + minute; + } + if (second < Const.TIME_10) { + secondStr = Const.STRING_0 + second; + } + return hourStr + Const.STRING_COLON + minuteStr + Const.STRING_COLON + secondStr; + } + +} + +/** + * Get time string. + * @param timeIndex + * @param index + * @returns time + */ +export function getTimeString(timeIndex: number, index: number): string { + let result = timeIndex + index - Const.NUMBER_3; + if (result < 0) { + return ''; + } + if (result % Const.TIME_60 < Const.TIME_10) { + return Const.STRING_0 + Math.floor(result / Const.TIME_60) + Const.STRING_COLON_0 + (result % Const.TIME_60); + } + if (result % Const.TIME_60 >= Const.TIME_10) { + return Const.STRING_0 + Math.floor(result / Const.TIME_60) + Const.STRING_COLON + (result % Const.TIME_60); + } + return ''; +} + +/** + * Update time. + * @param millisecond + * @returns time + */ +export function updateTime(millisecond: number): string { + if (millisecond < 0) { + return Const.STRING_TIME; + } + let hour = Math.floor((millisecond / Const.TIME_60000 / Const.TIME_60)); + let minute = Math.floor((millisecond / Const.TIME_60000 - hour * Const.TIME_60)); + let second = Math.floor((millisecond / Const.TIME_1000 - hour * Const.TIME_3600 - minute * Const.TIME_60)); + let hourStr = '' + hour; + let minuteStr = '' + minute; + let secondStr = '' + second; + if (hour < Const.TIME_10) { + hourStr = Const.STRING_0 + hour; + } + if (minute < Const.TIME_10) { + minuteStr = Const.STRING_0 + minute; + } + if (second < Const.TIME_10) { + secondStr = Const.STRING_0 + second; + } + return hourStr + Const.STRING_COLON + minuteStr + Const.STRING_COLON + secondStr; +} + +/** + * Update times. + * @param millisecond + * @returns time + */ +export function updateTimes(millisecond: number): string { + let minute = Math.floor((millisecond / Const.TIME_60000)); + let second = Math.floor(((millisecond - (minute * Const.TIME_60000)) / Const.TIME_1000)); + let minuteStr = '' + minute; + let secondStr = '' + second; + if (minute < Const.TIME_10) { + minuteStr = Const.STRING_0 + minute; + } + if (second < Const.TIME_10) { + secondStr = Const.STRING_0 + second; + } + return minuteStr + Const.STRING_COLON + secondStr; +} diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/entryability/EntryAbility.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a0ed7a8035267bd4c8e49a835927434e6c98411 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,58 @@ +/* + * 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 AbilityConstant from '@ohos.app.ability.AbilityConstant'; +import hilog from '@ohos.hilog'; +import UIAbility from '@ohos.app.ability.UIAbility'; +import Want from '@ohos.app.ability.Want'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/MainPage', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/MediaManager.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/MediaManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..3867ed0eae821e2c586ca5394aefe0aed470292d --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/MediaManager.ets @@ -0,0 +1,81 @@ +/* + * 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 mediaLibrary from '@ohos.multimedia.mediaLibrary'; +import AudioData from '../viewmodel/AudioData'; +import Logger from '../common/utils/Logger'; + +const TAG = 'MediaManager'; + +class MediaManager { + public mediaManager?: mediaLibrary.MediaLibrary; + private publicPath?: string = ''; + + constructor() { + this.init(); + } + + async init() { + let context = getContext(this); + this.mediaManager = mediaLibrary.getMediaLibrary(context); + this.publicPath = await this.mediaManager.getPublicDirectory(mediaLibrary.DirectoryType.DIR_AUDIO); + Logger.info(TAG, `Init finished, public path is: ${this.publicPath.toString()}`); + } + + async createAudioFile() { + let timeStamp = new Date().getTime().toString(); + let fileName = timeStamp + '.m4a'; + Logger.info(TAG, `Create audio file finished, file name is: ${fileName}, `); + this.publicPath = await this.mediaManager?.getPublicDirectory(mediaLibrary?.DirectoryType.DIR_AUDIO); + return this.mediaManager?.createAsset(mediaLibrary?.MediaType.AUDIO, fileName, this.publicPath!); + } + + async query() { + if (this.mediaManager === undefined) { + Logger.info(TAG, `Query failed, no mediaManager found`); + } else { + Logger.info(TAG, `Query begin, mediaManager is: ${JSON.stringify(this.mediaManager)}`); + } + let audiosFetchOp: mediaLibrary.MediaFetchOptions = { + selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', + selectionArgs: [mediaLibrary.MediaType.AUDIO.toString()] + }; + const context = getContext(this); + this.mediaManager = mediaLibrary.getMediaLibrary(context); + let fetchResult = await this.mediaManager.getFileAssets(audiosFetchOp); + let fileAssets = await fetchResult.getAllObject(); + if (fileAssets.length === 0) { + Logger.info(TAG, `No audio file was found`); + } + let audioList: Array = []; + for (let i = 0; i < fileAssets.length; i++) { + let fileAsset = fileAssets[i]; + let audio: AudioData = {name: '', uri: '', size: 0, time: 0, duration: 0, height: '72vp'}; + let fdNumber = await fileAsset.open('r'); + let uri = `fd://${fdNumber.toString()}`; + audio.name = fileAsset.displayName; + audio.uri = uri; + audio.size = fileAsset.size; + audio.time = fileAsset.dateModified; + audio.duration = fileAsset.duration; + Logger.info(TAG, `The audio file information: ${JSON.stringify(audio)}`); + audioList.push(audio); + } + Logger.info(TAG, `The audioList is: ${JSON.stringify(audioList)}`); + return audioList; + } +} + +export default new MediaManager(); diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/PlayManager.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/PlayManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a662057638bbf7707258bf06057494bb44463aa --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/PlayManager.ets @@ -0,0 +1,160 @@ +/* + * 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 common from '@ohos.app.ability.common'; +import media from '@ohos.multimedia.media'; +import { CommonConstants as Const } from '../common/constants/CommonConstants'; +import Logger from '../common/utils/Logger'; + +import progress from '../viewmodel/Progress'; + +const TAG = 'PlayManager'; + +export default class PlayManager { + public audioPlayer?: media.AVPlayer; + + init(progress: progress) { + this.release(); + media.createAVPlayer((err, player: media.AVPlayer) => { + if (player !== null) { + this.audioPlayer = player; + this.audioPlayer.on('timeUpdate', (time: number) => { + progress.loader = time; + }); + this.audioPlayer.on('durationUpdate', (duration: number) => { + progress.total = duration; + }); + this.audioPlayer.on('stateChange', async (state: media.AVPlayerState) => { + switch (state.toString()) { + case 'idle': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + break; + case 'initialized': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + this.audioPlayer!.prepare((err) => { + if (!err) { + Logger.info(TAG, `The AVPlayer prepare success`); + } else { + Logger.info(TAG, + `The AVPlayer prepare failed, error: ${err.message}, state: ${this.audioPlayer!.state}`); + } + }); + break; + case 'prepared': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + this.audioPlayer!.play((err) => { + if (!err) { + Logger.info(TAG, `The AVPlayer play success`); + } else { + Logger.info(TAG, `The AVPlayer play failed, error: ${err.message}, state: ${this.audioPlayer!.state}`); + } + }); + break; + case 'playing': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + break; + case 'paused': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + break; + case 'completed': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + progress.isCompleted = true; + break; + case 'stopped': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + break; + case 'released': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + break; + case 'error': + Logger.info(TAG, `The AVPlayer state is: ${this.audioPlayer!.state}`); + break; + default: + break; + } + Logger.info(TAG, `The AVPlayer state is changed to: ${this.audioPlayer!.state}`); + }); + this.audioPlayer.on('error', (error) => { + Logger.info(TAG, `The AVPlayer error, err code is: ${error.code}, err message is: ${error.message}`); + }); + Logger.info(TAG, `create AVPlayer success`); + } else { + Logger.info(TAG, `create AVPlayer failed, error: ${err.message}`); + } + }); + } + + release() { + if (this.audioPlayer !== undefined) { + this.audioPlayer!.release((err) => { + if (!err) { + Logger.info(TAG, `release AVPlayer success`); + } else { + Logger.info(TAG, `release AVPlayer failed, error: ${err.message}`); + } + }); + } else { + Logger.info(TAG, `No need to release AVPlayer`); + } + } + + play(filePath: string, isNewAudio: boolean = false) { + if (!isNewAudio) { + if (this.audioPlayer!.state === Const.IDLE) { + this.audioPlayer!.url = filePath; + } else { + this.audioPlayer!.play((err) => { + if (!err) { + Logger.info(TAG, `AVPlayer play success`); + } else { + Logger.info(TAG, `AVPlayer play failed, error: ${err.message}`); + } + }); + } + } else { + this.audioPlayer!.reset((err) => { + if (!err) { + Logger.info(TAG, `AVPlayer reset success`); + this.audioPlayer!.url = filePath; + } else { + Logger.info(TAG, `AVPlayer reset failed, error: ${err.message}`); + } + }); + } + } + + pause() { + if (this.audioPlayer!.state === Const.PLAYING) { + this.audioPlayer!.pause((err) => { + if (!err) { + Logger.info(TAG, `AVPlayer pause success`); + } else { + Logger.info(TAG, `AVPlayer pause failed, error: ${err.message}`); + } + }); + } else { + Logger.info(TAG, this.audioPlayer === undefined ? + `No AVPlayer found`: `AVPlayer pause failed, current state is wrong, now is: ${this.audioPlayer!.state}`); + } + } + + duration(): number { + return this.audioPlayer!.duration; + } + + state(): media.AVPlayerState { + return this.audioPlayer!.state; + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/RecordManager.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/RecordManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..1680b2c710331a8985b4338fe7ef68ed2a2dd2df --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/manager/RecordManager.ets @@ -0,0 +1,159 @@ +/* + * 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 media from '@ohos.multimedia.media'; +import { CommonConstants as Const } from '../common/constants/CommonConstants'; +import Logger from '../common/utils/Logger'; + +const TAG = 'RecordManager'; + +export default class RecordManager { + private audioRecorder?: media.AVRecorder; + private recordProfile: media.AVRecorderProfile = { + audioBitrate: Const.BIT_RATE, + audioChannels: Const.CHANNEL, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: Const.SAMPLE_RATE, + fileFormat: media.ContainerFormatType.CFT_MPEG_4A + }; + private recordConfig: media.AVRecorderConfig = { + audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, + profile: this.recordProfile, + url: '', + rotation: 0, + location: { latitude: Const.LATITUDE, longitude: Const.LONGITUDE } + }; + + init() { + this.release(); + media.createAVRecorder((err, recorder: media.AVRecorder) => { + if (recorder !== null) { + this.audioRecorder = recorder; + this.audioRecorder.on('stateChange', async (state: media.AVRecorderState) => { + switch (state.toString()) { + case 'idle': + Logger.info(TAG, `The AVRecorder state is: ${this.audioRecorder!.state}`); + break; + case 'prepared': + Logger.info(TAG, `The AVRecorder state is: ${this.audioRecorder!.state}`); + this.audioRecorder!.start((err) => { + if (!err) { + Logger.info(TAG, `The AVRecorder start success`); + } else { + Logger.info(TAG, `The AVRecorder start failed, error: ${err.message}`); + } + }) + break; + case 'started': + Logger.info(TAG, `The AVRecorder state is: ${this.audioRecorder!.state}`); + break; + case 'paused': + Logger.info(TAG, `The AVRecorder state is: ${this.audioRecorder!.state}`); + break; + case 'stopped': + Logger.info(TAG, `The AVRecorder state is: ${this.audioRecorder!.state}`); + break; + case 'released': + Logger.info(TAG, `The AVRecorder state is: ${this.audioRecorder!.state}`); + break; + case 'error': + Logger.info(TAG, `The AVRecorder state is: ${this.audioRecorder!.state}`); + break; + default: + break; + } + Logger.info(TAG, `The AVRecorder state is changed to: ${this.audioRecorder!.state}`); + }); + this.audioRecorder.on('error', (error) => { + Logger.info(TAG, `The AVRecorder error, err code is: ${error.code}, err message is: ${error.message}`); + }); + Logger.info(TAG, `create AVRecorder success`); + } else { + Logger.info(TAG, `create AVRecorder failed, error: ${err.message}`); + } + }); + } + + release() { + if (this.audioRecorder !== undefined) { + this.audioRecorder!.release((err) => { + if (!err) { + Logger.info(TAG, `release AVRecorder success`); + } else { + Logger.info(TAG, `release AVRecorder failed, error: ${err.message}`); + } + }); + } else { + Logger.info(TAG, `No need to release AVRecorder`); + } + } + + start(filePath: string) { + if (this.audioRecorder !== undefined) { + this.recordConfig.url = filePath; + this.audioRecorder!.prepare(this.recordConfig, (err) => { + if (!err) { + Logger.info(TAG, `AVPlayer prepare success`); + } else { + Logger.info(TAG, `AVPlayer prepare failed, error: ${err.message}`); + } + }); + } else { + Logger.info(TAG, `No AVRecorder found`); + } + } + + pause() { + if (this.audioRecorder!.state === Const.STARTED) { + this.audioRecorder!.pause((err) => { + if (!err) { + Logger.info(TAG, `AVRecorder pause success`); + } else { + Logger.info(TAG, `AVRecorder pause failed, error: ${err.message}`); + } + }); + } else { + Logger.info(TAG, `AVRecorder pause failed, current state is wrong, now is: ${this.audioRecorder!.state}`); + } + } + + resume() { + if (this.audioRecorder!.state === Const.PAUSED) { + this.audioRecorder!.resume((err) => { + if (!err) { + Logger.info(TAG, `AVRecorder resume success`); + } else { + Logger.info(TAG, `AVRecorder resume failed, error: ${err.message}`); + } + }); + } else { + Logger.info(TAG, `AVRecorder resume failed, current state is wrong, now is: ${this.audioRecorder!.state}`); + } + } + + finish() { + if (this.audioRecorder!.state === Const.STARTED || this.audioRecorder!.state === Const.PAUSED) { + this.audioRecorder!.stop((err) => { + if (!err) { + Logger.info(TAG, `AVRecorder stop success`); + } else { + Logger.info(TAG, `AVRecorder stop failed, error: ${err.message}`); + } + }); + } else { + Logger.info(TAG, `AVRecorder stop failed, current state is wrong, now is: ${this.audioRecorder!.state}`); + } + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/MainPage.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/MainPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..b45aad82c358ab6658669e91a8423f0a5fd213dd --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/MainPage.ets @@ -0,0 +1,295 @@ +/* + * 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 router from '@ohos.router'; +import AbilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; +import AudioData from '../viewmodel/AudioData'; +import { CommonConstants as Const } from '../common/constants/CommonConstants'; +import Logger from '../common/utils/Logger'; +import utils from '../common/utils/Utils'; +import mediaManager from '../manager/MediaManager'; +import PlayManager from '../manager/PlayManager'; + +import preferences from '@ohos.data.preferences'; +import bundleManager from '@ohos.bundle.bundleManager'; +import common from '@ohos.app.ability.common'; +import promptAction from '@ohos.promptAction'; + +import progress from '../viewmodel/Progress'; + +const TAG = 'MainPage'; + +@Entry +@Component +struct MainPage { + @State recordList: Array = []; + @State curIndex: number = -1; + @State isChanged: boolean = false; + @State isPlaying: boolean = false; + @State time: string = '00:00:00'; + private playModel: PlayManager = new PlayManager(); + private curPlayUri: string = ''; + + @State @Watch('onPlayCompleted') progress: progress = { + loader: 0, + total: 0, + isCompleted: false + } + + + @State permissionFlag: boolean = false; + + async requestPermissions() { + const permissions: Array = [ + Const.INTERNET, + Const.MEDIA_LOCATION, + Const.READ_MEDIA, + Const.WRITE_MEDIA, + Const.MICROPHONE + ]; + let atManager = AbilityAccessCtrl.createAtManager(); + let context = getContext(this); + await atManager.requestPermissionsFromUser(context, permissions).then((data) => { + Logger.info(TAG, `Request permissions succeed, data is: ${data}`); + }).catch((error: Error) => { + Logger.error(TAG, `Request permissions failed, error is: ${error}`); + }); + } + + async checkAccessToken(permission: Permissions) { + let atManager = AbilityAccessCtrl.createAtManager(); + let grantStatus: AbilityAccessCtrl.GrantStatus; + let tokenID: number; + try { + let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); + let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo; + tokenID = appInfo.accessTokenId; + } catch (err) { + console.error(`getBundleInfoForSelf failed, error: ${err}`); + } + + try { + grantStatus = await atManager.checkAccessToken(tokenID!, permission); + } catch (err) { + console.error(`checkAccessToken failed, error: ${err}`); + } + return grantStatus!; + } + + async checkPermissions(): Promise { + const permissions: Array = [ + Const.INTERNET, + Const.MEDIA_LOCATION, + Const.READ_MEDIA, + Const.WRITE_MEDIA, + Const.MICROPHONE + ]; + for (let i = 0; i < Const.NUMBER_5; i++) { + let grantStatus: AbilityAccessCtrl.GrantStatus = await this.checkAccessToken(permissions[i]); + if (grantStatus !== AbilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { + let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; + promptAction.showDialog({ + title: Const.TITLE, + message: Const.MESSAGE + }) + setTimeout(() => context.terminateSelf(), Const.TIME_1000); + } + } + } + + async getAudioFiles() { + this.recordList = await mediaManager.query(); + preferences.getPreferences(getContext(this), 'duration').then((obj: preferences.Preferences) => { + let promise = obj; + for (let i = 0; i < this.recordList.length; i++) { + promise.get(this.recordList[i].name, 0, (err, val: preferences.ValueType) => { + if (!err && val !== 0) { + this.recordList[i].duration = Number(val); + } + }) + } + }) + Logger.info(TAG, 'recordList query succeed.'); + } + + async aboutToAppear() { + await this.requestPermissions(); + await this.checkPermissions(); + await this.getAudioFiles(); + this.playModel.init(this.progress); + } + + async onPageShow() { + if (this.isChanged) { + await this.getAudioFiles(); + } + } + + onPlayCompleted() { + this.time = utils.duration2Time(this.progress.loader); + if (this.progress.isCompleted) { + this.isPlaying = false; + } + } + + build() { + Column() { + Stack() { + Column() { + Text($r('app.string.EntryAbility_label')) + .width(Const.FULL_SIZE) + .height($r('app.float.title_height')) + .fontSize($r('app.float.title_font_size')) + .padding({ left: $r('app.float.title_padding'), right: $r('app.float.title_padding') }) + .margin({ top: $r('app.float.title_margin_top'), bottom: $r('app.float.title_margin_bottom') }) + + List() { + ForEach(this.recordList, (item: AudioData, index?: number) => { + ListItem() { + Column() { + Row() { + Column() { + Text(item.name) + .fontSize($r('app.float.audio_title_font_size')) + .width(Const.FULL_SIZE) + .height($r('app.float.audio_title_height')) + .margin({ top: $r('app.float.audio_title_margin_top'), bottom: $r('app.float.audio_title_margin_bottom')}) + Text(utils.timestamp2Time(item.time)) + .fontSize($r('app.float.audio_time_font_size')) + .width(Const.FULL_SIZE) + .height($r('app.float.audio_time_height')) + .margin({ bottom: $r('app.float.audio_time_margin') }) + } + .width($r('app.float.audio_data_width')) + + Row() { + Image(index === this.curIndex ? + (this.isPlaying ? $r('app.media.ic_pause') : $r('app.media.ic_play')) : $r('app.media.ic_play')) + .width($r('app.float.audio_little_icon_size')) + .height($r('app.float.audio_little_icon_size')) + .onClick(() => { + this.curIndex = this.recordList.indexOf(item); + if (!this.isPlaying) { + if (this.curPlayUri === '' || this.curPlayUri === item.uri) { + this.curPlayUri = item.uri; + this.playModel.play(this.curPlayUri); + } else { + this.progress.loader = 0; + this.time = '00:00:00'; + this.curPlayUri = item.uri; + this.playModel.play(this.curPlayUri, true); + } + this.progress.isCompleted = false; + this.isPlaying = true; + } else { + this.playModel.pause(); + if (this.curPlayUri === item.uri) { + this.isPlaying = false; + } else { + this.progress.loader = 0; + this.time = '00:00:00'; + this.curPlayUri = item.uri; + this.playModel.play(this.curPlayUri, true); + } + } + }) + } + .width($r('app.float.audio_play_row_width')) + .height($r('app.float.audio_play_row_height')) + .justifyContent(FlexAlign.End) + } + .width(Const.FULL_SIZE) + .justifyContent(FlexAlign.SpaceBetween) + + if (index === this.curIndex) { + Column() { + Progress({ value: this.progress.loader / Const.TIME_1000, total: this.progress.total / Const.TIME_1000 }) + .height($r('app.float.progress_height')) + .margin({ top: $r('app.float.progress_margin'), bottom: $r('app.float.progress_margin') }) + .width(Const.FULL_SIZE) + } + .width(Const.FULL_SIZE) + .height($r('app.float.progress_column_height')) + + Row() { + Text(this.time) + .fontSize($r('app.float.progress_time_font_size')) + + Text(utils.duration2Time(this.progress.total)) + .fontSize($r('app.float.progress_time_font_size')) + } + .width(Const.FULL_SIZE) + .height($r('app.float.progress_row_height')) + .margin({ bottom: $r('app.float.progress_row_margin') }) + .justifyContent(FlexAlign.SpaceBetween) + } + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + } + .width(Const.FULL_SIZE) + .height(index === this.curIndex ? $r('app.float.audio_item_height_open') : $r('app.float.audio_item_height')) + .borderRadius($r('app.float.audio_item_border_radius')) + .backgroundColor(Color.White) + .padding({ + top: $r('app.float.audio_item_padding_top'), + bottom: $r('app.float.audio_item_padding_top'), + left: $r('app.float.audio_item_padding_left'), + right: $r('app.float.audio_item_padding_left') + }) + .margin({ bottom: $r('app.float.audio_item_margin_bottom') }) + .onClick(() => { + this.playModel.pause(); + this.isPlaying = false; + router.pushUrl({ + url: 'pages/PlayPage', + params: { + name: item.name, + uri: item.uri, + duration: item.duration + } + }); + }) + }, (item: AudioData) => JSON.stringify(item)) + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + .padding({ left: $r('app.float.audio_list_padding'), right: $r('app.float.audio_list_padding') }) + .layoutWeight(1) + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + + Button() { + Image($r('app.media.ic_record')) + } + .width($r('app.float.button_size')) + .height($r('app.float.button_size')) + .markAnchor({ x: $r('app.float.button_mark_anchor'), y: 0 }) + .position({ x: Const.POSITION_X, y: Const.POSITION_Y}) + .backgroundColor($r('app.color.background_color')) + .onClick(() => { + this.playModel.pause(); + this.isPlaying = false; + router.pushUrl({ url: 'pages/RecordPage' }); + this.isChanged = true; + }) + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + .backgroundColor($r('app.color.background_color')) + } + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/PlayPage.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/PlayPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..b22a6dca6568e5a6144aeeb23c620c0350b250c4 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/PlayPage.ets @@ -0,0 +1,185 @@ +/* + * 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 router from '@ohos.router'; +import { CommonConstants as Const } from '../common/constants/CommonConstants'; +import Utils from '../common/utils/Utils'; +import PlayManager from '../manager/PlayManager'; + +import progress from '../viewmodel/Progress'; + +@Entry +@Component +struct PlayPage { + private player: PlayManager = new PlayManager(); + private uri: string = ''; + private audioName: string = ''; + private intervalId: number = 0; + private timer: number = 0; + private timeScale = Const.TIME_SCALE; + @State @Watch('onPlayChange') isPlaying: boolean = false; + @State timeAdd: number = 0; + @State milliseconds: number = 0; + @State translateText: string = Const.INIT_TRANSLATE; + @State translateImage: string = Const.INIT_TRANSLATE; + @State time: string = '00:00:00'; + + @State @Watch('onTimeChanged') @Watch('onPlayCompleted') progress: progress = { + loader: 0, + total: 0, + isCompleted: false + } + + aboutToAppear() { + let params = router.getParams() as Record; + this.uri = params.uri as string; + this.audioName = params.name as string; + this.player.init(this.progress); + } + + onTimeChanged() { + this.time = Utils.duration2Time(this.progress.loader); + } + + animator() { + if (this.isPlaying) { + this.intervalId = setInterval(() => { + this.translateText = Const.TRANSLATE_TEXT; + this.translateImage = Const.TRANSLATE_IMAGE; + this.timeAdd += 1; + animateTo({ duration: Const.TIME_1000, curve: Curve.Linear }, () => { + this.translateImage = Const.INIT_TRANSLATE; + this.translateText = Const.INIT_TRANSLATE; + }); + }, Const.TIME_1000); + } else { + clearInterval(this.intervalId); + } + } + + startTimer() { + if (this.isPlaying) { + clearInterval(this.timer); + this.timer = setInterval(() => { + this.milliseconds += Const.TIME_1000; + }, Const.TIME_1000); + } else { + clearInterval(this.timer); + } + } + + onPlayChange() { + setTimeout((): void => this.startTimer(), Const.TIME_1000); + this.animator(); + } + + onPlayCompleted() { + if (this.progress.isCompleted) { + this.isPlaying = false; + } + } + + build() { + Row() { + Column() { + Row() { + Image($r('app.media.ic_back')) + .width($r('app.float.icon_back_width')) + .height($r('app.float.icon_back_height')) + .margin({ left: $r('app.float.icon_back_margin_left'), right: $r('app.float.icon_back_margin_right') }) + .onClick(() => { + this.player.release(); + router.back(); + }) + + Text(this.audioName) + .fontSize($r('app.float.file_name_font_size')) + } + .width(Const.FULL_SIZE) + .height($r('app.float.file_name_row_height')) + .margin({ bottom: $r('app.float.file_name_row_margin') }) + + Column() { + Row() { + ForEach(this.timeScale, (item: string) => { + Column() { + Text(Utils.updateSlider(this.timeAdd, this.timeScale.indexOf(item))) + .fontSize($r('app.float.time_slider_font_size')) + .fontColor(Color.Gray) + .textAlign(TextAlign.End) + .maxLines(1) + } + .width(Const.TIME_SLIDER_WIDTH) + }, (item: string) => JSON.stringify(item)) + } + .width(Const.FULL_SIZE) + .height($r('app.float.time_slider_height')) + .translate({ x: this.translateText }) + .justifyContent(FlexAlign.Center) + + Image($r('app.media.ic_slider_time')) + .width(Const.TIME_SLIDER_IMAGE_WIDTH) + .height($r('app.float.time_slider_image_height')) + .objectFit(ImageFit.Fill) + .translate({ x: this.translateImage }) + + Image($r('app.media.ic_bg_play')) + .width(Const.FULL_SIZE) + .height($r('app.float.time_slider_bg_height')) + .objectFit(ImageFit.Fill) + + Text(Utils.updateTime(this.milliseconds)) + .fontSize($r('app.float.cur_time_text_font_size')) + .width($r('app.float.cur_time_text_width')) + .height($r('app.float.cur_time_text_height')) + + Text(Utils.duration2Time(this.progress.total)) + .fontSize($r('app.float.duration_font_size')) + .width($r('app.float.duration_width')) + .height($r('app.float.duration_height')) + } + .width(Const.FULL_SIZE) + + Button() { + Image(this.isPlaying? $r('app.media.ic_pause_lg') : $r('app.media.ic_play_lg')) + } + .width($r('app.float.button_size')) + .height($r('app.float.button_size')) + .markAnchor({ x: $r('app.float.button_mark_anchor'), y: 0 }) + .position({ x: Const.POSITION_X, y: Const.POSITION_Y }) + .backgroundColor($r('app.color.background_color')) + .onClick(() => { + if (this.isPlaying) { + this.player.pause(); + this.isPlaying = false; + } else { + this.player.play(this.uri); + this.isPlaying = true; + } + if(this.progress.isCompleted) { + this.timeAdd = 0; + this.milliseconds = 0; + this.progress.isCompleted = false; + } + }) + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + .backgroundColor($r('app.color.background_color')) + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/RecordPage.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/RecordPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..953a482b58fb4e9c047e05e88690640d66515222 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/pages/RecordPage.ets @@ -0,0 +1,194 @@ +/* + * 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 mediaLibrary from '@ohos.multimedia.mediaLibrary'; +import preferences from '@ohos.data.preferences'; +import router from '@ohos.router'; +import { CommonConstants as Const } from '../common/constants/CommonConstants'; +import Utils from '../common/utils/Utils'; +import MediaManager from '../manager/MediaManager'; +import RecordManager from '../manager/RecordManager'; + +@Entry +@Component +struct RecordPage { + private recorder: RecordManager = new RecordManager(); + private audioFile?: mediaLibrary.FileAsset; + private fd?: number; + private intervalId: number = 0; + private timer: number = 0; + private timeScale: Array = Const.TIME_SCALE; + private preferences?: preferences.Preferences; + @State @Watch('onRecordChange') isRecording: boolean = true; + @State fileName: string = ''; + @State timeAdd: number = 0; + @State milliseconds: number = 0; + @State translateText: string = Const.INIT_TRANSLATE; + @State translateImage: string = Const.INIT_TRANSLATE; + + async aboutToAppear() { + this.recorder.init(); + this.audioFile = await MediaManager!.createAudioFile(); + this.fd = await this.audioFile!.open('rw'); + this.fileName = this.audioFile!.displayName; + this.recorder.start(`fd://${this.fd}`); + } + + onPageShow() { + setTimeout((): void => this.startTimer(), Const.TIME_1000); + this.animator(); + let promise = preferences.getPreferences(getContext(this), 'duration'); + promise.then((obj: preferences.Preferences) => { + this.preferences = obj; + }) + } + + animator() { + if (this.isRecording) { + this.intervalId = setInterval(() => { + this.translateText = Const.TRANSLATE_TEXT; + this.translateImage = Const.TRANSLATE_IMAGE; + this.timeAdd += 1; + animateTo({ duration: Const.TIME_1000, curve: Curve.Linear }, () => { + this.translateText = Const.INIT_TRANSLATE; + this.translateImage = Const.INIT_TRANSLATE; + }); + }, Const.TIME_1000); + } else { + clearInterval(this.intervalId); + } + } + + startTimer() { + if (this.isRecording) { + this.timer = setInterval(() => { + this.milliseconds += Const.TIME_1000; + }, Const.TIME_1000); + } else { + clearInterval(this.timer); + } + } + + onRecordChange() { + setTimeout((): void => this.startTimer(), Const.TIME_1000); + this.animator(); + } + + saveDuration() { + this.preferences!.put(this.fileName, this.milliseconds).then(() => { + this.preferences!.flush().then(() => { + console.log('[Recorder]success!' + this.fileName + this.milliseconds) + }) + }) + } + + build() { + Row() { + Column() { + Row() { + Image($r('app.media.ic_back')) + .width($r('app.float.icon_back_width')) + .height($r('app.float.icon_back_height')) + .margin({ left: $r('app.float.icon_back_margin_left'), right: $r('app.float.icon_back_margin_right') }) + .onClick(async () => { + this.recorder.finish(); + await this.audioFile!.close(this.fd!); + router.back(); + }) + + Text(this.fileName) + .fontSize($r('app.float.file_name_font_size')) + } + .width(Const.FULL_SIZE) + .height($r('app.float.file_name_row_height')) + .margin({ bottom: $r('app.float.file_name_row_margin') }) + + Column() { + Row() { + ForEach(this.timeScale, (item: string) => { + Column() { + Text(Utils.updateSlider(this.timeAdd, this.timeScale.indexOf(item))) + .fontSize($r('app.float.time_slider_font_size')) + .fontColor(Color.Gray) + .textAlign(TextAlign.End) + .maxLines(1) + } + .width(Const.TIME_SLIDER_WIDTH) + }, (item: string) => JSON.stringify(item)) + } + .width(Const.FULL_SIZE) + .height($r('app.float.time_slider_height')) + .translate({ x: this.translateText }) + .justifyContent(FlexAlign.Center) + + Image($r('app.media.ic_slider_time')) + .width(Const.TIME_SLIDER_IMAGE_WIDTH) + .height($r('app.float.time_slider_image_height')) + .objectFit(ImageFit.Fill) + .translate({ x: this.translateImage }) + + Image($r('app.media.ic_bg_play')) + .width(Const.FULL_SIZE) + .height($r('app.float.time_slider_bg_height')) + .objectFit(ImageFit.Fill) + + Text(Utils.updateTime(this.milliseconds)) + .fontSize($r('app.float.cur_time_text_font_size')) + .width($r('app.float.cur_time_text_width')) + .height($r('app.float.cur_time_text_height')) + } + .width(Const.FULL_SIZE) + + Button() { + Image($r('app.media.ic_finish')) + } + .width($r('app.float.button_size')) + .height($r('app.float.button_size')) + .markAnchor({ x: $r('app.float.button_mark_anchor'), y: 0 }) + .position({ x: Const.POSITION_X, y: Const.POSITION_Y }) + .backgroundColor($r('app.color.background_color')) + .onClick(async () => { + this.recorder.finish(); + await this.audioFile!.close(this.fd!); + this.saveDuration(); + router.back(); + }) + + Button() { + Image(this.isRecording ? $r('app.media.ic_pause') : $r('app.media.ic_resume')) + } + .width($r('app.float.audio_little_icon_size')) + .height($r('app.float.audio_little_icon_size')) + .markAnchor({ x: $r('app.float.audio_little_icon_mark_anchor'), y: 0 }) + .position({ x: Const.ICON_POSITION_X, y: Const.ICON_POSITION_Y }) + .backgroundColor($r('app.color.background_color')) + .onClick(() => { + if (this.isRecording) { + this.recorder.pause(); + this.isRecording = false; + } else { + this.recorder.resume(); + this.isRecording = true; + } + }) + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + } + .width(Const.FULL_SIZE) + .height(Const.FULL_SIZE) + .backgroundColor($r('app.color.background_color')) + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/viewmodel/AudioData.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/viewmodel/AudioData.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e3c64a2c0c05aab14c570c6050d710be1f382fa --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/viewmodel/AudioData.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ + +/** + * Information of audio files. + */ + +export default interface AudioData { + name: string; + uri: string; + size: number; + time: number; + duration: number; + height: string +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/ets/viewmodel/Progress.ets b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/viewmodel/Progress.ets new file mode 100644 index 0000000000000000000000000000000000000000..78618fd20f9bbf6d954b81f69b858b87d5e4a173 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/ets/viewmodel/Progress.ets @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/** + * Information of audio files. + */ + +export default interface Progress { + loader: number, + total: number, + isCompleted: boolean +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/module.json5 b/HarmonyOS_NEXT/Recorder/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6a843ddb1abc74057d1e80b1eb14bfc847603303 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/module.json5 @@ -0,0 +1,55 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET" + }, + { + "name": "ohos.permission.MICROPHONE" + }, + { + "name": "ohos.permission.MEDIA_LOCATION" + }, + { + "name": "ohos.permission.READ_MEDIA" + }, + { + "name": "ohos.permission.WRITE_MEDIA" + } + ] + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/color.json b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..70821b018c502451ca827914ea0f5897d5a292d2 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "background_color", + "value": "#FFF1F3F5" + } + ] +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/float.json b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..ddaa6e50dbfb939d75fb37c801db173f416ceac4 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/float.json @@ -0,0 +1,234 @@ +{ + "float": [ + { + "name": "title_height", + "value": "41vp" + }, + { + "name": "title_font_size", + "value": "30fp" + }, + { + "name": "title_padding", + "value": "24vp" + }, + { + "name": "title_margin_top", + "value": "7vp" + }, + { + "name": "title_margin_bottom", + "value": "16vp" + }, + { + "name": "audio_title_font_size", + "value": "16fp" + }, + { + "name": "audio_title_height", + "value": "22vp" + }, + { + "name": "audio_title_margin_top", + "value": "10vp" + }, + { + "name": "audio_title_margin_bottom", + "value": "2vp" + }, + { + "name": "audio_time_font_size", + "value": "14fp" + }, + { + "name": "audio_time_height", + "value": "19vp" + }, + { + "name": "audio_time_margin", + "value": "11vp" + }, + { + "name": "audio_data_width", + "value": "195vp" + }, + { + "name": "audio_duration_font_size", + "value": "14vp" + }, + { + "name": "audio_duration_width", + "value": "59vp" + }, + { + "name": "audio_little_icon_size", + "value": "24vp" + }, + { + "name": "audio_play_row_width", + "value": "95vp" + }, + { + "name": "audio_play_row_height", + "value": "50vp" + }, + { + "name": "progress_height", + "value": "4vp" + }, + { + "name": "progress_margin", + "value": "10vp" + }, + { + "name": "progress_column_height", + "value": "24vp" + }, + { + "name": "progress_time_font_size", + "value": "10fp" + }, + { + "name": "progress_row_height", + "value": "14vp" + }, + { + "name": "progress_row_margin", + "value": "8vp" + }, + { + "name": "audio_item_height", + "value": "72vp" + }, + { + "name": "audio_item_height_open", + "value": "118vp" + }, + { + "name": "audio_item_border_radius", + "value": "24vp" + }, + { + "name": "audio_item_padding_top", + "value": "4vp" + }, + { + "name": "audio_item_padding_left", + "value": "12vp" + }, + { + "name": "audio_item_margin_bottom", + "value": "12vp" + }, + { + "name": "audio_list_padding", + "value": "12vp" + }, + { + "name": "button_size", + "value": "54vp" + }, + { + "name": "button_mark_anchor", + "value": "27vp" + }, + { + "name": "icon_back_width", + "value": "20vp" + }, + { + "name": "icon_back_height", + "value": "18vp" + }, + { + "name": "icon_back_margin_left", + "value": "26vp" + }, + { + "name": "icon_back_margin_right", + "value": "18vp" + }, + { + "name": "file_name_font_size", + "value": "20fp" + }, + { + "name": "file_name_row_height", + "value": "56vp" + }, + { + "name": "file_name_row_margin", + "value": "8vp" + }, + { + "name": "audio_little_icon_mark_anchor", + "value": "12vp" + }, + { + "name": "time_slider_font_size", + "value": "12fp" + }, + { + "name": "time_slider_height", + "value": "12vp" + }, + { + "name": "time_slider_image_height", + "value": "19vp" + }, + { + "name": "time_slider_bg_height", + "value": "201vp" + }, + { + "name": "cur_time_text_font_size", + "value": "48fp" + }, + { + "name": "cur_time_text_width", + "value": "192vp" + }, + { + "name": "cur_time_text_height", + "value": "64vp" + }, + { + "name": "duration_font_size", + "value": "16fp" + }, + { + "name": "duration_width", + "value": "64vp" + }, + { + "name": "duration_height", + "value": "21vp" + } + ] +} + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/string.json b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_back.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_back.png new file mode 100644 index 0000000000000000000000000000000000000000..6cbe911b6b33e467fe20c4fbe305f2bc7022d29d Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_back.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_bg_play.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_bg_play.png new file mode 100644 index 0000000000000000000000000000000000000000..70ca6be96132d8f9ff10a353d04867ae877ae917 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_bg_play.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_finish.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_finish.png new file mode 100644 index 0000000000000000000000000000000000000000..3192e1feabef63a524a23f02cbf63b03f7505596 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_finish.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_pause.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_pause.png new file mode 100644 index 0000000000000000000000000000000000000000..347fb8077f13386d9baf0f8de2ac5f366a8c383d Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_pause.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_pause_lg.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_pause_lg.png new file mode 100644 index 0000000000000000000000000000000000000000..65470bf0eea8ab1be795d3c0310dad7da4d90a4b Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_pause_lg.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_play.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_play.png new file mode 100644 index 0000000000000000000000000000000000000000..1f5fa49f4f57d90ac182b2f548eef99a984205e9 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_play.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_play_lg.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_play_lg.png new file mode 100644 index 0000000000000000000000000000000000000000..880b4cfe9086680a532716499231912ab3d9fa26 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_play_lg.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_record.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_record.png new file mode 100644 index 0000000000000000000000000000000000000000..4aea65b32da13d982b995784690f90510906593d Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_record.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_resume.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_resume.png new file mode 100644 index 0000000000000000000000000000000000000000..13fbf5e2b7a4b81d7e2818707a5ea74fb08b3ad0 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_resume.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_slider_time.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_slider_time.png new file mode 100644 index 0000000000000000000000000000000000000000..93d768e7160bbab2f43bffc0df7e52f14b874bc7 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/ic_slider_time.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/icon.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/icon.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/startIcon.png b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/media/startIcon.png differ diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/profile/main_pages.json b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..19eb75e0930364fbc22847cdf419a4981769260b --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,7 @@ +{ + "src": [ + "pages/MainPage", + "pages/PlayPage", + "pages/RecordPage" + ] +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/en_US/element/string.json b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/entry/src/main/resources/zh_CN/element/string.json b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..60fe49a1ed5dfa0fef373050472085da9b28585d --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "录音机" + } + ] +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/hvigor/hvigor-config.json5 b/HarmonyOS_NEXT/Recorder/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f7a6fdec200c7b520e258063d112cdeea3dc4b40 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/hvigor/hvigor-config.json5 @@ -0,0 +1,22 @@ +/* + * 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. + */ + +{ + "hvigorVersion": "file:../dependencies/hvigor-3.0.9-s.tgz", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "file:../dependencies/hvigor-ohos-plugin-3.0.9-s.tgz", + "rollup": "file:../dependencies/rollup.tgz", + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/hvigor/hvigor-wrapper.js b/HarmonyOS_NEXT/Recorder/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..ed520df42d9190418c6ade156daa022ec8f43e21 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/hvigor/hvigor-wrapper.js @@ -0,0 +1 @@ +"use strict";var u=require("fs"),e=require("path"),t=require("os"),r=require("crypto"),n=require("child_process"),i=require("constants"),o=require("stream"),D=require("util"),c=require("assert");function a(u){return u&&"object"==typeof u&&"default"in u?u:{default:u}}var s=a(u),f=a(e),E=a(t),l=a(r),F=a(n),C=a(i),A=a(o),d=a(D),y=a(c),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h={},m={},B={},v=p&&p.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(B,"__esModule",{value:!0}),B.isMac=B.isLinux=B.isWindows=void 0;const S=v(E.default),_="Windows_NT",O="Linux",w="Darwin";B.isWindows=function(){return S.default.type()===_},B.isLinux=function(){return S.default.type()===O},B.isMac=function(){return S.default.type()===w};var P={},b=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),g=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),N=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&b(e,u,t);return g(e,u),e};Object.defineProperty(P,"__esModule",{value:!0}),P.hash=void 0;const R=N(l.default);P.hash=function(u,e="md5"){return R.createHash(e).update(u,"utf-8").digest("hex")},function(u){var e=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),t=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),r=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var r={};if(null!=u)for(var n in u)"default"!==n&&Object.prototype.hasOwnProperty.call(u,n)&&e(r,u,n);return t(r,u),r};Object.defineProperty(u,"__esModule",{value:!0}),u.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.HVIGOR_PROJECT_WRAPPER_HOME=u.HVIGOR_PROJECT_NAME=u.HVIGOR_PROJECT_ROOT_DIR=u.HVIGOR_PROJECT_CACHES_HOME=u.HVIGOR_PNPM_STORE_PATH=u.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.HVIGOR_WRAPPER_TOOLS_HOME=u.HVIGOR_USER_HOME=u.DEFAULT_PACKAGE_JSON=u.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=u.NPM_TOOL=u.PNPM_TOOL=u.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const n=r(f.default),i=r(E.default),o=B,D=P;u.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",u.PNPM_TOOL=(0,o.isWindows)()?"pnpm.cmd":"pnpm",u.NPM_TOOL=(0,o.isWindows)()?"npm.cmd":"npm",u.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",u.DEFAULT_PACKAGE_JSON="package.json",u.HVIGOR_USER_HOME=n.resolve(i.homedir(),".hvigor"),u.HVIGOR_WRAPPER_TOOLS_HOME=n.resolve(u.HVIGOR_USER_HOME,"wrapper","tools"),u.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.resolve(u.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",u.PNPM_TOOL),u.HVIGOR_PNPM_STORE_PATH=n.resolve(u.HVIGOR_USER_HOME,"caches"),u.HVIGOR_PROJECT_CACHES_HOME=n.resolve(u.HVIGOR_USER_HOME,"project_caches"),u.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),u.HVIGOR_PROJECT_NAME=n.basename((0,D.hash)(u.HVIGOR_PROJECT_ROOT_DIR)),u.HVIGOR_PROJECT_WRAPPER_HOME=n.resolve(u.HVIGOR_PROJECT_ROOT_DIR,"hvigor"),u.HVIGOR_PROJECT_DEPENDENCIES_HOME=n.resolve(u.HVIGOR_PROJECT_CACHES_HOME,u.HVIGOR_PROJECT_NAME,"workspace"),u.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=n.resolve(u.HVIGOR_PROJECT_DEPENDENCIES_HOME,u.DEFAULT_PACKAGE_JSON)}(m);var I={},k={};Object.defineProperty(k,"__esModule",{value:!0}),k.logErrorAndExit=void 0,k.logErrorAndExit=function(u){u instanceof Error?console.error(u.message):console.error(u),process.exit(-1)};var T=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),x=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),M=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&T(e,u,t);return x(e,u),e};Object.defineProperty(I,"__esModule",{value:!0}),I.executeCommand=I.getNpmPath=I.hasNpmPackInPaths=void 0;const H=F.default,j=M(f.default),J=m,L=k;I.hasNpmPackInPaths=function(u,e){try{return require.resolve(u,{paths:[...e]}),!0}catch(u){return!1}},I.getNpmPath=function(){const u=process.execPath;return j.join(j.dirname(u),J.NPM_TOOL)},I.executeCommand=function(u,e,t){0!==(0,H.spawnSync)(u,e,t).status&&(0,L.logErrorAndExit)(`Error: ${u} execute failed.See above for details.`)};var G=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),V=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),$=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&G(e,u,t);return V(e,u),e};Object.defineProperty(h,"__esModule",{value:!0});var U=h.executeInstallPnpm=Z=h.isPnpmAvailable=void 0;const W=$(s.default),q=m,K=I,Y=$(f.default),z=k;var Z=h.isPnpmAvailable=function(){return!!W.existsSync(q.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,K.hasNpmPackInPaths)("pnpm",[q.HVIGOR_WRAPPER_TOOLS_HOME])};U=h.executeInstallPnpm=function(){const u=(0,K.getNpmPath)();!function(){const u=Y.resolve(q.HVIGOR_WRAPPER_TOOLS_HOME,q.DEFAULT_PACKAGE_JSON);try{W.existsSync(q.HVIGOR_WRAPPER_TOOLS_HOME)||W.mkdirSync(q.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const e={dependencies:{}};W.writeFileSync(u,JSON.stringify(e))}catch(e){(0,z.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${u} failed.`)}}(),(0,K.executeCommand)(u,["install","pnpm"],{cwd:q.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"]})};var X={},Q={},uu={},eu={};Object.defineProperty(eu,"__esModule",{value:!0}),eu.Unicode=void 0;class tu{}eu.Unicode=tu,tu.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,tu.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,tu.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(uu,"__esModule",{value:!0}),uu.JudgeUtil=void 0;const ru=eu;uu.JudgeUtil=class{static isIgnoreChar(u){return"string"==typeof u&&("\t"===u||"\v"===u||"\f"===u||" "===u||" "===u||"\ufeff"===u||"\n"===u||"\r"===u||"\u2028"===u||"\u2029"===u)}static isSpaceSeparator(u){return"string"==typeof u&&ru.Unicode.Space_Separator.test(u)}static isIdStartChar(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||ru.Unicode.ID_Start.test(u))}static isIdContinueChar(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||ru.Unicode.ID_Continue.test(u))}static isDigitWithoutZero(u){return/[1-9]/.test(u)}static isDigit(u){return"string"==typeof u&&/[0-9]/.test(u)}static isHexDigit(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};var nu={},iu={fromCallback:function(u){return Object.defineProperty((function(...e){if("function"!=typeof e[e.length-1])return new Promise(((t,r)=>{u.call(this,...e,((u,e)=>null!=u?r(u):t(e)))}));u.apply(this,e)}),"name",{value:u.name})},fromPromise:function(u){return Object.defineProperty((function(...e){const t=e[e.length-1];if("function"!=typeof t)return u.apply(this,e);u.apply(this,e.slice(0,-1)).then((u=>t(null,u)),t)}),"name",{value:u.name})}},ou=C.default,Du=process.cwd,cu=null,au=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return cu||(cu=Du.call(process)),cu};try{process.cwd()}catch(u){}if("function"==typeof process.chdir){var su=process.chdir;process.chdir=function(u){cu=null,su.call(process,u)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,su)}var fu=function(u){ou.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(u){u.lchmod=function(e,t,r){u.open(e,ou.O_WRONLY|ou.O_SYMLINK,t,(function(e,n){e?r&&r(e):u.fchmod(n,t,(function(e){u.close(n,(function(u){r&&r(e||u)}))}))}))},u.lchmodSync=function(e,t){var r,n=u.openSync(e,ou.O_WRONLY|ou.O_SYMLINK,t),i=!0;try{r=u.fchmodSync(n,t),i=!1}finally{if(i)try{u.closeSync(n)}catch(u){}else u.closeSync(n)}return r}}(u);u.lutimes||function(u){ou.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(e,t,r,n){u.open(e,ou.O_SYMLINK,(function(e,i){e?n&&n(e):u.futimes(i,t,r,(function(e){u.close(i,(function(u){n&&n(e||u)}))}))}))},u.lutimesSync=function(e,t,r){var n,i=u.openSync(e,ou.O_SYMLINK),o=!0;try{n=u.futimesSync(i,t,r),o=!1}finally{if(o)try{u.closeSync(i)}catch(u){}else u.closeSync(i)}return n}):u.futimes&&(u.lutimes=function(u,e,t,r){r&&process.nextTick(r)},u.lutimesSync=function(){})}(u);u.chown=r(u.chown),u.fchown=r(u.fchown),u.lchown=r(u.lchown),u.chmod=e(u.chmod),u.fchmod=e(u.fchmod),u.lchmod=e(u.lchmod),u.chownSync=n(u.chownSync),u.fchownSync=n(u.fchownSync),u.lchownSync=n(u.lchownSync),u.chmodSync=t(u.chmodSync),u.fchmodSync=t(u.fchmodSync),u.lchmodSync=t(u.lchmodSync),u.stat=i(u.stat),u.fstat=i(u.fstat),u.lstat=i(u.lstat),u.statSync=o(u.statSync),u.fstatSync=o(u.fstatSync),u.lstatSync=o(u.lstatSync),u.chmod&&!u.lchmod&&(u.lchmod=function(u,e,t){t&&process.nextTick(t)},u.lchmodSync=function(){});u.chown&&!u.lchown&&(u.lchown=function(u,e,t,r){r&&process.nextTick(r)},u.lchownSync=function(){});"win32"===au&&(u.rename="function"!=typeof u.rename?u.rename:function(e){function t(t,r,n){var i=Date.now(),o=0;e(t,r,(function D(c){if(c&&("EACCES"===c.code||"EPERM"===c.code)&&Date.now()-i<6e4)return setTimeout((function(){u.stat(r,(function(u,i){u&&"ENOENT"===u.code?e(t,r,D):n(c)}))}),o),void(o<100&&(o+=10));n&&n(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(u.rename));function e(e){return e?function(t,r,n){return e.call(u,t,r,(function(u){D(u)&&(u=null),n&&n.apply(this,arguments)}))}:e}function t(e){return e?function(t,r){try{return e.call(u,t,r)}catch(u){if(!D(u))throw u}}:e}function r(e){return e?function(t,r,n,i){return e.call(u,t,r,n,(function(u){D(u)&&(u=null),i&&i.apply(this,arguments)}))}:e}function n(e){return e?function(t,r,n){try{return e.call(u,t,r,n)}catch(u){if(!D(u))throw u}}:e}function i(e){return e?function(t,r,n){function i(u,e){e&&(e.uid<0&&(e.uid+=4294967296),e.gid<0&&(e.gid+=4294967296)),n&&n.apply(this,arguments)}return"function"==typeof r&&(n=r,r=null),r?e.call(u,t,r,i):e.call(u,t,i)}:e}function o(e){return e?function(t,r){var n=r?e.call(u,t,r):e.call(u,t);return n&&(n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296)),n}:e}function D(u){return!u||("ENOSYS"===u.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==u.code&&"EPERM"!==u.code))}u.read="function"!=typeof u.read?u.read:function(e){function t(t,r,n,i,o,D){var c;if(D&&"function"==typeof D){var a=0;c=function(s,f,E){if(s&&"EAGAIN"===s.code&&a<10)return a++,e.call(u,t,r,n,i,o,c);D.apply(this,arguments)}}return e.call(u,t,r,n,i,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(u.read),u.readSync="function"!=typeof u.readSync?u.readSync:(c=u.readSync,function(e,t,r,n,i){for(var o=0;;)try{return c.call(u,e,t,r,n,i)}catch(u){if("EAGAIN"===u.code&&o<10){o++;continue}throw u}});var c};var Eu=A.default.Stream,lu=function(u){return{ReadStream:function e(t,r){if(!(this instanceof e))return new e(t,r);Eu.call(this);var n=this;this.path=t,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var i=Object.keys(r),o=0,D=i.length;othis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){n._read()}));u.open(this.path,this.flags,this.mode,(function(u,e){if(u)return n.emit("error",u),void(n.readable=!1);n.fd=e,n.emit("open",e),n._read()}))},WriteStream:function e(t,r){if(!(this instanceof e))return new e(t,r);Eu.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var n=Object.keys(r),i=0,o=n.length;i= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=u.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Fu=function(u){if(null===u||"object"!=typeof u)return u;if(u instanceof Object)var e={__proto__:Cu(u)};else e=Object.create(null);return Object.getOwnPropertyNames(u).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(u,t))})),e},Cu=Object.getPrototypeOf||function(u){return u.__proto__};var Au,du,yu=s.default,pu=fu,hu=lu,mu=Fu,Bu=d.default;function vu(u,e){Object.defineProperty(u,Au,{get:function(){return e}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(Au=Symbol.for("graceful-fs.queue"),du=Symbol.for("graceful-fs.previous")):(Au="___graceful-fs.queue",du="___graceful-fs.previous");var Su=function(){};if(Bu.debuglog?Su=Bu.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Su=function(){var u=Bu.format.apply(Bu,arguments);u="GFS4: "+u.split(/\n/).join("\nGFS4: "),console.error(u)}),!yu[Au]){var _u=p[Au]||[];vu(yu,_u),yu.close=function(u){function e(e,t){return u.call(yu,e,(function(u){u||gu(),"function"==typeof t&&t.apply(this,arguments)}))}return Object.defineProperty(e,du,{value:u}),e}(yu.close),yu.closeSync=function(u){function e(e){u.apply(yu,arguments),gu()}return Object.defineProperty(e,du,{value:u}),e}(yu.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Su(yu[Au]),y.default.equal(yu[Au].length,0)}))}p[Au]||vu(p,yu[Au]);var Ou,wu=Pu(mu(yu));function Pu(u){pu(u),u.gracefulify=Pu,u.createReadStream=function(e,t){return new u.ReadStream(e,t)},u.createWriteStream=function(e,t){return new u.WriteStream(e,t)};var e=u.readFile;u.readFile=function(u,t,r){"function"==typeof t&&(r=t,t=null);return function u(t,r,n,i){return e(t,r,(function(e){!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?"function"==typeof n&&n.apply(this,arguments):bu([u,[t,r,n],e,i||Date.now(),Date.now()])}))}(u,t,r)};var t=u.writeFile;u.writeFile=function(u,e,r,n){"function"==typeof r&&(n=r,r=null);return function u(e,r,n,i,o){return t(e,r,n,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof i&&i.apply(this,arguments):bu([u,[e,r,n,i],t,o||Date.now(),Date.now()])}))}(u,e,r,n)};var r=u.appendFile;r&&(u.appendFile=function(u,e,t,n){"function"==typeof t&&(n=t,t=null);return function u(e,t,n,i,o){return r(e,t,n,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):bu([u,[e,t,n,i],r,o||Date.now(),Date.now()])}))}(u,e,t,n)});var n=u.copyFile;n&&(u.copyFile=function(u,e,t,r){"function"==typeof t&&(r=t,t=0);return function u(e,t,r,i,o){return n(e,t,r,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):bu([u,[e,t,r,i],n,o||Date.now(),Date.now()])}))}(u,e,t,r)});var i=u.readdir;u.readdir=function(u,e,t){"function"==typeof e&&(t=e,e=null);var r=o.test(process.version)?function(u,e,t,r){return i(u,n(u,e,t,r))}:function(u,e,t,r){return i(u,e,n(u,e,t,r))};return r(u,e,t);function n(u,e,t,n){return function(i,o){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?(o&&o.sort&&o.sort(),"function"==typeof t&&t.call(this,i,o)):bu([r,[u,e,t],i,n||Date.now(),Date.now()])}}};var o=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var D=hu(u);E=D.ReadStream,l=D.WriteStream}var c=u.ReadStream;c&&(E.prototype=Object.create(c.prototype),E.prototype.open=function(){var u=this;C(u.path,u.flags,u.mode,(function(e,t){e?(u.autoClose&&u.destroy(),u.emit("error",e)):(u.fd=t,u.emit("open",t),u.read())}))});var a=u.WriteStream;a&&(l.prototype=Object.create(a.prototype),l.prototype.open=function(){var u=this;C(u.path,u.flags,u.mode,(function(e,t){e?(u.destroy(),u.emit("error",e)):(u.fd=t,u.emit("open",t))}))}),Object.defineProperty(u,"ReadStream",{get:function(){return E},set:function(u){E=u},enumerable:!0,configurable:!0}),Object.defineProperty(u,"WriteStream",{get:function(){return l},set:function(u){l=u},enumerable:!0,configurable:!0});var s=E;Object.defineProperty(u,"FileReadStream",{get:function(){return s},set:function(u){s=u},enumerable:!0,configurable:!0});var f=l;function E(u,e){return this instanceof E?(c.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function l(u,e){return this instanceof l?(a.apply(this,arguments),this):l.apply(Object.create(l.prototype),arguments)}Object.defineProperty(u,"FileWriteStream",{get:function(){return f},set:function(u){f=u},enumerable:!0,configurable:!0});var F=u.open;function C(u,e,t,r){return"function"==typeof t&&(r=t,t=null),function u(e,t,r,n,i){return F(e,t,r,(function(o,D){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof n&&n.apply(this,arguments):bu([u,[e,t,r,n],o,i||Date.now(),Date.now()])}))}(u,e,t,r)}return u.open=C,u}function bu(u){Su("ENQUEUE",u[0].name,u[1]),yu[Au].push(u),Nu()}function gu(){for(var u=Date.now(),e=0;e2&&(yu[Au][e][3]=u,yu[Au][e][4]=u);Nu()}function Nu(){if(clearTimeout(Ou),Ou=void 0,0!==yu[Au].length){var u=yu[Au].shift(),e=u[0],t=u[1],r=u[2],n=u[3],i=u[4];if(void 0===n)Su("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-n>=6e4){Su("TIMEOUT",e.name,t);var o=t.pop();"function"==typeof o&&o.call(null,r)}else{var D=Date.now()-i,c=Math.max(i-n,1);D>=Math.min(1.2*c,100)?(Su("RETRY",e.name,t),e.apply(null,t.concat([n]))):yu[Au].push(u)}void 0===Ou&&(Ou=setTimeout(Nu,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!yu.__patched&&(wu=Pu(yu),yu.__patched=!0),function(u){const e=iu.fromCallback,t=wu,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((u=>"function"==typeof t[u]));Object.assign(u,t),r.forEach((r=>{u[r]=e(t[r])})),u.exists=function(u,e){return"function"==typeof e?t.exists(u,e):new Promise((e=>t.exists(u,e)))},u.read=function(u,e,r,n,i,o){return"function"==typeof o?t.read(u,e,r,n,i,o):new Promise(((o,D)=>{t.read(u,e,r,n,i,((u,e,t)=>{if(u)return D(u);o({bytesRead:e,buffer:t})}))}))},u.write=function(u,e,...r){return"function"==typeof r[r.length-1]?t.write(u,e,...r):new Promise(((n,i)=>{t.write(u,e,...r,((u,e,t)=>{if(u)return i(u);n({bytesWritten:e,buffer:t})}))}))},"function"==typeof t.writev&&(u.writev=function(u,e,...r){return"function"==typeof r[r.length-1]?t.writev(u,e,...r):new Promise(((n,i)=>{t.writev(u,e,...r,((u,e,t)=>{if(u)return i(u);n({bytesWritten:e,buffers:t})}))}))}),"function"==typeof t.realpath.native?u.realpath.native=e(t.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(nu);var Ru={},Iu={};const ku=f.default;Iu.checkPath=function(u){if("win32"===process.platform){if(/[<>:"|?*]/.test(u.replace(ku.parse(u).root,""))){const e=new Error(`Path contains invalid characters: ${u}`);throw e.code="EINVAL",e}}};const Tu=nu,{checkPath:xu}=Iu,Mu=u=>"number"==typeof u?u:{mode:511,...u}.mode;Ru.makeDir=async(u,e)=>(xu(u),Tu.mkdir(u,{mode:Mu(e),recursive:!0})),Ru.makeDirSync=(u,e)=>(xu(u),Tu.mkdirSync(u,{mode:Mu(e),recursive:!0}));const Hu=iu.fromPromise,{makeDir:ju,makeDirSync:Ju}=Ru,Lu=Hu(ju);var Gu={mkdirs:Lu,mkdirsSync:Ju,mkdirp:Lu,mkdirpSync:Ju,ensureDir:Lu,ensureDirSync:Ju};const Vu=iu.fromPromise,$u=nu;var Uu={pathExists:Vu((function(u){return $u.access(u).then((()=>!0)).catch((()=>!1))})),pathExistsSync:$u.existsSync};const Wu=wu;var qu=function(u,e,t,r){Wu.open(u,"r+",((u,n)=>{if(u)return r(u);Wu.futimes(n,e,t,(u=>{Wu.close(n,(e=>{r&&r(u||e)}))}))}))},Ku=function(u,e,t){const r=Wu.openSync(u,"r+");return Wu.futimesSync(r,e,t),Wu.closeSync(r)};const Yu=nu,zu=f.default,Zu=d.default;function Xu(u,e,t){const r=t.dereference?u=>Yu.stat(u,{bigint:!0}):u=>Yu.lstat(u,{bigint:!0});return Promise.all([r(u),r(e).catch((u=>{if("ENOENT"===u.code)return null;throw u}))]).then((([u,e])=>({srcStat:u,destStat:e})))}function Qu(u,e){return e.ino&&e.dev&&e.ino===u.ino&&e.dev===u.dev}function ue(u,e){const t=zu.resolve(u).split(zu.sep).filter((u=>u)),r=zu.resolve(e).split(zu.sep).filter((u=>u));return t.reduce(((u,e,t)=>u&&r[t]===e),!0)}function ee(u,e,t){return`Cannot ${t} '${u}' to a subdirectory of itself, '${e}'.`}var te={checkPaths:function(u,e,t,r,n){Zu.callbackify(Xu)(u,e,r,((r,i)=>{if(r)return n(r);const{srcStat:o,destStat:D}=i;if(D){if(Qu(o,D)){const r=zu.basename(u),i=zu.basename(e);return"move"===t&&r!==i&&r.toLowerCase()===i.toLowerCase()?n(null,{srcStat:o,destStat:D,isChangingCase:!0}):n(new Error("Source and destination must not be the same."))}if(o.isDirectory()&&!D.isDirectory())return n(new Error(`Cannot overwrite non-directory '${e}' with directory '${u}'.`));if(!o.isDirectory()&&D.isDirectory())return n(new Error(`Cannot overwrite directory '${e}' with non-directory '${u}'.`))}return o.isDirectory()&&ue(u,e)?n(new Error(ee(u,e,t))):n(null,{srcStat:o,destStat:D})}))},checkPathsSync:function(u,e,t,r){const{srcStat:n,destStat:i}=function(u,e,t){let r;const n=t.dereference?u=>Yu.statSync(u,{bigint:!0}):u=>Yu.lstatSync(u,{bigint:!0}),i=n(u);try{r=n(e)}catch(u){if("ENOENT"===u.code)return{srcStat:i,destStat:null};throw u}return{srcStat:i,destStat:r}}(u,e,r);if(i){if(Qu(n,i)){const r=zu.basename(u),o=zu.basename(e);if("move"===t&&r!==o&&r.toLowerCase()===o.toLowerCase())return{srcStat:n,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(n.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${u}'.`);if(!n.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${u}'.`)}if(n.isDirectory()&&ue(u,e))throw new Error(ee(u,e,t));return{srcStat:n,destStat:i}},checkParentPaths:function u(e,t,r,n,i){const o=zu.resolve(zu.dirname(e)),D=zu.resolve(zu.dirname(r));if(D===o||D===zu.parse(D).root)return i();Yu.stat(D,{bigint:!0},((o,c)=>o?"ENOENT"===o.code?i():i(o):Qu(t,c)?i(new Error(ee(e,r,n))):u(e,t,D,n,i)))},checkParentPathsSync:function u(e,t,r,n){const i=zu.resolve(zu.dirname(e)),o=zu.resolve(zu.dirname(r));if(o===i||o===zu.parse(o).root)return;let D;try{D=Yu.statSync(o,{bigint:!0})}catch(u){if("ENOENT"===u.code)return;throw u}if(Qu(t,D))throw new Error(ee(e,r,n));return u(e,t,o,n)},isSrcSubdir:ue,areIdentical:Qu};const re=wu,ne=f.default,ie=Gu.mkdirs,oe=Uu.pathExists,De=qu,ce=te;function ae(u,e,t,r,n){const i=ne.dirname(t);oe(i,((o,D)=>o?n(o):D?fe(u,e,t,r,n):void ie(i,(i=>i?n(i):fe(u,e,t,r,n)))))}function se(u,e,t,r,n,i){Promise.resolve(n.filter(t,r)).then((o=>o?u(e,t,r,n,i):i()),(u=>i(u)))}function fe(u,e,t,r,n){(r.dereference?re.stat:re.lstat)(e,((i,o)=>i?n(i):o.isDirectory()?function(u,e,t,r,n,i){return e?Ce(t,r,n,i):function(u,e,t,r,n){re.mkdir(t,(i=>{if(i)return n(i);Ce(e,t,r,(e=>e?n(e):Fe(t,u,n)))}))}(u.mode,t,r,n,i)}(o,u,e,t,r,n):o.isFile()||o.isCharacterDevice()||o.isBlockDevice()?function(u,e,t,r,n,i){return e?function(u,e,t,r,n){if(!r.overwrite)return r.errorOnExist?n(new Error(`'${t}' already exists`)):n();re.unlink(t,(i=>i?n(i):Ee(u,e,t,r,n)))}(u,t,r,n,i):Ee(u,t,r,n,i)}(o,u,e,t,r,n):o.isSymbolicLink()?function(u,e,t,r,n){re.readlink(e,((e,i)=>e?n(e):(r.dereference&&(i=ne.resolve(process.cwd(),i)),u?void re.readlink(t,((e,o)=>e?"EINVAL"===e.code||"UNKNOWN"===e.code?re.symlink(i,t,n):n(e):(r.dereference&&(o=ne.resolve(process.cwd(),o)),ce.isSrcSubdir(i,o)?n(new Error(`Cannot copy '${i}' to a subdirectory of itself, '${o}'.`)):u.isDirectory()&&ce.isSrcSubdir(o,i)?n(new Error(`Cannot overwrite '${o}' with '${i}'.`)):function(u,e,t){re.unlink(e,(r=>r?t(r):re.symlink(u,e,t)))}(i,t,n)))):re.symlink(i,t,n))))}(u,e,t,r,n):o.isSocket()?n(new Error(`Cannot copy a socket file: ${e}`)):o.isFIFO()?n(new Error(`Cannot copy a FIFO pipe: ${e}`)):n(new Error(`Unknown file: ${e}`))))}function Ee(u,e,t,r,n){re.copyFile(e,t,(i=>i?n(i):r.preserveTimestamps?function(u,e,t,r){if(function(u){return 0==(128&u)}(u))return function(u,e,t){return Fe(u,128|e,t)}(t,u,(n=>n?r(n):le(u,e,t,r)));return le(u,e,t,r)}(u.mode,e,t,n):Fe(t,u.mode,n)))}function le(u,e,t,r){!function(u,e,t){re.stat(u,((u,r)=>u?t(u):De(e,r.atime,r.mtime,t)))}(e,t,(e=>e?r(e):Fe(t,u,r)))}function Fe(u,e,t){return re.chmod(u,e,t)}function Ce(u,e,t,r){re.readdir(u,((n,i)=>n?r(n):Ae(i,u,e,t,r)))}function Ae(u,e,t,r,n){const i=u.pop();return i?function(u,e,t,r,n,i){const o=ne.join(t,e),D=ne.join(r,e);ce.checkPaths(o,D,"copy",n,((e,c)=>{if(e)return i(e);const{destStat:a}=c;!function(u,e,t,r,n){r.filter?se(fe,u,e,t,r,n):fe(u,e,t,r,n)}(a,o,D,n,(e=>e?i(e):Ae(u,t,r,n,i)))}))}(u,i,e,t,r,n):n()}var de=function(u,e,t,r){"function"!=typeof t||r?"function"==typeof t&&(t={filter:t}):(r=t,t={}),r=r||function(){},(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001"),ce.checkPaths(u,e,"copy",t,((n,i)=>{if(n)return r(n);const{srcStat:o,destStat:D}=i;ce.checkParentPaths(u,o,e,"copy",(n=>n?r(n):t.filter?se(ae,D,u,e,t,r):ae(D,u,e,t,r)))}))};const ye=wu,pe=f.default,he=Gu.mkdirsSync,me=Ku,Be=te;function ve(u,e,t,r){const n=(r.dereference?ye.statSync:ye.lstatSync)(e);if(n.isDirectory())return function(u,e,t,r,n){return e?Oe(t,r,n):function(u,e,t,r){return ye.mkdirSync(t),Oe(e,t,r),_e(t,u)}(u.mode,t,r,n)}(n,u,e,t,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return function(u,e,t,r,n){return e?function(u,e,t,r){if(r.overwrite)return ye.unlinkSync(t),Se(u,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}(u,t,r,n):Se(u,t,r,n)}(n,u,e,t,r);if(n.isSymbolicLink())return function(u,e,t,r){let n=ye.readlinkSync(e);r.dereference&&(n=pe.resolve(process.cwd(),n));if(u){let u;try{u=ye.readlinkSync(t)}catch(u){if("EINVAL"===u.code||"UNKNOWN"===u.code)return ye.symlinkSync(n,t);throw u}if(r.dereference&&(u=pe.resolve(process.cwd(),u)),Be.isSrcSubdir(n,u))throw new Error(`Cannot copy '${n}' to a subdirectory of itself, '${u}'.`);if(ye.statSync(t).isDirectory()&&Be.isSrcSubdir(u,n))throw new Error(`Cannot overwrite '${u}' with '${n}'.`);return function(u,e){return ye.unlinkSync(e),ye.symlinkSync(u,e)}(n,t)}return ye.symlinkSync(n,t)}(u,e,t,r);if(n.isSocket())throw new Error(`Cannot copy a socket file: ${e}`);if(n.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${e}`);throw new Error(`Unknown file: ${e}`)}function Se(u,e,t,r){return ye.copyFileSync(e,t),r.preserveTimestamps&&function(u,e,t){(function(u){return 0==(128&u)})(u)&&function(u,e){_e(u,128|e)}(t,u);(function(u,e){const t=ye.statSync(u);me(e,t.atime,t.mtime)})(e,t)}(u.mode,e,t),_e(t,u.mode)}function _e(u,e){return ye.chmodSync(u,e)}function Oe(u,e,t){ye.readdirSync(u).forEach((r=>function(u,e,t,r){const n=pe.join(e,u),i=pe.join(t,u),{destStat:o}=Be.checkPathsSync(n,i,"copy",r);return function(u,e,t,r){if(!r.filter||r.filter(e,t))return ve(u,e,t,r)}(o,n,i,r)}(r,u,e,t)))}var we=function(u,e,t){"function"==typeof t&&(t={filter:t}),(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:r,destStat:n}=Be.checkPathsSync(u,e,"copy",t);return Be.checkParentPathsSync(u,r,e,"copy"),function(u,e,t,r){if(r.filter&&!r.filter(e,t))return;const n=pe.dirname(t);ye.existsSync(n)||he(n);return ve(u,e,t,r)}(n,u,e,t)};var Pe={copy:(0,iu.fromCallback)(de),copySync:we};const be=wu,ge=f.default,Ne=y.default,Re="win32"===process.platform;function Ie(u){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((e=>{u[e]=u[e]||be[e],u[e+="Sync"]=u[e]||be[e]})),u.maxBusyTries=u.maxBusyTries||3}function ke(u,e,t){let r=0;"function"==typeof e&&(t=e,e={}),Ne(u,"rimraf: missing path"),Ne.strictEqual(typeof u,"string","rimraf: path should be a string"),Ne.strictEqual(typeof t,"function","rimraf: callback function required"),Ne(e,"rimraf: invalid options argument provided"),Ne.strictEqual(typeof e,"object","rimraf: options should be object"),Ie(e),Te(u,e,(function n(i){if(i){if(("EBUSY"===i.code||"ENOTEMPTY"===i.code||"EPERM"===i.code)&&rTe(u,e,n)),100*r)}"ENOENT"===i.code&&(i=null)}t(i)}))}function Te(u,e,t){Ne(u),Ne(e),Ne("function"==typeof t),e.lstat(u,((r,n)=>r&&"ENOENT"===r.code?t(null):r&&"EPERM"===r.code&&Re?xe(u,e,r,t):n&&n.isDirectory()?He(u,e,r,t):void e.unlink(u,(r=>{if(r){if("ENOENT"===r.code)return t(null);if("EPERM"===r.code)return Re?xe(u,e,r,t):He(u,e,r,t);if("EISDIR"===r.code)return He(u,e,r,t)}return t(r)}))))}function xe(u,e,t,r){Ne(u),Ne(e),Ne("function"==typeof r),e.chmod(u,438,(n=>{n?r("ENOENT"===n.code?null:t):e.stat(u,((n,i)=>{n?r("ENOENT"===n.code?null:t):i.isDirectory()?He(u,e,t,r):e.unlink(u,r)}))}))}function Me(u,e,t){let r;Ne(u),Ne(e);try{e.chmodSync(u,438)}catch(u){if("ENOENT"===u.code)return;throw t}try{r=e.statSync(u)}catch(u){if("ENOENT"===u.code)return;throw t}r.isDirectory()?Je(u,e,t):e.unlinkSync(u)}function He(u,e,t,r){Ne(u),Ne(e),Ne("function"==typeof r),e.rmdir(u,(n=>{!n||"ENOTEMPTY"!==n.code&&"EEXIST"!==n.code&&"EPERM"!==n.code?n&&"ENOTDIR"===n.code?r(t):r(n):function(u,e,t){Ne(u),Ne(e),Ne("function"==typeof t),e.readdir(u,((r,n)=>{if(r)return t(r);let i,o=n.length;if(0===o)return e.rmdir(u,t);n.forEach((r=>{ke(ge.join(u,r),e,(r=>{if(!i)return r?t(i=r):void(0==--o&&e.rmdir(u,t))}))}))}))}(u,e,r)}))}function je(u,e){let t;Ie(e=e||{}),Ne(u,"rimraf: missing path"),Ne.strictEqual(typeof u,"string","rimraf: path should be a string"),Ne(e,"rimraf: missing options"),Ne.strictEqual(typeof e,"object","rimraf: options should be object");try{t=e.lstatSync(u)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&Re&&Me(u,e,t)}try{t&&t.isDirectory()?Je(u,e,null):e.unlinkSync(u)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return Re?Me(u,e,t):Je(u,e,t);if("EISDIR"!==t.code)throw t;Je(u,e,t)}}function Je(u,e,t){Ne(u),Ne(e);try{e.rmdirSync(u)}catch(r){if("ENOTDIR"===r.code)throw t;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(u,e){if(Ne(u),Ne(e),e.readdirSync(u).forEach((t=>je(ge.join(u,t),e))),!Re){return e.rmdirSync(u,e)}{const t=Date.now();do{try{return e.rmdirSync(u,e)}catch{}}while(Date.now()-t<500)}}(u,e);else if("ENOENT"!==r.code)throw r}}var Le=ke;ke.sync=je;const Ge=wu,Ve=iu.fromCallback,$e=Le;var Ue={remove:Ve((function(u,e){if(Ge.rm)return Ge.rm(u,{recursive:!0,force:!0},e);$e(u,e)})),removeSync:function(u){if(Ge.rmSync)return Ge.rmSync(u,{recursive:!0,force:!0});$e.sync(u)}};const We=iu.fromPromise,qe=nu,Ke=f.default,Ye=Gu,ze=Ue,Ze=We((async function(u){let e;try{e=await qe.readdir(u)}catch{return Ye.mkdirs(u)}return Promise.all(e.map((e=>ze.remove(Ke.join(u,e)))))}));function Xe(u){let e;try{e=qe.readdirSync(u)}catch{return Ye.mkdirsSync(u)}e.forEach((e=>{e=Ke.join(u,e),ze.removeSync(e)}))}var Qe={emptyDirSync:Xe,emptydirSync:Xe,emptyDir:Ze,emptydir:Ze};const ut=iu.fromCallback,et=f.default,tt=wu,rt=Gu;var nt={createFile:ut((function(u,e){function t(){tt.writeFile(u,"",(u=>{if(u)return e(u);e()}))}tt.stat(u,((r,n)=>{if(!r&&n.isFile())return e();const i=et.dirname(u);tt.stat(i,((u,r)=>{if(u)return"ENOENT"===u.code?rt.mkdirs(i,(u=>{if(u)return e(u);t()})):e(u);r.isDirectory()?t():tt.readdir(i,(u=>{if(u)return e(u)}))}))}))})),createFileSync:function(u){let e;try{e=tt.statSync(u)}catch{}if(e&&e.isFile())return;const t=et.dirname(u);try{tt.statSync(t).isDirectory()||tt.readdirSync(t)}catch(u){if(!u||"ENOENT"!==u.code)throw u;rt.mkdirsSync(t)}tt.writeFileSync(u,"")}};const it=iu.fromCallback,ot=f.default,Dt=wu,ct=Gu,at=Uu.pathExists,{areIdentical:st}=te;var ft={createLink:it((function(u,e,t){function r(u,e){Dt.link(u,e,(u=>{if(u)return t(u);t(null)}))}Dt.lstat(e,((n,i)=>{Dt.lstat(u,((n,o)=>{if(n)return n.message=n.message.replace("lstat","ensureLink"),t(n);if(i&&st(o,i))return t(null);const D=ot.dirname(e);at(D,((n,i)=>n?t(n):i?r(u,e):void ct.mkdirs(D,(n=>{if(n)return t(n);r(u,e)}))))}))}))})),createLinkSync:function(u,e){let t;try{t=Dt.lstatSync(e)}catch{}try{const e=Dt.lstatSync(u);if(t&&st(e,t))return}catch(u){throw u.message=u.message.replace("lstat","ensureLink"),u}const r=ot.dirname(e);return Dt.existsSync(r)||ct.mkdirsSync(r),Dt.linkSync(u,e)}};const Et=f.default,lt=wu,Ft=Uu.pathExists;var Ct={symlinkPaths:function(u,e,t){if(Et.isAbsolute(u))return lt.lstat(u,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),t(e)):t(null,{toCwd:u,toDst:u})));{const r=Et.dirname(e),n=Et.join(r,u);return Ft(n,((e,i)=>e?t(e):i?t(null,{toCwd:n,toDst:u}):lt.lstat(u,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),t(e)):t(null,{toCwd:u,toDst:Et.relative(r,u)})))))}},symlinkPathsSync:function(u,e){let t;if(Et.isAbsolute(u)){if(t=lt.existsSync(u),!t)throw new Error("absolute srcpath does not exist");return{toCwd:u,toDst:u}}{const r=Et.dirname(e),n=Et.join(r,u);if(t=lt.existsSync(n),t)return{toCwd:n,toDst:u};if(t=lt.existsSync(u),!t)throw new Error("relative srcpath does not exist");return{toCwd:u,toDst:Et.relative(r,u)}}}};const At=wu;var dt={symlinkType:function(u,e,t){if(t="function"==typeof e?e:t,e="function"!=typeof e&&e)return t(null,e);At.lstat(u,((u,r)=>{if(u)return t(null,"file");e=r&&r.isDirectory()?"dir":"file",t(null,e)}))},symlinkTypeSync:function(u,e){let t;if(e)return e;try{t=At.lstatSync(u)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}};const yt=iu.fromCallback,pt=f.default,ht=nu,mt=Gu.mkdirs,Bt=Gu.mkdirsSync,vt=Ct.symlinkPaths,St=Ct.symlinkPathsSync,_t=dt.symlinkType,Ot=dt.symlinkTypeSync,wt=Uu.pathExists,{areIdentical:Pt}=te;function bt(u,e,t,r){vt(u,e,((n,i)=>{if(n)return r(n);u=i.toDst,_t(i.toCwd,t,((t,n)=>{if(t)return r(t);const i=pt.dirname(e);wt(i,((t,o)=>t?r(t):o?ht.symlink(u,e,n,r):void mt(i,(t=>{if(t)return r(t);ht.symlink(u,e,n,r)}))))}))}))}var gt={createSymlink:yt((function(u,e,t,r){r="function"==typeof t?t:r,t="function"!=typeof t&&t,ht.lstat(e,((n,i)=>{!n&&i.isSymbolicLink()?Promise.all([ht.stat(u),ht.stat(e)]).then((([n,i])=>{if(Pt(n,i))return r(null);bt(u,e,t,r)})):bt(u,e,t,r)}))})),createSymlinkSync:function(u,e,t){let r;try{r=ht.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){const t=ht.statSync(u),r=ht.statSync(e);if(Pt(t,r))return}const n=St(u,e);u=n.toDst,t=Ot(n.toCwd,t);const i=pt.dirname(e);return ht.existsSync(i)||Bt(i),ht.symlinkSync(u,e,t)}};const{createFile:Nt,createFileSync:Rt}=nt,{createLink:It,createLinkSync:kt}=ft,{createSymlink:Tt,createSymlinkSync:xt}=gt;var Mt={createFile:Nt,createFileSync:Rt,ensureFile:Nt,ensureFileSync:Rt,createLink:It,createLinkSync:kt,ensureLink:It,ensureLinkSync:kt,createSymlink:Tt,createSymlinkSync:xt,ensureSymlink:Tt,ensureSymlinkSync:xt};var Ht={stringify:function(u,{EOL:e="\n",finalEOL:t=!0,replacer:r=null,spaces:n}={}){const i=t?e:"";return JSON.stringify(u,r,n).replace(/\n/g,e)+i},stripBom:function(u){return Buffer.isBuffer(u)&&(u=u.toString("utf8")),u.replace(/^\uFEFF/,"")}};let jt;try{jt=wu}catch(u){jt=s.default}const Jt=iu,{stringify:Lt,stripBom:Gt}=Ht;const Vt=Jt.fromPromise((async function(u,e={}){"string"==typeof e&&(e={encoding:e});const t=e.fs||jt,r=!("throws"in e)||e.throws;let n,i=await Jt.fromCallback(t.readFile)(u,e);i=Gt(i);try{n=JSON.parse(i,e?e.reviver:null)}catch(e){if(r)throw e.message=`${u}: ${e.message}`,e;return null}return n}));const $t=Jt.fromPromise((async function(u,e,t={}){const r=t.fs||jt,n=Lt(e,t);await Jt.fromCallback(r.writeFile)(u,n,t)}));const Ut={readFile:Vt,readFileSync:function(u,e={}){"string"==typeof e&&(e={encoding:e});const t=e.fs||jt,r=!("throws"in e)||e.throws;try{let r=t.readFileSync(u,e);return r=Gt(r),JSON.parse(r,e.reviver)}catch(e){if(r)throw e.message=`${u}: ${e.message}`,e;return null}},writeFile:$t,writeFileSync:function(u,e,t={}){const r=t.fs||jt,n=Lt(e,t);return r.writeFileSync(u,n,t)}};var Wt={readJson:Ut.readFile,readJsonSync:Ut.readFileSync,writeJson:Ut.writeFile,writeJsonSync:Ut.writeFileSync};const qt=iu.fromCallback,Kt=wu,Yt=f.default,zt=Gu,Zt=Uu.pathExists;var Xt={outputFile:qt((function(u,e,t,r){"function"==typeof t&&(r=t,t="utf8");const n=Yt.dirname(u);Zt(n,((i,o)=>i?r(i):o?Kt.writeFile(u,e,t,r):void zt.mkdirs(n,(n=>{if(n)return r(n);Kt.writeFile(u,e,t,r)}))))})),outputFileSync:function(u,...e){const t=Yt.dirname(u);if(Kt.existsSync(t))return Kt.writeFileSync(u,...e);zt.mkdirsSync(t),Kt.writeFileSync(u,...e)}};const{stringify:Qt}=Ht,{outputFile:ur}=Xt;var er=async function(u,e,t={}){const r=Qt(e,t);await ur(u,r,t)};const{stringify:tr}=Ht,{outputFileSync:rr}=Xt;var nr=function(u,e,t){const r=tr(e,t);rr(u,r,t)};const ir=iu.fromPromise,or=Wt;or.outputJson=ir(er),or.outputJsonSync=nr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var Dr=or;const cr=wu,ar=f.default,sr=Pe.copy,fr=Ue.remove,Er=Gu.mkdirp,lr=Uu.pathExists,Fr=te;function Cr(u,e,t,r,n){return r?Ar(u,e,t,n):t?fr(e,(r=>r?n(r):Ar(u,e,t,n))):void lr(e,((r,i)=>r?n(r):i?n(new Error("dest already exists.")):Ar(u,e,t,n)))}function Ar(u,e,t,r){cr.rename(u,e,(n=>n?"EXDEV"!==n.code?r(n):function(u,e,t,r){const n={overwrite:t,errorOnExist:!0};sr(u,e,n,(e=>e?r(e):fr(u,r)))}(u,e,t,r):r()))}var dr=function(u,e,t,r){"function"==typeof t&&(r=t,t={});const n=(t=t||{}).overwrite||t.clobber||!1;Fr.checkPaths(u,e,"move",t,((t,i)=>{if(t)return r(t);const{srcStat:o,isChangingCase:D=!1}=i;Fr.checkParentPaths(u,o,e,"move",(t=>t?r(t):function(u){const e=ar.dirname(u);return ar.parse(e).root===e}(e)?Cr(u,e,n,D,r):void Er(ar.dirname(e),(t=>t?r(t):Cr(u,e,n,D,r)))))}))};const yr=wu,pr=f.default,hr=Pe.copySync,mr=Ue.removeSync,Br=Gu.mkdirpSync,vr=te;function Sr(u,e,t){try{yr.renameSync(u,e)}catch(r){if("EXDEV"!==r.code)throw r;return function(u,e,t){const r={overwrite:t,errorOnExist:!0};return hr(u,e,r),mr(u)}(u,e,t)}}var _r=function(u,e,t){const r=(t=t||{}).overwrite||t.clobber||!1,{srcStat:n,isChangingCase:i=!1}=vr.checkPathsSync(u,e,"move",t);return vr.checkParentPathsSync(u,n,e,"move"),function(u){const e=pr.dirname(u);return pr.parse(e).root===e}(e)||Br(pr.dirname(e)),function(u,e,t,r){if(r)return Sr(u,e,t);if(t)return mr(e),Sr(u,e,t);if(yr.existsSync(e))throw new Error("dest already exists.");return Sr(u,e,t)}(u,e,r,i)};var Or={move:(0,iu.fromCallback)(dr),moveSync:_r},wr={...nu,...Pe,...Qe,...Mt,...Dr,...Gu,...Or,...Xt,...Uu,...Ue},Pr=p&&p.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Q,"__esModule",{value:!0}),Q.parseJsonText=Q.parseJsonFile=void 0;const br=uu,gr=Pr(wr),Nr=Pr(f.default),Rr=Pr(E.default),Ir=k;var kr;!function(u){u[u.Char=0]="Char",u[u.EOF=1]="EOF",u[u.Identifier=2]="Identifier"}(kr||(kr={}));let Tr,xr,Mr,Hr,jr,Jr,Lr="start",Gr=[],Vr=0,$r=1,Ur=0,Wr=!1,qr="default",Kr="'",Yr=1;function zr(u,e=!1){xr=String(u),Lr="start",Gr=[],Vr=0,$r=1,Ur=0,Hr=void 0,Wr=e;do{Tr=Zr(),nn[Lr]()}while("eof"!==Tr.type);return Hr}function Zr(){for(qr="default",jr="",Kr="'",Yr=1;;){Jr=Xr();const u=un[qr]();if(u)return u}}function Xr(){if(xr[Vr])return String.fromCodePoint(xr.codePointAt(Vr))}function Qr(){const u=Xr();return"\n"===u?($r++,Ur=0):u?Ur+=u.length:Ur++,u&&(Vr+=u.length),u}Q.parseJsonFile=function(u,e=!1,t="utf-8"){const r=gr.default.readFileSync(Nr.default.resolve(u),{encoding:t});try{return zr(r,e)}catch(e){if(e instanceof SyntaxError){const t=e.message.split("at");2===t.length&&(0,Ir.logErrorAndExit)(`${t[0].trim()}${Rr.default.EOL}\t at ${u}:${t[1].trim()}`)}(0,Ir.logErrorAndExit)(`${u} is not in valid JSON/JSON5 format.`)}},Q.parseJsonText=zr;const un={default(){switch(Jr){case"/":return Qr(),void(qr="comment");case void 0:return Qr(),en("eof")}if(!br.JudgeUtil.isIgnoreChar(Jr)&&!br.JudgeUtil.isSpaceSeparator(Jr))return un[Lr]();Qr()},start(){qr="value"},beforePropertyName(){switch(Jr){case"$":case"_":return jr=Qr(),void(qr="identifierName");case"\\":return Qr(),void(qr="identifierNameStartEscape");case"}":return en("punctuator",Qr());case'"':case"'":return Kr=Jr,Qr(),void(qr="string")}if(br.JudgeUtil.isIdStartChar(Jr))return jr+=Qr(),void(qr="identifierName");throw an(kr.Char,Qr())},afterPropertyName(){if(":"===Jr)return en("punctuator",Qr());throw an(kr.Char,Qr())},beforePropertyValue(){qr="value"},afterPropertyValue(){switch(Jr){case",":case"}":return en("punctuator",Qr())}throw an(kr.Char,Qr())},beforeArrayValue(){if("]"===Jr)return en("punctuator",Qr());qr="value"},afterArrayValue(){switch(Jr){case",":case"]":return en("punctuator",Qr())}throw an(kr.Char,Qr())},end(){throw an(kr.Char,Qr())},comment(){switch(Jr){case"*":return Qr(),void(qr="multiLineComment");case"/":return Qr(),void(qr="singleLineComment")}throw an(kr.Char,Qr())},multiLineComment(){switch(Jr){case"*":return Qr(),void(qr="multiLineCommentAsterisk");case void 0:throw an(kr.Char,Qr())}Qr()},multiLineCommentAsterisk(){switch(Jr){case"*":return void Qr();case"/":return Qr(),void(qr="default");case void 0:throw an(kr.Char,Qr())}Qr(),qr="multiLineComment"},singleLineComment(){switch(Jr){case"\n":case"\r":case"\u2028":case"\u2029":return Qr(),void(qr="default");case void 0:return Qr(),en("eof")}Qr()},value(){switch(Jr){case"{":case"[":return en("punctuator",Qr());case"n":return Qr(),tn("ull"),en("null",null);case"t":return Qr(),tn("rue"),en("boolean",!0);case"f":return Qr(),tn("alse"),en("boolean",!1);case"-":case"+":return"-"===Qr()&&(Yr=-1),void(qr="numerical");case".":case"0":case"I":case"N":return void(qr="numerical");case'"':case"'":return Kr=Jr,Qr(),jr="",void(qr="string")}if(void 0===Jr||!br.JudgeUtil.isDigitWithoutZero(Jr))throw an(kr.Char,Qr());qr="numerical"},numerical(){switch(Jr){case".":return jr=Qr(),void(qr="decimalPointLeading");case"0":return jr=Qr(),void(qr="zero");case"I":return Qr(),tn("nfinity"),en("numeric",Yr*(1/0));case"N":return Qr(),tn("aN"),en("numeric",NaN)}if(void 0!==Jr&&br.JudgeUtil.isDigitWithoutZero(Jr))return jr=Qr(),void(qr="decimalInteger");throw an(kr.Char,Qr())},zero(){switch(Jr){case".":case"e":case"E":return void(qr="decimal");case"x":case"X":return jr+=Qr(),void(qr="hexadecimal")}return en("numeric",0)},decimalInteger(){switch(Jr){case".":case"e":case"E":return void(qr="decimal")}if(!br.JudgeUtil.isDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},decimal(){switch(Jr){case".":jr+=Qr(),qr="decimalFraction";break;case"e":case"E":jr+=Qr(),qr="decimalExponent"}},decimalPointLeading(){if(br.JudgeUtil.isDigit(Jr))return jr+=Qr(),void(qr="decimalFraction");throw an(kr.Char,Qr())},decimalFraction(){switch(Jr){case"e":case"E":return jr+=Qr(),void(qr="decimalExponent")}if(!br.JudgeUtil.isDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},decimalExponent(){switch(Jr){case"+":case"-":return jr+=Qr(),void(qr="decimalExponentSign")}if(br.JudgeUtil.isDigit(Jr))return jr+=Qr(),void(qr="decimalExponentInteger");throw an(kr.Char,Qr())},decimalExponentSign(){if(br.JudgeUtil.isDigit(Jr))return jr+=Qr(),void(qr="decimalExponentInteger");throw an(kr.Char,Qr())},decimalExponentInteger(){if(!br.JudgeUtil.isDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},hexadecimal(){if(br.JudgeUtil.isHexDigit(Jr))return jr+=Qr(),void(qr="hexadecimalInteger");throw an(kr.Char,Qr())},hexadecimalInteger(){if(!br.JudgeUtil.isHexDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},identifierNameStartEscape(){if("u"!==Jr)throw an(kr.Char,Qr());Qr();const u=rn();switch(u){case"$":case"_":break;default:if(!br.JudgeUtil.isIdStartChar(u))throw an(kr.Identifier)}jr+=u,qr="identifierName"},identifierName(){switch(Jr){case"$":case"_":case"‌":case"‍":return void(jr+=Qr());case"\\":return Qr(),void(qr="identifierNameEscape")}if(!br.JudgeUtil.isIdContinueChar(Jr))return en("identifier",jr);jr+=Qr()},identifierNameEscape(){if("u"!==Jr)throw an(kr.Char,Qr());Qr();const u=rn();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!br.JudgeUtil.isIdContinueChar(u))throw an(kr.Identifier)}jr+=u,qr="identifierName"},string(){switch(Jr){case"\\":return Qr(),void(jr+=function(){const u=Xr(),e=function(){switch(Xr()){case"b":return Qr(),"\b";case"f":return Qr(),"\f";case"n":return Qr(),"\n";case"r":return Qr(),"\r";case"t":return Qr(),"\t";case"v":return Qr(),"\v"}return}();if(e)return e;switch(u){case"0":if(Qr(),br.JudgeUtil.isDigit(Xr()))throw an(kr.Char,Qr());return"\0";case"x":return Qr(),function(){let u="",e=Xr();if(!br.JudgeUtil.isHexDigit(e))throw an(kr.Char,Qr());if(u+=Qr(),e=Xr(),!br.JudgeUtil.isHexDigit(e))throw an(kr.Char,Qr());return u+=Qr(),String.fromCodePoint(parseInt(u,16))}();case"u":return Qr(),rn();case"\n":case"\u2028":case"\u2029":return Qr(),"";case"\r":return Qr(),"\n"===Xr()&&Qr(),""}if(void 0===u||br.JudgeUtil.isDigitWithoutZero(u))throw an(kr.Char,Qr());return Qr()}());case'"':case"'":if(Jr===Kr){const u=en("string",jr);return Qr(),u}return void(jr+=Qr());case"\n":case"\r":case void 0:throw an(kr.Char,Qr());case"\u2028":case"\u2029":!function(u){(0,Ir.logErrorAndExit)(`JSON5: '${cn(u)}' in strings is not valid ECMAScript; consider escaping.`)}(Jr)}jr+=Qr()}};function en(u,e){return{type:u,value:e,line:$r,column:Ur}}function tn(u){for(const e of u){if(Xr()!==e)throw an(kr.Char,Qr());Qr()}}function rn(){let u="",e=4;for(;e-- >0;){const e=Xr();if(!br.JudgeUtil.isHexDigit(e))throw an(kr.Char,Qr());u+=Qr()}return String.fromCodePoint(parseInt(u,16))}const nn={start(){if("eof"===Tr.type)throw an(kr.EOF);on()},beforePropertyName(){switch(Tr.type){case"identifier":case"string":return Mr=Tr.value,void(Lr="afterPropertyName");case"punctuator":return void Dn();case"eof":throw an(kr.EOF)}},afterPropertyName(){if("eof"===Tr.type)throw an(kr.EOF);Lr="beforePropertyValue"},beforePropertyValue(){if("eof"===Tr.type)throw an(kr.EOF);on()},afterPropertyValue(){if("eof"===Tr.type)throw an(kr.EOF);switch(Tr.value){case",":return void(Lr="beforePropertyName");case"}":Dn()}},beforeArrayValue(){if("eof"===Tr.type)throw an(kr.EOF);"punctuator"!==Tr.type||"]"!==Tr.value?on():Dn()},afterArrayValue(){if("eof"===Tr.type)throw an(kr.EOF);switch(Tr.value){case",":return void(Lr="beforeArrayValue");case"]":Dn()}},end(){}};function on(){const u=function(){let u;switch(Tr.type){case"punctuator":switch(Tr.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=Tr.value}return u}();if(Wr&&"object"==typeof u&&(u._line=$r,u._column=Ur),void 0===Hr)Hr=u;else{const e=Gr[Gr.length-1];Array.isArray(e)?Wr&&"object"!=typeof u?e.push({value:u,_line:$r,_column:Ur}):e.push(u):e[Mr]=Wr&&"object"!=typeof u?{value:u,_line:$r,_column:Ur}:u}!function(u){if(u&&"object"==typeof u)Gr.push(u),Lr=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{const u=Gr[Gr.length-1];Lr=u?Array.isArray(u)?"afterArrayValue":"afterPropertyValue":"end"}}(u)}function Dn(){Gr.pop();const u=Gr[Gr.length-1];Lr=u?Array.isArray(u)?"afterArrayValue":"afterPropertyValue":"end"}function cn(u){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[u])return e[u];if(u<" "){const e=u.charCodeAt(0).toString(16);return`\\x${`00${e}`.substring(e.length)}`}return u}function an(u,e){let t="";switch(u){case kr.Char:t=void 0===e?`JSON5: invalid end of input at ${$r}:${Ur}`:`JSON5: invalid character '${cn(e)}' at ${$r}:${Ur}`;break;case kr.EOF:t=`JSON5: invalid end of input at ${$r}:${Ur}`;break;case kr.Identifier:Ur-=5,t=`JSON5: invalid identifier character at ${$r}:${Ur}`}const r=new sn(t);return r.lineNumber=$r,r.columnNumber=Ur,r}class sn extends SyntaxError{}var fn=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),En=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),ln=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&fn(e,u,t);return En(e,u),e};Object.defineProperty(X,"__esModule",{value:!0});var Fn=X.executeInstallHvigor=vn=X.isHvigorInstalled=void 0;const Cn=ln(s.default),An=ln(f.default),dn=m,yn=I,pn=k,hn=Q;let mn,Bn;var vn=X.isHvigorInstalled=function(){return mn=function(){const u=An.resolve(dn.HVIGOR_PROJECT_WRAPPER_HOME,dn.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(!Cn.existsSync(u))throw new Error(`Error: Hvigor config file ${u} does not exist.`);return(0,hn.parseJsonFile)(u)}(),Bn=Cn.existsSync(dn.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,hn.parseJsonFile)(dn.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}},!(!(0,yn.hasNpmPackInPaths)(dn.HVIGOR_ENGINE_PACKAGE_NAME,[dn.HVIGOR_PROJECT_DEPENDENCIES_HOME])||mn.hvigorVersion!==Bn.dependencies[dn.HVIGOR_ENGINE_PACKAGE_NAME])||(console.log("Hvigor installing..."),!1)};const Sn={cwd:dn.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};Fn=X.executeInstallHvigor=function(){const u={dependencies:{}};u.dependencies[dn.HVIGOR_ENGINE_PACKAGE_NAME]=mn.hvigorVersion;try{Cn.mkdirSync(dn.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const e=An.resolve(dn.HVIGOR_PROJECT_DEPENDENCIES_HOME,dn.DEFAULT_PACKAGE_JSON);Cn.writeFileSync(e,JSON.stringify(u))}catch(u){(0,pn.logErrorAndExit)(u)}!function(){const u=["config","set","store-dir",dn.HVIGOR_PNPM_STORE_PATH];(0,yn.executeCommand)(dn.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,u,Sn)}(),(0,yn.executeCommand)(dn.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Sn)};var _n={},On=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),wn=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),Pn=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&On(e,u,t);return wn(e,u),e};Object.defineProperty(_n,"__esModule",{value:!0});var bn=_n.executeBuild=void 0;const gn=m,Nn=Pn(s.default),Rn=Pn(f.default),In=k;bn=_n.executeBuild=function(){const u=Rn.resolve(gn.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=Nn.realpathSync(u);require(e)}catch(e){(0,In.logErrorAndExit)(`Error: ENOENT: no such file ${u},delete ${gn.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},Z()||U(),vn()||Fn(),bn(); \ No newline at end of file diff --git a/HarmonyOS_NEXT/Recorder/hvigorfile.ts b/HarmonyOS_NEXT/Recorder/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/HarmonyOS_NEXT/Recorder/oh-package.json5 b/HarmonyOS_NEXT/Recorder/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..25e8fee51c890feb6bb8bf0f0df2bf6b40ca33c4 --- /dev/null +++ b/HarmonyOS_NEXT/Recorder/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "name": "recorder", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.13" + } +} diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets index f76dad0c12b6fc52710d0874c94322bc16c78177..e9557b8d5c8fb6986c1e11e975987d9871927a15 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets @@ -16,7 +16,7 @@ /** * route for second page */ -export const SECOND_PAGE: string = 'pages/SimpleVideoPlay'; +export const SECOND_PAGE: string = 'pages/VideoPlayerPage'; /** * route param @@ -108,7 +108,8 @@ export const enum STRING_PERCENT { INDEX_SWIPER_HEIGHT_PERCENT = '24.1%', INDEX_MODULE_HEIGHT_PERCENT = '22.8%', INDEX_SWIPER_LEFT_RIGHT_MARGIN = '3.3%' -}; +} +; /** * margin or font size @@ -121,7 +122,8 @@ export const enum MARGIN_FONT_SIZE { FIFTH_MARGIN = 50, SIXTH_MARGIN = 94, SEVENTH_MARGIN = 132 -}; +} +; /** * video resource type @@ -129,7 +131,8 @@ export const enum MARGIN_FONT_SIZE { export const enum VIDEO_TYPE { INNER = 'inner', NET = 'net' -}; +} +; /** * Attribute Styles in a Stack Layout diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/entryability/EntryAbility.ts b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/entryability/EntryAbility.ts index e4ecf2507fa184a69eb6c62c9e0ffa7405910b22..e729ec0f2ffd4b17cfef623d0ee979ce77a35c5c 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/entryability/EntryAbility.ts +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/entryability/EntryAbility.ts @@ -20,7 +20,7 @@ export default class EntryAbility extends Ability { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - windowStage.loadContent('pages/SimpleVideoIndex', (err, data) => { + windowStage.loadContent('pages/VideoListPage', (err, data) => { if (err.code) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/model/VideoControll.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/model/VideoControll.ets index 62f6720b6d3b2db9a40d4c526bd2a63819000fe7..143a6ccbe68ce9638dee4af58b09ec0442898361 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/model/VideoControll.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/model/VideoControll.ets @@ -13,51 +13,57 @@ * limitations under the License. */ -import { COMMON_NUM_MINUTE, COMMON_NUM_DOUBLE, ZERO_STR, SPLIT, STACK_STYLE } from '../common/constants/CommonConstants'; -import { ViewPlayerController } from '../controller/ViewPlayerController'; +import { + COMMON_NUM_MINUTE, + COMMON_NUM_DOUBLE, + ZERO_STR, + SPLIT, + STACK_STYLE +} from '../common/constants/CommonConstants'; +import { VideoPlayerModel } from './VideoPlayerModel'; import { DurationObject } from '../view/VideoPlayer'; /** * video component prepared callback */ -export function prepared(that :ViewPlayerController, event : DurationObject) { - that.durationTime = event.duration; +export function prepared(model: VideoPlayerModel, event: DurationObject) { + model.durationTime = event.duration; let second: number = event.duration % COMMON_NUM_MINUTE; let min: number = Number.parseInt((event.duration / COMMON_NUM_MINUTE).toString()); let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min; let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : second; - that.durationStringTime = `${head}${SPLIT}${end}`; - that.flag = true; -}; + model.durationStringTime = `${head}${SPLIT}${end}`; + model.flag = true; +} /** * video component finish callback */ -export function finish(that : ViewPlayerController) { - that.isPlay = false; - that.isOpacity = false; -}; +export function finish(model: VideoPlayerModel) { + model.isPlay = false; + model.isOpacity = false; +} /** * video slider component onchange callback */ -export function sliderOnchange(that :ViewPlayerController, value: number, mode: SliderChangeMode) { - that.currentTime = Number.parseInt(value.toString()); - that.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); +export function sliderOnchange(model: VideoPlayerModel, value: number, mode: SliderChangeMode) { + model.currentTime = Number.parseInt(value.toString()); + model.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); if (mode === SliderChangeMode.Begin) { - that.isOpacity = false; + model.isOpacity = false; } if (mode === SliderChangeMode.Moving) { - that.isOpacity = false; + model.isOpacity = false; } if (mode === SliderChangeMode.End) { - that.isOpacity = true; + model.isOpacity = true; } -}; +} /** * get video string of current time - * @param the number of current time + * @param the number of current time * @return the string of current time */ export function changeSliderTime(value: number): string { @@ -67,42 +73,42 @@ export function changeSliderTime(value: number): string { let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : second; let nowTime = `${head}${SPLIT}${end}`; return nowTime; -}; +} /** * icon onclick callback */ -export function iconOnclick(that :ViewPlayerController) { - if (that.isPlay === true) { - that.controller.pause() - that.isPlay = false; - that.isOpacity = false; +export function iconOnclick(model: VideoPlayerModel) { + if (model.isPlay === true) { + model.controller.pause() + model.isPlay = false; + model.isOpacity = false; return; } - if(that.flag === true) { - that.controller.start(); - that.isPlay = true; - that.isOpacity = true; + if (model.flag === true) { + model.controller.start(); + model.isPlay = true; + model.isOpacity = true; } else { - that.isLoading = true; + model.isLoading = true; // The video loading is not complete. The loading action is displayed. let intervalLoading = setInterval(() => { - if (that.progressVal >= STACK_STYLE.PROGRESS_TOTAL) { - that.progressVal = 0; + if (model.progressVal >= STACK_STYLE.PROGRESS_TOTAL) { + model.progressVal = 0; } else { - that.progressVal += STACK_STYLE.PROGRESS_STEP; + model.progressVal += STACK_STYLE.PROGRESS_STEP; } }, STACK_STYLE.MILLI_SECONDS) // The scheduled task determines whether the video loading is complete. let intervalFlag = setInterval(() => { - if (that.flag === true) { - that.controller.start(); - that.isPlay = true; - that.isOpacity = true; - that.isLoading = false; + if (model.flag === true) { + model.controller.start(); + model.isPlay = true; + model.isOpacity = true; + model.isLoading = false; clearInterval(intervalFlag); clearInterval(intervalLoading); } }, STACK_STYLE.MILLI_SECONDS); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/model/VideoPlayerModel.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/model/VideoPlayerModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fe562fbdad96181a408022528d5814775315863 --- /dev/null +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/model/VideoPlayerModel.ets @@ -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 { START_TIME } from '../common/constants/CommonConstants'; + +export class VideoPlayerModel { + public currentTime: number = 0; + public durationTime: number = 0; + public isPlay: boolean = false; + public isOpacity: boolean = false; + public durationStringTime: string = START_TIME; + public currentStringTime: string = START_TIME; + public flag: boolean = false; + public isLoading: boolean = false; + public progressVal: number = 0; + public controller: VideoController = new VideoController(); +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/pages/VideoListPage.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/pages/VideoListPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ff6f5a1c7dda5e14d20d654563f2aa39f805bf0 --- /dev/null +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/pages/VideoListPage.ets @@ -0,0 +1,46 @@ +/* + * 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 { VideoModule } from '../view/IndexModule'; +import { SwiperVideo } from '../view/IndexSwiper'; +import { LIST, MARGIN_FONT_SIZE, ALL_PERCENT } from '../common/constants/CommonConstants'; + +/** + * The start index of the application + */ +@Entry +@Component +struct VideoListPage { + build() { + Column({ space: MARGIN_FONT_SIZE.FOURTH_MARGIN }) { + SwiperVideo() + List() { + ForEach(LIST, (item: string) => { + ListItem() { + VideoModule({ moduleName: item }) + .margin({ top: MARGIN_FONT_SIZE.FIRST_MARGIN }) + } + }, (item: string) => JSON.stringify(item)) + } + .listDirection(Axis.Vertical) + .margin({ top: MARGIN_FONT_SIZE.THIRD_MARGIN }) + } + .width(ALL_PERCENT) + .height(ALL_PERCENT) + .backgroundColor($r("app.color.index_backgroundColor")) + } +} + diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/pages/VideoPlayerPage.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/pages/VideoPlayerPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..2de0531167e0ce68df6f65c1a4f03f64acc79dfb --- /dev/null +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/pages/VideoPlayerPage.ets @@ -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 router from '@ohos.router'; +import { VideoPlayer } from '../view/VideoPlayer'; +import { + MARGIN_FONT_SIZE, + COMMON_NUM_FONT_WEIGHT, + ALL_PERCENT, + STACK_STYLE +} from '../common/constants/CommonConstants'; +import { VideoPlayerModel } from '../model/VideoPlayerModel'; + +/** + * second page + */ +@Entry +@Component +struct VideoPlayerPage { + private source: string = (router.getParams() as Record).source as string; + private startIconResource: Resource = $r('app.media.ic_public_play'); + private backIconResource: Resource = $r('app.media.ic_back'); + @Provide videoPlayerModel: VideoPlayerModel = new VideoPlayerModel(); + + aboutToAppear() { + this.source; + } + + onPageHide() { + this.videoPlayerModel.controller.pause(); + } + + build() { + Column() { + Row() { + Image(this.backIconResource) + .width(MARGIN_FONT_SIZE.FOURTH_MARGIN) + .height(MARGIN_FONT_SIZE.FOURTH_MARGIN) + .margin({ left: MARGIN_FONT_SIZE.FOURTH_MARGIN }) + .onClick(() => { + router.back(); + }) + Text($r('app.string.back')) + .fontColor(Color.White) + .fontSize(MARGIN_FONT_SIZE.FOURTH_MARGIN) + .fontWeight(COMMON_NUM_FONT_WEIGHT) + .margin({ left: MARGIN_FONT_SIZE.FIRST_MARGIN }) + } + .width(ALL_PERCENT) + .margin({ + left: MARGIN_FONT_SIZE.FIRST_MARGIN, + top: MARGIN_FONT_SIZE.FIRST_MARGIN + }) + .justifyContent(FlexAlign.Start) + + Stack() { + if (!this.videoPlayerModel.isPlay && !this.videoPlayerModel.isLoading) { + Image(this.startIconResource) + .width(MARGIN_FONT_SIZE.FIFTH_MARGIN) + .height(MARGIN_FONT_SIZE.FIFTH_MARGIN) + .zIndex(STACK_STYLE.IMAGE_Z_INDEX) + } + if (this.videoPlayerModel.isLoading) { + Progress({ + value: STACK_STYLE.PROGRESS_VALUE, + total: STACK_STYLE.PROGRESS_TOTAL, + type: ProgressType.ScaleRing + }) + .color(Color.Grey) + .value(this.videoPlayerModel.progressVal) + .width(STACK_STYLE.PROGRESS_WIDTH) + .style({ + strokeWidth: STACK_STYLE.PROGRESS_STROKE_WIDTH, + scaleCount: STACK_STYLE.PROGRESS_SCALE_COUNT, + scaleWidth: STACK_STYLE.PROGRESS_SCALE_WIDTH + }) + .zIndex(STACK_STYLE.PROGRESS_Z_INDEX) + } + VideoPlayer({ + source: this.source + }) + .zIndex(0) + + } + } + .height(ALL_PERCENT) + .backgroundColor(Color.Black) + } +} diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexModule.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexModule.ets index 1223fa6eb8fd40f0680a219bce62267cf37bd57a..635ed5c29e1f4783e937a30774dacaa771117b6e 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexModule.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexModule.ets @@ -15,12 +15,7 @@ import router from '@ohos.router'; import { HORIZONTAL_VIDEOS } from '../viewmodel/VideoData'; -import { - MARGIN_FONT_SIZE, - STRING_PERCENT, - SECOND_PAGE, - NET -} from '../common/constants/CommonConstants'; +import { MARGIN_FONT_SIZE, STRING_PERCENT, SECOND_PAGE, NET } from '../common/constants/CommonConstants'; import { HorizontalVideoItem } from '../viewmodel/HorizontalVideoItem'; /** diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexSwiper.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexSwiper.ets index 6a6fd2f2c1f03e643c9458da6e09151cb7ccf87f..d44819c3d0040aa18574f1ede86af839cccd2311 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexSwiper.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/IndexSwiper.ets @@ -23,7 +23,6 @@ import { ParamItem } from '../viewmodel/ParamItem'; */ @Component export struct SwiperVideo { - build() { Column() { Swiper() { @@ -36,11 +35,11 @@ export struct SwiperVideo { .height(STRING_PERCENT.INDEX_SWIPER_HEIGHT_PERCENT) .width(STRING_PERCENT.INDEX_COMPONENT_WITH_PERCENT) .backgroundColor($r('app.color.white')) - .margin({ - left: STRING_PERCENT.INDEX_SWIPER_LEFT_RIGHT_MARGIN, + .margin({ + left: STRING_PERCENT.INDEX_SWIPER_LEFT_RIGHT_MARGIN, right: STRING_PERCENT.INDEX_SWIPER_LEFT_RIGHT_MARGIN, top: MARGIN_FONT_SIZE.FOURTH_MARGIN - }) + }) } } diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlaySlider.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlaySlider.ets index 870d125ab8bafae24f36e39e762265730a98a8c9..d586efff89450003d93ea993f6fd5fee5e2d76c6 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlaySlider.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlaySlider.ets @@ -23,32 +23,32 @@ import { BIG_TRACK_THICK_NESS, IMAGE_SIZE } from '../common/constants/CommonConstants'; -import { ViewPlayerController } from '../controller/ViewPlayerController'; +import { VideoPlayerModel } from '../model/VideoPlayerModel'; /** * video slider component */ @Component export struct VideoSlider { - @Consume vpcontroller : ViewPlayerController; + @Consume videoPlayerModel: VideoPlayerModel; build() { Row({ space: MARGIN_FONT_SIZE.FIRST_MARGIN }) { - Image(this.vpcontroller.isPlay ? $r('app.media.ic_pause') : $r('app.media.ic_play')) + Image(this.videoPlayerModel.isPlay ? $r('app.media.ic_pause') : $r('app.media.ic_play')) .width(IMAGE_SIZE) .height(IMAGE_SIZE) .margin({ left: MARGIN_FONT_SIZE.FIRST_MARGIN }) .onClick(() => { - iconOnclick(this.vpcontroller); + iconOnclick(this.videoPlayerModel); }) - Text(this.vpcontroller.currentStringTime) + Text(this.videoPlayerModel.currentStringTime) .fontSize(MARGIN_FONT_SIZE.SECOND_MARGIN) .fontColor(Color.White) .margin({ left: MARGIN_FONT_SIZE.FIRST_MARGIN }) Slider({ - value: this.vpcontroller.currentTime, + value: this.videoPlayerModel.currentTime, min: 0, - max: this.vpcontroller.durationTime, + max: this.videoPlayerModel.durationTime, step: 1, style: SliderStyle.OutSet }) @@ -58,17 +58,17 @@ export struct VideoSlider { .selectedColor($r("app.color.white")) .showSteps(true) .showTips(true) - .trackThickness(this.vpcontroller.isOpacity ? SMALL_TRACK_THICK_NESS : BIG_TRACK_THICK_NESS) + .trackThickness(this.videoPlayerModel.isOpacity ? SMALL_TRACK_THICK_NESS : BIG_TRACK_THICK_NESS) .onChange((value: number, mode: SliderChangeMode) => { - sliderOnchange(this.vpcontroller, value, mode); + sliderOnchange(this.videoPlayerModel, value, mode); }) - Text(this.vpcontroller.durationStringTime) + Text(this.videoPlayerModel.durationStringTime) .fontSize(MARGIN_FONT_SIZE.SECOND_MARGIN) .margin({ right: MARGIN_FONT_SIZE.FIRST_MARGIN }) .fontColor(Color.White) } - .opacity(this.vpcontroller.isOpacity ? DEFAULT_OPACITY : 1) + .opacity(this.videoPlayerModel.isOpacity ? DEFAULT_OPACITY : 1) .width(ALL_PERCENT) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets index ed70383b4d0670842178f16f0cff7df3309c6506..4968946c6c4802010fff93d6357694d2f975eaac 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets @@ -23,7 +23,7 @@ import { MESSAGE, ALL_PERCENT } from '../common/constants/CommonConstants'; -import { ViewPlayerController } from '../controller/ViewPlayerController'; +import { VideoPlayerModel } from '../model/VideoPlayerModel'; /** * video controller component @@ -31,7 +31,7 @@ import { ViewPlayerController } from '../controller/ViewPlayerController'; @Component export struct VideoPlayer { source: string | Resource = ''; - @Consume private vpcontroller : ViewPlayerController; + @Consume private videoPlayerModel: VideoPlayerModel; private previewUris: Resource = $r('app.media.preview'); build() { @@ -39,7 +39,7 @@ export struct VideoPlayer { Video({ src: this.source, previewUri: this.previewUris, - controller: this.vpcontroller.controller + controller: this.videoPlayerModel.controller }) .width(ALL_PERCENT) .height(STRING_PERCENT.NINETY_PERCENT) @@ -48,16 +48,14 @@ export struct VideoPlayer { .objectFit(ImageFit.Contain) .loop(false) .onUpdate((event) => { - if(event) { - this.vpcontroller.currentTime = event.time; - this.vpcontroller.currentStringTime = changeSliderTime(this.vpcontroller.currentTime); - } + this.videoPlayerModel.currentTime = event.time; + this.videoPlayerModel.currentStringTime = changeSliderTime(this.videoPlayerModel.currentTime); }) .onPrepared((event ?: DurationObject) => { - prepared(this.vpcontroller, event); + prepared(this.videoPlayerModel, event); }) .onFinish(() => { - finish(this.vpcontroller); + finish(this.videoPlayerModel); }) .onError(() => { prompt.showToast({ @@ -69,6 +67,7 @@ export struct VideoPlayer { } } } -export interface DurationObject { + +export interface DurationObject { duration: number; } \ No newline at end of file diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/ParamItem.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/ParamItem.ets index d601505b8c0459c8ea7a60e3e0459c3132920392..2b43be9ae5434c4eacc0d320cf71d166013cc021 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/ParamItem.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/ParamItem.ets @@ -18,5 +18,5 @@ */ @Observed export class ParamItem { - source: Resource = $r("app.string.empty");; + source: Resource = $r("app.string.empty"); } \ No newline at end of file diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/VideoData.ets b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/VideoData.ets index 15ca6c3a3be111894f172560f4af589e04ca04bf..2c1e7f27512e00ed0f9f684567c9994b66ce3d34 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/VideoData.ets +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/ets/viewmodel/VideoData.ets @@ -19,10 +19,10 @@ export const SWIPER_VIDEOS: SwiperVideoItem[] = [ new SwiperVideoItem($r('app.media.banner1')), new SwiperVideoItem($r('app.media.banner2')), new SwiperVideoItem($r('app.media.banner3')) -]; +] export const HORIZONTAL_VIDEOS: HorizontalVideoItem[] = [ new HorizontalVideoItem(1, $r('app.media.video_list0'), '视频1'), new HorizontalVideoItem(2, $r('app.media.video_list1'), '视频2'), new HorizontalVideoItem(3, $r('app.media.video_list2'), '视频3') -]; \ No newline at end of file +] \ No newline at end of file diff --git a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/resources/base/profile/main_pages.json b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/resources/base/profile/main_pages.json index 22562243f0aa1da3da17a1725ca1b87995742d81..9673e653f48c8d09af44d9ef010885894f20a95b 100644 --- a/HarmonyOS_NEXT/SimpleVideo/entry/src/main/resources/base/profile/main_pages.json +++ b/HarmonyOS_NEXT/SimpleVideo/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/SimpleVideoIndex", - "pages/SimpleVideoPlay" + "pages/VideoListPage", + "pages/VideoPlayerPage" ] } diff --git a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/pages/MainPage.ets b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/pages/MainPage.ets index 2f5e4eda8517483ff573a0fff771e2fc0ee5477e..92af7e04356bcd03424f85e2e897883a617fa0c6 100644 --- a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/pages/MainPage.ets +++ b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/pages/MainPage.ets @@ -16,7 +16,7 @@ import TargetInformation from '../view/TargetInformation'; import AddTargetDialog from '../view/AddTargetDialog'; import TargetList from '../view/TargetList'; -import TaskItemBean from '../viewmodel/TaskItemBean'; +import TaskItemModel from '../viewmodel/TaskItemModel'; import DataModel from '../viewmodel/DataModel'; import { CommonConstants } from '../common/constant/CommonConstant'; import getCurrentTime from '../common/utils/DateUtil'; @@ -25,7 +25,7 @@ import promptAction from '@ohos.promptAction'; @Entry @Component struct MainPage { - @State targetData: Array = DataModel.getData(); + @State targetData: Array = DataModel.getData(); @State totalTasksNumber: number = 0; @State completedTasksNumber: number = 0; @State latestUpdateDate: string = CommonConstants.DEFAULT_PROGRESS_VALUE; @@ -48,7 +48,7 @@ struct MainPage { */ onProgressChanged() { this.totalTasksNumber = this.targetData.length; - this.completedTasksNumber = this.targetData.filter((item: TaskItemBean) => { + this.completedTasksNumber = this.targetData.filter((item: TaskItemModel) => { return item.progressValue === CommonConstants.SLIDER_MAX_VALUE; }).length; this.latestUpdateDate = getCurrentTime(); @@ -101,7 +101,7 @@ struct MainPage { }); return; } - DataModel.addData(new TaskItemBean(taskName, 0, getCurrentTime())); + DataModel.addData(new TaskItemModel(taskName, 0, getCurrentTime())); this.targetData = DataModel.getData(); this.overAllProgressChanged = !this.overAllProgressChanged; this.dialogController.close(); diff --git a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetList.ets b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetList.ets index 2dc9d3847554945738391aaf1a8d7955e238588a..f83e213c930aa65c65317be91e60930ba13731ba 100644 --- a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetList.ets +++ b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetList.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import TaskItemBean from '../viewmodel/TaskItemBean'; +import TaskItemModel from '../viewmodel/TaskItemModel'; import TargetListItem from './TargetListItem'; import { CommonConstants } from '../common/constant/CommonConstant'; import DataModel from '../viewmodel/DataModel'; @@ -25,7 +25,7 @@ export default struct TargetList { @State selectArray: Array = []; @State clickIndex: number = CommonConstants.DEFAULT_CLICK_INDEX; @State selectAll: boolean = false; - @Link targetData: Array; + @Link targetData: Array; onAddClick?: () => void; build() { @@ -77,7 +77,7 @@ export default struct TargetList { }) List({ space: CommonConstants.LIST_SPACE }) { - ForEach(this.targetData, (item: TaskItemBean, index: number | undefined) => { + ForEach(this.targetData, (item: TaskItemModel, index: number | undefined) => { ListItem() { TargetListItem({ taskItem: item, @@ -87,7 +87,7 @@ export default struct TargetList { clickIndex: $clickIndex }) } - }, (item: TaskItemBean) => JSON.stringify(item)) + }, (item: TaskItemModel) => JSON.stringify(item)) } .edgeEffect(EdgeEffect.None) .margin({ top: $r('app.float.list_margin_top') }) diff --git a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetListItem.ets b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetListItem.ets index 122de34508512353c6b90eb55d52618757c0cc88..bff1ba58ae58c22acba1e8f232c2cecca05a5bd0 100644 --- a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetListItem.ets +++ b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetListItem.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import TaskItemBean from '../viewmodel/TaskItemBean'; +import TaskItemModel from '../viewmodel/TaskItemModel'; import { CommonConstants } from '../common/constant/CommonConstant'; import getCurrentTime from '../common/utils/DateUtil'; import DataModel from '../viewmodel/DataModel'; @@ -21,7 +21,7 @@ import ProgressEditPanel from './ProgressEditPanel'; @Component export default struct TargetListItem { - private taskItem?: TaskItemBean; + private taskItem?: TaskItemModel; @State latestProgress?: number = 0; @State updateDate?: string = ''; @Link selectArr: Array; diff --git a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets index d3ff5d5a369be1779d8aa3cfa8bca12acf7dd9f8..dce827e7a53808b7b35135167214585cb69e6e59 100644 --- a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets +++ b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets @@ -15,7 +15,7 @@ import { CommonConstants } from '../common/constant/CommonConstant'; import Logger from '../common/utils/Logger'; -import TaskItemBean from './TaskItemBean'; +import TaskItemModel from './TaskItemModel'; const TAG = '[DataModel]'; @@ -27,12 +27,12 @@ export class DataModel { /** * Saved data. */ - private targetData: Array = []; + private targetData: Array = []; /** * Get the latest data. */ - getData(): Array { + getData(): Array { return this.targetData; } @@ -58,7 +58,7 @@ export class DataModel { * * @param Data of the RecordItemBean type to be added. */ - addData(data: TaskItemBean) { + addData(data: TaskItemModel) { if (!data) { Logger.error(TAG, 'addData error because data is: ' + data); return; diff --git a/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/TaskItemModel.ets b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/TaskItemModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..81c66a037b942415533c64ab5890dcec35e433ff --- /dev/null +++ b/HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/TaskItemModel.ets @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/** + * Task item entity class. + */ +export default class TaskItemModel { + /** + * Progress value of task item. + */ + taskName: string; + + /** + * Update time of task item. + */ + updateDate: string; + + /** + * progress value of task item. + */ + progressValue: number; + + + /** + * Construction method. + * + * @param progressValue progress value. + * @param updateDate update time. + */ + constructor(taskName: string, progressValue: number, updateDate: string) { + this.taskName = taskName; + this.progressValue = progressValue; + this.updateDate = updateDate; + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/UIAbilityLifeCycle/entry/src/main/ets/entryability/EntryAbility.ts b/HarmonyOS_NEXT/UIAbilityLifeCycle/entry/src/main/ets/entryability/EntryAbility.ts index eaa29167a341eca5f5bc789f8bc22815d3388c80..4c5e8f1c524093f76364a8aa359aa9ac04376eb8 100644 --- a/HarmonyOS_NEXT/UIAbilityLifeCycle/entry/src/main/ets/entryability/EntryAbility.ts +++ b/HarmonyOS_NEXT/UIAbilityLifeCycle/entry/src/main/ets/entryability/EntryAbility.ts @@ -25,6 +25,13 @@ export default class EntryAbility extends UIAbility { domain: number = 0x0000; want: Want; launchParam: AbilityConstant.LaunchParam; + windowStageEventFunc: (data: window.WindowStageEventType) => void = (data: window.WindowStageEventType): void => { + hilog.info( + this.domain, + 'Succeeded in enabling the listener for window stage event changes. Data: %{public}', + JSON.stringify(data)?? '' + ); + }; onCreate(want, launchParam) { this.want = want; @@ -41,13 +48,7 @@ export default class EntryAbility extends UIAbility { // Setting Event Subscription for WindowStage (Obtained/Out-of-focus, Visible/Invisible) try { - windowStage.on('windowStageEvent', (data) => { - hilog.info( - this.domain, - 'Succeeded in enabling the listener for window stage event changes. Data: %{public}', - JSON.stringify(data)?? '' - ); - }); + windowStage.on('windowStageEvent', this.windowStageEventFunc); } catch (exception) { hilog.error( this.domain, diff --git a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/FlowItemComponent.ets b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/FlowItemComponent.ets index 62bb44ccef29ee3c1013ea23c69081603bf1e105..aa6ca51f35129e0295e3f09e8b5da6bfdc73c3ea 100644 --- a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/FlowItemComponent.ets +++ b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/FlowItemComponent.ets @@ -14,7 +14,7 @@ */ import { CommonConstants as Const } from '../common/constants/CommonConstants'; -import ProductBean from '../viewmodel/ProductBean'; +import ProductItem from '../viewmodel/ProductItem'; import { waterFlowData } from '../viewmodel/HomeViewModel'; /** @@ -23,7 +23,7 @@ import { waterFlowData } from '../viewmodel/HomeViewModel'; */ @Component export default struct FlowItemComponent { - item: ProductBean = waterFlowData[0]; + item: ProductItem = waterFlowData[0]; build() { Column() { diff --git a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/SwiperComponent.ets b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/SwiperComponent.ets index c7fc7608f8462efa8b7ed1feb0d2c69c6280e48a..c98c3eb225401be70119e7d43e1a6f10bab979a9 100644 --- a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/SwiperComponent.ets +++ b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/SwiperComponent.ets @@ -23,6 +23,12 @@ import { swiperImage } from '../viewmodel/HomeViewModel'; */ @Component export default struct SwiperComponent { + private dotIndicator: DotIndicator = new DotIndicator(); + + aboutToAppear(){ + this.dotIndicator.selectedColor($r('app.color.indicator_select')); + } + build() { Swiper() { ForEach(swiperImage, (item: Resource) => { @@ -33,11 +39,10 @@ export default struct SwiperComponent { .backgroundColor(Color.White) }, (item: Resource) => JSON.stringify(item)) } - .indicatorStyle({ selectedColor: $r('app.color.indicator_select') }) + .indicator(this.dotIndicator) .autoPlay(true) .itemSpace(0) .width(Const.FULL_WIDTH) - .indicator(true) .displayCount(1) .margin({ top: $r('app.float.swiper_margin_top'), diff --git a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/WaterFlowComponent.ets b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/WaterFlowComponent.ets index 5b91ec884ff7927a3ab8f070c979aa09b07c2df1..e0ee03d4c971fbedf62f5b7b85d5c50b6975f242 100644 --- a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/WaterFlowComponent.ets +++ b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/view/WaterFlowComponent.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import ProductBean from '../viewmodel/ProductBean'; +import ProductItem from '../viewmodel/ProductItem'; import { WaterFlowDataSource } from '../viewmodel/WaterFlowDataSource'; import { CommonConstants as Const } from '../common/constants/CommonConstants'; import { waterFlowData } from '../viewmodel/HomeViewModel'; @@ -34,11 +34,11 @@ export default struct WaterFlowComponent { build() { WaterFlow({ footer: (): void => this.itemFoot() }) { - LazyForEach(this.datasource, (item: ProductBean) => { + LazyForEach(this.datasource, (item: ProductItem) => { FlowItem() { FlowItemComponent({ item: item }) } - }, (item: ProductBean) => JSON.stringify(item)) + }, (item: ProductItem) => JSON.stringify(item)) } .layoutWeight(Const.WATER_FLOW_LAYOUT_WEIGHT) .layoutDirection(FlexDirection.Column) diff --git a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/HomeViewModel.ets b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/HomeViewModel.ets index 1e0111b69083863df2a829b0e7773089742c3bea..01fa89abec199a192c72b3c869c7a03daf19c9ca 100644 --- a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/HomeViewModel.ets +++ b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/HomeViewModel.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { IProductBean } from './ProductBean'; +import { IProductItem } from './ProductItem'; /** * Home page classify title data. @@ -41,7 +41,7 @@ const swiperImage: Resource[] = [ /** * Home page water flow item init data. */ -const waterFlowData: IProductBean[] = [ +const waterFlowData: IProductItem[] = [ { image_url: $r('app.media.ic_holder_50e'), name: 'XXX50E', diff --git a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/ProductItem.ets b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/ProductItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..1245e9f3f84f9a5c89ad5f0cb8616ff5acd6cefe --- /dev/null +++ b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/ProductItem.ets @@ -0,0 +1,67 @@ +/* + * 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 IProductItem { + /** + * Product image url. + */ + image_url: Resource; + + /** + * Product name. + */ + name: string; + + /** + * Product discount. + */ + discount: string; + + /** + * Product price. + */ + price: string; + + /** + * Product promotion. + */ + promotion: string; + + /** + * Product bonus points. + */ + bonus_points: string; +} + +/** + * Water flow item. + */ +export default class ProductItem implements IProductItem { + image_url: Resource; + name: string; + discount: string; + price: string; + promotion: string; + bonus_points: string; + + constructor(props: ProductItem) { + this.image_url = props.image_url; + this.name = props.name; + this.discount = props.discount; + this.price = props.price; + this.promotion = props.promotion; + this.bonus_points = props.bonus_points; + } +} \ No newline at end of file diff --git a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/WaterFlowDataSource.ets b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/WaterFlowDataSource.ets index 955b6d603aa44f2e99ad75ee1f6defba3abf9f4e..c880e3266ba742b43e95d1ff072246b592c6ece9 100644 --- a/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/WaterFlowDataSource.ets +++ b/HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/WaterFlowDataSource.ets @@ -13,21 +13,21 @@ * limitations under the License. */ -import ProductBean from './ProductBean'; +import ProductItem from './ProductItem'; /** * Water flow data source. */ export class WaterFlowDataSource implements IDataSource { - private dataArray: ProductBean[] = []; + private dataArray: ProductItem[] = []; private listeners: DataChangeListener[] = []; /** * Set water flow data array. * - * @param {ProductBean[]} productDataArray Displaying water flow Data. + * @param {ProductItem[]} productDataArray Displaying water flow Data. */ - public setDataArray(productDataArray: ProductBean[]): void { + public setDataArray(productDataArray: ProductItem[]): void { this.dataArray = productDataArray; } @@ -42,9 +42,9 @@ export class WaterFlowDataSource implements IDataSource { * Get the data corresponding to the index. * * @param {number} index Data index. - * @returns Return ProductBean. + * @returns Return ProductItem. */ - public getData(index: number): ProductBean { + public getData(index: number): ProductItem { return this.dataArray[index]; } diff --git a/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/entryability/EntryAbility.ts b/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/entryability/EntryAbility.ets similarity index 98% rename from HarmonyOS_NEXT/WebCookie/entry/src/main/ets/entryability/EntryAbility.ts rename to HarmonyOS_NEXT/WebCookie/entry/src/main/ets/entryability/EntryAbility.ets index 336c59e1b762e156d4333b51e5d65bbbf349eafd..d86eddc8a89981139d5b9a30bb3d7bfea38e563d 100644 --- a/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/entryability/EntryAbility.ts +++ b/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/entryability/EntryAbility.ets @@ -18,7 +18,7 @@ import hilog from '@ohos.hilog'; import window from '@ohos.window'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { + onCreate() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } diff --git a/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/pages/Verify.ets b/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/pages/Verify.ets index 810e5d47614c8193445295458215b87cb31b7747..697763133524f58cc63be7467e60cb7106fe9fc6 100644 --- a/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/pages/Verify.ets +++ b/HarmonyOS_NEXT/WebCookie/entry/src/main/ets/pages/Verify.ets @@ -89,4 +89,4 @@ struct Verify { .width(CommonConstants.FULL_WIDTH) .height(CommonConstants.FULL_HEIGHT) } -} \ No newline at end of file +} diff --git a/HarmonyOS_NEXT/WebCookie/entry/src/main/module.json5 b/HarmonyOS_NEXT/WebCookie/entry/src/main/module.json5 index 74955c51a185276ebc25a3ca9d2ca63b156dd48c..efb611627cd081ffa042f3a9f68f72e4c7e7a5ea 100644 --- a/HarmonyOS_NEXT/WebCookie/entry/src/main/module.json5 +++ b/HarmonyOS_NEXT/WebCookie/entry/src/main/module.json5 @@ -13,7 +13,7 @@ "abilities": [ { "name": "EntryAbility", - "srcEntry": "./ets/entryability/EntryAbility.ts", + "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", "icon": "$media:icon", "label": "$string:EntryAbility_label",