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', pluginRef: 'plugins.jPushPlugin', repo: 'https://github.com/jpush/jpush-phonegap-plugin', install: 'ionic cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_app_key', installVariables: ['APP_KEY'], platforms: ['Android', 'iOS'] }) @Injectable() export class JPush extends IonicNativePlugin { @Cordova() init(): Promise { return; } @Cordova() setDebugMode(enable: boolean): Promise { return; } @Cordova() getRegistrationID(): Promise { return; } @Cordova() stopPush(): Promise { return; } @Cordova() resumePush(): Promise { return; } @Cordova() isPushStopped(): Promise { return; } @Cordova() setTags(params: TagOptions): Promise { return; } @Cordova() addTags(params: TagOptions): Promise { return; } @Cordova() deleteTags(params: TagOptions): Promise { return; } @Cordova() cleanTags(params: TagOptions): Promise { return; } @Cordova() getAllTags(params: TagOptions): Promise { return; } /** * @param params { sequence: number, tag: string } */ @Cordova() checkTagBindState(params: object): Promise { return; } @Cordova() setAlias(params: AliasOptions): Promise { return; } @Cordova() deleteAlias(params: AliasOptions): Promise { return; } @Cordova() getAlias(params: AliasOptions): Promise { return; } /** * Determinate whether the application notification has been opened. * * iOS: 0: closed; >1: opened. * UIRemoteNotificationTypeNone = 0, * UIRemoteNotificationTypeBadge = 1 << 0, * UIRemoteNotificationTypeSound = 1 << 1, * UIRemoteNotificationTypeAlert = 1 << 2, * UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3 * * Android: 0: closed; 1: opened. */ @Cordova() getUserNotificationSettings(): Promise { return; } @Cordova() clearLocalNotifications(): Promise { return; } // iOS API - start @Cordova() setBadge(badge: number): Promise { return; } @Cordova() resetBadge(): Promise { return; } @Cordova() setApplicationIconBadgeNumber(badge: number): Promise { return; } @Cordova() getApplicationIconBadgeNumber(): Promise { return; } @Cordova() addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: string): Promise { return; } @Cordova() deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise { return; } @Cordova() addDismissActions(actions: Array, categoryId: string): Promise { return; } @Cordova() addNotificationActions(actions: Array, categoryId: string): Promise { return; } @Cordova() setLocation(latitude: number, longitude: number): Promise { return; } @Cordova() startLogPageView(pageName: string): Promise { return; } @Cordova() stopLogPageView(pageName: string): Promise { return; } @Cordova() beginLogPageView(pageName: string, duration: number): Promise { return; } // iOS API - end // Android API - start @Cordova() getConnectionState(): Promise { return; } @Cordova() setBasicPushNotificationBuilder(): Promise { return; } @Cordova() setCustomPushNotificationBuilder(): Promise { return; } @Cordova() clearAllNotification(): Promise { return; } @Cordova() clearNotificationById(id: number): Promise { return; } @Cordova() setLatestNotificationNum(num: number): Promise { return; } @Cordova() addLocalNotification(builderId: number, content: string, title: string, notificationId: number, broadcastTime: number, extras?: string): Promise { return; } @Cordova() removeLocalNotification(notificationId: number): Promise { return; } @Cordova() reportNotificationOpened(msgId: number): Promise { return; } @Cordova() requestPermission(): Promise { return; } @Cordova() setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise { return; } @Cordova() setPushTime(weekdays: Array, startHour: number, endHour: number): Promise { return; } // Android API - end }