• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 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 */
15
16import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
17import router from '@ohos.router';
18import common from '@ohos.app.ability.common';
19import { staffItem } from '../component/encryptionComponents/staff';
20import Constants from '../common/constant';
21import ability from '@ohos.ability.ability';
22import {
23  AuthAccount,
24  PermissionType,
25  calculate,
26  toggleShow,
27  directionStatus,
28  getTime,
29} from '../common/utils';
30import GlobalContext from '../common/GlobalContext';
31import { HiLog } from '../common/HiLog';
32import { SystemUtils } from '../common/systemUtils';
33import IdDlpRpcServiceProxy from '../Ability/data/IIdlDlpRpcServiceTs/id_dlpRpc_service_proxy';
34
35const TAG = 'EncSucc';
36let abilityResult: ability.AbilityResult = {
37  'resultCode': 0,
38  'want': {}
39};
40
41@Extend(Text)
42function customizeText() {
43  .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
44  .fontSize($r('sys.float.ohos_id_text_size_button2'))
45  .fontWeight(FontWeight.Medium)
46}
47
48let storage: LocalStorage = LocalStorage.getShared();
49@Entry(storage)
50@Component
51struct encryptionSuccess {
52  @State session: UIExtensionContentSession | undefined = storage === undefined ? undefined : storage.get<UIExtensionContentSession>('session');
53  private routerParams: Record<string, AuthAccount[] | PermissionType> =
54    router.getParams() as Record<string, AuthAccount[] | PermissionType>;
55  @State directionStatus: number = 0;
56  @State flag: boolean = false;
57  @State editFlag: boolean = false;
58  @State readOnlyFlag: boolean = false;
59  @State handlePopupReadOnly: boolean = false;
60  @State handlePopupEdit: boolean = false;
61  @State rowNamesLenEdit: number = 0;
62  @State rowNamesLenReadOnly: number = 0;
63  @State hideNamesNumEdit: string = '0';
64  @State hideNamesNumReadOnly: string = '0';
65  @State showNamesArrEdit: AuthAccount[] = [];
66  @State showNamesArrReadOnly: AuthAccount[] = [];
67  @State staffDataArrayReadOnly: AuthAccount[] = this.routerParams.staffDataArrayReadOnly as AuthAccount[];
68  @State staffDataArrayEdit: AuthAccount[] = this.routerParams.staffDataArrayEdit as AuthAccount[];
69
70  @Builder popupBuilderReadOnly() {
71    Row() {
72      Text($r('app.string.header_title_readonly_tips'))
73        .fontFamily('HarmonyHeiTi')
74        .fontSize($r('sys.float.ohos_id_text_size_body2'))
75        .fontColor($r('sys.color.ohos_id_color_text_primary'))
76    }
77    .width(Constants.HEADER_COLUMN_MESSAGE_TIPS)
78    .padding({
79      left: Constants.ROW_FONT_SIZE,
80      right: Constants.ROW_FONT_SIZE,
81      top: Constants.DA_MARGIN_TOP,
82      bottom: Constants.DA_MARGIN_TOP
83    })
84  }
85
86  @Builder popupBuilderEdit() {
87    Row() {
88      Text($r('app.string.header_title_edit_tips'))
89        .fontSize($r('sys.float.ohos_id_text_size_body2'))
90        .fontColor($r('sys.color.ohos_id_color_text_primary'))
91    }
92    .width(Constants.HEADER_COLUMN_MESSAGE_TIPS)
93    .padding({
94      left: Constants.ROW_FONT_SIZE,
95      right: Constants.ROW_FONT_SIZE,
96      top: Constants.DA_MARGIN_TOP,
97      bottom: Constants.DA_MARGIN_TOP
98    })
99  }
100
101  onFlagChange() {
102    animateTo({
103      duration: 650,
104      curve: Curve.Smooth
105    }, () => {
106      this.flag = !this.flag;
107    })
108  }
109
110  aboutToAppear() {
111    HiLog.info(TAG, `aboutToAppear, encrypt success`);
112    this.directionStatus = (getContext(this) as common.UIAbilityContext).config.direction ?? -1;
113    directionStatus((counter) => {
114      this.directionStatus = counter;
115    })
116  }
117
118  build() {
119    GridRow({
120      columns: {
121        xs: Constants.XS_COLUMNS,
122        sm: Constants.SM_COLUMNS,
123        md: Constants.MD_COLUMNS,
124        lg: Constants.LG_COLUMNS
125      },
126      gutter: Constants.DIALOG_GUTTER
127    }) {
128      GridCol({
129        span: {
130          xs: Constants.XS_SPAN,
131          sm: Constants.SM_SPAN,
132          md: Constants.DIALOG_MD_SPAN,
133          lg: Constants.DIALOG_LG_SPAN
134        },
135        offset: {
136          xs: Constants.XS_OFFSET,
137          sm: Constants.SM_OFFSET,
138          md: Constants.DIALOG_MD_OFFSET,
139          lg: Constants.DIALOG_LG_OFFSET
140        }
141      }) {
142        Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center,
143          direction: FlexDirection.Column }) {
144          Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
145            Column() {
146              Row() {
147                Text($r('app.string.header_title'))
148                  .fontWeight(FontWeight.Bold)
149                  .fontFamily($r('app.string.typeface'))
150                  .fontColor($r('sys.color.ohos_id_color_text_primary'))
151                  .fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
152                  .width(Constants.HEADER_TEXT_WIDTH)
153                  .align(Alignment.Start)
154              }
155              .width(Constants.HEADER_COLUMN_WIDTH)
156              .height(Constants.HEADER_COLUMN_HEIGHT)
157              .padding({
158                left: Constants.HEADER_COLUMN_PADDING_LEFT,
159                right: Constants.HEADER_COLUMN_PADDING_RIGHT
160              })
161              .margin({ bottom: Constants.HEADER_COLUMN_MARGIN_BOTTOM });
162
163              Scroll() {
164                Column() {
165                  Stack() {
166                    Circle({ width: Constants.ENCRYPTION_SUCCESS_CIRCLE, height: Constants.ENCRYPTION_SUCCESS_CIRCLE })
167                      .fill($r('sys.color.multi_color_04'));
168                    SymbolGlyph($r('sys.symbol.checkmark'))
169                      .fontSize(`${Constants.ENCRYPTION_SUCCESS_ICON}vp`)
170                      .fontColor([$r('sys.color.icon_on_primary')])
171                  }
172                  .margin({ top: Constants.ENCRYPTION_SUCCESS_IMAGE_MARGIN_TOP });
173                  Column() {
174                    Row() {
175                      Text($r('app.string.file_encrypted'))
176                        .fontSize($r('sys.float.ohos_id_text_size_body1'))
177                        .fontColor($r('sys.color.ohos_id_color_text_primary'))
178                        .width(Constants.HEADER_COLUMN_WIDTH)
179                        .textAlign(TextAlign.Center)
180                        .fontWeight(FontWeight.Medium)
181                    }
182                    .width(Constants.HEADER_COLUMN_WIDTH)
183
184                    Row() {
185                      Text(`${GlobalContext.load('dlpFileName') as string}`)
186                        .fontSize($r('sys.float.ohos_id_text_size_body2'))
187                        .fontColor($r('sys.color.ohos_id_color_secondary'))
188                        .fontWeight(FontWeight.Regular)
189                        .width(Constants.HEADER_COLUMN_WIDTH)
190                        .textAlign(TextAlign.Center)
191                    }
192                    .width(Constants.HEADER_COLUMN_WIDTH)
193                  }
194                  .width(Constants.HEADER_COLUMN_WIDTH)
195                  .padding({
196                    top: Constants.HEADER_COLUMN_PADDING_LEFT,
197                    bottom: Constants.HEADER_COLUMN_PADDING_RIGHT
198                  })
199
200                  Row() {
201                    Text(!this.flag ? $r('app.string.viewing_encryption_details') : $r('app.string.stow_away'))
202                      .fontSize($r('sys.float.ohos_id_text_size_body2'))
203                      .fontColor($r('sys.color.ohos_id_color_secondary'))
204                      .fontWeight(FontWeight.Regular)
205                      .textAlign(TextAlign.Center)
206                    SymbolGlyph($r('sys.symbol.chevron_down'))
207                      .fontSize(`${Constants.PP_IMAGE_HEIGHT}vp`)
208                      .fontColor([$r('sys.color.ohos_id_color_tertiary')])
209                      .rotate({
210                        angle: !this.flag ? Constants.PP_BUTTON_PAD : Constants.ENCRYPTION_SUCCESS_TRANSLATE
211                      })
212                      .transition({ type: TransitionType.All, opacity: Constants.PP_BUTTON_PAD })
213                  }
214                  .onClick(() => this.onFlagChange())
215                  .justifyContent(FlexAlign.Center)
216                  .margin({ bottom: Constants.ENCRYPTION_SUCCESS_ROTATE_MARGIN_BOTTOM })
217
218                  Column() {
219                    if (this.flag) {
220                      if ((this.routerParams.selectedPermissionTypeReadOnly as PermissionType).data === 'all') {
221                        Row() {
222                          Text($r('app.string.header_title_readonly'))
223                            .fontWeight(FontWeight.Medium)
224                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
225                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
226                          Text(' : ')
227                            .fontFamily($r('app.string.typeface'))
228                            .fontWeight(FontWeight.Regular)
229                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
230                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
231                          Text($r('app.string.PERMISSION_TYPE_SELECT_ALL'))
232                            .fontFamily($r('app.string.typeface'))
233                            .fontWeight(FontWeight.Regular)
234                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
235                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
236                          SymbolGlyph($r('sys.symbol.info_circle'))
237                            .fontSize(`${Constants.FOOTER_ROW_PAD_RIGHT}vp`)
238                            .fontColor([$r('sys.color.icon_secondary')])
239                            .margin({
240                              right: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_RIGHT : Constants.AP_TEXT_PAD_LEFT,
241                              left: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_LEFT : Constants.AP_TEXT_PAD_RIGHT,
242                            })
243                            .onClick(() => {
244                              this.handlePopupReadOnly = !this.handlePopupReadOnly
245                            })
246                            .draggable(false)
247                            .bindPopup(this.handlePopupReadOnly, {
248                              builder: this.popupBuilderReadOnly,
249                              placement: SystemUtils.isRTL() ? Placement.BottomRight : Placement.BottomLeft,
250                              offset: {
251                                x: SystemUtils.isRTL() ? Constants.POPUP_OFFSET_RTL_X : Constants.POPUP_OFFSET_X
252                              },
253                              enableArrow: true,
254                              showInSubWindow: false,
255                              onStateChange: (e) => {
256                                if (!e.isVisible) {
257                                  this.handlePopupReadOnly = false
258                                }
259                              }
260                            })
261                        }
262                        .width(Constants.FOOTER_ROW_WIDTH)
263                        .margin({
264                          top: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_TOP,
265                          bottom: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_BOTTOM
266                        })
267                      } else {
268                        if (this.staffDataArrayReadOnly['length']) {
269                          Row() {
270                            Text($r('app.string.header_title_readonly'))
271                              .fontWeight(FontWeight.Medium)
272                              .fontColor($r('sys.color.ohos_id_color_text_primary'))
273                              .fontSize($r('sys.float.ohos_id_text_size_body2'))
274                            Text(` (${this.staffDataArrayReadOnly['length']}):`)
275                              .fontFamily($r('app.string.typeface'))
276                              .fontWeight(FontWeight.Regular)
277                              .fontColor($r('sys.color.ohos_id_color_text_primary'))
278                              .fontSize($r('sys.float.ohos_id_text_size_body2'))
279                            SymbolGlyph($r('sys.symbol.info_circle'))
280                              .fontSize(`${Constants.FOOTER_ROW_PAD_RIGHT}vp`)
281                              .fontColor([$r('sys.color.icon_secondary')])
282                              .margin({
283                                right: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_RIGHT : Constants.AP_TEXT_PAD_LEFT,
284                                left: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_LEFT : Constants.AP_TEXT_PAD_RIGHT,
285                              })
286                              .onClick(() => {
287                                this.handlePopupReadOnly = !this.handlePopupReadOnly
288                              })
289                              .draggable(false)
290                              .bindPopup(this.handlePopupReadOnly, {
291                                builder: this.popupBuilderReadOnly,
292                                placement: SystemUtils.isRTL() ? Placement.BottomRight : Placement.BottomLeft,
293                                offset: {
294                                  x: SystemUtils.isRTL() ? Constants.POPUP_OFFSET_RTL_X : Constants.POPUP_OFFSET_X
295                                },
296                                enableArrow: true,
297                                showInSubWindow: false,
298                                onStateChange: (e) => {
299                                  if (!e.isVisible) {
300                                    this.handlePopupReadOnly = false
301                                  }
302                                }
303                              })
304                          }
305                          .width(Constants.FOOTER_ROW_WIDTH)
306
307                          Flex({
308                            direction: FlexDirection.Row,
309                            wrap: FlexWrap.Wrap,
310                          }) {
311                            if (this.staffDataArrayReadOnly['length'] > 0) {
312                              ForEach(
313                                this.showNamesArrReadOnly,
314                                (item: AuthAccount, index?: number) => {
315                                  staffItem({
316                                    authAccount: item.authAccount,
317                                    textContent: item.textContent,
318                                    isActive: false,
319                                    changeIndex: Number(index),
320                                  })
321                                },
322                                (item: AuthAccount) => item.authAccount
323                              )
324                              if (Number(this.hideNamesNumReadOnly) > 0) {
325                                Row() {
326                                  if (this.showNamesArrReadOnly.length !== this.staffDataArrayReadOnly.length) {
327                                    Text() {
328                                      Span('+')
329                                      Span(this.hideNamesNumReadOnly)
330                                    }
331                                    .customizeText()
332                                  }
333                                  SymbolGlyph($r('sys.symbol.chevron_down'))
334                                    .fontSize(`${Constants.PP_IMAGE_HEIGHT}vp`)
335                                    .fontColor([$r('sys.color.ohos_id_color_secondary')])
336                                    .rotate({
337                                      angle: !this.readOnlyFlag ?
338                                        Constants.PP_BUTTON_PAD : Constants.ENCRYPTION_SUCCESS_TRANSLATE
339                                    })
340                                    .transition({ type: TransitionType.All, opacity: Constants.PP_BUTTON_PAD })
341                                }
342                                .height(Constants.ENCRYPTION_SUCCESS_TOGGLE_HEIGHT)
343                                .onClick(() => {
344                                  let tmp: Record<string, AuthAccount[] | boolean> = toggleShow(
345                                    this.routerParams.staffDataArrayReadOnly as AuthAccount[],
346                                    this.showNamesArrReadOnly,
347                                    this.readOnlyFlag,
348                                    this.rowNamesLenReadOnly
349                                  );
350                                  this.showNamesArrReadOnly = tmp.showNamesArr as AuthAccount[];
351                                  this.readOnlyFlag = tmp.showFlag as boolean;
352                                })
353                              }
354                            }
355                          }
356                          .onAreaChange((oldValue: Area, newValue: Area) => {
357                            if (oldValue.width === Constants.ENCRYPTION_ON_AREA_CHANGE_WIDTH ||
358                              newValue.width !== oldValue.width) {
359                              let tmp: Record<string, number | AuthAccount[] | string> =
360                                calculate(newValue, this.routerParams.staffDataArrayReadOnly as AuthAccount[]);
361                              this.rowNamesLenReadOnly = tmp.rowNamesLen as number;
362                              this.showNamesArrReadOnly = tmp.showNamesArr as AuthAccount[];
363                              this.hideNamesNumReadOnly = tmp.hideNamesNum as string;
364                              this.readOnlyFlag = false;
365                            }
366                          })
367                          .margin({
368                            top: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_TOP,
369                            bottom: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_BOTTOM
370                          })
371                        }
372                      }
373
374                      if (['all', 'self']
375                        .includes((this.routerParams.selectedPermissionTypeEdit as PermissionType).data)) {
376                        Row() {
377                          Text($r('app.string.header_title_edit'))
378                            .fontWeight(FontWeight.Medium)
379                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
380                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
381                          Text(' : ')
382                            .fontFamily($r('app.string.typeface'))
383                            .fontWeight(FontWeight.Regular)
384                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
385                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
386                          Text((this.routerParams.selectedPermissionTypeEdit as PermissionType).data === 'all' ?
387                            $r('app.string.PERMISSION_TYPE_SELECT_ALL') : $r('app.string.PERMISSION_TYPE_SELECT_SELF'))
388                            .fontFamily($r('app.string.typeface'))
389                            .fontWeight(FontWeight.Regular)
390                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
391                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
392                          SymbolGlyph($r('sys.symbol.info_circle'))
393                            .fontSize(`${Constants.FOOTER_ROW_PAD_RIGHT}vp`)
394                            .fontColor([$r('sys.color.icon_secondary')])
395                            .margin({
396                              right: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_RIGHT : Constants.AP_TEXT_PAD_LEFT,
397                              left: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_LEFT : Constants.AP_TEXT_PAD_RIGHT,
398                            })
399                            .onClick(() => {
400                              this.handlePopupEdit = !this.handlePopupEdit
401                            })
402                            .draggable(false)
403                            .bindPopup(this.handlePopupEdit, {
404                              builder: this.popupBuilderEdit,
405                              placement: SystemUtils.isRTL() ? Placement.BottomRight : Placement.BottomLeft,
406                              offset: {
407                                x: SystemUtils.isRTL() ? Constants.POPUP_OFFSET_RTL_X : Constants.POPUP_OFFSET_X
408                              },
409                              enableArrow: true,
410                              showInSubWindow: false,
411                              onStateChange: (e) => {
412                                if (!e.isVisible) {
413                                  this.handlePopupEdit = false
414                                }
415                              }
416                            })
417                        }
418                        .justifyContent(FlexAlign.Start)
419                        .width(Constants.FOOTER_ROW_WIDTH)
420                        .margin({
421                          top: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_TOP,
422                          bottom: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_BOTTOM
423                        })
424                      } else {
425                        if (this.staffDataArrayEdit['length']) {
426                          Row() {
427                            Text($r('app.string.header_title_edit'))
428                              .fontWeight(FontWeight.Medium)
429                              .fontColor($r('sys.color.ohos_id_color_text_primary'))
430                              .fontSize($r('sys.float.ohos_id_text_size_body2'))
431                            Text(` (${this.staffDataArrayEdit['length']}):`)
432                              .fontFamily($r('app.string.typeface'))
433                              .fontWeight(FontWeight.Regular)
434                              .fontColor($r('sys.color.ohos_id_color_text_primary'))
435                              .fontSize($r('sys.float.ohos_id_text_size_body2'))
436                            SymbolGlyph($r('sys.symbol.info_circle'))
437                              .fontSize(`${Constants.FOOTER_ROW_PAD_RIGHT}vp`)
438                              .fontColor([$r('sys.color.icon_secondary')])
439                              .margin({
440                                right: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_RIGHT : Constants.AP_TEXT_PAD_LEFT,
441                                left: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_LEFT : Constants.AP_TEXT_PAD_RIGHT,
442                              })
443                              .onClick(() => {
444                                this.handlePopupEdit = !this.handlePopupEdit
445                              })
446                              .draggable(false)
447                              .bindPopup(this.handlePopupEdit, {
448                                builder: this.popupBuilderEdit,
449                                placement: SystemUtils.isRTL() ? Placement.BottomRight : Placement.BottomLeft,
450                                offset: {
451                                  x: SystemUtils.isRTL() ? Constants.POPUP_OFFSET_RTL_X : Constants.POPUP_OFFSET_X
452                                },
453                                enableArrow: true,
454                                showInSubWindow: false,
455                                onStateChange: (e) => {
456                                  if (!e.isVisible) {
457                                    this.handlePopupEdit = false
458                                  }
459                                }
460                              })
461                          }
462                          .justifyContent(FlexAlign.Start)
463                          .width(Constants.FOOTER_ROW_WIDTH)
464
465                          Flex({
466                            direction: FlexDirection.Row,
467                            wrap: FlexWrap.Wrap,
468                          }) {
469                            if (this.staffDataArrayEdit['length'] > 0) {
470                              ForEach(
471                                this.showNamesArrEdit,
472                                (item: AuthAccount, index?: number) => {
473                                  staffItem({
474                                    authAccount: item.authAccount,
475                                    textContent: item.textContent,
476                                    isActive: false,
477                                    changeIndex: Number(index),
478                                  })
479                                },
480                                (item: AuthAccount) => item.authAccount
481                              )
482                              if (Number(this.hideNamesNumEdit) > 0) {
483                                Row() {
484                                  if (this.showNamesArrEdit.length !== this.staffDataArrayEdit.length) {
485                                    Text() {
486                                      Span('+')
487                                      Span(this.hideNamesNumEdit)
488                                    }
489                                      .customizeText()
490                                  }
491                                  SymbolGlyph($r('sys.symbol.chevron_down'))
492                                    .fontSize(`${Constants.PP_IMAGE_HEIGHT}vp`)
493                                    .fontColor([$r('sys.color.ohos_id_color_secondary')])
494                                    .rotate({
495                                      angle: !this.editFlag ?
496                                        Constants.PP_BUTTON_PAD : Constants.ENCRYPTION_SUCCESS_TRANSLATE
497                                    })
498                                    .transition({ type: TransitionType.All, opacity: Constants.PP_BUTTON_PAD })
499                                }
500                                .height(Constants.ENCRYPTION_SUCCESS_TOGGLE_HEIGHT)
501                                .onClick(() => {
502                                  let tmp: Record<string, AuthAccount[] | boolean> = toggleShow(
503                                    this.routerParams.staffDataArrayEdit as AuthAccount[],
504                                    this.showNamesArrEdit,
505                                    this.editFlag,
506                                    this.rowNamesLenEdit
507                                  );
508                                  this.showNamesArrEdit = tmp.showNamesArr as AuthAccount[];
509                                  this.editFlag = tmp.showFlag as boolean;
510                                })
511                              }
512                            }
513                          }
514                          .onAreaChange((oldValue: Area, newValue: Area) => {
515                            if (oldValue.width === Constants.ENCRYPTION_ON_AREA_CHANGE_WIDTH ||
516                              newValue.width !== oldValue.width) {
517                              let tmp: Record<string, number | AuthAccount[] | string> =
518                                calculate(newValue, this.routerParams.staffDataArrayEdit as AuthAccount[]);
519                              this.rowNamesLenEdit = tmp.rowNamesLen as number;
520                              this.showNamesArrEdit = tmp.showNamesArr as AuthAccount[];
521                              this.hideNamesNumEdit = tmp.hideNamesNum as string;
522                              this.editFlag = false;
523                            }
524                          })
525                          .margin({
526                            top: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_TOP,
527                            bottom: Constants.ENCRYPTION_SUCCESS_ADD_STAFF_MARGIN_BOTTOM
528                          })
529                        }
530                      }
531
532                      Column({ space: Constants.HEADER_ROW_FONT_SIZE }) {
533                        Row() {
534                          Text($r('app.string.Document_valid_until'))
535                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
536                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
537                            .fontWeight(FontWeight.Medium)
538                            .textAlign(TextAlign.Start)
539                          Text(' :')
540                            .fontFamily($r('app.string.typeface'))
541                            .fontWeight(FontWeight.Regular)
542                            .fontColor($r('sys.color.ohos_id_color_text_primary'))
543                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
544                            .margin({
545                              right: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_LEFT : Constants.AP_TEXT_PAD_RIGHT,
546                              left: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_RIGHT : Constants.AP_TEXT_PAD_LEFT,
547                            })
548                          Text(getTime())
549                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
550                            .fontColor($r('sys.color.ohos_id_color_text_secondary'))
551                            .fontWeight(FontWeight.Regular)
552                            .width(Constants.HEADER_COLUMN_WIDTH)
553                            .textAlign(TextAlign.Start)
554                            .margin({
555                              right: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_RIGHT : Constants.AP_TEXT_PAD_LEFT,
556                              left: SystemUtils.isRTL() ? Constants.AP_TEXT_PAD_LEFT : Constants.AP_TEXT_PAD_RIGHT,
557                            })
558                        }
559                        .width(Constants.HEADER_COLUMN_WIDTH)
560
561                        Row() {
562                          Text($r('app.string.change_encryption'))
563                            .fontSize($r('sys.float.ohos_id_text_size_body2'))
564                            .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
565                            .fontWeight(FontWeight.Medium)
566                            .width(Constants.HEADER_COLUMN_WIDTH)
567                            .textAlign(TextAlign.Start)
568                            .onClick(() => {
569                              router.replaceUrl({
570                                url: 'pages/changeEncryption',
571                                params: this.routerParams
572                              })
573                            })
574                        }
575                        .width(Constants.HEADER_COLUMN_WIDTH)
576                      }
577                      .width(Constants.HEADER_COLUMN_WIDTH)
578                      .margin({ bottom: Constants.ENCRYPTION_CHANGE_VALID_UNTIL_MARGIN_BOTTOM })
579                    }
580                  }
581                }
582              }.constraintSize({
583                maxHeight: this.directionStatus ===
584                  0 ? Constants.CHANGE_MAX_HEIGHT : Constants.ENCRYPTION_SUCCESS_MAX_HEIGHT
585              })
586              .padding({
587                left: Constants.HEADER_COLUMN_PADDING_LEFT,
588                right: Constants.HEADER_COLUMN_PADDING_RIGHT
589              })
590
591              Row() {
592                Button($r('app.string.finished'), { type: ButtonType.Capsule, stateEffect: true })
593                  .backgroundColor($r('sys.color.ohos_id_color_text_primary_activated'))
594                  .fontWeight(FontWeight.Medium)
595                  .width(Constants.FOOTER_WIDTH_BUTTON)
596                  .controlSize(ControlSize.NORMAL)
597                  .onClick(async (event) => {
598                    if (!(GlobalContext.load('requestIsFromSandBox') as boolean)) {
599                      let dlpFileName: string = GlobalContext.load('dlpFileName') as string;
600                      try {
601                        HiLog.info(TAG, `closeDLPFile: ${dlpFileName}`);
602                        let dlpRpcProxy: IdDlpRpcServiceProxy = GlobalContext.load('dlpRpcProxy');
603                        await new Promise<void>((resolve, reject) => {
604                          dlpRpcProxy.closeDlpFile(GlobalContext.load('uri'), (err: number) => {
605                            if (err !== 0) {
606                              reject();
607                            }
608                            resolve();
609                          });
610                        })
611                      } catch (err) {
612                        HiLog.error(TAG, `closeDLPFile: ${dlpFileName}, failed: ${JSON.stringify(err)}`);
613                      }
614                    }
615                    if (this.session !== undefined) {
616                      this.session.terminateSelfWithResult({
617                        'resultCode': 0,
618                        'want': {
619                          'bundleName': Constants.DLP_MANAGER_BUNDLE_NAME,
620                        },
621                      });
622                    } else {
623                      if (GlobalContext.load('fileOpenHistoryFromMain')) {
624                        (GlobalContext.load('fileOpenHistoryFromMain') as Map<string, Object>)
625                          .delete(GlobalContext.load('uri') as string)
626                      }
627                      abilityResult.resultCode = 0;
628                      (getContext(this) as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
629                    }
630                  })
631              }
632              .justifyContent(FlexAlign.Center)
633              .margin({
634                top: Constants.ENCRYPTION_BUTTON_PADDING_TOP,
635                bottom: Constants.ENCRYPTION_BUTTON_MARGIN_BOTTOM
636              })
637              .padding({
638                left: Constants.FOOTER_ROW_PAD_LEFT,
639                right: Constants.FOOTER_ROW_PAD_RIGHT
640              })
641            }
642            .width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
643            .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
644            .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
645            .constraintSize({
646              minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH,
647              minHeight: Constants.ENCRYPTION_LOADING_HEIGHT
648            })
649            .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
650          }
651        }
652      }
653    }
654    .backgroundColor($r('sys.color.mask_fourth'))
655  }
656}
657