• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//@ts-nocheck
2/*
3 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import Window from '@ohos.window';
17import parameter from '@ohos.systemparameter';
18import parameter from '@ohos.systemparameter';
19import settings from '@ohos.settings';
20
21export interface Rect {
22  left: number;
23  top: number;
24  width: number;
25  height: number;
26};
27
28export type WindowType = 'status' | 'navigation' | 'volume';
29
30export function getWindowName(windowType): WindowType {
31  switch (windowType) {
32    case Window.WindowType.TYPE_NAVIGATION_BAR:
33      return 'navigation';
34    case Window.WindowType.TYPE_STATUS_BAR:
35      return 'status';
36    case Window.WindowType.TYPE_VOLUME_OVERLAY:
37      return 'volume';
38  }
39}
40
41export default class Constants {
42  static readonly URI_VAR: string = 'datashare:///com.ohos.settingsdata.DataAbility';
43  static readonly KEY_BRIGHTNESS_STATUS = settings.display.SCREEN_BRIGHTNESS_STATUS;
44  static readonly KEY_TIME_FORMAT = settings.date.TIME_FORMAT;
45  static readonly KEY_NAVIGATIONBAR_STATUS = 'settings.display.navigationbar_status';
46
47  /**
48   * 获取拼接后的uri,适配settingsdata去常驻
49   *
50   * @param key settings key
51   */
52  static getUriSync(key: string): string {
53    return "datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true&key=" + key;
54  }
55}
56
57export enum FASlotName {
58  AUTO_ROTATE = 'auto_rotate',
59  AIR_PLANE = 'air_plane',
60  BATTERY = 'battery',
61  BLUETOOTH = 'bluetooth',
62  CAPSULE = 'capsule',
63  CLOCK = 'clock',
64  EMPTY = 'empty',
65  LOCATION = 'location',
66  NOTIFICATION = 'notification',
67  RING_MODE = 'ring_mode',
68  SIGNAL = 'signal',
69  WIFI = 'wifi',
70  NFC = 'nfc',
71}
72
73export function isNfcAvailable(){
74  if (parameter.getSync("const.SystemCapability.Communication.NFC.Core", "false") == "false"){
75    return false
76  } else {
77    return true
78  }
79 }
80