Browse Source

no message

xiaobai 1 month ago
parent
commit
eeab57698b
38 changed files with 597 additions and 57 deletions
  1. 1 1
      .gitignore
  2. 35 42
      lib/main.dart
  3. 0 8
      lib/pages/guide_page.dart
  4. 1 0
      lib/pages/my/vip/page/vip_buy_page.dart
  5. 1 3
      macos/Flutter/GeneratedPluginRegistrant.swift
  6. 20 0
      ohos/.gitignore
  7. 10 0
      ohos/AppScope/app.json5
  8. 16 0
      ohos/AppScope/resources/base/element/string.json
  9. BIN
      ohos/AppScope/resources/base/media/app_icon.png
  10. 52 0
      ohos/build-profile.json5
  11. 7 0
      ohos/entry/.gitignore
  12. 15 0
      ohos/entry/build-profile.json5
  13. 7 0
      ohos/entry/hvigorfile.ts
  14. 10 0
      ohos/entry/src/main/ets/entryability/EntryAbility.ets
  15. 24 0
      ohos/entry/src/main/ets/pages/Index.ets
  16. 68 0
      ohos/entry/src/main/module.json5
  17. 8 0
      ohos/entry/src/main/resources/base/element/color.json
  18. 16 0
      ohos/entry/src/main/resources/base/element/string.json
  19. BIN
      ohos/entry/src/main/resources/base/media/icon.png
  20. 8 0
      ohos/entry/src/main/resources/base/profile/buildinfo.json5
  21. 5 0
      ohos/entry/src/main/resources/base/profile/main_pages.json
  22. 16 0
      ohos/entry/src/main/resources/en_US/element/string.json
  23. 16 0
      ohos/entry/src/main/resources/zh_CN/element/string.json
  24. 35 0
      ohos/entry/src/ohosTest/ets/test/Ability.test.ets
  25. 5 0
      ohos/entry/src/ohosTest/ets/test/List.test.ets
  26. 48 0
      ohos/entry/src/ohosTest/ets/testability/TestAbility.ets
  27. 36 0
      ohos/entry/src/ohosTest/ets/testability/pages/Index.ets
  28. 50 0
      ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts
  29. 37 0
      ohos/entry/src/ohosTest/module.json5
  30. 8 0
      ohos/entry/src/ohosTest/resources/base/element/color.json
  31. 16 0
      ohos/entry/src/ohosTest/resources/base/element/string.json
  32. BIN
      ohos/entry/src/ohosTest/resources/base/media/icon.png
  33. 5 0
      ohos/entry/src/ohosTest/resources/base/profile/test_pages.json
  34. 6 0
      ohos/hvigor/hvigor-config.json5
  35. 4 0
      ohos/hvigorconfig.ts
  36. 8 0
      ohos/hvigorfile.ts
  37. 2 2
      pubspec.lock
  38. 1 1
      pubspec.yaml

+ 1 - 1
.gitignore

@@ -45,4 +45,4 @@ app.*.map.json
 /android/app/profile
 /android/app/release
 .gradle/
-/ohos/
+#/ohos/

+ 35 - 42
lib/main.dart

