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