From 3bd2c57bbf70466cb176c36d4bdb5d39009f75ab Mon Sep 17 00:00:00 2001 From: zhangpeng Date: Sun, 22 Dec 2024 15:44:55 +0800 Subject: [PATCH] =?UTF-8?q?setWindowLayoutFullScreen=E4=BD=BF=E7=94=A8prom?= =?UTF-8?q?ise=E5=BC=82=E6=AD=A5=E5=9B=9E=E8=B0=83=EF=BC=9B=E8=B0=83?= =?UTF-8?q?=E7=94=A8setSpecificSystemBarEnabled=E5=89=8D=E5=85=88=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E5=90=A6=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/entryability/EntryAbility.ets | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 29c0fea..32f98fc 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -44,18 +44,18 @@ export default class EntryAbility extends UIAbility { } this.windowClass = data; try { - this.windowClass.setWindowLayoutFullScreen(this.isLayoutFullScreen, (err: BusinessError) => { - const errCode: number = err.code; - if (errCode) { - Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); - return; - } - Logger.info('Succeeded in setting the window layout to full-screen mode.'); + let promise = this.windowClass.setWindowLayoutFullScreen(this.isLayoutFullScreen); + promise.then(() => { + console.info('Succeeded in setting the window layout to full-screen mode.'); + }).catch((err: BusinessError) => { + console.error(`Failed to set the window layout to full-screen mode. Cause code: ${err.code}, message: ${err.message}`); }); } catch (exception) { - Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(exception)); + console.error(`Failed to set the window layout to full-screen mode. Cause code: ${exception.code}, message: ${exception.message}`); + } + if (canIUse('SystemCapability.Window.SessionManager')) { + this.windowClass.setSpecificSystemBarEnabled('status', false); } - this.windowClass.setSpecificSystemBarEnabled('status', false); }) windowStage.loadContent('pages/Index', (err) => { -- Gitee