From 6255de2034e89a6a5e4c400d12afc6260e7da4c1 Mon Sep 17 00:00:00 2001 From: hxy-111 <976125628@qq.com> Date: Fri, 8 Dec 2023 11:44:41 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E9=94=AE=E7=9B=98=E6=97=A0=E6=B3=95=E8=BF=9E=E7=BB=AD=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/plugin/editing/TextInputPlugin.ets | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets index f29018808a..9efe31f6ca 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets @@ -66,7 +66,7 @@ class TextInputMethodHandlerImpl implements TextInputMethodHandler { mEditable: ListenableEditingState; private mRestartInputPending: boolean = false; private plugin: EditingStateWatcher | ESObject; - + private keyboardStatus: inputMethod.KeyboardStatus = KeyboardStatus.NONE; private imcFlag: boolean = false; constructor(plugin: TextInputPlugin | ESObject) { @@ -82,11 +82,16 @@ class TextInputMethodHandlerImpl implements TextInputMethodHandler { } show(): void { + if(this.keyboardStatus == KeyboardStatus.SHOW){ + return; + } this.showTextInput(); + this.keyboardStatus = KeyboardStatus.SHOW; } hide(): void { this.hideTextInput(); + this.keyboardStatus = KeyboardStatus.HIDE; } requestAutofill(): void { @@ -253,6 +258,13 @@ enum Type { PHYSICAL_DISPLAY_PLATFORM_VIEW, } +enum KeyboardStatus { + NONE = 0, + HIDE = 1, + SHOW = 2, +} + + export class InputTarget { type: Type; id: number; -- Gitee From 6dab5fca877622bef90c77f080510693eb332ef7 Mon Sep 17 00:00:00 2001 From: zhoujiaying Date: Sat, 9 Dec 2023 15:51:52 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9lifecycle=20channel?= =?UTF-8?q?=E5=81=B6=E7=8E=B0=E7=BC=BA=E5=A4=B1inactive=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoujiaying --- .../src/main/ets/embedding/ohos/FlutterAbilityDelegate.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityDelegate.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityDelegate.ets index 7be1d1994b..31a454eb7e 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityDelegate.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityDelegate.ets @@ -260,7 +260,7 @@ class FlutterAbilityDelegate implements ExclusiveAppComponent { onCreate() { this.ensureAlive(); if (this.shouldDispatchAppLifecycleState()) { - this.flutterEngine?.getLifecycleChannel()?.appIsInactive(); + this.flutterEngine?.getLifecycleChannel()?.appIsResumed(); } } @@ -304,6 +304,7 @@ class FlutterAbilityDelegate implements ExclusiveAppComponent { onBackground() { if (this.shouldDispatchAppLifecycleState()) { + this.flutterEngine?.getLifecycleChannel()?.noWindowsAreFocused(); this.flutterEngine?.getLifecycleChannel()?.appIsPaused(); } } -- Gitee From 5afd3d1d4ae46567a7a0484fa0da9c90c561cb04 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Mon, 11 Dec 2023 11:10:30 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9is=5Fohos=E4=B8=8D?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- attachment/repos/build4.bin | 39 ++++++++++++------- .../ios/platform_message_handler_ios.mm | 2 +- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/attachment/repos/build4.bin b/attachment/repos/build4.bin index 6094a9a9cc..c7c42c6496 100644 --- a/attachment/repos/build4.bin +++ b/attachment/repos/build4.bin @@ -1,5 +1,5 @@ diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index bd3476a..f1c88b9 100644 +index bd3476a..d789796 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -36,7 +36,7 @@ @@ -24,18 +24,22 @@ index bd3476a..f1c88b9 100644 } } -@@ -261,27 +258,13 @@ if (current_os == "win") { +@@ -257,31 +254,18 @@ if (current_os == "win") { + is_fuchsia_host = false + is_ios = true + is_linux = false ++ is_ohos = false + is_mac = false is_posix = true is_win = false is_wasm = false -} else if (current_os == "linux" && target_os == "ohos") { - target_os="linux" -+} else if (current_os == "ohos") { - is_android = false - is_chromeos = false - is_fuchsia = false - is_fuchsia_host = false - is_ios = false +- is_android = false +- is_chromeos = false +- is_fuchsia = false +- is_fuchsia_host = false +- is_ios = false - is_linux = true - is_ohos = true - is_mac = false @@ -44,13 +48,22 @@ index bd3476a..f1c88b9 100644 - is_wasm = false -} else if ((current_os == "ohos" || current_os == "linux") && host_os == "mac") { - target_os="linux" -- is_android = false -- is_chromeos = false -- is_fuchsia = false -- is_fuchsia_host = false -- is_ios = false ++} else if (current_os == "ohos") { + is_android = false + is_chromeos = false + is_fuchsia = false + is_fuchsia_host = false + is_ios = false - is_linux = true + is_linux = false is_ohos = true is_mac = false is_posix = true +@@ -318,6 +302,7 @@ if (current_os == "win") { + is_fuchsia_host = false + is_ios = false + is_linux = false ++ is_ohos = false + is_mac = false + is_posix = false + is_win = false diff --git a/shell/platform/darwin/ios/platform_message_handler_ios.mm b/shell/platform/darwin/ios/platform_message_handler_ios.mm index cf510bc301..a5a2b15169 100644 --- a/shell/platform/darwin/ios/platform_message_handler_ios.mm +++ b/shell/platform/darwin/ios/platform_message_handler_ios.mm @@ -16,7 +16,7 @@ static uint64_t platform_message_counter = 1; @end @interface FLTSerialTaskQueue : NSObject -@property(nonatomic, strong) dispatch_queue_t queue; +@property(nonatomic, assign) dispatch_queue_t queue; @end @implementation FLTSerialTaskQueue -- Gitee From bed53c06e8ceb917f61cf1816cda2eee2dfcfc22 Mon Sep 17 00:00:00 2001 From: mahaonan Date: Mon, 11 Dec 2023 20:44:12 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E3=80=90=E4=BB=BB=E5=8A=A1=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=E3=80=91=20=E5=B7=B2=E7=BB=8F=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E8=BF=87=E7=9A=84=E5=B7=A5=E7=A8=8B=EF=BC=8C=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=97=B6=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=8E=9F?= =?UTF-8?q?=E6=9C=89=E7=AD=BE=E5=90=8D=E6=96=87=E4=BB=B6=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=20=E3=80=90=E8=A7=A3=E5=86=B3=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E3=80=91=20=E6=A0=B9=E6=8D=AEhap=E5=8C=85=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E4=B8=8E=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E5=90=A6=E9=9C=80=E8=A6=81=E6=8B=B7=E8=B4=9D?= =?UTF-8?q?=20flutter=20=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mahaonan --- .../embedding/engine/loader/FlutterLoader.ets | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets index 8917880d49..2f874e60a9 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets @@ -25,6 +25,8 @@ import StringUtils from '../../../util/StringUtils'; import ApplicationInfoLoader from './ApplicationInfoLoader'; import bundleManager from '@ohos.bundle.bundleManager'; import fs from '@ohos.file.fs'; +import { BusinessError } from '@ohos.base'; +import data_preferences from '@ohos.data.preferences'; const TAG = "FlutterLoader"; @@ -95,10 +97,45 @@ export default class FlutterLoader { Log.d(TAG, "flutterLoader end init") } + private async isNeedCopyResource(): Promise { + let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT; + try { + if (this.context != null) { + let bundleInfo = await bundleManager.getBundleInfoForSelf(bundleFlags); + let key = bundleInfo.name + '.bundleInfoPreferences' + let preferences: data_preferences.Preferences = await data_preferences.getPreferences(this.context, key); + let storeInstallTime = await preferences.get("installTime", 0); + let storeUpdateTime = await preferences.get("updateTime", 0); + if (storeInstallTime != bundleInfo.installTime || storeUpdateTime != bundleInfo.updateTime) { + await preferences.put("installTime", bundleInfo.installTime); + await preferences.put("updateTime", bundleInfo.updateTime); + await preferences.flush(); + return true; + } + } + + return false; + } catch (err) { + let message = (err as BusinessError).message; + Log.i(TAG, 'Judge is need copy resource : %{public}s', message); + return true; + } + } + private async copyResource(context: common.Context) { + let copyFlag = await this.isNeedCopyResource(); + if (!copyFlag) { + return; + } + let filePath = context.filesDir + FILE_SEPARATOR + this.flutterApplicationInfo!.flutterAssetsDir - if (!fs.accessSync(filePath + FILE_SEPARATOR + DEFAULT_KERNEL_BLOB) && this.context != null) { + if (this.context != null) { Log.d(TAG, "start copyResource") + if (fs.accessSync(filePath + FILE_SEPARATOR + DEFAULT_KERNEL_BLOB)) { + Log.d(TAG, "hap has changed, start delete previous file") + fs.rmdirSync(filePath); + } + fs.mkdirSync(filePath) let icudtlBuffer = await this.context.resourceManager.getRawFileContent(this.flutterApplicationInfo!.flutterAssetsDir + "/icudtl.dat") -- Gitee From 29b0c7adc18c80c7c8253efe54fef1da0738e680 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Wed, 13 Dec 2023 17:16:44 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- README.en.md | 8 ++++++++ README.md | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/README.en.md b/README.en.md index 7e9ebe46f2..94cbad4522 100644 --- a/README.en.md +++ b/README.en.md @@ -60,6 +60,14 @@ This warehouse is based on the extension of Flutter's official engine warehouse 6. Update project: In the engine directory, execute `./update_engine.sh` (Linux/Mac platform) or `update_engine.bat` (Windows platform) +## FAQ: +1. When running the project, an error of Member notfound:'isOhos' is reported: Please ensure that all dart patches are applied in the src/third_party/dart directory (the patches are located in the src/flutter/attachment/repos directory, and you can use git apply to apply the patch). Recompile the engine after patching + +2. Prompt Permission denied: Execute chmod +x