Merge pull request #394 from jpush/dev

Dev
This commit is contained in:
HuminiOS 2019-02-24 00:03:44 +08:00 committed by GitHub
commit eb624a7bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 405 additions and 390 deletions

View File

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

View File

@ -7,9 +7,37 @@ export interface AliasOptions {
sequence: number; sequence: number;
alias?: string; alias?: string;
} }
export declare class JPush extends IonicNativePlugin { /**
init(): Promise<any>; * @name jpush
setDebugMode(enable: boolean): Promise<any>; * @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>; getRegistrationID(): Promise<any>;
stopPush(): Promise<any>; stopPush(): Promise<any>;
resumePush(): Promise<any>; resumePush(): Promise<any>;
@ -40,18 +68,18 @@ export declare class JPush extends IonicNativePlugin {
*/ */
getUserNotificationSettings(): Promise<any>; getUserNotificationSettings(): Promise<any>;
clearLocalNotifications(): Promise<any>; clearLocalNotifications(): Promise<any>;
setBadge(badge: number): Promise<any>; setBadge(badge: number): void;
resetBadge(): Promise<any>; resetBadge(): void;
setApplicationIconBadgeNumber(badge: number): Promise<any>; setApplicationIconBadgeNumber(badge: number): void;
getApplicationIconBadgeNumber(): Promise<any>; getApplicationIconBadgeNumber(): Promise<any>;
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): Promise<any>; addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): void;
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise<any>; deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): void;
addDismissActions(actions: Array<object>, categoryId: string): Promise<any>; addDismissActions(actions: Array<object>, categoryId: string): void;
addNotificationActions(actions: Array<object>, categoryId: string): Promise<any>; addNotificationActions(actions: Array<object>, categoryId: string): void;
setLocation(latitude: number, longitude: number): Promise<any>; setLocation(latitude: number, longitude: number): void;
startLogPageView(pageName: string): Promise<any>; startLogPageView(pageName: string): void;
stopLogPageView(pageName: string): Promise<any>; stopLogPageView(pageName: string): void;
beginLogPageView(pageName: string, duration: number): Promise<any>; beginLogPageView(pageName: string, duration: number): void;
getConnectionState(): Promise<any>; getConnectionState(): Promise<any>;
setBasicPushNotificationBuilder(): Promise<any>; setBasicPushNotificationBuilder(): Promise<any>;
setCustomPushNotificationBuilder(): 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>; setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise<any>;
setPushTime(weekdays: Array<string>, startHour: number, endHour: 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

File diff suppressed because one or more lines are too long

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

View File

@ -1,6 +1,6 @@
{ {
"name": "jpush-phonegap-plugin", "name": "jpush-phonegap-plugin",
"version": "3.6.1", "version": "3.6.2",
"description": "JPush for cordova plugin", "description": "JPush for cordova plugin",
"cordova": { "cordova": {
"id": "jpush-phonegap-plugin", "id": "jpush-phonegap-plugin",

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
id="jpush-phonegap-plugin" id="jpush-phonegap-plugin"
version="3.6.1"> version="3.6.2">
<name>JPush</name> <name>JPush</name>
<description>JPush for cordova plugin</description> <description>JPush for cordova plugin</description>
@ -49,7 +49,7 @@
<source-file src="src/ios/Plugins/AppDelegate+JPush.m" /> <source-file src="src/ios/Plugins/AppDelegate+JPush.m" />
<header-file src="src/ios/lib/JPUSHService.h" /> <header-file src="src/ios/lib/JPUSHService.h" />
<source-file src="src/ios/lib/jpush-ios-3.1.1.a" framework="true" /> <source-file src="src/ios/lib/jpush-ios-3.1.2.a" framework="true" />
<resource-file src="src/ios/JPushConfig.plist" /> <resource-file src="src/ios/JPushConfig.plist" />
<framework src="CFNetwork.framework" weak="true" /> <framework src="CFNetwork.framework" weak="true" />

View File

@ -9,7 +9,7 @@
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved. * Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
*/ */
#define JPUSH_VERSION_NUMBER 3.1.1 #define JPUSH_VERSION_NUMBER 3.1.2
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
@ -21,6 +21,7 @@
@class UNNotificationRequest; @class UNNotificationRequest;
@class UNNotification; @class UNNotification;
@protocol JPUSHRegisterDelegate; @protocol JPUSHRegisterDelegate;
@protocol JPUSHGeofenceDelegate;
typedef void (^JPUSHTagsOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq); typedef void (^JPUSHTagsOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq);
typedef void (^JPUSHTagValidOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq, BOOL isBind); typedef void (^JPUSHTagValidOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq, BOOL isBind);
@ -370,6 +371,19 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
*/ */
+ (void)setLocation:(CLLocation *)location; + (void)setLocation:(CLLocation *)location;
/**
10 iOS系统默认地理围栏最大个数为20
@param count count
*/
+ (void)setGeofenecMaxCount:(NSInteger)count;
/**
@param delegate
@param launchOptions app启动完成是收到的字段参数
*/
+ (void)registerLbsGeofenceDelegate:(id<JPUSHGeofenceDelegate>)delegate withLaunchOptions:(NSDictionary *)launchOptions;
///---------------------------------------------------- ///----------------------------------------------------
/// @name Local Notification 本地通知 /// @name Local Notification 本地通知
@ -636,3 +650,25 @@ callbackSelector:(SEL)cbSelector
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(nullable UNNotification *)notification NS_AVAILABLE_IOS(12.0); - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(nullable UNNotification *)notification NS_AVAILABLE_IOS(12.0);
@end @end
@protocol JPUSHGeofenceDelegate <NSObject>
/**
@param geofenceId id
@param userInfo
@param error
*/
- (void)jpushGeofenceIdentifer:(NSString * _Nonnull)geofenceId didEnterRegion:(NSDictionary * _Nullable)userInfo error:(NSError * _Nullable)error;
/**
@param geofenceId id
@param userInfo
@param error
*/
- (void)jpushGeofenceIdentifer:(NSString * _Nonnull)geofenceId didExitRegion:(NSDictionary * _Nullable)userInfo error:(NSError * _Nullable)error;
@end