mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-22 00:30:33 +08:00
✨ Feature: add remoteNotice
This commit is contained in:
@@ -27,3 +27,22 @@ export enum IWindowList {
|
||||
MINI_WINDOW = 'MINI_WINDOW',
|
||||
RENAME_WINDOW = 'RENAME_WINDOW'
|
||||
}
|
||||
|
||||
export enum IRemoteNoticeActionType {
|
||||
OPEN_URL = 'OPEN_URL',
|
||||
SHOW_NOTICE = 'SHOW_NOTICE', // notification
|
||||
SHOW_DIALOG = 'SHOW_DIALOG', // dialog notice
|
||||
COMMON = 'COMMON',
|
||||
VOID = 'VOID', // do nothing
|
||||
SHOW_MESSAGE_BOX = 'SHOW_MESSAGE_BOX'
|
||||
}
|
||||
|
||||
export enum IRemoteNoticeTriggerHook {
|
||||
APP_START = 'APP_START',
|
||||
SETTING_WINDOW_OPEN = 'SETTING_WINDOW_OPEN',
|
||||
}
|
||||
|
||||
export enum IRemoteNoticeTriggerCount {
|
||||
ONCE = 'ONCE', // default
|
||||
ALWAYS = 'ALWAYS'
|
||||
}
|
||||
|
||||
41
src/universal/types/types.d.ts
vendored
41
src/universal/types/types.d.ts
vendored
@@ -219,6 +219,8 @@ interface IPrivateShowNotificationOption extends IShowNotificationOption{
|
||||
* click notification to copy the body
|
||||
*/
|
||||
clickToCopy?: boolean
|
||||
copyContent?: string // something to copy
|
||||
clickFn?: () => void
|
||||
}
|
||||
|
||||
interface IShowMessageBoxOption {
|
||||
@@ -348,3 +350,42 @@ interface II18nItem {
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
|
||||
interface IRemoteNotice {
|
||||
version: number
|
||||
list: Array<{
|
||||
versions: string[] // matched picgo version
|
||||
actions: IRemoteNoticeAction[]
|
||||
versionMatch?: 'exact' | 'gte' | 'lte'
|
||||
}>
|
||||
}
|
||||
|
||||
interface IRemoteNoticeAction {
|
||||
type: import('#/types/enum').IRemoteNoticeActionType
|
||||
// trigger time
|
||||
hooks: import('#/types/enum').IRemoteNoticeTriggerHook[]
|
||||
id: string
|
||||
// trigger count: always or once; default: once
|
||||
triggerCount: import('#/types/enum').IRemoteNoticeTriggerCount
|
||||
|
||||
data?: {
|
||||
title?: string
|
||||
content?: string
|
||||
desc?: string // action desc
|
||||
buttons?: IRemoteNoticeButton[]
|
||||
url?: string
|
||||
copyToClipboard?: string
|
||||
options: any // for other case
|
||||
}
|
||||
}
|
||||
|
||||
interface IRemoteNoticeButton {
|
||||
label: string
|
||||
labelEN?: string
|
||||
type: 'confirm' | 'cancel' | 'other'
|
||||
action: IRemoteNoticeAction
|
||||
}
|
||||
|
||||
interface IRemoteNoticeLocalCountStorage {
|
||||
[id: string]: true | number
|
||||
}
|
||||
|
||||
@@ -41,3 +41,5 @@ export const simpleClone = (obj: any) => {
|
||||
export const enforceNumber = (num: number | string) => {
|
||||
return isNaN(Number(num)) ? 0 : Number(num)
|
||||
}
|
||||
|
||||
export const isDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
Reference in New Issue
Block a user