123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
- import { Injectable } from '@angular/core';
- export interface TagOptions {
- sequence: number;
- tags?: Array<string>;
- }
- 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<any> { return; }
- @Cordova()
- setDebugMode(enable: boolean): Promise<any> { return; }
- @Cordova()
- getRegistrationID(): Promise<any> { return; }
- @Cordova()
- stopPush(): Promise<any> { return; }
- @Cordova()
- resumePush(): Promise<any> { return; }
- @Cordova()
- isPushStopped(): Promise<any> { return; }
- @Cordova()
- setTags(params: TagOptions): Promise<any> { return; }
- @Cordova()
- addTags(params: TagOptions): Promise<any> { return; }
- @Cordova()
- deleteTags(params: TagOptions): Promise<any> { return; }
- @Cordova()
- cleanTags(params: TagOptions): Promise<any> { return; }
- @Cordova()
- getAllTags(params: TagOptions): Promise<any> { return; }
- /**
- * @param params { sequence: number, tag: string }
- */
- @Cordova()
- checkTagBindState(params: object): Promise<any> { return; }
- @Cordova()
- setAlias(params: AliasOptions): Promise<any> { return; }
- @Cordova()
- deleteAlias(params: AliasOptions): Promise<any> { return; }
- @Cordova()
- getAlias(params: AliasOptions): Promise<any> { 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<any> { return; }
- @Cordova()
- clearLocalNotifications(): Promise<any> { return; }
- // iOS API - start
- @Cordova()
- setBadge(badge: number): Promise<any> { return; }
- @Cordova()
- resetBadge(): Promise<any> { return; }
- @Cordova()
- setApplicationIconBadgeNumber(badge: number): Promise<any> { return; }
- @Cordova()
- getApplicationIconBadgeNumber(): Promise<any> { return; }
- @Cordova()
- addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): Promise<any> { return; }
- @Cordova()
- deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise<any> { return; }
- @Cordova()
- addDismissActions(actions: Array<object>, categoryId: string): Promise<any> { return; }
- @Cordova()
- addNotificationActions(actions: Array<object>, categoryId: string): Promise<any> { return; }
- @Cordova()
- setLocation(latitude: number, longitude: number): Promise<any> { return; }
- @Cordova()
- startLogPageView(pageName: string): Promise<any> { return; }
- @Cordova()
- stopLogPageView(pageName: string): Promise<any> { return; }
- @Cordova()
- beginLogPageView(pageName: string, duration: number): Promise<any> { return; }
- // iOS API - end
- // Android API - start
- @Cordova()
- getConnectionState(): Promise<any> { return; }
- @Cordova()
- setBasicPushNotificationBuilder(): Promise<any> { return; }
- @Cordova()
- setCustomPushNotificationBuilder(): Promise<any> { return; }
- @Cordova()
- clearAllNotification(): Promise<any> { return; }
- @Cordova()
- clearNotificationById(id: number): Promise<any> { return; }
- @Cordova()
- setLatestNotificationNum(num: number): Promise<any> { return; }
- @Cordova()
- addLocalNotification(builderId: number, content: string, title: string, notificationId: number, broadcastTime: number, extras?: string): Promise<any> { return; }
- @Cordova()
- removeLocalNotification(notificationId: number): Promise<any> { return; }
- @Cordova()
- reportNotificationOpened(msgId: number): Promise<any> { return; }
- @Cordova()
- requestPermission(): Promise<any> { return; }
- @Cordova()
- setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise<any> { return; }
- @Cordova()
- setPushTime(weekdays: Array<string>, startHour: number, endHour: number): Promise<any> { return; }
- // Android API - end
- }
|