-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from zhangruiyu/ohos
Ohos支持
- Loading branch information
Showing
51 changed files
with
1,184 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/node_modules | ||
/oh_modules | ||
/local.properties | ||
/.idea | ||
**/build | ||
/.hvigor | ||
.cxx | ||
/.clangd | ||
/.clang-format | ||
/.clang-tidy | ||
**/.test | ||
*.har | ||
**/BuildProfile.ets | ||
**/oh-package-lock.json5 | ||
|
||
**/src/main/resources/rawfile/flutter_assets/ | ||
**/libs/arm64-v8a/libapp.so | ||
**/libs/arm64-v8a/libflutter.so | ||
**/libs/arm64-v8a/libvmservice_snapshot.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=https://ohpm.openharmony.cn/ohpm/,https://artifact.bytedance.com/repository/byted-ohpm/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"app": { | ||
"bundleName": "com.pure.woodenfish.next", | ||
"vendor": "example", | ||
"versionCode": 4, | ||
"versionName": "1.0.4", | ||
"icon": "$media:app_icon", | ||
"label": "$string:app_name" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"string": [ | ||
{ | ||
"name": "app_name", | ||
"value": "example" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"app": { | ||
"signingConfigs": [ | ||
{ | ||
"name": "default", | ||
"type": "HarmonyOS", | ||
"material": { | ||
"certpath": "/Users/housemao/.ohos/config/default_ohos_nqAToKei4RqYzVE_W0Qrtmgpl2bZulOSs9f_TUqDO8o=.cer", | ||
"storePassword": "0000001B6DA162590C5A9FC04251F74F7B849886605913978E14D4A617300CC2DC5380DDD0AF50CB93C5DA", | ||
"keyAlias": "debugKey", | ||
"keyPassword": "0000001B4BB625CF5EDA5D263BEDB85069F698A8A89D55B8A3F4E15F0AE3177C47F6FFF33FC2A31F138535", | ||
"profile": "/Users/housemao/.ohos/config/default_ohos_nqAToKei4RqYzVE_W0Qrtmgpl2bZulOSs9f_TUqDO8o=.p7b", | ||
"signAlg": "SHA256withECDSA", | ||
"storeFile": "/Users/housemao/.ohos/config/default_ohos_nqAToKei4RqYzVE_W0Qrtmgpl2bZulOSs9f_TUqDO8o=.p12" | ||
} | ||
} | ||
], | ||
"products": [ | ||
{ | ||
"name": "default", | ||
"signingConfig": "default", | ||
"compatibleSdkVersion": "5.0.0(12)", | ||
"runtimeOS": "HarmonyOS", | ||
"buildOption": { | ||
"strictMode": { | ||
"useNormalizedOHMUrl": true | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"modules": [ | ||
{ | ||
"name": "entry", | ||
"srcPath": "./entry", | ||
"targets": [ | ||
{ | ||
"name": "default", | ||
"applyToProducts": [ | ||
"default" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "flutter_unionad", | ||
"srcPath": "../../ohos", | ||
"targets": [ | ||
{ | ||
"name": "default", | ||
"applyToProducts": [ | ||
"default" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
/node_modules | ||
/oh_modules | ||
/.preview | ||
/build | ||
/.cxx | ||
/.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
{ | ||
"apiType": 'stageMode', | ||
"buildOption": { | ||
}, | ||
"targets": [ | ||
{ | ||
"name": "default", | ||
"runtimeOS": "HarmonyOS" | ||
}, | ||
{ | ||
"name": "ohosTest", | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. | ||
export { hapTasks } from '@ohos/hvigor-ohos-plugin'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "entry", | ||
"version": "1.0.0", | ||
"description": "Please describe the basic information.", | ||
"main": "", | ||
"author": "", | ||
"license": "", | ||
"dependencies": { | ||
"flutter_unionad": "file:../har/flutter_unionad.har" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
example/ohos/entry/src/main/ets/entryability/EntryAbility.ets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
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 | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { FlutterEngine, Log } from '@ohos/flutter_ohos'; | ||
import FlutterUnionadPlugin from 'flutter_unionad'; | ||
|
||
/** | ||
* 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 registerWith(flutterEngine: FlutterEngine) { | ||
try { | ||
flutterEngine.getPlugins()?.add(new FlutterUnionadPlugin()); | ||
} catch (e) { | ||
Log.e( | ||
TAG, | ||
"Tried to register plugins with FlutterEngine (" | ||
+ flutterEngine | ||
+ ") failed."); | ||
Log.e(TAG, "Received exception while registering", e); | ||
} | ||
} | ||
} |
Oops, something went wrong.