diff --git a/CHANGELOG.md b/CHANGELOG.md index 07ff3c3872fae065624dc66d0e83b2e75c3fcd76..ed463040791a940758519702751e482aea9a5a6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0 + +1.适配DevEco Studio:3.1Release(4.0.3.411), SDK:API10 Release(4.0.10.2) +2.包管理工具由npm切换成ohpm ## 1.0.3 - 适配DevEco Studio 3.1Beta1及以上版本。 diff --git a/OAT.xml b/OAT.xml index be5485b7a49d50b26deed1e0b29bf0690aebb6b1..7556372d4233bb0842e38a156b97392ae071c902 100644 --- a/OAT.xml +++ b/OAT.xml @@ -4,12 +4,58 @@ + + + + + + + + + + + + + diff --git a/README.md b/README.md index 05dbaf15880ef2ea6ff6bfddb5f0a4fac5a0c316..fc5234a7ed449746e637c2717fda885ed609ba1c 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,9 @@ ## 下载安装 ```shell -npm install @ohos/circleimageview --save +ohpm install @ohos/circleimageview --save ``` -OpenHarmony npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) 。 - +OpenHarmony ohpm 环境配置等更多内容,请参考 如何安装 OpenHarmony ohpm 包 https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_har_usage.md ## 使用说明 ### CircleImageView引用及使用 @@ -55,7 +54,7 @@ import { CircleImageView } from '@ohos/circleimageview'; ## 约束与限制 - [DevEco Studio版本](https://developer.harmonyos.com/cn/develop/deveco-studio#download):DevEco Studio 3.1Beta1。 -- OpenHarmony SDK版本:API version 9。 +- OpenHarmony SDK版本:API version 10。 ## 目录结构 ```` diff --git a/build-profile.json5 b/build-profile.json5 index 50cc3a70c50d626a2270cc0e8771fb3997c3f596..ad52764d5394590b01728dcc750a4b61ba6eff1c 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,12 +1,14 @@ { "app": { - "signingConfigs": [], - "compileSdkVersion": 9, - "compatibleSdkVersion": 9, + "signingConfigs": [ + ], "products": [ { "name": "default", - "signingConfig": "default", + "signingConfig": "debug_default", + "compileSdkVersion": 10, + "compatibleSdkVersion": 10, + "runtimeOS": "OpenHarmony" } ] }, diff --git a/circleimageview/.gitignore b/circleimageview/.gitignore index 5a6ba80fa3d9498a23ae8ae7d9518f8743fa8a96..e2713a2779c5a3e0eb879efe6115455592caeea5 100644 --- a/circleimageview/.gitignore +++ b/circleimageview/.gitignore @@ -1,4 +1,6 @@ /node_modules +/oh_modules /.preview /build -/.cxx \ No newline at end of file +/.cxx +/.test \ No newline at end of file diff --git a/circleimageview/index.ets b/circleimageview/index.ets index b2c4693e625b402bafab95847c0f88b3d008ca8e..f44afa1a88e74966567891abbe4863709b6cff50 100644 --- a/circleimageview/index.ets +++ b/circleimageview/index.ets @@ -13,4 +13,3 @@ * limitations under the License. */ export { default as CircleImageView } from './src/main/ets/components/MainPage/CircleImageView' - diff --git a/circleimageview/package.json b/circleimageview/oh-package.json5 similarity index 100% rename from circleimageview/package.json rename to circleimageview/oh-package.json5 diff --git a/circleimageview/src/main/module.json5 b/circleimageview/src/main/module.json5 index 7ae876a1f53080a3cb4c089a3000ec89d0af37be..e952168e1665000de549fc7d56bb2005bf0f0530 100644 --- a/circleimageview/src/main/module.json5 +++ b/circleimageview/src/main/module.json5 @@ -3,8 +3,7 @@ "name": "circleimageview", "type": "har", "deviceTypes": [ - "default", - "tablet" + "default" ] } } diff --git a/entry/.gitignore b/entry/.gitignore index 5a6ba80fa3d9498a23ae8ae7d9518f8743fa8a96..e2713a2779c5a3e0eb879efe6115455592caeea5 100644 --- a/entry/.gitignore +++ b/entry/.gitignore @@ -1,4 +1,6 @@ /node_modules +/oh_modules /.preview /build -/.cxx \ No newline at end of file +/.cxx +/.test \ No newline at end of file diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index f8f03407f77914b43168aeca6bb0929efd6700b4..7dc37bb919dada5132609c409200db266559004f 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -4,7 +4,7 @@ }, "targets": [ { - "name": "default" + "name": "default", }, { "name": "ohosTest", diff --git a/entry/package.json b/entry/oh-package.json5 similarity index 85% rename from entry/package.json rename to entry/oh-package.json5 index edb5e55946afab4ae3be07904e42f19e4a129526..54584d92f161376cf0b3458df6d3ed8eb7073b86 100644 --- a/entry/package.json +++ b/entry/oh-package.json5 @@ -1,6 +1,7 @@ { "license": "Apache License 2.0", "devDependencies": {}, + "author": "", "name": "entry", "ohos": { "org": "huawei", @@ -8,8 +9,9 @@ "buildTool": "hvigor" }, "description": "example description", + "main": "", "repository": {}, - "version": "1.0.3", + "version": "2.0.0", "dependencies": { "@ohos/circleimageview": "file:../circleimageview" } diff --git a/entry/src/main/ets/entryability/EntryAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts index 9a625d6f62c7ae08244600d1751b86f3ae99d7ed..7f47570973234fc3ea88d734445e5e38495d7a46 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ts +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -12,46 +12,46 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import UIAbility from '@ohos.app.ability.UIAbility'; import hilog from '@ohos.hilog'; import window from '@ohos.window'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); - globalThis.abilityWant = want; - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - - windowStage.loadContent('pages/Index', (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() { - // Main window is destroyed, release UI related resources - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); - } - - onForeground() { - // Ability has brought to foreground - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); - } - - onBackground() { - // Ability has back to background - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); - } + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + globalThis.abilityWant = want; + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (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() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } } diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index b46de68d13d5e1b54242a72d735f75126ae00674..c243e10db386020c083c0274d106e51a0a39bed8 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -6,13 +6,6 @@ "mainElement": "EntryAbility", "deviceTypes": [ "default", - "tablet" - ], - "metadata": [ - { - "name":"ArkTSPartialUpdate", - "value": "true" - } ], "deliveryWithInstall": true, "installationFree": false, @@ -20,13 +13,13 @@ "abilities": [ { "name": "EntryAbility", - "srcEntrance": "./ets/entryability/EntryAbility.ts", + "srcEntry": "./ets/entryability/EntryAbility.ts", "description": "$string:EntryAbility_desc", "icon": "$media:icon", "label": "$string:EntryAbility_label", "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background", - "visible": true, + "exported": true, "skills": [ { "entities": [ diff --git a/entry/src/ohosTest/ets/TestAbility/TestAbility.ets b/entry/src/ohosTest/ets/TestAbility/TestAbility.ets index 4e0a7ec1852f9226294308e4bc0f47adc2d48d5b..63b809e424e9b75401c9a32cf2160f145e1fb902 100644 --- a/entry/src/ohosTest/ets/TestAbility/TestAbility.ets +++ b/entry/src/ohosTest/ets/TestAbility/TestAbility.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import UIAbility from '@ohos.app.ability.UIAbility'; import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; import hilog from '@ohos.hilog'; diff --git a/entry/src/ohosTest/ets/TestAbility/pages/index.ets b/entry/src/ohosTest/ets/TestAbility/pages/index.ets index 8c3a73ee0e81e2a66e0ba21d4caef73334c4a9d3..1b44aa8339ba28d35af3c3899dcd0e8efa85345a 100644 --- a/entry/src/ohosTest/ets/TestAbility/pages/index.ets +++ b/entry/src/ohosTest/ets/TestAbility/pages/index.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import hilog from '@ohos.hilog'; @Entry @@ -21,29 +21,29 @@ struct Index { aboutToAppear() { hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts index 1d124edb5065067483f8f37c0d0f7e191a23de40..3b453c0114921899b6c7aef07e76bcc36928e5ce 100644 --- a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import hilog from '@ohos.hilog'; import TestRunner from '@ohos.application.testRunner'; import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index 5cddd9fac8f9fbf6a6defec4a7bab9dee76f52a3..c5767a5830e22e85288e24acb79493f14cb8d318 100644 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import hilog from '@ohos.hilog'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' diff --git a/entry/src/ohosTest/ets/test/List.test.ets b/entry/src/ohosTest/ets/test/List.test.ets index e4cbcc148ecae8c61bd60c526604b0f1352d7851..3f879556b7c2c3f8f921258d77836c632b93318b 100644 --- a/entry/src/ohosTest/ets/test/List.test.ets +++ b/entry/src/ohosTest/ets/test/List.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import abilityTest from './Ability.test' export default function testsuite() { diff --git a/entry/src/ohosTest/module.json5 b/entry/src/ohosTest/module.json5 index 476d15376f43323426498a79fb3d58a658a27a56..a3f016d6067d86eec994a04e9af8d2de876b16a5 100644 --- a/entry/src/ohosTest/module.json5 +++ b/entry/src/ohosTest/module.json5 @@ -6,7 +6,6 @@ "mainElement": "TestAbility", "deviceTypes": [ "default", - "tablet" ], "deliveryWithInstall": true, "installationFree": false, @@ -14,11 +13,11 @@ "abilities": [ { "name": "TestAbility", - "srcEntrance": "./ets/testability/TestAbility.ets", + "srcEntry": "./ets/testability/TestAbility.ets", "description": "$string:TestAbility_desc", "icon": "$media:icon", "label": "$string:TestAbility_label", - "visible": true, + "exported": true, "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background", "skills": [ diff --git a/hvigorw b/hvigorw new file mode 100644 index 0000000000000000000000000000000000000000..54aadd226b453397860013d328fd01031648fc31 --- /dev/null +++ b/hvigorw @@ -0,0 +1,48 @@ +#!/bin/bash + +# ---------------------------------------------------------------------------- +# Hvigor startup script, version 1.0.0 +# +# Required ENV vars: +# ------------------ +# NODE_HOME - location of a Node home dir +# or +# Add /usr/local/nodejs/bin to the PATH environment variable +# ---------------------------------------------------------------------------- + +HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) +HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js +warn() { + echo "" + echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +error() { + echo "" + echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +fail() { + error "$@" + exit 1 +} + +# Determine node to start hvigor wrapper script +if [ -n "${NODE_HOME}" ];then + EXECUTABLE_NODE="${NODE_HOME}/bin/node" + if [ ! -x "$EXECUTABLE_NODE" ];then + fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" + fi +else + EXECUTABLE_NODE="node" + which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" +fi + +# Check hvigor wrapper script +if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then + fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" +fi + +# start hvigor-wrapper script +exec "${EXECUTABLE_NODE}" \ + "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/hvigorw.bat b/hvigorw.bat new file mode 100644 index 0000000000000000000000000000000000000000..6861293e47dfd0186da380321b73be9033507e24 --- /dev/null +++ b/hvigorw.bat @@ -0,0 +1,64 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Hvigor startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js +set NODE_EXE=node.exe + +goto start + +:start +@rem Find node.exe +if defined NODE_HOME goto findNodeFromNodeHome + +%NODE_EXE% --version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:findNodeFromNodeHome +set NODE_HOME=%NODE_HOME:"=% +set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% + +if exist "%NODE_EXE_PATH%" goto execute +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:execute +@rem Execute hvigor +"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* + +if "%ERRORLEVEL%" == "0" goto hvigorwEnd + +:fail +exit /b 1 + +:hvigorwEnd +if "%OS%" == "Windows_NT" endlocal + +:end diff --git a/package.json b/oh-package.json5 similarity index 57% rename from package.json rename to oh-package.json5 index 840ba9104de2b7efa480ce333941760b5cb848de..2142a7139274028bb9c005558b259096f144bd85 100644 --- a/package.json +++ b/oh-package.json5 @@ -1,6 +1,9 @@ { "license": "Apache License 2.0", - "devDependencies": {}, + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "author": "", "name": "circleimageview", "ohos": { "org": "huawei", @@ -8,11 +11,8 @@ "buildTool": "hvigor" }, "description": "example description", + "main": "", "repository": {}, - "version": "1.0.3", - "dependencies": { - "@ohos/hypium": "1.0.2", - "@ohos/hvigor-ohos-plugin": "1.4.0", - "@ohos/hvigor": "1.4.0" - } + "version": "2.0.0", + "dependencies": {} }