@@ -75,44 +75,37 @@ void main() async {
   // await SpUtil.getInstance();
   await SharedPrefsUtil.getInstance();
 
-  // Future.delayed(Duration(seconds: 1), () async {
-  //   // await SpUtil.getInstance();
-  //   await SharedPrefsUtil.getInstance();
-  // });
-
-  // await SharedPrefsUtil.getInstance();
-
-  // SystemChannels.lifecycle.setMessageHandler((msg) async {
-  //   Logger().d('SystemChannels> $msg');
-  //   /// msg是个字符串,是下面的值
-  //   /// AppLifecycleState.resumed
-  //   /// AppLifecycleState.inactive
-  //   /// AppLifecycleState.paused
-  //   /// AppLifecycleState.detached
-  //   if (msg == "AppLifecycleState.resumed") { //进入前台
-  //     Logger().d("===================== app进入前台 =====================");
-  //     AppEvent.getInstance()?.fire(AppEnterForegroundEvent());
-  //     if (AppService().getThemeMode() == 0) { //跟随系统
-  //       if (HexColor.isDarkMode != (PlatformDispatcher.instance.platformBrightness==Brightness.dark)) { //系统模式改变
-  //         HexColor.reload();
-  //         AC.reload();
-  //         Get.forceAppUpdate();
-  //         // ToastUtil.settingEasyLoading();
-  //       }
-  //     }
-  //   }
-  //   else if (msg == "AppLifecycleState.inactive") { //进入非活跃状态
-  //     Logger().d("===================== app进入非活跃状态 =====================");
-  //   }
-  //   else if (msg == "AppLifecycleState.paused") { //进入后台
-  //     Logger().d("===================== app进入后台 =====================");
-  //     AppEvent.getInstance()?.fire(AppPasswordLockEvent());
-  //   }
-  //   else if (msg == "AppLifecycleState.detached") { //app被杀死
-  //     Logger().d("===================== app被杀死 =====================");
-  //   }
-  //   return msg;
-  // });
+  SystemChannels.lifecycle.setMessageHandler((msg) async {
+    Logger().d('SystemChannels> $msg');
+    /// msg是个字符串,是下面的值
+    /// AppLifecycleState.resumed
+    /// AppLifecycleState.inactive
+    /// AppLifecycleState.paused
+    /// AppLifecycleState.detached
+    if (msg == "AppLifecycleState.resumed") { //进入前台
+      Logger().d("===================== app进入前台 =====================");
+      AppEvent.getInstance()?.fire(AppEnterForegroundEvent());
+      if (AppService().getThemeMode() == 0) { //跟随系统
+        if (HexColor.isDarkMode != (PlatformDispatcher.instance.platformBrightness==Brightness.dark)) { //系统模式改变
+          HexColor.reload();
+          AC.reload();
+          Get.forceAppUpdate();
+          // ToastUtil.settingEasyLoading();
+        }
+      }
+    }
+    else if (msg == "AppLifecycleState.inactive") { //进入非活跃状态
+      Logger().d("===================== app进入非活跃状态 =====================");
+    }
+    else if (msg == "AppLifecycleState.paused") { //进入后台
+      Logger().d("===================== app进入后台 =====================");
+      AppEvent.getInstance()?.fire(AppPasswordLockEvent());
+    }
+    else if (msg == "AppLifecycleState.detached") { //app被杀死
+      Logger().d("===================== app被杀死 =====================");
+    }
+    return msg;
+  });
   //
   // Duration delay;
   // DateTime now = DateTime.now();
@@ -243,10 +236,10 @@ class _MyAppState extends State<MyApp> {
   Widget build(BuildContext context) {
 
     // ///禁用横屏
-    // SystemChrome.setPreferredOrientations([
-    //   DeviceOrientation.portraitUp, //只能纵向
-    //   DeviceOrientation.portraitDown, //只能纵向
-    // ]);
+    SystemChrome.setPreferredOrientations([
+      DeviceOrientation.portraitUp, //只能纵向
+      DeviceOrientation.portraitDown, //只能纵向
+    ]);
     //
     // if (Platform.isAndroid) {
     //   /// 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。

+ 0 - 8
lib/pages/guide_page.dart

@@ -293,14 +293,6 @@ class _GuideState extends State<GuidePage> {
                           onTap: () {
                             if (index < 3) {
                               _pageController.animateToPage(index+1, duration: Duration(milliseconds: 500), curve: Curves.ease);
-
-                              if (index == 0) {
-                                ToastUtil.showMsg(UserService().getToken());
-                                SharedPrefsUtil.putString("xiaobai", "heiheihei");
-                              }
-                              if (index == 2) {
-                                TipsDialog.showDialog(title: SharedPrefsUtil.getString("xiaobai"));
-                              }
                             }
                             else {
                               _toMainPage();

+ 1 - 0
lib/pages/my/vip/page/vip_buy_page.dart

@@ -1258,6 +1258,7 @@ class _VipBuyState extends State<VipBuyPage>
     );
 
     _fluwx.addSubscriber((event) {
+      ToastUtil.showMsg(event.errCode.toString());
       if(event.errCode == 0) { //支付成功
         _updateUserInfo(true);
         _buyVipEventTracking();

+ 1 - 3
macos/Flutter/GeneratedPluginRegistrant.swift

@@ -18,11 +18,10 @@ import path_provider_foundation
 import photo_manager
 import share_plus
 import shared_preferences_foundation
-import sqflite_darwin
+import sqflite
 import url_launcher_macos
 import video_player_avfoundation
 import wakelock_macos
-import webview_flutter_wkwebview
 
 func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
   AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
@@ -42,5 +41,4 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
   UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
   FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
   WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
-  WebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "WebViewFlutterPlugin"))
 }

+ 20 - 0
ohos/.gitignore

@@ -0,0 +1,20 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+**/BuildProfile.ets
+**/oh-package-lock.json5
+/package.json
+/package-lock.json
+
+**/src/main/resources/rawfile/flutter_assets/
+**/libs/**/libapp.so
+**/libs/**/libflutter.so
+**/libs/**/libvmservice_snapshot.so

+ 10 - 0
ohos/AppScope/app.json5

@@ -0,0 +1,10 @@
+{
+  "app": {
+    "bundleName": "com.xjql.iquokka.hm",
+    "vendor": "example",
+    "versionCode": 1000000,
+    "versionName": "1.0.0",
+    "icon": "$media:app_icon",
+    "label": "$string:app_name"
+  }
+}

+ 16 - 0
ohos/AppScope/resources/base/element/string.json

@@ -0,0 +1,16 @@
+{
+  "string": [
+    {
+      "name": "app_name",
+      "value": "心境奇旅"
+    },
+    {
+      "name": "CAMERA",
+      "value": "心境奇旅将访问您的相机权限"
+    },
+    {
+      "name": "WRITE_IMAGEVIDEO",
+      "value": "心境奇旅将访问您的相册权限"
+    }
+  ]
+}

BIN
ohos/AppScope/resources/base/media/app_icon.png


+ 52 - 0
ohos/build-profile.json5

@@ -0,0 +1,52 @@
+{
+  "app": {
+    "signingConfigs": [
+      {
+        "name": "default",
+        "type": "HarmonyOS",
+        "material": {
+          "storeFile": "/Users/xiaobai/Desktop/FlutterAPP/Harmony/profile/p12/ohos.p12",
+          "storePassword": "0000001CF1FA3A50F733D98030CDD215F52D3D3E1C4CF6D4379166B0B065CF680D5260F76FF7C1EB0A74719B",
+          "keyAlias": "ohosAlias",
+          "keyPassword": "0000001CDEF2BF7DA3B32E4CB91CE7BDF40E0F741D376EFD8705CC0AA555CE4754FEE4F6B9DDC5946F053A41",
+          "signAlg": "SHA256withECDSA",
+          "profile": "/Users/xiaobai/Desktop/FlutterAPP/Harmony/profile/iquokka_release_profileRelease.p7b",
+          "certpath": "/Users/xiaobai/Desktop/FlutterAPP/Harmony/profile/iquokka_release.cer"
+        }
+      }
+    ],
+    "products": [
+      {
+        "name": "default",
+        "signingConfig": "default",
+        "compatibleSdkVersion": "5.0.0(12)",
+        "runtimeOS": "HarmonyOS",
+      }
+    ],
+    "buildModeSet": [
+      {
+        "name": "debug"
+      },
+      {
+        "name": "profile"
+      },
+      {
+        "name": "release"
+      }
+    ]
+  },
+  "modules": [
+    {
+      "name": "entry",
+      "srcPath": "./entry",
+      "targets": [
+        {
+          "name": "default",
+          "applyToProducts": [
+            "default"
+          ]
+        }
+      ]
+    }
+  ]
+}

+ 7 - 0
ohos/entry/.gitignore

@@ -0,0 +1,7 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
+GeneratedPluginRegistrant.ets

+ 15 - 0
ohos/entry/build-profile.json5

@@ -0,0 +1,15 @@
+
+{
+  "apiType": 'stageMode',
+  "buildOption": {
+  },
+  "targets": [
+    {
+      "name": "default",
+      "runtimeOS": "HarmonyOS"
+    },
+    {
+      "name": "ohosTest",
+    }
+  ]
+}

+ 7 - 0
ohos/entry/hvigorfile.ts

@@ -0,0 +1,7 @@
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+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. */
+}

+ 10 - 0
ohos/entry/src/main/ets/entryability/EntryAbility.ets

@@ -0,0 +1,10 @@
+
+import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos';
+import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant';
+
+export default class EntryAbility extends FlutterAbility {
+  configureFlutterEngine(flutterEngine: FlutterEngine) {
+    super.configureFlutterEngine(flutterEngine)
+    GeneratedPluginRegistrant.registerWith(flutterEngine)
+  }
+}

+ 24 - 0
ohos/entry/src/main/ets/pages/Index.ets

@@ -0,0 +1,24 @@
+
+import common from '@ohos.app.ability.common';
+import { FlutterPage } from '@ohos/flutter_ohos'
+
+let storage = LocalStorage.getShared()
+const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS'
+
+@Entry(storage)
+@Component
+struct Index {
+  private context = getContext(this) as common.UIAbilityContext
+  @LocalStorageLink('viewId') viewId: string = "";
+
+  build() {
+    Column() {
+      FlutterPage({ viewId: this.viewId })
+    }
+  }
+
+  onBackPress(): boolean {
+    this.context.eventHub.emit(EVENT_BACK_PRESS)
+    return true
+  }
+}

+ 68 - 0
ohos/entry/src/main/module.json5

@@ -0,0 +1,68 @@
+
+{
+  "module": {
+    "name": "entry",
+    "type": "entry",
+    "description": "$string:module_desc",
+    "mainElement": "EntryAbility",
+    "deviceTypes": [
+      "phone"
+    ],
+    "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:icon",
+        "startWindowBackground": "$color:start_window_background",
+        "exported": true,
+        "skills": [
+          {
+            "entities": [
+              "entity.system.home"
+            ],
+            "actions": [
+              "action.system.home"
+            ]
+          }
+        ]
+      }
+    ],
+    "querySchemes": [
+      "weixin",
+      "wxopensdk",
+    ],
+    "requestPermissions": [
+      {"name" :  "ohos.permission.INTERNET"},
+      {
+        "name": "ohos.permission.CAMERA",
+        "reason": "$string:CAMERA",
+        "usedScene": {
+          "abilities": ["EntryAbility"],
+          "when": "inuse"
+        }
+      },
+//      {
+//        "name": "ohos.permission.READ_IMAGEVIDEO",
+//        "reason": "$string:WRITE_IMAGEVIDEO",
+//        "usedScene": {
+//          "abilities": ["EntryAbility"],
+//          "when": "inuse"
+//        }
+//      },
+//      {
+//        "name": "ohos.permission.WRITE_IMAGEVIDEO",
+//        "reason": "$string:WRITE_IMAGEVIDEO",
+//        "usedScene": {
+//          "abilities": ["EntryAbility"],
+//          "when": "inuse"
+//        }
+//      }
+    ]
+  }
+}

+ 8 - 0
ohos/entry/src/main/resources/base/element/color.json

@@ -0,0 +1,8 @@
+{
+  "color": [
+    {
+      "name": "start_window_background",
+      "value": "#FFFFFF"
+    }
+  ]
+}

+ 16 - 0
ohos/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": "心境奇旅"
+    }
+  ]
+}

