diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/BestPracticeSnippets.iml b/.idea/BestPracticeSnippets.iml new file mode 100644 index 0000000000000000000000000000000000000000..61021940449bdc69db005bbd04a05380f5629b2c --- /dev/null +++ b/.idea/BestPracticeSnippets.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..891e6bbf8a8464839ecc108f4cb7c0a6e6ac0f5a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NetworkManagement/.clang-format b/NetworkManagement/.clang-format new file mode 100644 index 0000000000000000000000000000000000000000..48439ed68073b99be118d374d1ebd43d04d4c4eb --- /dev/null +++ b/NetworkManagement/.clang-format @@ -0,0 +1,64 @@ +Language: Cpp +# BasedOnStyle: LLVM +ColumnLimit: 120 +SortIncludes: CaseSensitive +TabWidth: 4 +IndentWidth: 4 +UseTab: Never +AccessModifierOffset: -4 +ContinuationIndentWidth: 4 +IndentCaseBlocks: false +IndentCaseLabels: false +IndentGotoLabels: true +IndentWrappedFunctionNames: false +SortUsingDeclarations: false +NamespaceIndentation: None +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +AlignTrailingComments: true +AlignAfterOpenBracket: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AlwaysBreakTemplateDeclarations: MultiLine +BinPackArguments: true +BinPackParameters: true +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +InsertBraces: false +IndentExternBlock: NoIndent +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false +ReflowComments: true +MaxEmptyLinesToKeep: 2 \ No newline at end of file diff --git a/NetworkManagement/.hvigor/cache/meta.json b/NetworkManagement/.hvigor/cache/meta.json new file mode 100644 index 0000000000000000000000000000000000000000..f5b545083d5b77592afe5b0c1cf7870c84938b63 --- /dev/null +++ b/NetworkManagement/.hvigor/cache/meta.json @@ -0,0 +1 @@ +{"compileSdkVersion":"5.0.5(17)","hvigorVersion":"5.17.0","toolChainsVersion":"5.0.5.160"} diff --git a/NetworkManagement/.hvigor/dependencyMap/dependencyMap.json5 b/NetworkManagement/.hvigor/dependencyMap/dependencyMap.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d21b7ccb8466ab6a2f650fddced0eb43f0d93d21 --- /dev/null +++ b/NetworkManagement/.hvigor/dependencyMap/dependencyMap.json5 @@ -0,0 +1 @@ +{"basePath":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\.hvigor\\dependencyMap\\dependencyMap.json5","rootDependency":"./oh-package.json5","dependencyMap":{"entry":"./entry/oh-package.json5"},"modules":[{"name":"entry","srcPath":"..\\..\\..\\entry"}]} \ No newline at end of file diff --git a/NetworkManagement/.hvigor/dependencyMap/entry/oh-package.json5 b/NetworkManagement/.hvigor/dependencyMap/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..50a51753855fc6efdf037d5db6ab2cc001f17bbc --- /dev/null +++ b/NetworkManagement/.hvigor/dependencyMap/entry/oh-package.json5 @@ -0,0 +1 @@ +{"name":"entry","version":"1.0.0","description":"Please describe the basic information.","main":"","author":"","license":"","dependencies":{}} \ No newline at end of file diff --git a/NetworkManagement/.hvigor/dependencyMap/oh-package.json5 b/NetworkManagement/.hvigor/dependencyMap/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7548331ca118580824abab8328632210cb4354fa --- /dev/null +++ b/NetworkManagement/.hvigor/dependencyMap/oh-package.json5 @@ -0,0 +1 @@ +{"modelVersion":"5.0.0","description":"Please describe the basic information.","dependencies":{},"devDependencies":{}} \ No newline at end of file diff --git a/NetworkManagement/.hvigor/outputs/build-logs/build.log b/NetworkManagement/.hvigor/outputs/build-logs/build.log new file mode 100644 index 0000000000000000000000000000000000000000..5805f40f9f89efeb5b8e656c6e995417c5903687 --- /dev/null +++ b/NetworkManagement/.hvigor/outputs/build-logs/build.log @@ -0,0 +1,131 @@ +[2025-05-13T10:49:03.132] [DEBUG] debug-file - env: nodejsVersion=v18.20.1 +[2025-05-13T10:49:03.512] [DEBUG] debug-file - Hvigor init with startParameters:{ + hvigorfileTypeCheck: false, + parallelExecution: true, + incrementalExecution: true, + printStackTrace: false, + daemon: false, + analyze: 0, + logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' } +} +[2025-05-13T10:49:03.527] [DEBUG] debug-file - hvigorfile, resolving D:\code\BestPracticeSnippets\NetworkManagement\hvigorfile.ts +[2025-05-13T10:49:04.786] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: appTasks], plugins: [] } } +[2025-05-13T10:49:04.917] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug. +[2025-05-13T10:49:04.922] [DEBUG] debug-file - Product 'default' using build option: { + "debuggable": true, + "strictMode": { + "caseSensitiveCheck": true + } +} in this build. +[2025-05-13T10:49:04.927] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer +[2025-05-13T10:49:04.931] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native +[2025-05-13T10:49:04.937] [DEBUG] debug-file - Start recording SDK configuration permission data. +[2025-05-13T10:49:04.958] [DEBUG] debug-file - Sdk init in 34 ms +[2025-05-13T10:49:04.979] [DEBUG] debug-file - Project task initialization takes 20 ms +[2025-05-13T10:49:04.987] [DEBUG] debug-file - hvigorfile, resolving D:\code\BestPracticeSnippets\NetworkManagement\entry\hvigorfile.ts +[2025-05-13T10:49:05.002] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug +[2025-05-13T10:49:05.007] [DEBUG] debug-file - Module entry task initialization takes 3 ms +[2025-05-13T10:49:05.009] [DEBUG] debug-file - project has submodules:entry +[2025-05-13T10:49:05.024] [DEBUG] debug-file - Configuration task cost before running: 1 s 539 ms +[2025-05-13T10:49:05.026] [DEBUG] debug-file - Executing task :entry:clean +[2025-05-13T10:49:05.028] [DEBUG] debug-file - entry : clean cost memory 0.24335479736328125 +[2025-05-13T10:49:03.134] [DEBUG] debug-file - env: hvigor-config.json5 content = { + modelVersion: '5.0.0', + dependencies: {}, + execution: {}, + logging: {}, + debugging: {}, + nodeOptions: {} +} +[2025-05-13T10:49:05.041] [DEBUG] debug-file - Module 'entry' target 'default' using build option: { + "debuggable": true, + "copyFrom": "default", + "strictMode": { + "caseSensitiveCheck": true + }, + "name": "debug" +} in this build. +[2025-05-13T10:49:03.513] [DEBUG] debug-file - Since current hvigor version 5.17.0 differs from last hvigor version + undefined, delete file-cache.json and task-cache.json. +[2025-05-13T10:49:05.054] [DEBUG] debug-file - Create resident worker with id: 0. +[2025-05-13T10:49:04.786] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: appTasks] +[2025-05-13T10:49:04.917] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'. +[2025-05-13T10:49:04.923] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed. +[2025-05-13T10:49:04.979] [DEBUG] debug-file - hvigorfile, binding custom plugins [] +[2025-05-13T10:49:04.991] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: hapTasks], plugins: [] } } +[2025-05-13T10:49:05.002] [DEBUG] debug-file - Target 'default' config: {} +[2025-05-13T10:49:05.007] [DEBUG] debug-file - hvigorfile, binding custom plugins [] +[2025-05-13T10:49:05.010] [DEBUG] debug-file - start to load updatedOhPackageInfo to the disk +[2025-05-13T10:49:05.026] [DEBUG] debug-file - clean: Worker pool is inactive. +[2025-05-13T10:49:05.029] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 544 ms +[2025-05-13T10:49:03.136] [DEBUG] debug-file - env: daemon=false +[2025-05-13T10:49:05.052] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool. +[2025-05-13T10:49:03.514] [DEBUG] debug-file - Cache service initialization finished in 2 ms +[2025-05-13T10:49:05.055] [DEBUG] debug-file - Create resident worker with id: 1. +[2025-05-13T10:49:04.917] [DEBUG] debug-file - Product 'default' build option: {} +[2025-05-13T10:49:04.979] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\code\BestPracticeSnippets\NetworkManagement\hvigorfile.ts +[2025-05-13T10:49:04.991] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: hapTasks] +[2025-05-13T10:49:05.002] [DEBUG] debug-file - Module 'entry' target 'default' build option: { + "debuggable": true, + "copyFrom": "default", + "strictMode": { + "caseSensitiveCheck": true + }, + "name": "debug" +} +[2025-05-13T10:49:05.007] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\code\BestPracticeSnippets\NetworkManagement\entry\hvigorfile.ts +[2025-05-13T10:49:05.015] [DEBUG] debug-file - load to the disk finished +[2025-05-13T10:49:05.029] [INFO] debug-file - Finished :entry:clean... after 3 ms +[2025-05-13T10:49:03.136] [DEBUG] debug-file - no-daemon, use the parent process.execArgv --max-old-space-size=8192,--expose-gc +[2025-05-13T10:49:05.052] [DEBUG] debug-file - Worker pool is initialized with config: { + minPoolNum: 2, + maxPoolNum: undefined, + maxCoreSize: undefined, + cacheCapacity: undefined, + cacheTtl: undefined +} +[2025-05-13T10:49:05.056] [DEBUG] debug-file - Current worker pool is stopped or closed. +[2025-05-13T10:49:04.917] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'. +[2025-05-13T10:49:04.979] [DEBUG] debug-file - hvigorfile, resolve finished D:\code\BestPracticeSnippets\NetworkManagement\hvigorfile.ts +[2025-05-13T10:49:05.002] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry +[2025-05-13T10:49:05.016] [DEBUG] debug-file - Start to initialize dependency information. +[2025-05-13T10:49:05.007] [DEBUG] debug-file - hvigorfile, resolve finished D:\code\BestPracticeSnippets\NetworkManagement\entry\hvigorfile.ts +[2025-05-13T10:49:05.029] [DEBUG] debug-file - Executing task ::clean +[2025-05-13T10:49:05.056] [DEBUG] debug-file - Clear worker 0. +[2025-05-13T10:49:05.002] [DEBUG] debug-file - Module 'entry' target 'default' using build option: { + "debuggable": true, + "copyFrom": "default", + "strictMode": { + "caseSensitiveCheck": true + }, + "name": "debug" +} in this build. +[2025-05-13T10:49:05.017] [DEBUG] debug-file - Module NetworkManagement Collected Dependency: +[2025-05-13T10:49:05.029] [DEBUG] debug-file - clean: Worker pool is inactive. +[2025-05-13T10:49:05.057] [DEBUG] debug-file - Worker 0 has been cleared. +[2025-05-13T10:49:05.017] [DEBUG] debug-file - Module NetworkManagement's total dependency: 0 +[2025-05-13T10:49:05.030] [DEBUG] debug-file - NetworkManagement : clean cost memory 0.03101348876953125 +[2025-05-13T10:49:05.057] [DEBUG] debug-file - Current idle worker size: 1. +[2025-05-13T10:49:05.018] [DEBUG] debug-file - Start to initialize dependency information. +[2025-05-13T10:49:05.030] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 545 ms +[2025-05-13T10:49:05.057] [DEBUG] debug-file - Current busy worker size: 0. +[2025-05-13T10:49:05.019] [DEBUG] debug-file - Module entry Collected Dependency: +[2025-05-13T10:49:05.030] [INFO] debug-file - Finished ::clean... after 1 ms +[2025-05-13T10:49:05.057] [DEBUG] debug-file - Clear worker 1. +[2025-05-13T10:49:05.019] [DEBUG] debug-file - Module entry's total dependency: 0 +[2025-05-13T10:49:05.030] [DEBUG] debug-file - Executing task :entry:init +[2025-05-13T10:49:05.057] [DEBUG] debug-file - Worker 1 has been cleared. +[2025-05-13T10:49:05.021] [DEBUG] debug-file - Configuration phase cost:1 s 503 ms +[2025-05-13T10:49:05.030] [DEBUG] debug-file - entry : init cost memory 0.01021575927734375 +[2025-05-13T10:49:05.057] [DEBUG] debug-file - Current idle worker size: 0. +[2025-05-13T10:49:05.030] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 546 ms +[2025-05-13T10:49:05.057] [DEBUG] debug-file - Current busy worker size: 0. +[2025-05-13T10:49:05.030] [INFO] debug-file - Finished :entry:init... after 1 ms +[2025-05-13T10:49:05.057] [DEBUG] debug-file - hvigor build process will be closed. +[2025-05-13T10:49:05.030] [DEBUG] debug-file - Executing task ::init +[2025-05-13T10:49:05.060] [DEBUG] debug-file - worker[0] exits with exit code 0. +[2025-05-13T10:49:05.030] [DEBUG] debug-file - NetworkManagement : init cost memory 0.00899505615234375 +[2025-05-13T10:49:05.062] [DEBUG] debug-file - Current worker pool is terminated. +[2025-05-13T10:49:05.030] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 546 ms +[2025-05-13T10:49:05.063] [DEBUG] debug-file - worker[1] exits with exit code 0. +[2025-05-13T10:49:05.030] [INFO] debug-file - Finished ::init... after 1 ms diff --git a/NetworkManagement/.hvigor/outputs/sync/fileCache.json b/NetworkManagement/.hvigor/outputs/sync/fileCache.json new file mode 100644 index 0000000000000000000000000000000000000000..5bab8b417b5532890ff4465f467fc796938cdd52 --- /dev/null +++ b/NetworkManagement/.hvigor/outputs/sync/fileCache.json @@ -0,0 +1 @@ +{"CACHE_SYNC_FILE_HASH":{"D:\\code\\BestPracticeSnippets\\NetworkManagement\\hvigor\\hvigor-config.json5":"25d53d5d06c5251effa3ed80e52ed6c348681de96a785afb8653eb4784c77db3","D:\\code\\BestPracticeSnippets\\NetworkManagement\\build-profile.json5":"f9f9c2265b1c28b6a41d8e07d8e779d11b92cd579495d83e557c4fa6bdd842e4","D:\\code\\BestPracticeSnippets\\NetworkManagement\\hvigorfile.ts":"838c71d003b31e4f017c180ba0a3467fb8a3b0cb3f9a7f7df3abacaf3c92f06f","D:\\code\\BestPracticeSnippets\\NetworkManagement\\oh-package.json5":"3ba52b4823bf744dea486510c1e3b524625e2512ee6aad6d82d30262a346a19b","D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build-profile.json5":"5086061cf3323e5971ac79776f3a0245202178cf9430057d16cc437450e2f217","D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\hvigorfile.ts":"57bd41303c80c086297dd09b82c4d6ff9e4a60d02a098bf922f73b9d78b853f9","D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\oh-package.json5":"d94be5649daa75e1997a93e7ab4e3dc98a6b841becbd86e01a8a49b15fd2653a","D:\\code\\BestPracticeSnippets\\NetworkManagement\\.hvigor\\outputs\\sync\\output.json":"1fe36e99c13af777ad4b2eea0f3d70eda74313ef79799b310026296f76b8506c","SDK_LOCATION":"D:/Deveco/DevEco Studio/sdk"},"OHPM_INSTALL_FILE_HASH":{"D:\\code\\BestPracticeSnippets\\NetworkManagement\\oh-package.json5":"3ba52b4823bf744dea486510c1e3b524625e2512ee6aad6d82d30262a346a19b","D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\oh-package.json5":"d94be5649daa75e1997a93e7ab4e3dc98a6b841becbd86e01a8a49b15fd2653a","D:\\code\\BestPracticeSnippets\\NetworkManagement\\oh_modules":false,"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\oh_modules":false}} \ No newline at end of file diff --git a/NetworkManagement/.hvigor/outputs/sync/output.json b/NetworkManagement/.hvigor/outputs/sync/output.json new file mode 100644 index 0000000000000000000000000000000000000000..e0ccd0ac7d081edeaeeabc593c3f4006955c1695 --- /dev/null +++ b/NetworkManagement/.hvigor/outputs/sync/output.json @@ -0,0 +1,146 @@ +{ + "ohos-module-entry": { + "SELECT_TARGET": "default", + "MODULE_BUILD_DIR": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build", + "DEPENDENCY_INFO": {}, + "TARGETS": { + "default": { + "SOURCE_ROOT": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\src\\main", + "RESOURCES_PATH": [ + "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\src\\main\\resources" + ], + "BUILD_PATH": { + "OUTPUT_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\outputs\\default", + "INTERMEDIA_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates", + "JS_ASSETS_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\loader_out\\default", + "JS_LITE_ASSETS_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\loader_out_lite\\default", + "RES_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\res\\default", + "RES_PROFILE_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile", + "ETS_SUPER_VISUAL_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule", + "JS_SUPER_VISUAL_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle", + "WORKER_LOADER": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\loader\\default\\loader.json", + "MANIFEST_JSON": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\manifest\\default", + "OUTPUT_METADATA_JSON": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json", + "SOURCE_MAP_DIR": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\source_map\\default" + }, + "BUILD_OPTION": { + "debuggable": true + } + } + }, + "BUILD_OPTION": { + "default-default": { + "debuggable": true, + "copyFrom": "default", + "strictMode": { + "caseSensitiveCheck": true + }, + "name": "debug" + } + }, + "BUILD_PROFILE_OPT": { + "apiType": "stageMode", + "buildOption": {}, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + { + "name": "default" + }, + { + "name": "debug" + } + ], + "targets": [ + { + "name": "default" + } + ] + }, + "BUILD_CACHE_DIR": "" + }, + "ohos-project": { + "SELECT_PRODUCT_NAME": "default", + "MODULE_BUILD_DIR": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\build", + "BUNDLE_NAME": "com.example.networkmanagement", + "BUILD_PATH": { + "OUTPUT_PATH": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\build\\outputs\\default" + }, + "MODULES": [ + { + "name": "entry", + "srcPath": "D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ], + "belongProjectPath": "D:\\code\\BestPracticeSnippets\\NetworkManagement" + } + ], + "PROFILE_OPT": { + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug" + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] + }, + "CONFIG_PROPERTIES": { + "enableSignTask": true, + "skipNativeIncremental": false, + "hvigor.keepDependency": true + }, + "OVERALL_PROJECT_PATHS": [ + "D:\\code\\BestPracticeSnippets\\NetworkManagement" + ], + "BUILD_CACHE_DIR": "" + }, + "version": 1 +} \ No newline at end of file diff --git a/NetworkManagement/.idea/.deveco/module/entry.cache.json b/NetworkManagement/.idea/.deveco/module/entry.cache.json new file mode 100644 index 0000000000000000000000000000000000000000..4084310a5a3ce48b183aff8d55b2fffaaef72bb9 --- /dev/null +++ b/NetworkManagement/.idea/.deveco/module/entry.cache.json @@ -0,0 +1,22 @@ +{ + "CommonInfo":{ + "current.select.target":"default" + }, + "BuildOptions":{ + "SELECT_BUILD_TARGET":"default", + "BUILD_PATH":{ + "OUTPUT_METADATA_JSON":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json", + "OUTPUT_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\outputs\\default", + "RES_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\res\\default", + "ETS_SUPER_VISUAL_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule", + "JS_ASSETS_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\loader_out\\default", + "SOURCE_MAP_DIR":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\source_map\\default", + "INTERMEDIA_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates", + "RES_PROFILE_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile", + "WORKER_LOADER":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\loader\\default\\loader.json", + "MANIFEST_JSON":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\manifest\\default", + "JS_LITE_ASSETS_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\intermediates\\loader_out_lite\\default", + "JS_SUPER_VISUAL_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle" + } + } +} \ No newline at end of file diff --git a/NetworkManagement/.idea/.deveco/project.cache.json b/NetworkManagement/.idea/.deveco/project.cache.json new file mode 100644 index 0000000000000000000000000000000000000000..ba0327b62fa562fdd4e2a5b54edffbb98e933961 --- /dev/null +++ b/NetworkManagement/.idea/.deveco/project.cache.json @@ -0,0 +1,16 @@ +{ + "CommonInfo":{ + "project.ide.version":"5.0.13.100", + "current.select.product":"default", + "current.select.buildMode":"", + "crossplatform.projectType":"" + }, + "BuildOptions":{ + "SELECT_BUILD_PRODUCT":"default", + "BUNDLE_NAME":"com.example.networkmanagement", + "BUILD_PATH":{ + "OUTPUT_PATH":"D:\\code\\BestPracticeSnippets\\NetworkManagement\\build\\outputs\\default" + }, + "SELECT_BUILD_MODE":"" + } +} \ No newline at end of file diff --git a/NetworkManagement/.idea/.gitignore b/NetworkManagement/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ b/NetworkManagement/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/NetworkManagement/.idea/modules.xml b/NetworkManagement/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..345dbf0eefa8f1a46456cb4d684512e86417820f --- /dev/null +++ b/NetworkManagement/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/NetworkManagement/.idea/modules/NetworkManagement.iml b/NetworkManagement/.idea/modules/NetworkManagement.iml new file mode 100644 index 0000000000000000000000000000000000000000..cc722a93737bae7d1273a1047efaffd4bbf175fe --- /dev/null +++ b/NetworkManagement/.idea/modules/NetworkManagement.iml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NetworkManagement/.idea/modules/entry/entry.iml b/NetworkManagement/.idea/modules/entry/entry.iml new file mode 100644 index 0000000000000000000000000000000000000000..b630fe7f2a024b997f55fc5a52dea6c90a18c45d --- /dev/null +++ b/NetworkManagement/.idea/modules/entry/entry.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/NetworkManagement/.idea/vcs.xml b/NetworkManagement/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c0b8635858dc7ad44b93df54b762707ce49eefc --- /dev/null +++ b/NetworkManagement/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets b/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets index bedee70f8ad8f8bf8a8db545022f2f9985cc7f39..bc04c215f2b355674f64c5cb8994b14ca78757e9 100644 --- a/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets +++ b/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets @@ -216,7 +216,7 @@ export struct ListeningNetworkStatus { // DocsCode 8 networkWeak() { - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.weak_network_environment_message'), duration: 2000 }); @@ -268,7 +268,7 @@ export struct ListeningNetworkStatus { let judgeHasNet = this.judgeHasNet(); if (!judgeHasNet) { this.controller?.reset(); - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.network_unavailable_message'), duration: 2000 }); @@ -279,7 +279,7 @@ export struct ListeningNetworkStatus { Column() { Button($r('app.string.simulate_network_unavailable')).onClick(() => { this.controller.pause(); - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.network_unavailable_message'), duration: 2000 }); @@ -289,7 +289,7 @@ export struct ListeningNetworkStatus { .backgroundColor('#0A59F7') Button($r('app.string.simulate_network_lost')).onClick(() => { this.controller.pause(); - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.simulate_network_disconnected_message'), duration: 2000 }); @@ -299,7 +299,7 @@ export struct ListeningNetworkStatus { .backgroundColor('#0A59F7') Button($r('app.string.simulate_weak_network_environment')).onClick(() => { this.controller.pause(); - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.weak_network_toggle_video'), duration: 2000 }); @@ -309,7 +309,7 @@ export struct ListeningNetworkStatus { .backgroundColor('#0A59F7') Button($r('app.string.Simulate_low_quality_network_environment')).onClick(() => { this.controller.pause(); - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.low_quality_network_environment_message'), duration: 2000 }); @@ -321,13 +321,13 @@ export struct ListeningNetworkStatus { if (!this.isLowQuality) { this.toggleLowDefinition(); this.isLowQuality = true; - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.toggle_low_definition_message'), duration: 2000 }); this.controller?.reset(); } else { - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.toggle_definition_message_fail'), duration: 2000 }); @@ -340,7 +340,7 @@ export struct ListeningNetworkStatus { this.videoSrc = $rawfile('video.mp4'); this.isLowQuality = false; this.controller?.reset(); - promptAction.showToast({ + this.getUIContext().getPromptAction().showToast({ message: $r('app.string.toggle_high_definition_message'), duration: 2000 }); diff --git a/customPlugin/.gitignore b/customPlugin/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/customPlugin/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/customPlugin/AppScope/app.json5 b/customPlugin/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a8ee954ebc141b02bff612d829c9c01a88cf8161 --- /dev/null +++ b/customPlugin/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:layered_image", + "label": "$string:app_name" + } +} diff --git a/customPlugin/AppScope/resources/base/element/string.json b/customPlugin/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1080233f01384411ec684b58955cb8808746fdd3 --- /dev/null +++ b/customPlugin/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + } + ] +} diff --git a/customPlugin/AppScope/resources/base/media/background.png b/customPlugin/AppScope/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/customPlugin/AppScope/resources/base/media/background.png differ diff --git a/customPlugin/AppScope/resources/base/media/foreground.png b/customPlugin/AppScope/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/customPlugin/AppScope/resources/base/media/foreground.png differ diff --git a/customPlugin/AppScope/resources/base/media/layered_image.json b/customPlugin/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/customPlugin/AppScope/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/customPlugin/build-profile.json5 b/customPlugin/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ae19bf006133749717f7eb1fc8ae716bca4dbd74 --- /dev/null +++ b/customPlugin/build-profile.json5 @@ -0,0 +1,46 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "targetSdkVersion": "5.0.5(17)", + "compatibleSdkVersion": "5.0.5(17)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "library", + "srcPath": "./library", + } + ] +} \ No newline at end of file diff --git a/customPlugin/code-linter.json5 b/customPlugin/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..073990fa45394e1f8e85d85418ee60a8953f9b99 --- /dev/null +++ b/customPlugin/code-linter.json5 @@ -0,0 +1,32 @@ +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@security/no-unsafe-aes": "error", + "@security/no-unsafe-hash": "error", + "@security/no-unsafe-mac": "warn", + "@security/no-unsafe-dh": "error", + "@security/no-unsafe-dsa": "error", + "@security/no-unsafe-ecdsa": "error", + "@security/no-unsafe-rsa-encrypt": "error", + "@security/no-unsafe-rsa-sign": "error", + "@security/no-unsafe-rsa-key": "error", + "@security/no-unsafe-dsa-key": "error", + "@security/no-unsafe-dh-key": "error", + "@security/no-unsafe-3des": "error" + } +} \ No newline at end of file diff --git a/customPlugin/entry/.gitignore b/customPlugin/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/customPlugin/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/customPlugin/entry/build-profile.json5 b/customPlugin/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4d611879c7913fb0610c686e2399258ab3a6dad1 --- /dev/null +++ b/customPlugin/entry/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/customPlugin/entry/hvigorfile.ts b/customPlugin/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/customPlugin/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/customPlugin/entry/obfuscation-rules.txt b/customPlugin/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/customPlugin/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/customPlugin/entry/oh-package.json5 b/customPlugin/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a --- /dev/null +++ b/customPlugin/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/customPlugin/entry/src/main/ets/entryability/EntryAbility.ets b/customPlugin/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..508880af8c33aa838016d1cd4b2c68be2f447540 --- /dev/null +++ b/customPlugin/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,44 @@ +import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +const DOMAIN = 0x0000; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); + return; + } + hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/customPlugin/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/customPlugin/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e4de99282050bad799ac892eb85ac5449364a51 --- /dev/null +++ b/customPlugin/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,16 @@ +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; + +const DOMAIN = 0x0000; + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + hilog.info(DOMAIN, 'testTag', 'onBackup ok'); + await Promise.resolve(); + } + + async onRestore(bundleVersion: BundleVersion) { + hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + await Promise.resolve(); + } +} \ No newline at end of file diff --git a/customPlugin/entry/src/main/ets/pages/Index.ets b/customPlugin/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..766a658345715dec1cc6b6a626f9a2864861c73f --- /dev/null +++ b/customPlugin/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,24 @@ +import handover from '@hms.networkboost.handover'; +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + build() { + RelativeContainer() { + Text(this.message) + .id('HelloWorld') + .fontSize($r('app.float.page_text_font_size')) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }) + .onClick(() => { + this.message = 'Welcome'; + }) + } + .height('100%') + .width('100%') + } +} \ No newline at end of file diff --git a/customPlugin/entry/src/main/module.json5 b/customPlugin/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a1cea8b6a4560cee7bda7a2db52f310c035ab6c8 --- /dev/null +++ b/customPlugin/entry/src/main/module.json5 @@ -0,0 +1,52 @@ +{ + "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:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "EntryBackupAbility", + "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "type": "backup", + "exported": false, + "metadata": [ + { + "name": "ohos.extension.backup", + "resource": "$profile:backup_config" + } + ], + } + ] + } +} \ No newline at end of file diff --git a/customPlugin/entry/src/main/resources/base/element/color.json b/customPlugin/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/customPlugin/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/customPlugin/entry/src/main/resources/base/element/float.json b/customPlugin/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6 --- /dev/null +++ b/customPlugin/entry/src/main/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "page_text_font_size", + "value": "50fp" + } + ] +} diff --git a/customPlugin/entry/src/main/resources/base/element/string.json b/customPlugin/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/customPlugin/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/customPlugin/entry/src/main/resources/base/media/background.png b/customPlugin/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/customPlugin/entry/src/main/resources/base/media/background.png differ diff --git a/customPlugin/entry/src/main/resources/base/media/foreground.png b/customPlugin/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/customPlugin/entry/src/main/resources/base/media/foreground.png differ diff --git a/customPlugin/entry/src/main/resources/base/media/layered_image.json b/customPlugin/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/customPlugin/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/customPlugin/entry/src/main/resources/base/media/startIcon.png b/customPlugin/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/customPlugin/entry/src/main/resources/base/media/startIcon.png differ diff --git a/customPlugin/entry/src/main/resources/base/profile/backup_config.json b/customPlugin/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/customPlugin/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/customPlugin/entry/src/main/resources/base/profile/main_pages.json b/customPlugin/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/customPlugin/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/customPlugin/entry/src/main/resources/dark/element/color.json b/customPlugin/entry/src/main/resources/dark/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/customPlugin/entry/src/main/resources/dark/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/customPlugin/entry/src/mock/mock-config.json5 b/customPlugin/entry/src/mock/mock-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7a73a41bfdf76d6f793007240d80983a52f15f97 --- /dev/null +++ b/customPlugin/entry/src/mock/mock-config.json5 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/customPlugin/entry/src/ohosTest/ets/test/Ability.test.ets b/customPlugin/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048 --- /dev/null +++ b/customPlugin/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,35 @@ +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/customPlugin/entry/src/ohosTest/ets/test/List.test.ets b/customPlugin/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545 --- /dev/null +++ b/customPlugin/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,5 @@ +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/customPlugin/entry/src/ohosTest/module.json5 b/customPlugin/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..55725a929993a8a18b3808d41ef037759440488b --- /dev/null +++ b/customPlugin/entry/src/ohosTest/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/customPlugin/entry/src/test/List.test.ets b/customPlugin/entry/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7 --- /dev/null +++ b/customPlugin/entry/src/test/List.test.ets @@ -0,0 +1,5 @@ +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/customPlugin/entry/src/test/LocalUnit.test.ets b/customPlugin/entry/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f --- /dev/null +++ b/customPlugin/entry/src/test/LocalUnit.test.ets @@ -0,0 +1,33 @@ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/customPlugin/hvigor/hvigor-config.json5 b/customPlugin/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5bebc9755447385d82ce4138f54d991b1f85f348 --- /dev/null +++ b/customPlugin/hvigor/hvigor-config.json5 @@ -0,0 +1,22 @@ +{ + "modelVersion": "5.0.5", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/customPlugin/hvigorfile.ts b/customPlugin/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775 --- /dev/null +++ b/customPlugin/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/customPlugin/library/.gitignore b/customPlugin/library/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/customPlugin/library/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/customPlugin/library/BuildProfile.ets b/customPlugin/library/BuildProfile.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4 --- /dev/null +++ b/customPlugin/library/BuildProfile.ets @@ -0,0 +1,17 @@ +/** + * Use these variables when you tailor your ArkTS code. They must be of the const type. + */ +export const HAR_VERSION = '1.0.0'; +export const BUILD_MODE_NAME = 'debug'; +export const DEBUG = true; +export const TARGET_NAME = 'default'; + +/** + * BuildProfile Class is used only for compatibility purposes. + */ +export default class BuildProfile { + static readonly HAR_VERSION = HAR_VERSION; + static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; + static readonly DEBUG = DEBUG; + static readonly TARGET_NAME = TARGET_NAME; +} \ No newline at end of file diff --git a/customPlugin/library/Index.ets b/customPlugin/library/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e1aba4afb6a17f2fa4d43ab9dfaf6d97159a177 --- /dev/null +++ b/customPlugin/library/Index.ets @@ -0,0 +1 @@ +export { renameHarTask } from './src/main/ets/components/customPlugin'; diff --git a/customPlugin/library/build-profile.json5 b/customPlugin/library/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e6773f9f5d76a66d6d19fddc9c6ddb3f5621d3b1 --- /dev/null +++ b/customPlugin/library/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + }, + "consumerFiles": [ + "./consumer-rules.txt" + ] + } + }, + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest" + } + ] +} diff --git a/customPlugin/library/consumer-rules.txt b/customPlugin/library/consumer-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/customPlugin/library/hvigorfile.ts b/customPlugin/library/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/customPlugin/library/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/customPlugin/library/obfuscation-rules.txt b/customPlugin/library/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/customPlugin/library/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/customPlugin/library/oh-package.json5 b/customPlugin/library/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..b087f5751f90257cc50d1a605e879ddd5b2660e2 --- /dev/null +++ b/customPlugin/library/oh-package.json5 @@ -0,0 +1,9 @@ +{ + "name": "library", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "Index.ets", + "author": "", + "license": "Apache-2.0", + "dependencies": {} +} diff --git a/customPlugin/library/src/main/ets/components/customPlugin.ts b/customPlugin/library/src/main/ets/components/customPlugin.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6cefab353c89ba7ccb9cf840e0ae671580556a5 --- /dev/null +++ b/customPlugin/library/src/main/ets/components/customPlugin.ts @@ -0,0 +1,79 @@ +import { fileIo as fs } from '@kit.CoreFileKit'; +import { util } from '@kit.ArkTS'; +interface OhPackage { + name: string; + version: number; + description: string; + author: string; +} +//[Start readFileSync] +function readFileSync(filePath: string): string { + try { + const fd = fs.openSync(filePath, fs.OpenMode.READ_ONLY).fd; + const stat = fs.statSync(filePath); + + const buffer = new ArrayBuffer(stat.size); + const bufferView = new Uint8Array(buffer); + + const bytesRead = fs.readSync( + fd, + bufferView, + { length: stat.size } + ); + + fs.closeSync(fd); + + const textDecoder = new util.TextDecoder('utf-8'); + return textDecoder.decodeWithStream(bufferView); + } catch (err) { + console.error('Read file failed:', err); + throw err; // 重新抛出错误以便上层处理 + } +} +//[End readFileSync] + +//[Start renameHarTask] +export function renameHarTask(str?: string) { + return { + pluginId: 'RenameHarTaskID', + apply(pluginContext) { + pluginContext.registerTask({ + // 编写自定义任务 + name: 'renameHarTask', + run: (taskContext) => { + // 读取oh-package.json5,解析出version + const packageFile = taskContext.modulePath+'\\oh-package.json5'; + console.log('file: ', packageFile); + let fileContent = this.readFileSync(packageFile, 'utf8'); + console.log(fileContent); + const content: OhPackage = JSON.parse(fileContent); + const version = content.version; + const author = content.author; + + + console.log('renameHarTask: ', taskContext.moduleName, taskContext.modulePath); + const sourceFile = taskContext.modulePath + '\\build\\default\\outputs\\default\\' + taskContext.moduleName + '.har'; + const targetPath = taskContext.modulePath + '\\build\\default\\outputs\\target\\'; + const targetFile = targetPath + + taskContext.moduleName + '-' + version + '-' + author +'.har'; + console.log('renameHarTask: sourceFile: ', sourceFile); + console.log('renameHarTask: targetFile: ', targetFile); + + + // 创建目录 + fs.mkdir(targetPath, true, (err) => { + if (err) throw err; + // 移动并修改产物文件名 + fs.rename(sourceFile, targetFile, (err)=> { + console.log('err: ' + err); + }); + }); + }, + // 确认自定义任务插入位置 + dependencies: ['default@PackageHar'], + postDependencies: ['assembleHar'] + }) + } + } + //[End renameHarTask] +} \ No newline at end of file diff --git a/customPlugin/library/src/main/module.json5 b/customPlugin/library/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..dd30f8e0de7154e00da5009b23df656940652a64 --- /dev/null +++ b/customPlugin/library/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "library", + "type": "har", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ] + } +} diff --git a/customPlugin/library/src/main/resources/base/element/float.json b/customPlugin/library/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6 --- /dev/null +++ b/customPlugin/library/src/main/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "page_text_font_size", + "value": "50fp" + } + ] +} diff --git a/customPlugin/library/src/main/resources/base/element/string.json b/customPlugin/library/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607 --- /dev/null +++ b/customPlugin/library/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from package" + } + ] +} diff --git a/customPlugin/library/src/ohosTest/ets/test/Ability.test.ets b/customPlugin/library/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048 --- /dev/null +++ b/customPlugin/library/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,35 @@ +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/customPlugin/library/src/ohosTest/ets/test/List.test.ets b/customPlugin/library/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545 --- /dev/null +++ b/customPlugin/library/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,5 @@ +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/customPlugin/library/src/ohosTest/module.json5 b/customPlugin/library/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..2d357bce9c10ce2146bf57f966d4e29f770ab067 --- /dev/null +++ b/customPlugin/library/src/ohosTest/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "library_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/customPlugin/library/src/test/List.test.ets b/customPlugin/library/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7 --- /dev/null +++ b/customPlugin/library/src/test/List.test.ets @@ -0,0 +1,5 @@ +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/customPlugin/library/src/test/LocalUnit.test.ets b/customPlugin/library/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f --- /dev/null +++ b/customPlugin/library/src/test/LocalUnit.test.ets @@ -0,0 +1,33 @@ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/customPlugin/oh-package-lock.json5 b/customPlugin/oh-package-lock.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c6f99f5c73b06c5fdef7ec6f491b74b7befebe2e --- /dev/null +++ b/customPlugin/oh-package-lock.json5 @@ -0,0 +1,27 @@ +{ + "meta": { + "stableOrder": true + }, + "lockfileVersion": 3, + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", + "specifiers": { + "@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0", + "@ohos/hypium@1.0.21": "@ohos/hypium@1.0.21" + }, + "packages": { + "@ohos/hamock@1.0.0": { + "name": "@ohos/hamock", + "version": "1.0.0", + "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==", + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hamock/-/hamock-1.0.0.har", + "registryType": "ohpm" + }, + "@ohos/hypium@1.0.21": { + "name": "@ohos/hypium", + "version": "1.0.21", + "integrity": "sha512-iyKGMXxE+9PpCkqEwu0VykN/7hNpb+QOeIuHwkmZnxOpI+dFZt6yhPB7k89EgV1MiSK/ieV/hMjr5Z2mWwRfMQ==", + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.21.har", + "registryType": "ohpm" + } + } +} \ No newline at end of file diff --git a/customPlugin/oh-package.json5 b/customPlugin/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7c8255d53874fceb489cd38801d0331bd0cd9766 --- /dev/null +++ b/customPlugin/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "modelVersion": "5.0.5", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.21", + "@ohos/hamock": "1.0.0", + } +}