the adaption to ionic4 project and udpate ionic plugin to 2.0.0 version

This commit is contained in:
huangminlinux 2019-02-23 23:58:23 +08:00
parent 6767af7488
commit 1ecb2b273a
7 changed files with 365 additions and 384 deletions

View File

@ -23,11 +23,17 @@ export interface AliasOptions {
@Injectable()
export class JPush extends IonicNativePlugin {
@Cordova()
init(): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS', 'Android']
})
init(): void { }
@Cordova()
setDebugMode(enable: boolean): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS', 'Android']
})
setDebugMode(enable: boolean): void { }
@Cordova()
getRegistrationID(): Promise<any> { return; }
@ -91,41 +97,74 @@ export class JPush extends IonicNativePlugin {
// iOS API - start
@Cordova()
setBadge(badge: number): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
setBadge(badge: number): void { }
@Cordova()
resetBadge(): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
resetBadge(): void { }
@Cordova()
setApplicationIconBadgeNumber(badge: number): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
setApplicationIconBadgeNumber(badge: number): void { }
@Cordova()
getApplicationIconBadgeNumber(): Promise<any> { return; }
@Cordova()
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): void { }
@Cordova()
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): void { }
@Cordova()
addDismissActions(actions: Array<object>, categoryId: string): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
addDismissActions(actions: Array<object>, categoryId: string): void { }
@Cordova()
addNotificationActions(actions: Array<object>, categoryId: string): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
addNotificationActions(actions: Array<object>, categoryId: string): void { }
@Cordova()
setLocation(latitude: number, longitude: number): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
setLocation(latitude: number, longitude: number): void { }
@Cordova()
startLogPageView(pageName: string): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
startLogPageView(pageName: string): void { return; }
@Cordova()
stopLogPageView(pageName: string): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
stopLogPageView(pageName: string): void { return; }
@Cordova()
beginLogPageView(pageName: string, duration: number): Promise<any> { return; }
@Cordova({
sync: true,
platforms: ['iOS']
})
beginLogPageView(pageName: string, duration: number): void { return; }
// iOS API - end

View File

@ -7,9 +7,37 @@ export interface AliasOptions {
sequence: number;
alias?: string;
}
export declare class JPush extends IonicNativePlugin {
init(): Promise<any>;
setDebugMode(enable: boolean): Promise<any>;
/**
* @name jpush
* @description
* This plugin does something
*
* @usage
* ```typescript
* import { jpush } from '@ionic-native/jpush';
*
*
* constructor(private jpush: jpush) { }
*
* ...
*
*
* this.jpush.functionName('Hello', 123)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
* ```
*/
export declare class JPushOriginal extends IonicNativePlugin {
/**
* This function does something
* @param arg1 {string} Some param to configure something
* @param arg2 {number} Another param to configure something
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
functionName(arg1: string, arg2: number): Promise<any>;
init(): void;
setDebugMode(enable: boolean): void;
getRegistrationID(): Promise<any>;
stopPush(): Promise<any>;
resumePush(): Promise<any>;
@ -40,18 +68,18 @@ export declare class JPush extends IonicNativePlugin {
*/
getUserNotificationSettings(): Promise<any>;
clearLocalNotifications(): Promise<any>;
setBadge(badge: number): Promise<any>;
resetBadge(): Promise<any>;
setApplicationIconBadgeNumber(badge: number): Promise<any>;
setBadge(badge: number): void;
resetBadge(): void;
setApplicationIconBadgeNumber(badge: number): void;
getApplicationIconBadgeNumber(): Promise<any>;
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): Promise<any>;
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise<any>;
addDismissActions(actions: Array<object>, categoryId: string): Promise<any>;
addNotificationActions(actions: Array<object>, categoryId: string): Promise<any>;
setLocation(latitude: number, longitude: number): Promise<any>;
startLogPageView(pageName: string): Promise<any>;
stopLogPageView(pageName: string): Promise<any>;
beginLogPageView(pageName: string, duration: number): Promise<any>;
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): void;
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): void;
addDismissActions(actions: Array<object>, categoryId: string): void;
addNotificationActions(actions: Array<object>, categoryId: string): void;
setLocation(latitude: number, longitude: number): void;
startLogPageView(pageName: string): void;
stopLogPageView(pageName: string): void;
beginLogPageView(pageName: string, duration: number): void;
getConnectionState(): Promise<any>;
setBasicPushNotificationBuilder(): Promise<any>;
setCustomPushNotificationBuilder(): Promise<any>;
@ -65,3 +93,5 @@ export declare class JPush extends IonicNativePlugin {
setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise<any>;
setPushTime(weekdays: Array<string>, startHour: number, endHour: number): Promise<any>;
}
export declare const JPush: JPushOriginal;

File diff suppressed because one or more lines are too long

95
ionic/jpush/ngx/index.d.ts vendored Normal file
View File

