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