BIN
ohos/entry/src/main/resources/base/media/icon.png


+ 8 - 0
ohos/entry/src/main/resources/base/profile/buildinfo.json5

@@ -0,0 +1,8 @@
+{
+  "string": [
+    {
+      "name": "enable_impeller",
+      "value": "true"
+    }
+  ]
+}

+ 5 - 0
ohos/entry/src/main/resources/base/profile/main_pages.json

@@ -0,0 +1,5 @@
+{
+  "src": [
+    "pages/Index"
+  ]
+}

+ 16 - 0
ohos/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": "心境奇旅"
+    }
+  ]
+}

+ 16 - 0
ohos/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": "心境奇旅"
+    }
+  ]
+}

+ 35 - 0
ohos/entry/src/ohosTest/ets/test/Ability.test.ets

@@ -0,0 +1,35 @@
+import hilog from '@ohos.hilog';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+export default function abilityTest() {
+  describe('ActsAbilityTest', function () {
+    // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+    beforeAll(function () {
+      // 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(function () {
+      // 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(function () {
+      // 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(function () {
+      // 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, function () {
+      // 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)
+    })
+  })
+}

+ 5 - 0
ohos/entry/src/ohosTest/ets/test/List.test.ets

@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test'
+
+export default function testsuite() {
+  abilityTest()
+}

