diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..b4807c5 --- /dev/null +++ b/index.ts @@ -0,0 +1,185 @@ +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Injectable } from '@angular/core'; + +@Plugin({ + pluginName: 'JPush', + plugin: 'jpush-phonegap-plugin', + pluginRef: 'jPush', + 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; } + + /** + * @param params { sequence: number, tags: [string, string] } + */ + @Cordova + setTags(params: object): Promise { return; } + + /** + * @param params { sequence: number, tags: [string, string] } + */ + @Cordova + addTags(params: object): Promise { return; } + + /** + * @param params { sequence: number, tags: [string, string] } + */ + @Cordova + deleteTags(params: object): Promise { return; } + + /** + * @param params { sequence: number } + */ + @Cordova + cleanTags(params: object): Promise { return; } + + /** + * @param params { sequence: number } + */ + @Cordova + getAllTags(params: object): Promise { return; } + + /** + * @param params { sequence: number, tag: string } + */ + @Cordova + checkTagBindState(params: object): Promise { return; } + + /** + * @param params { sequence: number, alias: string } + */ + @Cordova + setAlias(params: object): Promise { return; } + + /** + * @param params { sequence: number } + */ + @Cordova + deleteAlias(params: object): Promise { return; } + + /** + * @param params { sequence: number } + */ + @Cordova + getAlias(params: object): 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, notificationId: number, 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 +} \ No newline at end of file