• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2024-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 */
15
16import HeadComponent from '../../common/component/headComponent';
17import { WidthPercent } from '../../common/util/ConfigData';
18import CmShowSysCaPresenter from '../../presenter/CmShowSysCaPresenter';
19import {
20  DialogDateComponent,
21  DialogFingerPrintComponent,
22  DialogIssuerComponent,
23  DialogSubjectComponent
24} from '../trustedCa';
25
26@Component
27export struct CaSystemDetailPage {
28  @State mShowSysCaPresenter: CmShowSysCaPresenter = CmShowSysCaPresenter.getInstance();
29
30  private stack?: NavPathStack;
31
32  build() {
33    NavDestination() {
34      Column() {
35        HeadComponent({ headName: $r('app.string.CustomDialogExample_firText'), isStartBySheet: true, onBackClicked: () => {
36          this.stack?.pop();
37        } })
38          .margin({
39            left: $r('app.float.wh_value_12'),
40            top: 8
41          })
42
43        Scroll() {
44          this.buildContent()
45        }
46        .padding({
47          left: 16, right: 16
48        })
49        .align(Alignment.Top)
50        .scrollable(ScrollDirection.Vertical)
51        .edgeEffect(EdgeEffect.Spring)
52        .scrollBar(BarState.Auto)
53        .width(WidthPercent.WH_100_100)
54        .layoutWeight(1)
55      }
56    }
57    .hideTitleBar(true)
58    .width(WidthPercent.WH_100_100)
59    .height(WidthPercent.WH_100_100)
60    .backgroundColor($r('sys.color.background_secondary'))
61    .onReady((ctx: NavDestinationContext) => {
62      this.stack = ctx.pathStack;
63    })
64  }
65
66  @Builder
67  private buildContent() {
68    Column() {
69      Text(this.mShowSysCaPresenter.certInfo.certAlias)
70        .fontSize($r('sys.float.ohos_id_text_size_body1'))
71        .fontColor($r('sys.color.ohos_id_color_text_primary'))
72        .fontWeight(FontWeight.Medium)
73        .margin({
74          top: $r('app.float.wh_value_8'),
75          bottom: $r('app.float.wh_value_24')
76        })
77        .alignSelf(ItemAlign.Start)
78
79      Text($r('app.string.CustomDialogExample_firListItem_text'))
80        .fontSize($r('sys.float.ohos_id_text_size_body1'))
81        .fontColor($r('sys.color.ohos_id_color_text_primary'))
82        .fontWeight(FontWeight.Medium)
83
84      DialogSubjectComponent({ map: this.mShowSysCaPresenter.certInfo.subjectNameMap })
85
86      Text($r('app.string.CustomDialogExample_secListItem_text'))
87        .fontSize($r('sys.float.ohos_id_text_size_body1'))
88        .fontColor($r('sys.color.ohos_id_color_text_primary'))
89        .fontWeight(FontWeight.Medium)
90        .margin({
91          top: $r('app.float.wh_value_24')
92        })
93
94      DialogIssuerComponent({ map: this.mShowSysCaPresenter.certInfo.issuerNameMap })
95
96      Text($r('app.string.CustomDialogExample_thdListItem_text'))
97        .fontSize($r('sys.float.ohos_id_text_size_body1'))
98        .fontColor($r('sys.color.ohos_id_color_text_primary'))
99        .fontWeight(FontWeight.Medium)
100        .margin({
101          top: $r('app.float.wh_value_24')
102        })
103
104      DialogDateComponent({ map: this.mShowSysCaPresenter.certInfo.dateMap })
105
106      Text($r('app.string.CustomDialogExample_fouListItem_text'))
107        .fontSize($r('sys.float.ohos_id_text_size_body1'))
108        .fontColor($r('sys.color.ohos_id_color_text_primary'))
109        .fontWeight(FontWeight.Medium)
110        .margin({
111          top: $r('app.float.wh_value_24')
112        })
113
114      DialogFingerPrintComponent({ fingerprintSha256: this.mShowSysCaPresenter.certInfo.fingerprintSha256 })
115    }
116    .alignItems(HorizontalAlign.Start)
117    .width(WidthPercent.WH_100_100)
118  }
119}