From dc7afe078a04720eee405673200a6c117cc6dc8a Mon Sep 17 00:00:00 2001 From: hxy-111 <976125628@qq.com> Date: Sat, 13 Jan 2024 20:10:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DsetApplicationSwitcherDes?= =?UTF-8?q?cription=E8=AE=BE=E7=BD=AE=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hxy-111 <976125628@qq.com> --- .../engine/systemchannels/PlatformChannel.ets | 7 +++++++ .../flutter/src/main/ets/plugin/PlatformPlugin.ets | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/PlatformChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/PlatformChannel.ets index e7155e04e6..4b90f2f63c 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/PlatformChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/PlatformChannel.ets @@ -325,6 +325,13 @@ class PlatformMethodCallback implements MethodCallHandler { break; case "SystemChrome.setApplicationSwitcherDescription": Log.d(PlatformMethodCallback.TAG, "setApplicationSwitcherDescription: " + JSON.stringify(args)); + try { + this.platform.platformMessageHandler.setApplicationSwitcherDescription(args); + result.success(null); + } catch (err) { + Log.e(PlatformMethodCallback.TAG, "setApplicationSwitcherDescription err:" + JSON.stringify(err)); + result.error("error", JSON.stringify(err), null); + } break; case "SystemChrome.setEnabledSystemUIOverlays": try { diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets index 14a84d6948..e92eff9b26 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets @@ -139,7 +139,15 @@ class PlatformPluginCallback implements PlatformMessageHandler { } setApplicationSwitcherDescription(description: AppSwitcherDescription) { - // representation described in the given {@code description}. + Log.d(PlatformPluginCallback.TAG, "setApplicationSwitcherDescription: " + JSON.stringify(description)); + try { + let label: string = description?.label; + this.uiAbilityContext?.setMissionLabel('test').then(() => { + Log.d(PlatformPluginCallback.TAG, "Succeeded in seting mission label"); + }) + } catch (err) { + Log.d(PlatformPluginCallback.TAG, "Failed to set mission label: " + JSON.stringify(err)); + } } showSystemOverlays(overlays: SystemUiOverlay[]) { -- Gitee From dc80bd82766bf8ae6877cc0883ecb3dcaf0b5206 Mon Sep 17 00:00:00 2001 From: hxy-111 <976125628@qq.com> Date: Sat, 13 Jan 2024 20:21:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DsetApplicationSwitcherDes?= =?UTF-8?q?cription=E8=AE=BE=E7=BD=AE=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hxy-111 <976125628@qq.com> --- .../flutter/src/main/ets/plugin/PlatformPlugin.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets index e92eff9b26..44b8ebe6d9 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets @@ -142,7 +142,7 @@ class PlatformPluginCallback implements PlatformMessageHandler { Log.d(PlatformPluginCallback.TAG, "setApplicationSwitcherDescription: " + JSON.stringify(description)); try { let label: string = description?.label; - this.uiAbilityContext?.setMissionLabel('test').then(() => { + this.uiAbilityContext?.setMissionLabel(label).then(() => { Log.d(PlatformPluginCallback.TAG, "Succeeded in seting mission label"); }) } catch (err) { -- Gitee