Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* Update plugin structure for OpenHarmony #301

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/flutter_image_compress/example/ohos/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ entry/libs/arm64-v8a/libapp.so
entry/libs/arm64-v8a/libflutter.so
entry/libs/arm64-v8a/libvmservice_snapshot.so
entry/src/main/resources/rawfile/flutter_assets/
har/flutter.har
har/*.har
oh-package-lock.json5
dta
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

{
"app": {
"signingConfigs": [],
Expand All @@ -22,7 +7,7 @@
"signingConfig": "default",
"compileSdkVersion": "4.1.0(11)",
"compatibleSdkVersion": "4.1.0(11)",
"runtimeOS": "HarmonyOS",
"runtimeOS": "HarmonyOS"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
name: 'entry',
version: '1.0.0',
description: 'Please describe the basic information.',
main: '',
author: '',
license: '',
dependencies: {
'@ohos/path_provider_ohos': 'file:./har/path_provider_ohos.har',
'@ohos/flutter_image_compress_ohos': 'file:./har/flutter_image_compress_ohos.har',
},
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {
"path_provider_ohos": "file:../har/path_provider_ohos.har",
"flutter_image_compress_ohos": "file:../har/flutter_image_compress_ohos.har"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<FlutterPlugin>;
plugins.forEach((plugin) => {
this.addPlugin(plugin);
})
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import { FlutterPlugin } from '@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/FlutterPlugin';
import List from '@ohos.util.List';
import FlutterImageCompressOhosPlugin from '@ohos/flutter_image_compress_ohos'
import PathProviderPlugin from '@ohos/path_provider_ohos'
import { FlutterEngine, Log } from '@ohos/flutter_ohos';
import FlutterImageCompressOhosPlugin from 'flutter_image_compress_ohos';
import PathProviderPlugin from 'path_provider_ohos';

/**
* 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<FlutterPlugin> {
let pluginList : List<FlutterPlugin> = new List();
pluginList.add(new FlutterImageCompressOhosPlugin());
pluginList.add(new PathProviderPlugin());
return pluginList;

static registerWith(flutterEngine: FlutterEngine) {
try {
flutterEngine.getPlugins()?.add(new FlutterImageCompressOhosPlugin());
flutterEngine.getPlugins()?.add(new PathProviderPlugin());
} catch (e) {
Log.e(
TAG,
"Tried to register plugins with FlutterEngine ("
+ flutterEngine
+ ") failed.");
Log.e(TAG, "Received exception while registering", e);
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading