From 95affd35a41f095d3634cf41ee0a21f3805a4694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E6=99=96?= Date: Tue, 8 Jul 2025 02:21:32 +0000 Subject: [PATCH 1/3] update display/entry/src/main/ets/pages/ConfirmDialog.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王宇晖 --- .../src/main/ets/pages/ConfirmDialog.ets | 50 ++++++++++++++++--- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/display/entry/src/main/ets/pages/ConfirmDialog.ets b/display/entry/src/main/ets/pages/ConfirmDialog.ets index 5d5cd6e50..bc90b976f 100644 --- a/display/entry/src/main/ets/pages/ConfirmDialog.ets +++ b/display/entry/src/main/ets/pages/ConfirmDialog.ets @@ -58,9 +58,9 @@ struct ConfirmCustomDialog { @State isProxy: boolean = false; @State appDataList: AppData[] = []; @State selectedAppDataList: AppSendData[] = []; - @State isFoldable: boolean = display.isFoldable(); - @State isFolded: display.FoldStatus = display.getFoldStatus(); - @State mLocalHeight: number = display.getDefaultDisplaySync().height; + @State isFoldable: boolean = false; + @State isFolded: display.FoldStatus = display.FoldStatus.FOLD_STATUS_UNKNOWN; + @State mLocalHeight: number = 1; @State currentOrientation: window.Orientation = window.Orientation.UNSPECIFIED; @State marginValue: number = 0; @State fontSizeScale: number = AppStorage.get('fontSizeScale') as number; @@ -99,6 +99,27 @@ struct ConfirmCustomDialog { this.getDeviceType(); this.appDataList = this.getAppDataList(); + try { + this.isFoldable = display.isFoldable(); + } catch (error) { + console.error('Failed to get isFoldable:', error); + this.isFoldable = false; + } + + try { + this.isFolded = display.getFoldStatus(); + } catch (err) { + console.error('Failed to get FoldStatus:', error); + this.isFolded = display.FoldStatus.FOLD_STATUS_UNKNOWN; + } + + try { + this.mLocalHeight = display.getDefaultDisplaySync().height; + } catch (error) { + console.error('Failed to get display height:', error); + this.mLocalHeight = 1; + } + if (AppStorage.get('isProxyBind') != null) { this.isProxy = AppStorage.get('isProxyBind') as boolean; console.log('isProxy is ' + this.isProxy); @@ -179,18 +200,31 @@ struct ConfirmCustomDialog { this.listener.on('change', () => { this.updateOrientation(); - this.mLocalHeight = display.getDefaultDisplaySync().height; - }); - display.on('foldDisplayModeChange', () => { - this.updateFoldState(); + try { + this.mLocalHeight = display.getDefaultDisplaySync().height; + } catch (err) { + console.error('Failed to get display height:', err); + this.mLocalHeight = 1; + } }); + try { + display.on('foldDisplayModeChange', () => { + this.updateFoldState(); + }); + } catch (err) { + console.error('Failed to register event listener:', err); + } } aboutToDisappear() { if (this.listener) { this.listener.off('change'); } - display.off('foldDisplayModeChange'); + try { + display.off('foldDisplayModeChange'); + } catch (err) { + console.error('Failed to remove foldDisplayModeChange listener:', err); + } clearInterval(this.times); } -- Gitee From 1951510404d8b2bcce7944ecae0ba43644d36c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E6=99=96?= Date: Tue, 8 Jul 2025 03:06:25 +0000 Subject: [PATCH 2/3] update display/entry/src/main/ets/pages/ConfirmDialog.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王宇晖 --- display/entry/src/main/ets/pages/ConfirmDialog.ets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/display/entry/src/main/ets/pages/ConfirmDialog.ets b/display/entry/src/main/ets/pages/ConfirmDialog.ets index bc90b976f..585f87ae7 100644 --- a/display/entry/src/main/ets/pages/ConfirmDialog.ets +++ b/display/entry/src/main/ets/pages/ConfirmDialog.ets @@ -101,22 +101,22 @@ struct ConfirmCustomDialog { try { this.isFoldable = display.isFoldable(); - } catch (error) { - console.error('Failed to get isFoldable:', error); + } catch (err) { + console.error('Failed to get isFoldable:', err); this.isFoldable = false; } try { this.isFolded = display.getFoldStatus(); } catch (err) { - console.error('Failed to get FoldStatus:', error); + console.error('Failed to get FoldStatus:', err); this.isFolded = display.FoldStatus.FOLD_STATUS_UNKNOWN; } try { this.mLocalHeight = display.getDefaultDisplaySync().height; - } catch (error) { - console.error('Failed to get display height:', error); + } catch (err) { + console.error('Failed to get display height:', err); this.mLocalHeight = 1; } -- Gitee From 72a9b05d4783eabf9bfbcea7bdc7298ed8f31fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E6=99=96?= Date: Tue, 8 Jul 2025 09:32:21 +0000 Subject: [PATCH 3/3] update display/entry/src/main/ets/pages/ConfirmDialog.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王宇晖 --- display/entry/src/main/ets/pages/ConfirmDialog.ets | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/display/entry/src/main/ets/pages/ConfirmDialog.ets b/display/entry/src/main/ets/pages/ConfirmDialog.ets index 585f87ae7..93269fa12 100644 --- a/display/entry/src/main/ets/pages/ConfirmDialog.ets +++ b/display/entry/src/main/ets/pages/ConfirmDialog.ets @@ -95,31 +95,28 @@ struct ConfirmCustomDialog { } aboutToAppear() { - this.updateOrientation(); - this.getDeviceType(); - this.appDataList = this.getAppDataList(); - try { this.isFoldable = display.isFoldable(); } catch (err) { console.error('Failed to get isFoldable:', err); - this.isFoldable = false; } try { this.isFolded = display.getFoldStatus(); } catch (err) { console.error('Failed to get FoldStatus:', err); - this.isFolded = display.FoldStatus.FOLD_STATUS_UNKNOWN; } try { this.mLocalHeight = display.getDefaultDisplaySync().height; } catch (err) { console.error('Failed to get display height:', err); - this.mLocalHeight = 1; } + this.updateOrientation(); + this.getDeviceType(); + this.appDataList = this.getAppDataList(); + if (AppStorage.get('isProxyBind') != null) { this.isProxy = AppStorage.get('isProxyBind') as boolean; console.log('isProxy is ' + this.isProxy); @@ -204,7 +201,6 @@ struct ConfirmCustomDialog { this.mLocalHeight = display.getDefaultDisplaySync().height; } catch (err) { console.error('Failed to get display height:', err); - this.mLocalHeight = 1; } }); try { -- Gitee