+ 48 - 0
ohos/entry/src/ohosTest/ets/testability/TestAbility.ets

@@ -0,0 +1,48 @@
+import UIAbility from '@ohos.app.ability.UIAbility';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+import hilog from '@ohos.hilog';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../test/List.test';
+import window from '@ohos.window';
+
+export default class TestAbility extends UIAbility {
+    onCreate(want, launchParam) {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
+        hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
+        hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
+        var abilityDelegator: any
+        abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+        var abilityDelegatorArguments: any
+        abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+        hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
+        Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+    }
+
+    onDestroy() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
+    }
+
+    onWindowStageCreate(windowStage: window.WindowStage) {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
+        windowStage.loadContent('testability/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() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
+    }
+
+    onForeground() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
+    }
+
+    onBackground() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
+    }
+}

+ 36 - 0
ohos/entry/src/ohosTest/ets/testability/pages/Index.ets

@@ -0,0 +1,36 @@
+
+
+import hilog from '@ohos.hilog';
+
+@Entry
+@Component
+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%')
+   }
+ }

+ 50 - 0
ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts

@@ -0,0 +1,50 @@
+
+import hilog from '@ohos.hilog';
+import TestRunner from '@ohos.application.testRunner';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+
+var abilityDelegator = undefined
+var abilityDelegatorArguments = undefined
+
+async function onAbilityCreateCallback() {
+    hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
+}
+
+async function addAbilityMonitorCallback(err: any) {
+    hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
+}
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+    constructor() {
+    }
+
+    onPrepare() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
+    }
+
+    async onRun() {
+        hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
+        abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+        abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+        var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
+        let lMonitor = {
+            abilityName: testAbilityName,
+            onAbilityCreate: onAbilityCreateCallback,
+        };
+        abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
+        var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
+        var debug = abilityDelegatorArguments.parameters['-D']
+        if (debug == 'true')
+        {
+            cmd += ' -D'
+        }
+        hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
+        abilityDelegator.executeShellCommand(cmd,
+            (err: any, d: any) => {
+                hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
+                hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
+                hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
+            })
+        hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
+    }
+}

