• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15import deviceManager from '@ohos.distributedHardware.deviceManager';
16import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
17import deviceInfo from '@ohos.deviceInfo';
18import Constant from '../common/constant';
19import common from '@ohos.app.ability.common';
20import display from '@ohos.display';
21import mediaQuery from '@ohos.mediaquery';
22import i18n from '@ohos.i18n';
23import { KeyCode } from '@ohos.multimodalInput.keyCode';
24import window from '@ohos.window';
25
26let dmClass: deviceManager.DeviceManager | null;
27let TAG = '[DeviceManagerUI:ConfirmDialog]==>';
28const ACTION_ALLOW_AUTH_ONCE: number = 0;
29const ACTION_CANCEL_AUTH: number = 1;
30const ACTION_AUTH_CONFIRM_TIMEOUT: number = 2;
31const ACTION_ALLOW_AUTH_ALWAYS: number = 6;
32const MSG_CANCEL_CONFIRM_SHOW: number = 5;
33const DEVICE_TYPE_2IN1: number = 0xA2F;
34const DEVICE_TYPE_PC: number = 0x0C;
35const CAST_PKG_NAME: string = 'CastEngineService';
36
37interface AppData {
38  hostPkgLabel: string;
39  bundleName: string;
40  bundleInfo: string;
41}
42
43interface AppSendData {
44  bundleName: string;
45}
46
47@CustomDialog
48struct ConfirmCustomDialog {
49  @State peerAppOperation: string = '';
50  @State peerCustomDescription: string = '';
51  @State peerDeviceName: string = '';
52  @State peerDeviceType: number = 0;
53  @State secondsNum: number = 30;
54  @State times: number = 0;
55  @State isAvailableType: boolean = false;
56  @State btnColor: ResourceColor = Color.Transparent;
57  @State title: string = '';
58  @State isProxy: boolean = false;
59  @State appDataList: AppData[] = [];
60  @State selectedAppDataList: AppSendData[] = [];
61  @State isFoldable: boolean = false;
62  @State isFolded: display.FoldStatus = display.FoldStatus.FOLD_STATUS_UNKNOWN;
63  @State mLocalHeight: number = 1;
64  @State currentOrientation: window.Orientation = window.Orientation.UNSPECIFIED;
65  @State marginValue: number = 0;
66  @State fontSizeScale: number = AppStorage.get('fontSizeScale') as number;
67  @State isPhone: boolean = false;
68  @State isPC: boolean = false;
69  @State isTablet: boolean = false;
70  @State isCar: boolean = false;
71  @State fontSize: string = '';
72  @State textHeight: number = 0;
73  @State scrollHeight: number = 0;
74  @State buttonHeight: number = 0;
75  @State columnHeight: number = 0;
76  @State symbolHeight: number = 0;
77  @State extraInfo: string = '';
78
79  controller ?: CustomDialogController;
80  listener: mediaQuery.MediaQueryListener = mediaQuery.matchMediaSync('(orientation: landscape)');
81
82  private updateOrientation() {
83    let isPortrait: boolean = mediaQuery.matchMediaSync('(orientation: portrait)').matches;
84    this.currentOrientation = isPortrait ? window.Orientation.PORTRAIT : window.Orientation.LANDSCAPE;
85    console.info(`currentOrientation: ${this.currentOrientation}`);
86  }
87
88  private updateFoldState() {
89    try {
90      this.isFolded = display.getFoldStatus();
91      console.log('fold status:', this.isFolded);
92    } catch (err) {
93      console.error(`status update failed: ${err.message}`);
94    }
95  }
96
97  aboutToAppear() {
98    try {
99      this.isFoldable = display.isFoldable();
100    } catch (err) {
101      console.error('Failed to get isFoldable:', err);
102    }
103
104    try {
105      this.isFolded = display.getFoldStatus();
106    } catch (err) {
107      console.error('Failed to get FoldStatus:', err);
108    }
109
110    try {
111      this.mLocalHeight = display.getDefaultDisplaySync().height;
112    } catch (err) {
113      console.error('Failed to get display height:', err);
114    }
115
116    this.updateOrientation();
117    this.getDeviceType();
118    this.appDataList = this.getAppDataList();
119
120    if (AppStorage.get('isProxyBind') != null) {
121      this.isProxy = AppStorage.get('isProxyBind') as boolean;
122      console.log('isProxy is ' + this.isProxy);
123    }
124
125    if (!this.isPhone && this.isProxy) {
126      this.onCancel;
127    }
128
129    if (AppStorage.get('title') != null) {
130      this.title = AppStorage.get('title') as string;
131      console.log('title is ' + this.title);
132    }
133
134    console.log(TAG + 'aboutToAppear execute PinCustomDialog')
135    let context = getContext() as common.UIAbilityContext;
136
137    this.fontSizeScale = context.config ?.fontSizeScale ?? 1;
138    console.log('=-= fontScale:' + this.fontSizeScale);
139    this.setMarginValue();
140
141    if (AppStorage.get('deviceName') != null) {
142      this.peerDeviceName = AppStorage.get('deviceName') as string;
143    }
144    let customDescriptionStr: string = AppStorage.get('customDescriptionStr') as string;
145    let hostPkgLabel: string = AppStorage.get('hostPkgLabel') as string;
146    if (this.isProxy) {
147      if (hostPkgLabel === CAST_PKG_NAME) {
148        this.peerCustomDescription =
149          context.resourceManager.getStringSync($r('app.string.dm_confirm_title_cast').id, this.peerDeviceName);
150      } else if (hostPkgLabel != null) {
151        this.peerCustomDescription = context.resourceManager.getStringSync($r('app.string.dm_confirm_proxy').id,
152          this.peerDeviceName);
153      } else {
154        let titleFirst: string =
155          context.resourceManager.getStringSync($r('app.string.dm_connect_device').id, this.peerDeviceName);
156        this.peerCustomDescription =
157          context.resourceManager.getStringSync($r('app.string.dm_is_trust_device').id, titleFirst);
158      }
159    } else {
160      if (hostPkgLabel === CAST_PKG_NAME) {
161        this.title =
162          context.resourceManager.getStringSync($r('app.string.dm_confirm_title_cast').id, this.peerDeviceName);
163      } else if (hostPkgLabel != null) {
164        this.title = context.resourceManager.getStringSync($r('app.string.dm_confirm_title_hap').id, hostPkgLabel,
165          this.peerDeviceName);
166        this.peerCustomDescription = context.resourceManager.getStringSync($r('app.string.dm_confirm_intention').id);
167        if (customDescriptionStr != undefined && customDescriptionStr != '') {
168          this.peerCustomDescription = this.peerDeviceName + customDescriptionStr;
169        }
170      } else {
171        let titleFirst: string =
172          context.resourceManager.getStringSync($r('app.string.dm_connect_device').id, this.peerDeviceName);
173        this.title =
174          context.resourceManager.getStringSync($r('app.string.dm_is_trust_device').id, titleFirst);
175        this.peerCustomDescription = context.resourceManager.getStringSync($r('app.string.dm_confirm_intention').id);
176      }
177    }
178
179    if (AppStorage.get('deviceType') != null) {
180      this.peerDeviceType = AppStorage.get('deviceType') as number;
181      console.log('peerDeviceType is ' + this.peerDeviceType);
182    }
183
184    this.times = setInterval(() => {
185      console.info('devicemanagerui confirm dialog run seconds:' + this.secondsNum);
186      this.secondsNum--;
187      if (this.secondsNum === 0) {
188        clearInterval(this.times);
189        this.times = 0;
190        this.setUserOperation(ACTION_AUTH_CONFIRM_TIMEOUT);
191        this.destruction();
192        console.info('click cancel times run out');
193      }
194    }, 1000)
195    console.log(TAG + 'deviceInfo.deviceType:' + deviceInfo.deviceType);
196
197    this.listener.on('change', () => {
198      this.updateOrientation();
199      try {
200        this.mLocalHeight = display.getDefaultDisplaySync().height;
201      } catch (err) {
202        console.error('Failed to get display height:', err);
203      }
204    });
205    try {
206      display.on('foldDisplayModeChange', () => {
207        this.updateFoldState();
208      });
209    } catch (err) {
210      console.error('Failed to register event listener:', err);
211    }
212  }
213
214  aboutToDisappear() {
215    if (this.listener) {
216      this.listener.off('change');
217    }
218    try {
219      display.off('foldDisplayModeChange');
220    } catch (err) {
221      console.error('Failed to remove foldDisplayModeChange listener:', err);
222    }
223    clearInterval(this.times);
224  }
225
226  onAllowOnce() {
227    console.log('allow once')
228    if (dmClass == null) {
229      console.log('createDeviceManager is null')
230      return
231    }
232    const param = {
233      'appUserData': this.selectedAppDataList
234    };
235    const jsonStr = JSON.stringify(param);
236    console.log('allow once' + ACTION_ALLOW_AUTH_ONCE)
237    console.log('param:' + jsonStr)
238    this.setUserAuthorization(ACTION_ALLOW_AUTH_ONCE, jsonStr)
239    this.destruction()
240  }
241
242  onAllowAlways() {
243    console.log('allow always')
244    if (dmClass == null) {
245      console.log('createDeviceManager is null')
246      return
247    }
248    const param = {
249      'appUserData': this.selectedAppDataList
250    };
251    const jsonStr = JSON.stringify(param);
252    console.log('allow always' + ACTION_ALLOW_AUTH_ALWAYS)
253    console.log('param:' + jsonStr)
254    this.setUserAuthorization(ACTION_ALLOW_AUTH_ALWAYS, jsonStr)
255    this.destruction()
256  }
257
258  onCancel() {
259    console.log('cancel')
260    if (dmClass == null) {
261      console.log('createDeviceManager is null')
262      return
263    }
264
265    console.log('cancel' + ACTION_CANCEL_AUTH)
266    this.setUserOperation(ACTION_CANCEL_AUTH)
267    this.destruction()
268  }
269
270  getAppDataList(): AppData[] {
271    try {
272      const jsonStr = AppStorage.get('appUserData') as string;
273      return JSON.parse(jsonStr) as AppData[];
274    } catch (err) {
275      console.error('Failed to parse data:', err);
276      return [];
277    }
278  }
279
280  getDeviceType(): void {
281    this.isPhone = Constant.isPhone();
282    this.isPC = Constant.isPC();
283    this.isTablet = Constant.isTablet();
284    this.isCar = Constant.isCar();
285  }
286
287  // fontSizeScale means senior mode display magnification scale
288  setMarginValue(): void {
289    if ((this.fontSizeScale >= 1) && (this.fontSizeScale < 1.75)) {
290      if (this.fontSizeScale === 1) {
291        this.fontSize = '20vp';
292      } else if (this.fontSizeScale === 1.15) {
293        this.fontSize = '23vp';
294      } else if (this.fontSizeScale === 1.3) {
295        this.fontSize = '26vp';
296      } else if (this.fontSizeScale === 1.45) {
297        this.fontSize = '29vp';
298      }
299      this.marginValue = 0;
300    } else if (this.fontSizeScale === 1.75) {
301      this.fontSize = '35vp';
302      this.marginValue = 5;
303    } else if (this.fontSizeScale === 2) {
304      this.fontSize = '40vp';
305      this.marginValue = 9;
306    } else if (this.fontSizeScale === 3.2) {
307      this.fontSize = '40vp';
308      this.marginValue = 13;
309    }
310  }
311
312  setUserAuthorization(operation: number, param: string) {
313    console.log(TAG + 'setUserAuthorization: ' + operation)
314    if (dmClass == null) {
315      console.log(TAG + 'setUserAuthorization: ' + 'dmClass null')
316      return;
317    }
318    try {
319      dmClass.setUserOperation(operation, param);
320    } catch (err) {
321      console.log(TAG + 'dmClass setUserOperation failed')
322    }
323  }
324
325  setUserOperation(operation: number) {
326    console.log(TAG + 'setUserOperation: ' + operation)
327    if (dmClass == null) {
328      console.log(TAG + 'setUserOperation: ' + 'dmClass null')
329      return;
330    }
331    try {
332      dmClass.setUserOperation(operation, 'extra');
333    } catch (err) {
334      console.log(TAG + 'dmClass setUserOperation failed')
335    }
336  }
337
338  destruction() {
339    let session = AppStorage.get<UIExtensionContentSession>('ConfirmSession');
340    if (session) {
341      session.terminateSelf();
342    }
343  }
344
345  private toggleSelection(app: AppData, index: number, checked: boolean) {
346  if (checked) {
347    if (!this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) {
348      this.selectedAppDataList = [...this.selectedAppDataList, { bundleName: app.bundleName }];
349    }
350  } else {
351    this.selectedAppDataList = this.selectedAppDataList.filter(
352      item => item.bundleName !== app.bundleName
353    );
354  }
355 }
356
357  getImages(peerdeviceType: number): Resource {
358    console.info('peerdeviceType is ' + peerdeviceType);
359    if (peerdeviceType === deviceManager.DeviceType.SPEAKER) {
360      this.isAvailableType = true;
361      return $r('sys.symbol.soundai_fill');
362    } else if (peerdeviceType === deviceManager.DeviceType.PHONE) {
363      this.isAvailableType = true;
364      return $r('sys.symbol.phone_fill_1');
365    } else if (peerdeviceType === deviceManager.DeviceType.TABLET) {
366      this.isAvailableType = true;
367      return $r('sys.symbol.pad_fill');
368    } else if (peerdeviceType === deviceManager.DeviceType.WEARABLE) {
369      this.isAvailableType = true;
370      return $r('sys.symbol.earphone_case_16896');
371    } else if (peerdeviceType === deviceManager.DeviceType.CAR) {
372      this.isAvailableType = true;
373      return $r('sys.symbol.car_fill');
374    } else if (peerdeviceType === deviceManager.DeviceType.TV) {
375      this.isAvailableType = true;
376      return $r('sys.symbol.smartscreen_fill');
377    } else if (peerdeviceType === DEVICE_TYPE_PC) {
378      this.isAvailableType = true;
379      return $r('sys.symbol.matebook_fill');
380    } else if (peerdeviceType === DEVICE_TYPE_2IN1) {
381      this.isAvailableType = true;
382      return $r('sys.symbol.matebook_fill');
383    } else {
384      this.isAvailableType = false;
385      return $r('sys.symbol.unknown_device_fill');
386    }
387  }
388
389  @Builder
390  Symbol() {
391    Shape() {
392      Circle()
393        .width(32)
394        .height(32)
395        .fill($r('sys.color.ohos_id_color_activated'))
396      Column() {
397        SymbolGlyph(this.getImages(this.peerDeviceType))
398          .fontSize('20vp')
399          .renderingStrategy(SymbolRenderingStrategy.MULTIPLE_OPACITY)
400          .fontColor([$r('sys.color.ohos_id_color_primary_contrary')])
401          .offset({ x: 6, y: 6 })
402      }
403        .onAreaChange((o, n) => {
404          this.symbolHeight = n.height as number;
405        })
406    }
407    .visibility(this.isAvailableType ? Visibility.Visible : Visibility.None)
408    .margin({ top: 24, bottom: 15 })
409  }
410
411  private isTibetanLanguages(): boolean {
412    console.info(`${TAG} isTibetanLanguages in`);
413    let locale = new Intl.Locale(i18n.System.getSystemLanguage()).toString();
414    console.info(`${TAG} isTibetanLanguages: ${locale}`);
415    return Constant.TIBETAN_LANGUAGES.includes(locale);
416  }
417
418  build() {
419    if (this.isProxy && this.isPhone) {
420      GridRow({
421        columns: { xs: 4, sm: 8, md: this.isPC ? 24 : 12 },
422        gutter: { x: 4 },
423        breakpoints: { value: ['600vp', '840vp'] }
424      }) {
425        GridCol({ span: { xs: 4, sm: 4, md: this.isPC ? 6 : 4 }, offset: { sm: 2, md: this.isPC ? 9 : 4 } }) {
426          if (this.isFoldable) {
427            if (this.isFolded === display.FoldStatus.FOLD_STATUS_FOLDED) {
428              if (this.currentOrientation === window.Orientation.PORTRAIT) {
429                Column() {
430                  this.Symbol();
431                  Column() {
432                    Text(this.title)
433                      .textAlign(TextAlign.Center)
434                      .fontSize(this.fontSize)
435                      .fontWeight(FontWeight.Bold)
436                      .fontColor($r('sys.color.ohos_id_color_text_primary'))
437                      .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST)
438                      .lineHeight(this.isTibetanLanguages() ? 22 : 0)
439                      .textOverflow({ overflow: TextOverflow.None })
440                      .width('auto')
441                      .maxLines(2)
442                  }
443                  .onAreaChange((o, n) => {
444                    this.textHeight = n.height as number;
445                    console.info('**textHeight**:${this.textHeight}')
446                  })
447                  .margin({
448                    top: this.isAvailableType ? 0 : 24,
449                    bottom: 15, left: 24, right: 24
450                  })
451                  .accessibilityGroup(true)
452                  .accessibilityLevel('yes')
453
454                  Column() {
455                    Scroll(){
456                      Column(){
457                        Text(this.peerCustomDescription)
458                          .textAlign(TextAlign.Center)
459                          .fontColor($r('sys.color.font_primary'))
460                          .fontSize($r('sys.float.Body_L'))
461                          .width('auto')
462                          .lineHeight(this.isTibetanLanguages() ? 22 : 0)
463                          .margin({
464                            bottom: 12, left: 12, right: 12
465                          })
466                          .padding({ left: (this.isPC) ? 10 : 0, right: (this.isPC) ? 10 : 0 })
467                          .accessibilityGroup(true)
468                          .accessibilityLevel('yes')
469
470                        Stack(){
471                          List({ space: 0 }) {
472                            ForEach(this.appDataList, (app: AppData, index: number) => {
473                              ListItem() {
474                                Row() {
475                                  Column() {
476                                    Column() {
477                                      Text(app.hostPkgLabel)
478                                        .fontSize($r('sys.float.Body_L'))
479                                        .fontColor($r('sys.color.font_primary'))
480                                        .textAlign(TextAlign.Start)
481                                        .maxLines(2)
482                                        .textOverflow({ overflow: TextOverflow.Ellipsis })
483                                        .width('100%')
484                                    }
485                                    .margin({ top: this.marginValue, bottom: 2 })
486                                    Column() {
487                                      Text(app.bundleInfo)
488                                        .fontSize($r('sys.float.Body_M'))
489                                        .fontColor($r('sys.color.font_secondary'))
490                                        .textAlign(TextAlign.Start)
491                                        .width('100%')
492                                    }
493                                    .margin({ bottom: this.marginValue })
494                                  }
495                                  .layoutWeight(1)
496                                  .padding({
497                                    right: 8
498                                  })
499                                  .accessibilityGroup(true)
500                                  .accessibilityLevel('yes')
501                                  .margin({
502                                    top: index === 0 ? 4 : 0,
503                                    bottom: index === (this.appDataList.length - 1) ? 4 : 0
504                                  })
505
506                                  Checkbox({ name: app.hostPkgLabel, })
507                                    .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName))
508                                    .shape(CheckBoxShape.CIRCLE)
509                                    .size({ width: 20, height: 20 })
510                                    .onChange((checked: boolean) => {
511                                      this.toggleSelection(app, index, checked);
512                                    })
513                                }
514                                .width('100%')
515                                .padding({ top: 11, bottom: 11, left: 12, right: 12 })
516                              }
517                            }, (app: AppData) => app.hostPkgLabel)
518                          }
519                          .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
520                          .backgroundColor($r('sys.color.comp_background_list_card'))
521                          .width('100%')
522                          .divider({
523                            strokeWidth: 1,
524                            color: $r('sys.color.ohos_id_color_list_separator'),
525                            startMargin: 12,
526                            endMargin: 12
527                          })
528                          .edgeEffect(EdgeEffect.Spring)
529                        }
530                      }
531                      .margin({ left: 12, right: 12 })
532                    }
533                    .height('auto')
534                    .onAreaChange((o, n) => {
535                      this.scrollHeight = n.height as number;
536                      console.info('**scrollHeight**:${this.scrollHeight}')
537                     })
538                    .constraintSize({
539                      maxHeight: ((px2vp(this.mLocalHeight) - 28 - 39) * 0.9 - this.symbolHeight -
540                        this.buttonHeight - this.textHeight - 81)
541                    })
542                    .onAreaChange((o, n) => {
543                      this.scrollHeight = n.height as number;
544                    })
545                    .scrollable(ScrollDirection.Vertical)
546                    .scrollBar(BarState.On)
547                  }
548                  .margin({ bottom: 8})
549
550                  Column() {
551                    Button($r('app.string.dm_allow_always'))
552                      .margin({ top: 0, bottom: 4 })
553                      .padding({ top: 8, bottom: 8 })
554                      .type(ButtonType.ROUNDED_RECTANGLE)
555                      .onClick(() => {
556                        this.onAllowAlways();
557                      })
558                      .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
559                      .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
560                      .width('100%')
561                      .backgroundColor(this.btnColor)
562                      .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
563                        if (isHover) {
564                          this.btnColor = $r('sys.color.ohos_id_color_hover');
565                        } else {
566                          this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
567                        }
568                      })
569                      .stateStyles({
570                        pressed: {
571                          .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
572                        },
573                        normal: {
574                          .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
575                        }
576                      })
577                      .accessibilityGroup(true)
578                      .accessibilityLevel('yes')
579
580                    Button($r('app.string.dm_allow_this_time'))
581                      .margin({ bottom: 4 })
582                      .padding({ top: 8, bottom: 8 })
583                      .type(ButtonType.ROUNDED_RECTANGLE)
584                      .onClick(() => {
585                        this.onAllowOnce();
586                      })
587                      .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
588                      .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
589                      .width('100%')
590                      .backgroundColor(this.btnColor)
591                      .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
592                        if (isHover) {
593                          this.btnColor = $r('sys.color.ohos_id_color_hover');
594                        } else {
595                          this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
596                        }
597                      })
598                      .stateStyles({
599                        pressed: {
600                          .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
601                        },
602                        normal: {
603                          .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
604                        }
605                      })
606                      .accessibilityGroup(true)
607                      .accessibilityLevel('yes')
608
609                    Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum))
610                      .padding({ top: 8, bottom: 8 })
611                      .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
612                      .defaultFocus(true)
613                      .type(ButtonType.ROUNDED_RECTANGLE)
614                      .onKeyEvent((event ?: KeyEvent) => {
615                        if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Down) {
616                          console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
617                          return;
618                        }
619                        if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Up) {
620                          console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
621                          this.onCancel();
622                        }
623                      })
624                      .onClick(() => {
625                        this.onCancel();
626                      })
627                      .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
628                      .width('100%')
629                      .backgroundColor(this.btnColor)
630                      .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
631                        if (isHover) {
632                          this.btnColor = $r('sys.color.ohos_id_color_hover');
633                        } else {
634                          this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
635                        }
636                      })
637                      .stateStyles({
638                        pressed: {
639                          .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
640                        },
641                        normal: {
642                          .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
643                        }
644                      })
645                      .accessibilityGroup(true)
646                      .accessibilityLevel('yes')
647                  }
648                  .onAreaChange((o, n) => {
649                    this.buttonHeight = n.height as number;
650                    console.info(`**buttonHeight**:${this.buttonHeight}`)
651                  })
652                  .margin({
653                    left: 16,
654                    right: 16,
655                    bottom: this.isPC ? 16 : 8
656                  })
657                }
658                .margin({
659                  left: 16, right: 16,
660                })
661                .height('auto')
662                .clip(true)
663                .backgroundColor($r('sys.color.mask_fourth'))
664                .borderRadius($r('sys.float.alert_container_shape'))
665                .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK)
666              } else if (this.currentOrientation === window.Orientation.LANDSCAPE) {
667                Column(){
668                  this.Symbol();
669                  Scroll() {
670                    Column() {
671                      Column() {
672                        Text(this.title)
673                          .textAlign(TextAlign.Center)
674                          .fontSize(this.fontSize)
675                          .fontWeight(FontWeight.Bold)
676                          .fontColor($r('sys.color.ohos_id_color_text_primary'))
677                          .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST)
678                          .lineHeight(this.isTibetanLanguages() ? 22 : 0)
679                          .textOverflow({ overflow: TextOverflow.None })
680                          .width('auto')
681                          .maxLines(2)
682                      }
683                      .margin({
684                        top: this.isAvailableType ? 0 : 24, left: 12, right: 12,
685                        bottom: 15
686                      })
687                      .accessibilityGroup(true)
688                      .accessibilityLevel('yes')
689
690                      Text(this.peerCustomDescription)
691                        .textAlign(TextAlign.Center)
692                        .fontColor($r('sys.color.font_primary'))
693                        .fontSize($r('sys.float.Body_L'))
694                        .width('auto')
695                        .lineHeight(this.isTibetanLanguages() ? 22 : 0)
696                        .margin({
697                          left: 12,
698                          right: 12,
699                          bottom: 12
700                        })
701                        .padding({ left: 20, right: 20 })
702                        .accessibilityGroup(true)
703                        .accessibilityLevel('yes')
704                      List({ space: 0 }) {
705                        ForEach(this.appDataList, (app: AppData, index: number) => {
706                          ListItem() {
707                            Row() {
708                              Column() {
709                                Column() {
710                                  Text(app.hostPkgLabel)
711                                  .fontSize($r('sys.float.Body_L'))
712                                    .fontColor($r('sys.color.font_primary'))
713                                    .textAlign(TextAlign.Start)
714                                    .maxLines(2)
715                                    .textOverflow({ overflow: TextOverflow.Ellipsis })
716                                    .width('100%')
717                                }
718                                  .margin({ top: this.marginValue, bottom: 2 })
719                                Column() {
720                                  Text(app.bundleInfo)
721                                    .fontSize($r('sys.float.Body_M'))
722                                    .fontColor($r('sys.color.font_secondary'))
723                                    .textAlign(TextAlign.Start)
724                                    .width('100%')
725                                }
726                                  .margin({ bottom: this.marginValue })
727                              }
728                                .layoutWeight(1)
729                                .padding({
730                                  right: 12
731                                })
732                                .accessibilityGroup(true)
733                                .accessibilityLevel('yes')
734                                .margin({
735                                  top: index === 0 ? 4 : 0,
736                                  bottom: index === (this.appDataList.length - 1) ? 4 : 0
737                                })
738
739                              Checkbox({ name: app.hostPkgLabel, })
740                                .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName))
741                                .shape(CheckBoxShape.CIRCLE)
742                                .size({ width: 20, height: 20 })
743                                .onChange((checked: boolean) => {
744                                  this.toggleSelection(app, index, checked);
745                                  })
746                            }
747                            .width('100%')
748                            .padding(12)
749                          }
750                        }, (app: AppData) => app.hostPkgLabel)
751                      }
752                      .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
753                      .backgroundColor($r('sys.color.comp_background_list_card'))
754                      .width('auto')
755                      .divider({
756                        strokeWidth: 1,
757                        color: $r('sys.color.ohos_id_color_list_separator'),
758                        startMargin: 12,
759                        endMargin: 12
760                      })
761                      .margin({ bottom: 4 })
762                      .edgeEffect(EdgeEffect.Spring)
763                      .scrollBar(BarState.On)
764
765                      Button($r('app.string.dm_allow_always'))
766                        .margin({ top: 4, bottom: 4, right: 4, left: 4 })
767                        .padding({ top: 8, bottom: 8 })
768                        .type(ButtonType.ROUNDED_RECTANGLE)
769                        .onClick(() => {
770                          this.onAllowAlways();
771                        })
772                        .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
773                        .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
774                        .width(this.isPC ? 250 : '100%')
775                        .backgroundColor(this.btnColor)
776                        .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
777                          if (isHover) {
778                            this.btnColor = $r('sys.color.ohos_id_color_hover');
779                          } else {
780                            this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
781                          }
782                        })
783                        .stateStyles({
784                          pressed: {
785                            .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
786                          },
787                          normal: {
788                            .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
789                          }
790                        })
791                        .accessibilityGroup(true)
792                        .accessibilityLevel('yes')
793
794                      Button($r('app.string.dm_allow_this_time'))
795                      .margin({ bottom: 4, right: 4, left: 4 })
796                        .padding({ top: 8, bottom: 8 })
797                        .type(ButtonType.ROUNDED_RECTANGLE)
798                        .onClick(() => {
799                          this.onAllowOnce();
800                        })
801                        .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
802                        .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
803                        .width(this.isPC ? 250 : '100%')
804                        .backgroundColor(this.btnColor)
805                        .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
806                          if (isHover) {
807                            this.btnColor = $r('sys.color.ohos_id_color_hover');
808                          } else {
809                            this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
810                          }
811                        })
812                        .stateStyles({
813                          pressed: {
814                            .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
815                          },
816                          normal: {
817                            .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
818                          }
819                        })
820                        .accessibilityGroup(true)
821                        .accessibilityLevel('yes')
822
823                      Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum))
824                        .margin({ bottom: 8, right: 4, left: 4 })
825                        .padding({ top: 8, bottom: 8 })
826                        .type(ButtonType.ROUNDED_RECTANGLE)
827                        .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
828                        .defaultFocus(true)
829                        .onKeyEvent((event ?: KeyEvent) => {
830                          if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Down) {
831                            console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
832                            return;
833                          }
834                          if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Up) {
835                            console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
836                            this.onCancel();
837                          }
838                        })
839                        .onClick(() => {
840                          this.onCancel();
841                        })
842                        .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
843                        .width(this.isPC ? 250 : '100%')
844                        .backgroundColor(this.btnColor)
845                        .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
846                          if (isHover) {
847                            this.btnColor = $r('sys.color.ohos_id_color_hover');
848                          } else {
849                            this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
850                          }
851                        })
852                        .stateStyles({
853                          pressed: {
854                            .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
855                          },
856                          normal: {
857                            .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
858                          }
859                        })
860                        .accessibilityGroup(true)
861                        .accessibilityLevel('yes')
862                  }
863                  .margin({ left: 12, right: 12 })
864                }
865                .border({
866                  radius: { topLeft: 0, topRight: 0, bottomLeft: 32, bottomRight: 32 }
867                })
868                .layoutWeight(1)
869                .constraintSize({
870                  maxHeight: 'auto'
871                })
872                .scrollable(ScrollDirection.Vertical)
873                .scrollBar(BarState.On)
874                }
875                .width(400)
876                .height(266)
877                .clip(true)
878                .backgroundColor($r('sys.color.mask_fourth'))
879                .borderRadius($r('sys.float.alert_container_shape'))
880                .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK)
881              }
882            } else if (this.isFolded === display.FoldStatus.FOLD_STATUS_EXPANDED ||
883              this.isFolded === display.FoldStatus.FOLD_STATUS_HALF_FOLDED) {
884              Column(){
885                this.Symbol();
886                Column() {
887                  Text(this.title)
888                    .textAlign(TextAlign.Center)
889                    .fontSize(this.fontSize)
890                    .fontWeight(FontWeight.Bold)
891                    .fontColor($r('sys.color.ohos_id_color_text_primary'))
892                    .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST)
893                    .lineHeight(this.isTibetanLanguages() ? 22 : 0)
894                    .textOverflow({ overflow: TextOverflow.None })
895                    .width('auto')
896                    .maxLines(2)
897                }
898                .onAreaChange((o, n) => {
899                  this.textHeight = n.height as number;
900                  console.info('**textHeight**:${this.textHeight}')
901                })
902                .margin({
903                  top: this.isAvailableType ? 0 : (24),
904                  bottom: 15, left: 24, right: 24
905                })
906                .accessibilityGroup(true)
907                .accessibilityLevel('yes')
908
909                Column() {
910                  Scroll() {
911                    Column() {
912                      Text(this.peerCustomDescription)
913                        .textAlign(TextAlign.Center)
914                        .fontColor($r('sys.color.font_primary'))
915                        .fontSize($r('sys.float.Body_L'))
916                        .width('auto')
917                        .lineHeight(this.isTibetanLanguages() ? 22 : 0)
918                        .margin({
919                          bottom: 12, left: 24, right: 24
920                        })
921                        .accessibilityGroup(true)
922                        .accessibilityLevel('yes')
923                      Stack() {
924                        List({ space: 0 }) {
925                          ForEach(this.appDataList, (app: AppData, index: number) => {
926                            ListItem() {
927                              Row() {
928                                Column() {
929                                  Column() {
930                                    Text(app.hostPkgLabel)
931                                      .fontSize($r('sys.float.Body_L'))
932                                      .fontColor($r('sys.color.font_primary'))
933                                      .textAlign(TextAlign.Start)
934                                      .maxLines(2)
935                                      .textOverflow({ overflow: TextOverflow.Ellipsis })
936                                      .width('100%')
937                                  }
938                                    .margin({ top: this.marginValue, bottom: 2 })
939                                  Column() {
940                                    Text(app.bundleInfo)
941                                      .fontSize($r('sys.float.Body_M'))
942                                      .fontColor($r('sys.color.font_secondary'))
943                                      .textAlign(TextAlign.Start)
944                                      .width('100%')
945                                  }
946                                    .margin({ bottom: this.marginValue })
947                                }
948                                  .layoutWeight(1)
949                                  .padding({
950                                    right: 8
951                                  })
952                                  .accessibilityGroup(true)
953                                  .accessibilityLevel('yes')
954                                  .margin({
955                                    top: index === 0 ? 4 : 0,
956                                    bottom: index === (this.appDataList.length - 1) ? 4 : 0
957                                  })
958
959                                Checkbox({ name: app.hostPkgLabel, })
960                                  .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName))
961                                  .shape(CheckBoxShape.CIRCLE)
962                                  .size({ width: 20, height: 20 })
963                                  .onChange((checked: boolean) => {
964                                    this.toggleSelection(app, index, checked);
965                                  })
966                              }
967                                .width('100%')
968                                .padding({ top: 11, bottom: 11, left: 12, right: 12 })
969                            }
970                          }, (app: AppData) => app.hostPkgLabel)
971                        }
972                        .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
973                        .backgroundColor($r('sys.color.comp_background_list_card'))
974                        .width('100%')
975                        .divider({
976                          strokeWidth: 1,
977                          color: $r('sys.color.ohos_id_color_list_separator'),
978                          startMargin: 12,
979                          endMargin: 12
980                        })
981                        .edgeEffect(EdgeEffect.Spring)
982                      }
983                    }
984                    .margin({ left: 12, right: 12 })
985                  }
986                  .height('auto')
987                  .onAreaChange((o, n) => {
988                    this.scrollHeight = n.height as number;
989                    console.info('**scrollHeight**:${this.scrollHeight}')
990                  })
991                  .constraintSize({
992                    maxHeight: ((px2vp(this.mLocalHeight) - 28 - 39) * 0.9 - this.symbolHeight -
993                      this.buttonHeight - this.textHeight - 81)
994                  })
995                  .scrollable(ScrollDirection.Vertical)
996                  .scrollBar(BarState.On)
997                }
998                .margin({ bottom: 8})
999
1000                Column() {
1001                  Button($r('app.string.dm_allow_always'))
1002                    .margin({ top: 0, bottom: 4 })
1003                    .padding({ top: 8, bottom: 8 })
1004                    .type(ButtonType.ROUNDED_RECTANGLE)
1005                    .onClick(() => {
1006                      this.onAllowAlways();
1007                    })
1008                    .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1009                    .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1010                    .width('100%')
1011                    .backgroundColor(this.btnColor)
1012                    .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1013                      if (isHover) {
1014                        this.btnColor = $r('sys.color.ohos_id_color_hover');
1015                      } else {
1016                        this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1017                      }
1018                    })
1019                    .stateStyles({
1020                      pressed: {
1021                        .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1022                      },
1023                      normal: {
1024                        .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1025                      }
1026                    })
1027                    .accessibilityGroup(true)
1028                    .accessibilityLevel('yes')
1029
1030                  Button($r('app.string.dm_allow_this_time'))
1031                    .margin({ bottom: 4 })
1032                    .padding({ top: 8, bottom: 8 })
1033                    .type(ButtonType.ROUNDED_RECTANGLE)
1034                    .onClick(() => {
1035                      this.onAllowOnce();
1036                    })
1037                    .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1038                    .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1039                    .width('100%')
1040                    .backgroundColor(this.btnColor)
1041                    .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1042                      if (isHover) {
1043                        this.btnColor = $r('sys.color.ohos_id_color_hover');
1044                      } else {
1045                        this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1046                      }
1047                    })
1048                    .stateStyles({
1049                      pressed: {
1050                        .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1051                      },
1052                      normal: {
1053                        .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1054                      }
1055                    })
1056                    .accessibilityGroup(true)
1057                    .accessibilityLevel('yes')
1058
1059                  Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum))
1060                    .padding({ top: 8, bottom: 8 })
1061                    .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1062                    .defaultFocus(true)
1063                    .type(ButtonType.ROUNDED_RECTANGLE)
1064                    .onKeyEvent((event ?: KeyEvent) => {
1065                      if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Down) {
1066                        console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1067                        return;
1068                      }
1069                      if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Up) {
1070                        console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1071                        this.onCancel();
1072                      }
1073                    })
1074                    .onClick(() => {
1075                      this.onCancel();
1076                    })
1077                    .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1078                    .width('100%')
1079                    .backgroundColor(this.btnColor)
1080                    .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1081                      if (isHover) {
1082                        this.btnColor = $r('sys.color.ohos_id_color_hover');
1083                      } else {
1084                        this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1085                      }
1086                    })
1087                    .stateStyles({
1088                      pressed: {
1089                        .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1090                      },
1091                      normal: {
1092                        .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1093                      }
1094                    })
1095                    .accessibilityGroup(true)
1096                    .accessibilityLevel('yes')
1097                }
1098                .onAreaChange((o, n) => {
1099                  this.buttonHeight = n.height as number;
1100                  console.info('**buttonHeight**:${this.buttonHeight}')
1101                })
1102                .margin({
1103                  left: 16,
1104                  right: 16,
1105                  bottom: this.isPC ? 16 : 8
1106                })
1107              }
1108              .width(400)
1109              .height('auto')
1110              .clip(true)
1111              .backgroundColor($r('sys.color.mask_fourth'))
1112              .borderRadius($r('sys.float.alert_container_shape'))
1113              .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK)
1114            }
1115          } else {
1116            if (this.currentOrientation === window.Orientation.PORTRAIT) {
1117              Column() {
1118                this.Symbol();
1119                Column() {
1120                  Text(this.title)
1121                    .textAlign(TextAlign.Center)
1122                    .fontSize(this.fontSize)
1123                    .fontWeight(FontWeight.Bold)
1124                    .fontColor($r('sys.color.ohos_id_color_text_primary'))
1125                    .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST)
1126                    .lineHeight(this.isTibetanLanguages() ? 22 : 0)
1127                    .textOverflow({ overflow: TextOverflow.None })
1128                    .width('auto')
1129                    .maxLines(2)
1130                }
1131                .onAreaChange((o, n) => {
1132                  this.textHeight = n.height as number;
1133                  console.info(`**textHeight**:${this.textHeight}`)
1134                })
1135                .margin({
1136                  top: this.isAvailableType ? 0 : (24),
1137                  bottom: 15, left: 24, right: 24
1138                })
1139                .accessibilityGroup(true)
1140                .accessibilityLevel('yes')
1141
1142                Column() {
1143                  Scroll(){
1144                    Column(){
1145                      Text(this.peerCustomDescription)
1146                        .textAlign(TextAlign.Center)
1147                        .fontColor($r('sys.color.font_primary'))
1148                        .fontSize($r('sys.float.Body_L'))
1149                        .width('auto')
1150                        .lineHeight(this.isTibetanLanguages() ? 22 : 0)
1151                        .margin({
1152                          bottom: 12, left: 12, right: 12
1153                        })
1154                        .accessibilityGroup(true)
1155                        .accessibilityLevel('yes')
1156
1157                      Stack(){
1158                        List({ space: 0 }) {
1159                          ForEach(this.appDataList, (app: AppData, index: number) => {
1160                            ListItem() {
1161                              Row() {
1162                                Column() {
1163                                  Column() {
1164                                    Text(app.hostPkgLabel)
1165                                      .fontSize($r('sys.float.Body_L'))
1166                                      .fontColor($r('sys.color.font_primary'))
1167                                      .textAlign(TextAlign.Start)
1168                                      .maxLines(2)
1169                                      .textOverflow({ overflow: TextOverflow.Ellipsis })
1170                                      .width('100%')
1171                                  }
1172                                  .margin({ top: this.marginValue, bottom: 2 })
1173                                  Column() {
1174                                    Text(app.bundleInfo)
1175                                      .fontSize($r('sys.float.Body_M'))
1176                                      .fontColor($r('sys.color.font_secondary'))
1177                                      .textAlign(TextAlign.Start)
1178                                      .width('100%')
1179                                  }
1180                                    .margin({ bottom: this.marginValue })
1181                                }
1182                                .layoutWeight(1)
1183                                .padding({
1184                                  right: 8
1185                                })
1186                                .accessibilityGroup(true)
1187                                .accessibilityLevel('yes')
1188                                .margin({
1189                                  top: index === 0 ? 4 : 0,
1190                                  bottom: index === (this.appDataList.length - 1) ? 4 : 0
1191                                })
1192
1193                                Checkbox({ name: app.hostPkgLabel, })
1194                                  .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName))
1195                                  .shape(CheckBoxShape.CIRCLE)
1196                                  .size({ width: 20, height: 20 })
1197                                  .onChange((checked: boolean) => {
1198                                    this.toggleSelection(app, index, checked);
1199                                  })
1200                              }
1201                              .width('100%')
1202                              .padding({ top: 11, bottom: 11, left: 12, right: 12 })
1203                            }
1204                          }, (app: AppData) => app.hostPkgLabel)
1205                        }
1206                        .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
1207                        .backgroundColor($r('sys.color.comp_background_list_card'))
1208                        .width('100%')
1209                        .divider({
1210                          strokeWidth: 1,
1211                          color: $r('sys.color.ohos_id_color_list_separator'),
1212                          startMargin: 12,
1213                          endMargin: 12
1214                        })
1215                        .edgeEffect(EdgeEffect.Spring)
1216                      }
1217                    }
1218                    .margin({ left: 12, right: 12 })
1219                  }
1220                  .height('auto')
1221                  .constraintSize({
1222                    maxHeight: ((px2vp(this.mLocalHeight) - 28 - 39) * 0.9 - this.symbolHeight -
1223                      this.buttonHeight - this.textHeight - 81)
1224                  })
1225                  .onAreaChange((o, n) => {
1226                    this.scrollHeight = n.height as number;
1227                    console.info(`**scrollHeight**:${this.scrollHeight}`)
1228                  })
1229                  .scrollable(ScrollDirection.Vertical)
1230                  .scrollBar(BarState.On)
1231                }
1232                .margin({ bottom: 8 })
1233
1234                Column() {
1235                  Button($r('app.string.dm_allow_always'))
1236                    .margin({ top: 0, bottom: 4 })
1237                    .padding({ top: 8, bottom: 8 })
1238                    .type(ButtonType.ROUNDED_RECTANGLE)
1239                    .onClick(() => {
1240                      this.onAllowAlways();
1241                    })
1242                    .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1243                    .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1244                    .width('100%')
1245                    .backgroundColor(this.btnColor)
1246                    .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1247                      if (isHover) {
1248                        this.btnColor = $r('sys.color.ohos_id_color_hover');
1249                      } else {
1250                        this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1251                      }
1252                    })
1253                    .stateStyles({
1254                      pressed: {
1255                        .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1256                      },
1257                      normal: {
1258                        .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1259                      }
1260                    })
1261                    .accessibilityGroup(true)
1262                    .accessibilityLevel('yes')
1263
1264                  Button($r('app.string.dm_allow_this_time'))
1265                    .margin({ bottom: 4 })
1266                    .padding({ top: 8, bottom: 8 })
1267                    .type(ButtonType.ROUNDED_RECTANGLE)
1268                    .onClick(() => {
1269                      this.onAllowOnce();
1270                    })
1271                    .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1272                    .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1273                    .width('100%')
1274                    .backgroundColor(this.btnColor)
1275                    .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1276                      if (isHover) {
1277                        this.btnColor = $r('sys.color.ohos_id_color_hover');
1278                      } else {
1279                        this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1280                      }
1281                    })
1282                    .stateStyles({
1283                      pressed: {
1284                        .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1285                      },
1286                      normal: {
1287                        .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1288                      }
1289                    })
1290                    .accessibilityGroup(true)
1291                    .accessibilityLevel('yes')
1292
1293                  Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum))
1294                    .padding({ top: 8, bottom: 8 })
1295                    .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1296                    .defaultFocus(true)
1297                    .type(ButtonType.ROUNDED_RECTANGLE)
1298                    .onKeyEvent((event ?: KeyEvent) => {
1299                      if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Down) {
1300                        console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1301                        return;
1302                      }
1303                      if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Up) {
1304                        console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1305                        this.onCancel();
1306                      }
1307                    })
1308                    .onClick(() => {
1309                      this.onCancel();
1310                    })
1311                    .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1312                    .width('100%')
1313                    .backgroundColor(this.btnColor)
1314                    .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1315                      if (isHover) {
1316                        this.btnColor = $r('sys.color.ohos_id_color_hover');
1317                      } else {
1318                        this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1319                      }
1320                    })
1321                    .stateStyles({
1322                      pressed: {
1323                        .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1324                      },
1325                      normal: {
1326                        .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1327                      }
1328                    })
1329                    .accessibilityGroup(true)
1330                    .accessibilityLevel('yes')
1331                  }
1332                .onAreaChange((o, n) => {
1333                  this.buttonHeight = n.height as number;
1334                  console.info(`**buttonHeight**:${this.buttonHeight}`)
1335                })
1336                .margin({
1337                  left: 16,
1338                  right: 16,
1339                  bottom: this.isPC ? 16 : 8
1340                })
1341              }
1342              .margin({
1343                left: 16, right: 16,
1344              })
1345              .height('auto')
1346              .clip(true)
1347              .backgroundColor($r('sys.color.mask_fourth'))
1348              .borderRadius($r('sys.float.alert_container_shape'))
1349              .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK)
1350            } else if (this.currentOrientation === window.Orientation.LANDSCAPE) {
1351              Column(){
1352                this.Symbol();
1353                Scroll() {
1354                  Column() {
1355                    Column() {
1356                      Text(this.title)
1357                        .textAlign(TextAlign.Center)
1358                        .fontSize(this.fontSize)
1359                        .fontWeight(FontWeight.Bold)
1360                        .fontColor($r('sys.color.ohos_id_color_text_primary'))
1361                        .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST)
1362                        .lineHeight(this.isTibetanLanguages() ? 22 : 0)
1363                        .textOverflow({ overflow: TextOverflow.None })
1364                        .width('auto')
1365                        .maxLines(2)
1366                    }
1367                    .margin({
1368                      top: this.isAvailableType ? 0 : 24, left: 12, right: 12,
1369                      bottom: 15
1370                    })
1371                    .accessibilityGroup(true)
1372                    .accessibilityLevel('yes')
1373
1374                    Text(this.peerCustomDescription)
1375                      .textAlign(TextAlign.Center)
1376                      .fontColor($r('sys.color.font_primary'))
1377                      .fontSize($r('sys.float.Body_L'))
1378                      .width('auto')
1379                      .lineHeight(this.isTibetanLanguages() ? 22 : 0)
1380                      .margin({
1381                        left: 12,
1382                        right: 12,
1383                        bottom: 12
1384                      })
1385                      .padding({ left: 20, right: 20 })
1386                      .accessibilityGroup(true)
1387                      .accessibilityLevel('yes')
1388                    List({ space: 0 }) {
1389                      ForEach(this.appDataList, (app: AppData, index: number) => {
1390                        ListItem() {
1391                          Row() {
1392                            Column() {
1393                              Column() {
1394                                Text(app.hostPkgLabel)
1395                                  .fontSize($r('sys.float.Body_L'))
1396                                  .fontColor($r('sys.color.font_primary'))
1397                                  .textAlign(TextAlign.Start)
1398                                  .maxLines(2)
1399                                  .textOverflow({ overflow: TextOverflow.Ellipsis })
1400                                  .width('100%')
1401                              }
1402                              .margin({ top: this.marginValue, bottom: 2 })
1403                              Column() {
1404                                Text(app.bundleInfo)
1405                                  .fontSize($r('sys.float.Body_M'))
1406                                  .fontColor($r('sys.color.font_secondary'))
1407                                  .textAlign(TextAlign.Start)
1408                                  .width('100%')
1409                              }
1410                              .margin({ bottom: this.marginValue })
1411                            }
1412                            .layoutWeight(1)
1413                            .padding({
1414                              right: 12
1415                            })
1416                            .accessibilityGroup(true)
1417                            .accessibilityLevel('yes')
1418                            .margin({
1419                              top: index === 0 ? 4 : 0,
1420                              bottom: index === (this.appDataList.length - 1) ? 4 : 0
1421                            })
1422
1423                            Checkbox({ name: app.hostPkgLabel, })
1424                              .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName))
1425                              .shape(CheckBoxShape.CIRCLE)
1426                              .size({ width: 20, height: 20 })
1427                              .onChange((checked: boolean) => {
1428                                this.toggleSelection(app, index, checked);
1429                              })
1430                          }
1431                          .width('100%')
1432                          .padding(12)
1433                        }
1434                      }, (app: AppData) => app.hostPkgLabel)
1435                    }
1436                    .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
1437                    .backgroundColor($r('sys.color.comp_background_list_card'))
1438                    .width('auto')
1439                    .divider({
1440                      strokeWidth: 1,
1441                      color: $r('sys.color.ohos_id_color_list_separator'),
1442                      startMargin: 12,
1443                      endMargin: 12
1444                    })
1445                    .margin({ bottom: 4 })
1446                    .edgeEffect(EdgeEffect.Spring)
1447                    .scrollBar(BarState.Off)
1448
1449                    Button($r('app.string.dm_allow_always'))
1450                      .margin({ top: 4, bottom: 4, right: 4, left: 4 })
1451                      .padding({ top: 8, bottom: 8 })
1452                      .type(ButtonType.ROUNDED_RECTANGLE)
1453                      .onClick(() => {
1454                        this.onAllowAlways();
1455                      })
1456                      .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1457                      .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1458                      .width(this.isPC ? 250 : '100%')
1459                      .backgroundColor(this.btnColor)
1460                      .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1461                        if (isHover) {
1462                          this.btnColor = $r('sys.color.ohos_id_color_hover');
1463                        } else {
1464                          this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1465                        }
1466                      })
1467                      .stateStyles({
1468                        pressed: {
1469                          .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1470                        },
1471                        normal: {
1472                          .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1473                        }
1474                      })
1475                      .accessibilityGroup(true)
1476                      .accessibilityLevel('yes')
1477
1478                    Button($r('app.string.dm_allow_this_time'))
1479                      .margin({ bottom: 4, right: 4, left: 4 })
1480                      .padding({ top: 8, bottom: 8 })
1481                      .type(ButtonType.ROUNDED_RECTANGLE)
1482                      .onClick(() => {
1483                        this.onAllowOnce();
1484                      })
1485                      .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1486                      .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1487                      .width(this.isPC ? 250 : '100%')
1488                      .backgroundColor(this.btnColor)
1489                      .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1490                        if (isHover) {
1491                          this.btnColor = $r('sys.color.ohos_id_color_hover');
1492                        } else {
1493                          this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1494                        }
1495                      })
1496                      .stateStyles({
1497                        pressed: {
1498                          .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1499                        },
1500                        normal: {
1501                          .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1502                        }
1503                      })
1504                      .accessibilityGroup(true)
1505                      .accessibilityLevel('yes')
1506
1507                    Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum))
1508                      .margin({ bottom: 8, right: 4, left: 4 })
1509                      .padding({ top: 8, bottom: 8 })
1510                      .type(ButtonType.ROUNDED_RECTANGLE)
1511                      .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1512                      .defaultFocus(true)
1513                      .onKeyEvent((event ?: KeyEvent) => {
1514                        if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Down) {
1515                          console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1516                          return;
1517                        }
1518                        if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Up) {
1519                          console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1520                          this.onCancel();
1521                        }
1522                      })
1523                      .onClick(() => {
1524                        this.onCancel();
1525                      })
1526                      .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1527                      .width(this.isPC ? 250 : '100%')
1528                      .backgroundColor(this.btnColor)
1529                      .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1530                        if (isHover) {
1531                          this.btnColor = $r('sys.color.ohos_id_color_hover');
1532                        } else {
1533                          this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1534                        }
1535                      })
1536                      .stateStyles({
1537                        pressed: {
1538                          .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1539                        },
1540                        normal: {
1541                          .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1542                        }
1543                      })
1544                      .accessibilityGroup(true)
1545                      .accessibilityLevel('yes')
1546                  }
1547                  .margin({ left: 12, right: 12 })
1548                }
1549                .border({
1550                  radius: { topLeft: 0, topRight: 0, bottomLeft: 32, bottomRight: 32 }
1551                })
1552                .layoutWeight(1)
1553                .constraintSize({
1554                  maxHeight: 'auto'
1555                })
1556                .scrollable(ScrollDirection.Vertical)
1557                .scrollBar(BarState.On)
1558              }
1559              .width(400)
1560              .height(266)
1561              .clip(true)
1562              .backgroundColor($r('sys.color.mask_fourth'))
1563              .borderRadius($r('sys.float.alert_container_shape'))
1564              .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK)
1565            }
1566          }
1567        }
1568      }
1569      .onAreaChange((o, n) => {
1570        this.columnHeight = n.height as number;
1571        console.info(`**columnHeight**:${this.columnHeight}`)
1572      })
1573      .constraintSize({ maxHeight: (px2vp(this.mLocalHeight) - 28 - 39) * 0.9 })
1574      .height('auto')
1575    } else {
1576      GridRow({
1577        columns: { xs: 4, sm: 8, md: this.isPC ? 24 : 12 },
1578        gutter: { x: 4 },
1579        breakpoints: { value: ['600vp', '840vp'] }
1580      }) {
1581        GridCol({ span: { xs: 4, sm: 4, md: this.isPC ? 6 : 4 }, offset: { sm: 2, md: this.isPC ? 9 : 4 } }) {
1582          Column() {
1583            this.Symbol();
1584            Column() {
1585              Text(this.title)
1586                .textAlign(TextAlign.Center)
1587                .fontSize($r('sys.float.Title_S'))
1588                .fontWeight(FontWeight.Bold)
1589                .fontColor($r('sys.color.ohos_id_color_text_primary'))
1590                .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST)
1591                .lineHeight(this.isTibetanLanguages() ? 22 : 0)
1592                .textOverflow({ overflow: TextOverflow.None })
1593                .width('auto')
1594                .maxLines(2)
1595            }
1596            .margin({
1597              top: this.isAvailableType ? 0 : 24,
1598              bottom: 15, left: 24, right: 24
1599            })
1600            .width('100%')
1601            Column() {
1602              Text(this.peerCustomDescription)
1603                .textAlign(TextAlign.Start)
1604                .fontColor($r('sys.color.ohos_id_color_text_secondary'))
1605                .fontWeight(FontWeight.Regular)
1606                .textOverflow({ overflow: TextOverflow.Ellipsis })
1607                .fontSize($r('sys.float.ohos_id_text_size_body2'))
1608                .maxLines(2)
1609                .width('auto')
1610                .lineHeight(this.isTibetanLanguages() ? 22 : 0)
1611                .margin({ top: 8 })
1612                .visibility(this.peerCustomDescription === '' ? Visibility.None : Visibility.Visible)
1613            }.margin({
1614              top: this.isAvailableType ? 0 : 24,
1615              bottom: 16, left: 24, right: 24
1616            })
1617
1618            Column() {
1619              Button($r('app.string.dm_allow_always'))
1620                .margin({ bottom: 4 })
1621                .padding({ top: 8, bottom: 8 })
1622                .onClick(() => {
1623                  this.onAllowAlways();
1624                })
1625                .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1626                .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1627                .width('100%')
1628                .backgroundColor(this.btnColor)
1629                .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1630                  if (isHover) {
1631                    this.btnColor = $r('sys.color.ohos_id_color_hover');
1632                  } else {
1633                    this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1634                  }
1635                })
1636                .stateStyles({
1637                  pressed: {
1638                    .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1639                  },
1640                  normal: {
1641                    .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1642                  }
1643                })
1644              Button($r('app.string.dm_allow_this_time'))
1645                .margin({ bottom: 4 })
1646                .padding({ top: 8, bottom: 8 })
1647                .onClick(() => {
1648                  this.onAllowOnce();
1649                })
1650                .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1651                .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1652                .width('100%')
1653                .backgroundColor(this.btnColor)
1654                .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1655                  if (isHover) {
1656                    this.btnColor = $r('sys.color.ohos_id_color_hover');
1657                  } else {
1658                    this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1659                  }
1660                })
1661                .stateStyles({
1662                  pressed: {
1663                    .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1664                  },
1665                  normal: {
1666                    .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1667                  }
1668                })
1669              Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum))
1670                .margin({ left: 16, right: 16 })
1671                .padding({ top: 8, bottom: 8 })
1672                .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
1673                .defaultFocus(true)
1674                .onKeyEvent((event ?: KeyEvent) => {
1675                  if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Down) {
1676                    console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1677                    return;
1678                  }
1679                  if (event && event ?.keyCode === KeyCode.KEYCODE_HOME && event ?.type === KeyType.Up) {
1680                    console.log(TAG + 'onKeyEvent eventType: ' + event ?.type)
1681                    this.onCancel();
1682                  }
1683                })
1684                .onClick(() => {
1685                  this.onCancel();
1686                })
1687                .height(this.isTibetanLanguages() ? 'auto' : (this.fontSizeScale > 1 ? 56 : 40))
1688                .width('100%')
1689                .backgroundColor(this.btnColor)
1690                .onHover((isHover ?: boolean, event ?: HoverEvent): void => {
1691                  if (isHover) {
1692                    this.btnColor = $r('sys.color.ohos_id_color_hover');
1693                  } else {
1694                    this.btnColor = this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent;
1695                  }
1696                })
1697                .stateStyles({
1698                  pressed: {
1699                    .backgroundColor($r('sys.color.ohos_id_color_click_effect'))
1700                  },
1701                  normal: {
1702                    .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent)
1703                  }
1704                })
1705            }
1706            .margin({
1707              left: 16,
1708              right: 16,
1709              bottom: this.isPC ? 24 : 8
1710            })
1711          }
1712          .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
1713          .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK)
1714          .margin({ left: $r('sys.float.ohos_id_dialog_margin_start'), right: $r('sys.float.ohos_id_dialog_margin_end') })
1715        }
1716      }
1717      .constraintSize({ maxHeight: '90%' })
1718    }
1719  }
1720}
1721
1722@Entry
1723@Component
1724struct dialogPlusPage {
1725  dialogController: CustomDialogController = new CustomDialogController({
1726    builder: ConfirmCustomDialog(),
1727    autoCancel: false,
1728    onWillDismiss: () => {
1729      this.onWillDismiss()
1730    },
1731    alignment: DialogAlignment.Center,
1732    offset: { dx: 0, dy: 0 },
1733    customStyle: true,
1734    maskColor: $r('sys.color.ohos_id_color_mask_thin')
1735  });
1736
1737  initStatue() {
1738    if (dmClass) {
1739      console.log(TAG + 'deviceManager exist')
1740      return
1741    }
1742    deviceManager.createDeviceManager('com.ohos.devicemanagerui.confirm',
1743      (err: Error, dm: deviceManager.DeviceManager) => {
1744        if (err) {
1745          console.log('createDeviceManager err:' + JSON.stringify(err) + ' --fail:' + JSON.stringify(dm))
1746          return
1747        }
1748        dmClass = dm
1749        dmClass.on('uiStateChange', (data: Record<string, string>) => {
1750          console.log('uiStateChange executed, dialog closed' + JSON.stringify(data))
1751          let tmpStr: Record<string, number> = JSON.parse(data.param)
1752          let msg: number = tmpStr.uiStateMsg as number
1753          if (msg === MSG_CANCEL_CONFIRM_SHOW) {
1754            console.log('cancel confirm show.')
1755            this.destruction()
1756            return
1757          }
1758        })
1759      })
1760  }
1761
1762  onWillDismiss() {
1763    console.log(TAG + 'onWillDismiss: ' + ACTION_CANCEL_AUTH)
1764    this.setUserOperation(ACTION_CANCEL_AUTH);
1765    this.destruction();
1766  }
1767
1768  setUserOperation(operation: number) {
1769    console.log(TAG + 'setUserOperation: ' + operation)
1770    if (dmClass == null) {
1771      console.log(TAG + 'setUserOperation: ' + 'dmClass null')
1772      return;
1773    }
1774    try {
1775      dmClass.setUserOperation(operation, 'extra');
1776    } catch (err) {
1777      console.log(TAG + 'dmClass setUserOperation failed')
1778    }
1779  }
1780
1781  onPageShow() {
1782    console.log('onPageShow')
1783    this.initStatue()
1784  }
1785
1786  destruction() {
1787    let session = AppStorage.get<UIExtensionContentSession>('ConfirmSession');
1788    if (session) {
1789      session.terminateSelf();
1790    }
1791  }
1792
1793  aboutToDisappear() {
1794    console.log(TAG + 'aboutToDisappear aboutToDisappear')
1795    if (dmClass != null) {
1796      try {
1797        dmClass.off('uiStateChange');
1798        dmClass.release();
1799      } catch (err) {
1800        console.log('dmClass release failed')
1801      }
1802      dmClass = null
1803    }
1804  }
1805
1806  build() {
1807    Column(this.dialogController.open())
1808  }
1809}
1810