diff --git a/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets index e4b95b43797af4425182bcd15654061d26c8baf6..a00049282e93c69f1b3dcd987538024f47e40ace 100644 --- a/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets +++ b/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -14,17 +14,12 @@ */ import { FlutterAbility } from '@ohos/flutter_ohos' -import { FlutterPlugin } from '@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/FlutterPlugin'; import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; -import List from '@ohos.util.List'; import FlutterEngine from '@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterEngine'; export default class EntryAbility extends FlutterAbility { configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) - let plugins = GeneratedPluginRegistrant.getPlugins() as List; - plugins.forEach((plugin) => { - this.addPlugin(plugin); - }) + GeneratedPluginRegistrant.registerWith(flutterEngine) } } diff --git a/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets index 2131f1f507fed5a6cf54e398e6a66179ee99e27e..54e0fbfe0881f6f0225285b2cfd9ac5529028791 100644 --- a/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +++ b/packages/share_plus/share_plus/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -13,17 +13,28 @@ * limitations under the License. */ -import { FlutterPlugin } from '@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/FlutterPlugin'; -import List from '@ohos.util.List'; +import FlutterEngine from '@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterEngine'; +import Log from '@ohos/flutter_ohos/src/main/ets/util/Log'; /** * Generated file. Do not edit. * This file is generated by the Flutter tool based on the * plugins that support the Ohos platform. */ + +const TAG = "GeneratedPluginRegistrant"; + export class GeneratedPluginRegistrant { - static getPlugins(): List { - let pluginList : List = new List(); - return pluginList; + + static registerWith(flutterEngine: FlutterEngine) { + try { + } catch (e) { + Log.e( + TAG, + "Tried to register plugins with FlutterEngine (" + + flutterEngine + + ") failed."); + Log.e(TAG, "Received exception while registering", e); + } } } diff --git a/packages/share_plus/share_plus/example/pubspec.yaml b/packages/share_plus/share_plus/example/pubspec.yaml index 6fbec945b7f23a9af7dc3ec36b55e08ec06bdffc..e8cc241bd61a693026ddf35620ebbd77461dfd70 100644 --- a/packages/share_plus/share_plus/example/pubspec.yaml +++ b/packages/share_plus/share_plus/example/pubspec.yaml @@ -5,7 +5,10 @@ dependencies: flutter: sdk: flutter share_plus: - path: ../ + git: + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + ref: master + path: packages/share_plus/share_plus image_picker: git: url: https://gitee.com/openharmony-sig/flutter_packages.git diff --git a/packages/share_plus/share_plus/ohos/.gitignore b/packages/share_plus/share_plus/ohos/.gitignore index 15d49a1077517d4318da6899499083809ad5b200..5a32e550ad39c50064f61410de0cd82377d19c43 100644 --- a/packages/share_plus/share_plus/ohos/.gitignore +++ b/packages/share_plus/share_plus/ohos/.gitignore @@ -13,4 +13,3 @@ share_plus/libs/arm64-v8a/libapp.so share_plus/libs/arm64-v8a/libflutter.so share_plus/libs/arm64-v8a/libvmservice_snapshot.so share_plus/src/main/resources/rawfile/flutter_assets/ -har/flutter.har diff --git a/packages/share_plus/share_plus/ohos/oh-package.json5 b/packages/share_plus/share_plus/ohos/oh-package.json5 index 4d21c58a876104e118ab5b1e79ff337c8018ca89..ed8fc868a050ac673c5511b5c8b7fd896673725e 100644 --- a/packages/share_plus/share_plus/ohos/oh-package.json5 +++ b/packages/share_plus/share_plus/ohos/oh-package.json5 @@ -21,7 +21,6 @@ "author": "", "license": "", "dependencies": { - "@ohos/flutter_ohos": "file:./har/flutter.har" }, "devDependencies": { "@ohos/hypium": "1.0.6" diff --git a/packages/share_plus/share_plus/ohos/share_plus/BuildProfile.ets b/packages/share_plus/share_plus/ohos/share_plus/BuildProfile.ets index 7137b1440075f42f321166590f40bf3ce3e0c764..a564006636097a2b823d8d610a61e26f3112ad65 100644 --- a/packages/share_plus/share_plus/ohos/share_plus/BuildProfile.ets +++ b/packages/share_plus/share_plus/ohos/share_plus/BuildProfile.ets @@ -15,6 +15,6 @@ export default class BuildProfile { static readonly HAR_VERSION = '1.0.0'; - static readonly BUILD_MODE_NAME = 'debug'; + static readonly BUILD_MODE_NAME = 'release'; static readonly DEBUG = true; } \ No newline at end of file diff --git a/packages/share_plus/share_plus/ohos/share_plus/oh-package.json5 b/packages/share_plus/share_plus/ohos/share_plus/oh-package.json5 index 9a6d07cb00dd6a8194de6f94c5927c63efad9867..5fa924d5eefa90b0a87b97da089ef0a805c2665b 100644 --- a/packages/share_plus/share_plus/ohos/share_plus/oh-package.json5 +++ b/packages/share_plus/share_plus/ohos/share_plus/oh-package.json5 @@ -20,6 +20,7 @@ "main": "index.ets", "author": "", "license": "Apache-2.0", - "devDependencies": { + "dependencies": { + "@ohos/flutter_ohos": "file:./har/flutter.har" } } diff --git a/packages/share_plus/share_plus/ohos/share_plus/src/main/ets/dev/fluttercommunity/plus/share/MethodChannelHandlerImpl.ets b/packages/share_plus/share_plus/ohos/share_plus/src/main/ets/dev/fluttercommunity/plus/share/MethodChannelHandlerImpl.ets index 548c59bbc5b3c9c0d58c6191fdebc75e0ff78469..8aba6b32aa49a747b55c419c036d9e63046a7d8b 100644 --- a/packages/share_plus/share_plus/ohos/share_plus/src/main/ets/dev/fluttercommunity/plus/share/MethodChannelHandlerImpl.ets +++ b/packages/share_plus/share_plus/ohos/share_plus/src/main/ets/dev/fluttercommunity/plus/share/MethodChannelHandlerImpl.ets @@ -31,7 +31,7 @@ export default class MethodCallHandlerImpl implements MethodCallHandler { Log.i(TAG, "onMethodCall step in"); let method: string = call.method; Log.i(TAG, "Received '" + method + "' message."); - const isWithResult = call.method.endsWith('WithResult'); + const isWithResult: boolean = call.method.endsWith('WithResult'); try { switch (method) { case 'shareUri': diff --git a/packages/share_plus/share_plus/pubspec.yaml b/packages/share_plus/share_plus/pubspec.yaml index 0ccdbafd6680195dc2faa0d8ca19fb9c79aed9e3..31c670685c9dedd6dcb7253033baa960b894f1d6 100644 --- a/packages/share_plus/share_plus/pubspec.yaml +++ b/packages/share_plus/share_plus/pubspec.yaml @@ -36,7 +36,10 @@ dependencies: flutter_web_plugins: sdk: flutter share_plus_platform_interface: - path: ../share_plus_platform_interface + git: + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + ref: master + path: packages/share_plus/share_plus_platform_interface file: ">=6.1.4 <8.0.0" url_launcher_web: ^2.0.16 url_launcher_windows: ^3.0.6