• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 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 { Event } from '../../default/event/EventUtil';
17import notificationManager from '@ohos.notificationManager';
18import image from '@ohos.multimedia.image';
19import resourceManager from '@ohos.resourceManager';
20import { WantAgent } from '@ohos.wantAgent';
21import NtfMgr from '@ohos.notificationManager';
22
23export default class Constants {
24  static readonly INIT_CONFIG = 'initConfig';
25  static readonly INIT_FINISH = 'initFinish';
26  static readonly CLEAR_ALL = 'clearAll';
27  static readonly ADD_ITEM = 'addItem';
28  static readonly REMOVE_ITEM = 'removeItem';
29  static readonly LOCAL_DEVICE = 'local';
30  static readonly LOAD_DATA = 'loadData';
31  static readonly LOAD_PLUGIN_COMPONENT_DATA = 'loadPluginComponentData';
32  static readonly UPDATE_PLUGIN_COMPONENT_DATA = 'updatePluginComponentData';
33}
34
35export type FilterData = {
36  id: string;
37  bundleName: string;
38  abilityName: string;
39};
40
41export type RootConfigInfo = {
42  action: string;
43  filterDatas: FilterData[];
44  loaderConfig: {
45    [key in any]: LoaderConfigInfo;
46  };
47};
48
49export type LoaderConfigInfo = {
50  [key: string]: any;
51};
52
53export enum PluginType {
54  META = 1,
55  DATA_ABILITY = 2,
56  PLUGIN_COMPONENT = 3,
57}
58
59export function obtainMsg(action: string, data: any): {
60  action: string,
61  data: any
62} {
63  return { action: action, data: data };
64}
65
66export type ItemComponentData = {
67  id?: string;
68  pluginType?: number;
69  deviceId?: string;
70  bundleName?: string;
71  moduleName?: string,
72  abilityName?: string;
73  abilityLabelId?: number;
74  abilityIconId?: number;
75  label?: string;
76  iconUrl?: string;
77  template?: string;
78  state?: any;
79  actionData?: ActionData;
80}
81
82export class ActionData {
83  clickAction?: Event;
84  longClickAction?: Event;
85  launchType?: number;
86  pluginData?: PluginComponentData;
87  extra?: any;
88}
89
90export class PluginComponentData {
91  template;
92  data;
93}
94
95export class itemData {
96  id?:string;
97  pluginType?:number;
98  bundleName?:string;
99  moduleName?:string;
100  abilityName?:string;
101  abilityLabelId?:number;
102  abilityIconId?:number;
103  label?:string;
104  iconUrl?: string;
105  actionData?;
106  relationWindowId?
107  canSelect?
108  isShowLabel?
109  isShowIcon?
110}
111
112export interface NotificationItemData {
113  id: string;
114  hashcode: string;
115  userId: number;
116  uid: number;
117  contentType: string;
118  timestamp: number;
119  time: string;
120  appName: string;
121  want: WantAgent;
122  actionButtons: notificationManager.ButtonOptions[];
123  bundleName: string;
124  smallIcon?: image.PixelMap | string;
125  largeIcon?: image.PixelMap | string;
126  picture?: image.PixelMap;
127  title?: string;
128  text?: string;
129  additionalText?: string;
130  briefText?: string;
131  expandedTitle?: string;
132  longText?: string;
133  lines?: any[];
134  longTitle?: string;
135  slotLevel?: any;
136  source?: number;
137  versionName?: string;
138  sound?: string;
139  vibrationValues?: Array<number>;
140  notificationFlags?: any;
141  ruleData?: RuleData;
142  template?: any;
143  isOngoing?: boolean;
144  isUnremovable?: boolean;
145  isRemoveAllowed?: boolean;
146  distributedOption?: any;
147  deviceId?: string;
148  groupName?: string;
149  tapDismissed?: boolean;
150}
151
152export interface RuleData {
153  isAllowBanner?: boolean;
154  isAllowSound?: boolean;
155  isAllowVibrationValues?: boolean;
156  isAllowStatusBarShow?: boolean;
157  isAllowNotificationListShow?: boolean;
158}
159
160export interface ConfigInfo {
161  maxWidth: number;
162  maxHeight: number;
163  minHeight: number;
164  showHorizontal: boolean;
165  direction: number;
166  realWidth: number;
167  realHeight: number;
168  xCoordinate: number;
169  yCoordinate: number;
170  ableToMaximize?: boolean;
171  showNavHorizontal?: boolean;
172}
173
174export interface BundleItemData {
175  appIcon?: string;
176  appTitle?: string;
177  appValue?: string;
178  appArrow?: string | resourceManager.Resource;
179  appSummary?: string;
180  appBundleName?: string;
181  appIconId?: string;
182  appUri?: string;
183  appUid?: number;
184  systemApp?: boolean;
185  slotSettingUrl?: string
186}
187
188export interface TouchMoveData {
189  direction: string,
190  touchComponent: string
191}