• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-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 {CancelButton} from './component/BaseComponent';
18import AppStorageHelper from '../Common/Adapter/AppStorageHelper';
19import { AppStorageKeyName, Constants } from '@ohos/common';
20
21const TAG = 'AboutPage';
22
23@Entry
24@Component
25struct AboutPage {
26  @State versionName: string = Constants.STRING_NONE;
27
28  aboutToAppear() {
29    this.versionName = AppStorageHelper.getValue<string>(AppStorageKeyName.APP_VERSION);
30  }
31
32  build() {
33    Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
34      Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
35        Column() {
36          Image($r('app.media.logo'))
37            .width($r('app.float.privacy_statement_print_log_width_height'))
38            .height($r('app.float.privacy_statement_print_log_width_height'))
39            .margin({top: $r('app.float.about_print_log_width_height')})
40          Text($r('app.string.MainAbility_label'))
41            .fontSize($r('sys.float.ohos_id_text_size_headline7'))
42            .fontColor($r('sys.color.ohos_id_color_text_primary'))
43            .fontWeight(FontWeight.Bolder)
44            .margin({top: $r('app.float.about_text_relative_img_margin_top')})
45          Text(this.versionName)
46            .margin({ top: $r('app.float.privacy_statement_text_relative_text_margin_top')})
47            .fontColor($r('sys.color.ohos_fa_text_tertiary'))
48            .fontWeight(FontWeight.Regular)
49        }
50        Column() {
51          Text($r('app.string.about_privacy_statement_text'))
52            .fontColor($r('sys.color.ohos_id_color_text_hyperlink'))
53            .onClick(() => {
54              router.pushUrl({
55                url: 'pages/PrivacyStatementWebPage',
56                params: {
57                  info: false
58                }
59              });
60            })
61            .margin({
62              left: $r('app.float.privacy_statement_text_margin_left_right'),
63              right: $r('app.float.privacy_statement_text_margin_left_right')
64            })
65          CancelButton({
66            cancelLabel: $r('app.string.Cancel'),
67            cancelWidth: $r('app.float.about_button_width'),
68            cancelHeight: $r('app.float.privacy_statement_button_height'),
69            cancelClick: () => {
70              router.back({ url: 'pages/PrintPage' });
71            }
72          })
73          .margin({
74            top: $r('app.float.privacy_statement_button_to_text_margin_top')
75          })
76        }
77        .margin({bottom: $r('app.float.privacy_statement_button_margin_bottom')})
78      }
79    }
80    .width('100%')
81    .height('100%')
82  }
83}