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'; 17 18export default class Constants { 19 static readonly INIT_CONFIG = 'initConfig'; 20 static readonly INIT_FINISH = 'initFinish'; 21 static readonly CLEAR_ALL = 'clearAll'; 22 static readonly ADD_ITEM = 'addItem'; 23 static readonly REMOVE_ITEM = 'removeItem'; 24 static readonly LOCAL_DEVICE = 'local'; 25 static readonly LOAD_DATA = 'loadData'; 26 static readonly LOAD_PLUGIN_COMPONENT_DATA = 'loadPluginComponentData'; 27 static readonly UPDATE_PLUGIN_COMPONENT_DATA = 'updatePluginComponentData'; 28} 29 30export type FilterData = { 31 id: string; 32 bundleName: string; 33 abilityName: string; 34}; 35 36export type RootConfigInfo = { 37 action: string; 38 filterDatas: FilterData[]; 39 loaderConfig: { 40 [key in any]: LoaderConfigInfo; 41 }; 42}; 43 44export type LoaderConfigInfo = { 45 [key: string]: any; 46}; 47 48export enum PluginType { 49 META = 1, 50 DATA_ABILITY = 2, 51 PLUGIN_COMPONENT = 3, 52} 53 54export function obtainMsg(action: string, data: any): { 55 action: string, 56 data: any 57} { 58 return { action: action, data: data }; 59} 60 61export type ItemComponentData = { 62 id?: string; 63 pluginType?: number; 64 deviceId?: string; 65 bundleName?: string; 66 moduleName?: string, 67 abilityName?: string; 68 abilityLabelId?: number; 69 abilityIconId?: number; 70 label?: string; 71 iconUrl?: string; 72 template?: string; 73 state?: any; 74 actionData?: ActionData; 75} 76 77export class ActionData { 78 clickAction?: Event; 79 longClickAction?: Event; 80 launchType?: number; 81 pluginData?: PluginComponentData; 82 extra?: any; 83} 84 85export class PluginComponentData { 86 template; 87 data; 88} 89 90export class itemData { 91 id?:string; 92 pluginType?:number; 93 bundleName?:string; 94 moduleName?:string; 95 abilityName?:string; 96 abilityLabelId?:number; 97 abilityIconId?:number; 98 label?:string; 99 iconUrl?: string; 100 actionData?; 101 relationWindowId? 102 canSelect? 103 isShowLabel? 104 isShowIcon? 105} 106 107export class notificationData { 108 id: string; 109 hashcode: string; 110 userId: number; 111 uid: number; 112 contentType: string; 113 timestamp: number; 114 time: string; 115 appName: string; 116 want: any; 117 actionButtons: any[]; 118 bundleName: string; 119 smallIcon?: PixelMap; 120 largeIcon?: PixelMap; 121 picture?: PixelMap; 122 title?: string; 123 text?: string; 124 additionalText?: string; 125 briefText?: string; 126 expandedTitle?: string; 127 longText?: string; 128 lines?: any[]; 129 longTitle?: string; 130 slotLevel?: any; 131 source?: number; 132 versionName?: string; 133 sound?: string; 134 vibrationValues?: Array<number>; 135 notificationFlags?: any; 136 ruleData?; 137 template?: any; 138 isOngoing?: boolean; 139 isUnremovable?: boolean; 140 isRemoveAllowed?: boolean; 141 distributedOption?: any; 142 deviceId?: string; 143 groupName?: string; 144 tapDismissed?: boolean; 145}