@ -0,0 +1,95 @@
import { IonicNativePlugin } from '@ionic-native/core';
export interface TagOptions {
sequence: number;
tags?: Array<string>;
}
export interface AliasOptions {
sequence: number;
alias?: string;
}
/**
* @name jpush
* @description
* This plugin does something
*
* @usage
* ```typescript
* import { jpush } from '@ionic-native/jpush';
*
*
* constructor(private jpush: jpush) { }
*
* ...
*
*
* this.jpush.functionName('Hello', 123)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
* ```
*/
export declare class JPush extends IonicNativePlugin {
/**
* This function does something
* @param arg1 {string} Some param to configure something
* @param arg2 {number} Another param to configure something
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
functionName(arg1: string, arg2: number): Promise<any>;
init(): void;
setDebugMode(enable: boolean): void;
getRegistrationID(): Promise<any>;
stopPush(): Promise<any>;
resumePush(): Promise<any>;
isPushStopped(): Promise<any>;
setTags(params: TagOptions): Promise<any>;
addTags(params: TagOptions): Promise<any>;
deleteTags(params: TagOptions): Promise<any>;
cleanTags(params: TagOptions): Promise<any>;
getAllTags(params: TagOptions): Promise<any>;
/**
* @param params { sequence: number, tag: string }
*/
checkTagBindState(params: object): Promise<any>;
setAlias(params: AliasOptions): Promise<any>;
deleteAlias(params: AliasOptions): Promise<any>;
getAlias(params: AliasOptions): Promise<any>;
/**
* 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.
*/
getUserNotificationSettings(): Promise<any>;
clearLocalNotifications(): Promise<any>;
setBadge(badge: number): void;
resetBadge(): void;
setApplicationIconBadgeNumber(badge: number): void;
getApplicationIconBadgeNumber(): Promise<any>;
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): void;
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): void;
addDismissActions(actions: Array<object>, categoryId: string): void;
addNotificationActions(actions: Array<object>, categoryId: string): void;
setLocation(latitude: number, longitude: number): void;
startLogPageView(pageName: string): void;
stopLogPageView(pageName: string): void;
beginLogPageView(pageName: string, duration: number): void;
getConnectionState(): Promise<any>;
setBasicPushNotificationBuilder(): Promise<any>;
setCustomPushNotificationBuilder(): Promise<any>;
clearAllNotification(): Promise<any>;
clearNotificationById(id: number): Promise<any>;
setLatestNotificationNum(num: number): Promise<any>;
addLocalNotification(builderId: number, content: string, title: string, notificationId: number, broadcastTime: number, extras?: string): Promise<any>;
removeLocalNotification(notificationId: number): Promise<any>;
reportNotificationOpened(msgId: number): Promise<any>;
requestPermission(): Promise<any>;
setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise<any>;
setPushTime(weekdays: Array<string>, startHour: number, endHour: number): Promise<any>;
}

95
ionic/jpush/ngx/index.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
[{"__symbolic":"module","version":4,"metadata":{"TagOptions":{"__symbolic":"interface"},"AliasOptions":{"__symbolic":"interface"},"JPush":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@ionic-native/core","name":"IonicNativePlugin","line":67,"character":27},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":64,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"functionName":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"setDebugMode":[{"__symbolic":"method"}],"getRegistrationID":[{"__symbolic":"method"}],"stopPush":[{"__symbolic":"method"}],"resumePush":[{"__symbolic":"method"}],"isPushStopped":[{"__symbolic":"method"}],"setTags":[{"__symbolic":"method"}],"addTags":[{"__symbolic":"method"}],"deleteTags":[{"__symbolic":"method"}],"cleanTags":[{"__symbolic":"method"}],"getAllTags":[{"__symbolic":"method"}],"checkTagBindState":[{"__symbolic":"method"}],"setAlias":[{"__symbolic":"method"}],"deleteAlias":[{"__symbolic":"method"}],"getAlias":[{"__symbolic":"method"}],"getUserNotificationSettings":[{"__symbolic":"method"}],"clearLocalNotifications":[{"__symbolic":"method"}],"setBadge":[{"__symbolic":"method"}],"resetBadge":[{"__symbolic":"method"}],"setApplicationIconBadgeNumber":[{"__symbolic":"method"}],"getApplicationIconBadgeNumber":[{"__symbolic":"method"}],"addLocalNotificationForIOS":[{"__symbolic":"method"}],"deleteLocalNotificationWithIdentifierKeyInIOS":[{"__symbolic":"method"}],"addDismissActions":[{"__symbolic":"method"}],"addNotificationActions":[{"__symbolic":"method"}],"setLocation":[{"__symbolic":"method"}],"startLogPageView":[{"__symbolic":"method"}],"stopLogPageView":[{"__symbolic":"method"}],"beginLogPageView":[{"__symbolic":"method"}],"getConnectionState":[{"__symbolic":"method"}],"setBasicPushNotificationBuilder":[{"__symbolic":"method"}],"setCustomPushNotificationBuilder":[{"__symbolic":"method"}],"clearAllNotification":[{"__symbolic":"method"}],"clearNotificationById":[{"__symbolic":"method"}],"setLatestNotificationNum":[{"__symbolic":"method"}],"addLocalNotification":[{"__symbolic":"method"}],"removeLocalNotification":[{"__symbolic":"method"}],"reportNotificationOpened":[{"__symbolic":"method"}],"requestPermission":[{"__symbolic":"method"}],"setSilenceTime":[{"__symbolic":"method"}],"setPushTime":[{"__symbolic":"method"}]}}}}]

View File

@ -1,15 +1,15 @@
{
"name": "@jiguang-ionic/jpush",
"version": "1.0.2",
"version": "2.0.0",
"description": "JPush support for ionic-native",
"module": "index.js",
"typings": "index.d.ts",
"author": "hevin",
"license": "MIT",
"peerDependencies": {
"@ionic-native/core": "^4.2.0",
"@ionic-native/core": "^5.1.0",
"@angular/core": "*",
"rxjs": "^5.0.1"
"rxjs": "^6.3.0"
},
"repository": {
"type": "git",