diff --git a/index.ts b/index.ts index b4807c5..e1615ac 100644 --- a/index.ts +++ b/index.ts @@ -1,6 +1,16 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Injectable } from '@angular/core'; +export interface TagOptions { + sequence: number; + tags?: Array; +} + +export interface AliasOptions { + sequence: number; + alias?: string; +} + @Plugin({ pluginName: 'JPush', plugin: 'jpush-phonegap-plugin', @@ -13,77 +23,53 @@ import { Injectable } from '@angular/core'; @Injectable() export class JPush extends IonicNativePlugin { - @Cordova + @Cordova() init(): Promise { return; } - @Cordova + @Cordova() setDebugMode(enable: boolean): Promise { return; } - @Cordova + @Cordova() getRegistrationID(): Promise { return; } - @Cordova + @Cordova() stopPush(): Promise { return; } - @Cordova + @Cordova() resumePush(): Promise { return; } - @Cordova + @Cordova() isPushStopped(): Promise { return; } - /** - * @param params { sequence: number, tags: [string, string] } - */ - @Cordova - setTags(params: object): Promise { return; } + @Cordova() + setTags(params: TagOptions): Promise { return; } - /** - * @param params { sequence: number, tags: [string, string] } - */ - @Cordova - addTags(params: object): Promise { return; } + @Cordova() + addTags(params: TagOptions): Promise { return; } - /** - * @param params { sequence: number, tags: [string, string] } - */ - @Cordova - deleteTags(params: object): Promise { return; } + @Cordova() + deleteTags(params: TagOptions): Promise { return; } - /** - * @param params { sequence: number } - */ - @Cordova - cleanTags(params: object): Promise { return; } + @Cordova() + cleanTags(params: TagOptions): Promise { return; } - /** - * @param params { sequence: number } - */ - @Cordova - getAllTags(params: object): Promise { return; } + @Cordova() + getAllTags(params: TagOptions): Promise { return; } /** * @param params { sequence: number, tag: string } */ - @Cordova + @Cordova() checkTagBindState(params: object): Promise { return; } - /** - * @param params { sequence: number, alias: string } - */ - @Cordova - setAlias(params: object): Promise { return; } + @Cordova() + setAlias(params: AliasOptions): Promise { return; } - /** - * @param params { sequence: number } - */ - @Cordova - deleteAlias(params: object): Promise { return; } + @Cordova() + deleteAlias(params: AliasOptions): Promise { return; } - /** - * @param params { sequence: number } - */ - @Cordova - getAlias(params: object): Promise { return; } + @Cordova() + getAlias(params: AliasOptions): Promise { return; } /** * Determinate whether the application notification has been opened. @@ -97,89 +83,89 @@ export class JPush extends IonicNativePlugin { * * Android: 0: closed; 1: opened. */ - @Cordova + @Cordova() getUserNotificationSettings(): Promise { return; } - @Cordova + @Cordova() clearLocalNotifications(): Promise { return; } // iOS API - start - @Cordova + @Cordova() setBadge(badge: number): Promise { return; } - @Cordova + @Cordova() resetBadge(): Promise { return; } - @Cordova + @Cordova() setApplicationIconBadgeNumber(badge: number): Promise { return; } - @Cordova + @Cordova() getApplicationIconBadgeNumber(): Promise { return; } - @Cordova - addLocalNotificationForIOS(delayTime: number, content: string, badge: number, notificationId: number, extras: string): Promise { return; } + @Cordova() + addLocalNotificationForIOS(delayTime: number, content: string, badge: number, notificationId: number, extras?: string): Promise { return; } - @Cordova + @Cordova() deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise { return; } - @Cordova + @Cordova() addDismissActions(actions: Array, categoryId: string): Promise { return; } - @Cordova + @Cordova() addNotificationActions(actions: Array, categoryId: string): Promise { return; } - @Cordova + @Cordova() setLocation(latitude: number, longitude: number): Promise { return; } - @Cordova + @Cordova() startLogPageView(pageName: string): Promise { return; } - @Cordova + @Cordova() stopLogPageView(pageName: string): Promise { return; } - @Cordova - beginLogPageView(pageName: string, duration: number): Promise { return; } + @Cordova() + beginLogPageView(pageName: string, duration: number): Promise { return; } // iOS API - end // Android API - start - @Cordova + @Cordova() getConnectionState(): Promise { return; } - @Cordova + @Cordova() setBasicPushNotificationBuilder(): Promise { return; } - @Cordova + @Cordova() setCustomPushNotificationBuilder(): Promise { return; } - @Cordova + @Cordova() clearAllNotification(): Promise { return; } - @Cordova + @Cordova() clearNotificationById(id: number): Promise { return; } - @Cordova + @Cordova() setLatestNotificationNum(num: number): Promise { return; } - @Cordova - addLocalNotification(builderId: number, content: string, title: string, notificationId: number, broadcastTime: number, extras: string): Promise { return; } + @Cordova() + addLocalNotification(builderId: number, content: string, title: string, notificationId: number, broadcastTime: number, extras?: string): Promise { return; } - @Cordova + @Cordova() removeLocalNotification(notificationId: number): Promise { return; } - @Cordova + @Cordova() reportNotificationOpened(msgId: number): Promise { return; } - @Cordova + @Cordova() requestPermission(): Promise { return; } - @Cordova + @Cordova() setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise { return; } - @Cordova + @Cordova() setPushTime(weekdays: Array, startHour: number, endHour: number): Promise { return; } // Android API - end -} \ No newline at end of file +}