+ 37 - 0
ohos/entry/src/ohosTest/module.json5

@@ -0,0 +1,37 @@
+
+{
+  "module": {
+    "name": "entry_test",
+    "type": "feature",
+    "description": "$string:module_test_desc",
+    "mainElement": "TestAbility",
+    "deviceTypes": [
+      "phone"
+    ],
+    "deliveryWithInstall": true,
+    "installationFree": false,
+    "pages": "$profile:test_pages",
+    "abilities": [
+      {
+        "name": "TestAbility",
+        "srcEntry": "./ets/testability/TestAbility.ets",
+        "description": "$string:TestAbility_desc",
+        "icon": "$media:icon1",
+        "label": "$string:TestAbility_label",
+        "exported": true,
+        "startWindowIcon": "$media:icon1",
+        "startWindowBackground": "$color:start_window_background",
+        "skills": [
+          {
+            "actions": [
+              "action.system.home"
+            ],
+            "entities": [
+              "entity.system.home"
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}

+ 8 - 0
ohos/entry/src/ohosTest/resources/base/element/color.json

@@ -0,0 +1,8 @@
+{
+  "color": [
+    {
+      "name": "start_window_background",
+      "value": "#FFFFFF"
+    }
+  ]
+}

+ 16 - 0
ohos/entry/src/ohosTest/resources/base/element/string.json

@@ -0,0 +1,16 @@
+{
+  "string": [
+    {
+      "name": "module_test_desc",
+      "value": "test ability description"
+    },
+    {
+      "name": "TestAbility_desc",
+      "value": "the test ability"
+    },
+    {
+      "name": "TestAbility_label",
+      "value": "test label"
+    }
+  ]
+}

BIN
ohos/entry/src/ohosTest/resources/base/media/icon.png


+ 5 - 0
ohos/entry/src/ohosTest/resources/base/profile/test_pages.json

@@ -0,0 +1,5 @@
+{
+  "src": [
+    "testability/pages/Index"
+  ]
+}

+ 6 - 0
ohos/hvigor/hvigor-config.json5

@@ -0,0 +1,6 @@
+
+{ 
+  "modelVersion": "5.0.0",
+  "dependencies": {
+  }
+}

+ 4 - 0
ohos/hvigorconfig.ts

@@ -0,0 +1,4 @@
+import path from 'path'
+import { injectNativeModules } from 'flutter-hvigor-plugin';
+
+injectNativeModules(__dirname, path.dirname(__dirname))

+ 8 - 0
ohos/hvigorfile.ts

@@ -0,0 +1,8 @@
+import path from 'path'
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+import { flutterHvigorPlugin } from 'flutter-hvigor-plugin';
+
+export default {
+    system: appTasks,  /* Built-in plugin of Hvigor. It cannot be modified. */
+    plugins:[flutterHvigorPlugin(path.dirname(__dirname))]         /* Custom plugin to extend the functionality of Hvigor. */
+}

+ 2 - 2
pubspec.lock

@@ -443,10 +443,10 @@ packages:
     dependency: "direct main"
     description:
       name: flutter_draggable_gridview
-      sha256: "1b4b2ef5c0f6710a456ef75b69381a865c0d1ac8ca22ebc16f068c591dddf12f"
+      sha256: "907c24819845a546f50c935e7e5e67e1ff7b89a5c48fa39ddf7652403e5bc668"
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "0.0.13"
+    version: "0.0.14"
   flutter_html:
     dependency: "direct main"
     description:

+ 1 - 1
pubspec.yaml

@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 
 
-version: 1.16.6+175
+version: 1.17.0+186
 
 environment:
   sdk: ">=3.1.5 <4.0.0"