Compare commits

...

13 Commits

Author SHA1 Message Date
Hevin
031acb9631 Merge branch 'dev' 2017-10-13 13:11:12 +08:00
Hevin
0ee5f8b1a0 Update iOS SDK to v3.0.7 2017-10-13 13:10:47 +08:00
Hevin
259ec0a03a Update API doc 2017-10-13 13:09:19 +08:00
Hevin
6283cb26f6 Remove deprecated method
setTagsWithAlias
2017-10-13 10:12:16 +08:00
Hevin
8d098d29b1 Merge branch 'dev' 2017-10-11 14:49:23 +08:00
Hevin
1c3228848b build: v3.2.7 2017-10-11 14:49:07 +08:00
huangminlinux
a9343ac776 Merge pull request #278 from jpush/dev
fix open local notification to launch app event bug
2017-10-11 01:43:19 -05:00
huangminlinux
585e2a5084 fix open local notification to launch app event bug 2017-10-11 14:28:56 +08:00
huangminlinux
de58071773 Merge pull request #277 from jpush/dev
remove jpush.startLocalNotification event in iOS docs
2017-10-10 22:30:56 -05:00
huangminlinux
c726477cfb remove jpush.startLocalNotification event in iOS docs 2017-10-11 11:29:40 +08:00
huangminlinux
13341fd68a Merge pull request #276 from jpush/dev
Dev
2017-10-10 22:28:05 -05:00
huangminlinux
3f00143a5a update doc remove startLocalNotification event 2017-10-11 11:26:46 +08:00
huangminlinux
f5ea2b5b10 ios add jpush.receiveRegistrationId event 2017-10-11 11:15:13 +08:00
12 changed files with 177 additions and 227 deletions

View File

@@ -1,7 +1,7 @@
# JPush PhoneGap / Cordova Plugin # JPush PhoneGap / Cordova Plugin
[![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin) [![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin)
[![release](https://img.shields.io/badge/release-3.2.6-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases) [![release](https://img.shields.io/badge/release-3.2.8-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin) [![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin)
[![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1) [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)

View File

@@ -437,9 +437,7 @@ window.JPush.clearAllLocalNotifications()
监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。 监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。
### 点击本地通知横幅启动 App
监听 `jpush.startLocalNotification` 事件。
## 页面的统计 ## 页面的统计
@@ -718,18 +716,10 @@ window.JPush.getUserNotificationSettings(callback)
[iOS 7 以后后台收到远程通知](#后台收到推送) [iOS 7 以后后台收到远程通知](#后台收到推送)
### jpush.setTagsWithAlias
[设置标签别名回调](#返回值说明)
### jpush.receiveMessage ### jpush.receiveMessage
[获取自定义消息内容](#获取自定义消息内容) [获取自定义消息内容](#获取自定义消息内容)
### jpush.startLocalNotification
[点击本地通知横幅启动 App](#点击本地通知横幅启动-app)
### jpush.receiveLocalNotification ### jpush.receiveLocalNotification
[iOS 10 before 收到本地通知](#ios-10-before-收到本地通知) [iOS 10 before 收到本地通知](#ios-10-before-收到本地通知)

View File

@@ -1,6 +1,6 @@
{ {
"name": "jpush-phonegap-plugin", "name": "jpush-phonegap-plugin",
"version": "3.2.6", "version": "3.2.8",
"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.2.6"> version="3.2.8">
<name>JPush</name> <name>JPush</name>
<description>JPush for cordova plugin</description> <description>JPush for cordova plugin</description>
@@ -38,7 +38,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.0.6.a" framework="true" /> <source-file src="src/ios/lib/jpush-ios-3.0.7.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

@@ -527,24 +527,6 @@ public class JPushPlugin extends CordovaPlugin {
eventCallbackMap.put(sequence, callbackContext); eventCallbackMap.put(sequence, callbackContext);
} }
void setTagsWithAlias(JSONArray data, CallbackContext callbackContext) {
HashSet<String> tags = new HashSet<String>();
String alias;
try {
alias = data.getString(0);
JSONArray tagsArray = data.getJSONArray(1);
for (int i = 0; i < tagsArray.length(); i++) {
tags.add(tagsArray.getString(i));
}
JPushInterface.setAliasAndTags(mContext,
alias, tags, mTagWithAliasCallback);
callbackContext.success();
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Error reading tagAlias JSON");
}
}
void getConnectionState(JSONArray data, CallbackContext callback) { void getConnectionState(JSONArray data, CallbackContext callback) {
boolean isConnected = JPushInterface.getConnectionState(cordovaActivity.getApplicationContext()); boolean isConnected = JPushInterface.getConnectionState(cordovaActivity.getApplicationContext());
callback.success(String.valueOf(isConnected)); callback.success(String.valueOf(isConnected));
@@ -553,8 +535,7 @@ public class JPushPlugin extends CordovaPlugin {
/** /**
* 自定义通知行为,声音、震动、呼吸灯等。 * 自定义通知行为,声音、震动、呼吸灯等。
*/ */
void setBasicPushNotificationBuilder(JSONArray data, void setBasicPushNotificationBuilder(JSONArray data, CallbackContext callbackContext) {
CallbackContext callbackContext) {
BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder( BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(
this.cordova.getActivity()); this.cordova.getActivity());
builder.developerArg0 = "Basic builder 1"; builder.developerArg0 = "Basic builder 1";

View File

@@ -1,156 +1,170 @@
// //
// AppDelegate+JPush.m // AppDelegate+JPush.m
// delegateExtention // delegateExtention
// //
// Created by on 15/8/3. // Created by on 15/8/3.
// Copyright (c) 2015 JPush. All rights reserved. // Copyright (c) 2015 JPush. All rights reserved.
// //
#import "AppDelegate+JPush.h" #import "AppDelegate+JPush.h"
#import "JPushPlugin.h" #import "JPushPlugin.h"
#import <objc/runtime.h> #import <objc/runtime.h>
#import <AdSupport/AdSupport.h> #import <AdSupport/AdSupport.h>
#import <UserNotifications/UserNotifications.h> #import <UserNotifications/UserNotifications.h>
#import "JPushDefine.h" #import "JPushDefine.h"
@implementation AppDelegate (JPush) @implementation AppDelegate (JPush)
+(void)load{ +(void)load{
Method origin1; Method origin1;
Method swizzle1; Method swizzle1;
origin1 = class_getInstanceMethod([self class],@selector(init)); origin1 = class_getInstanceMethod([self class],@selector(init));
swizzle1 = class_getInstanceMethod([self class], @selector(init_plus)); swizzle1 = class_getInstanceMethod([self class], @selector(init_plus));
method_exchangeImplementations(origin1, swizzle1); method_exchangeImplementations(origin1, swizzle1);
} }
-(instancetype)init_plus{ -(instancetype)init_plus{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidLaunch:) name:UIApplicationDidFinishLaunchingNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidLaunch:) name:UIApplicationDidFinishLaunchingNotification object:nil];
return [self init_plus]; return [self init_plus];
} }
-(void)fireOpenNotification:(NSTimer*)timer{ -(void)fireOpenNotification:(NSTimer*)timer{
if (SharedJPushPlugin) { if (SharedJPushPlugin) {
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[timer.userInfo toJsonString]]; [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[timer.userInfo toJsonString]];
[timer invalidate]; [timer invalidate];
} }
} }
NSDictionary *_launchOptions; NSDictionary *_launchOptions;
-(void)applicationDidLaunch:(NSNotification *)notification{ -(void)applicationDidLaunch:(NSNotification *)notification{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jpushSDKDidLoginNotification) name:kJPFNetworkDidLoginNotification object:nil];
if (notification) {
if (notification.userInfo) { if (notification) {
NSDictionary *userInfo1 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; if (notification.userInfo) {
if (userInfo1.count > 0) {
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo1 repeats:YES]; if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
} [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:)
userInfo:[notification.userInfo
NSDictionary *userInfo2 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]; valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey] repeats:YES];
if (userInfo2.count > 0) { }
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo2 repeats:YES];
} if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) {
} UILocalNotification *localNotification = [notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
[JPUSHService setDebugMode];
NSDictionary* localNotificationEvent = @{@"content":localNotification.alertBody,
NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"]; @"badge": @(localNotification.applicationIconBadgeNumber),
NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath]; @"extras":localNotification.userInfo,
NSNumber *delay = [plistData valueForKey:JPushConfig_Delay]; };
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:localNotificationEvent repeats:YES];
_launchOptions = notification.userInfo; }
}
if (![delay boolValue]) {
[self startJPushSDK]; [JPUSHService setDebugMode];
}
} NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
} NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
NSNumber *delay = [plistData valueForKey:JPushConfig_Delay];
-(void)startJPushSDK{
[self registerForRemoteNotification]; _launchOptions = notification.userInfo;
[JPushPlugin setupJPushSDK:_launchOptions];
} if (![delay boolValue]) {
[self startJPushSDK];
-(void)registerForRemoteNotification{ }
if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) { }
#ifdef NSFoundationVersionNumber_iOS_9_x_Max }
JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
entity.types = UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound; -(void)startJPushSDK{
[JPUSHService registerForRemoteNotificationConfig:entity delegate:self]; [self registerForRemoteNotification];
#endif [JPushPlugin setupJPushSDK:_launchOptions];
}else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) { }
//categories
[JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | - (void)jpushSDKDidLoginNotification {
UIUserNotificationTypeSound | NSDictionary *event = @{@"registrationId": JPUSHService.registrationID};
UIUserNotificationTypeAlert) [JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]];
categories:nil]; }
} else if([[UIDevice currentDevice].systemVersion floatValue] < 8.0){
//categories nil -(void)registerForRemoteNotification{
[JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
UIRemoteNotificationTypeSound | #ifdef NSFoundationVersionNumber_iOS_9_x_Max
UIRemoteNotificationTypeAlert) JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
categories:nil]; entity.types = UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound;
} [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
} #endif
}else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { //categories
[JPUSHService registerDeviceToken:deviceToken]; [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
} UIUserNotificationTypeSound |
UIUserNotificationTypeAlert)
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{ categories:nil];
[JPUSHService handleRemoteNotification:userInfo]; } else if([[UIDevice currentDevice].systemVersion floatValue] < 8.0){
//categories nil
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]]; [JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
} UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{ categories:nil];
[JPUSHService handleRemoteNotification:userInfo]; }
NSString *eventName; }
switch ([UIApplication sharedApplication].applicationState) {
case UIApplicationStateInactive: - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
eventName = JPushDocumentEvent_OpenNotification; [JPUSHService registerDeviceToken:deviceToken];
break; }
case UIApplicationStateActive:
eventName = JPushDocumentEvent_ReceiveNotification; -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
break; [JPUSHService handleRemoteNotification:userInfo];
case UIApplicationStateBackground:
eventName = JPushDocumentEvent_BackgroundNotification; [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
break; }
default:
break; -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
} [JPUSHService handleRemoteNotification:userInfo];
[JPushPlugin fireDocumentEvent:eventName jsString:[userInfo toJsonString]]; NSString *eventName;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ switch ([UIApplication sharedApplication].applicationState) {
completionHandler(UIBackgroundFetchResultNewData); case UIApplicationStateInactive:
}); eventName = JPushDocumentEvent_OpenNotification;
} break;
case UIApplicationStateActive:
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{ eventName = JPushDocumentEvent_ReceiveNotification;
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:notification.request.content.userInfo]; break;
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]]; case UIApplicationStateBackground:
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert); eventName = JPushDocumentEvent_BackgroundNotification;
} break;
default:
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{ break;
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:response.notification.request.content.userInfo]; }
@try { [JPushPlugin fireDocumentEvent:eventName jsString:[userInfo toJsonString]];
[userInfo setValue:[response valueForKey:@"userText"] forKey:@"userText"]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
} @catch (NSException *exception) { } completionHandler(UIBackgroundFetchResultNewData);
[userInfo setValue:response.actionIdentifier forKey:@"actionIdentifier"]; });
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[userInfo toJsonString]]; }
completionHandler();
} -(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:notification.request.content.userInfo];
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
[[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:notification.userInfo]; completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
} }
- (void)applicationWillEnterForeground:(UIApplication *)application { -(void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{
// [application setApplicationIconBadgeNumber:0]; NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:response.notification.request.content.userInfo];
// [application cancelAllLocalNotifications]; @try {
} [userInfo setValue:[response valueForKey:@"userText"] forKey:@"userText"];
} @catch (NSException *exception) { }
- (void)applicationDidEnterBackground:(UIApplication *)application { [userInfo setValue:response.actionIdentifier forKey:@"actionIdentifier"];
// [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[userInfo toJsonString]];
} completionHandler();
}
@end
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:notification.userInfo];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// [application setApplicationIconBadgeNumber:0];
// [application cancelAllLocalNotifications];
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}
@end

View File

@@ -27,7 +27,6 @@ static NSString *const JPushDocumentEvent_OpenNotification = @"openNoti
static NSString *const JPushDocumentEvent_BackgroundNotification = @"backgroundNotification"; static NSString *const JPushDocumentEvent_BackgroundNotification = @"backgroundNotification";
static NSString *const JPushDocumentEvent_SetTagsWithAlias = @"setTagsWithAlias"; static NSString *const JPushDocumentEvent_SetTagsWithAlias = @"setTagsWithAlias";
static NSString *const JPushDocumentEvent_ReceiveMessage = @"receiveMessage"; static NSString *const JPushDocumentEvent_ReceiveMessage = @"receiveMessage";
static NSString *const JPushDocumentEvent_StartLocalNotification = @"startLocalNotification";
static NSString *const JPushDocumentEvent_ReceiveLocalNotification = @"receiveLocalNotification"; static NSString *const JPushDocumentEvent_ReceiveLocalNotification = @"receiveLocalNotification";
static NSString *const JPushDocumentEvent_receiveRegistrationId = @"receiveRegistrationId";

View File

@@ -17,8 +17,6 @@
//以下为js中可调用接口 //以下为js中可调用接口
//设置标签、别名 //设置标签、别名
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command;
-(void)setTags:(CDVInvokedUrlCommand*)command; -(void)setTags:(CDVInvokedUrlCommand*)command;
-(void)addTags:(CDVInvokedUrlCommand*)command; -(void)addTags:(CDVInvokedUrlCommand*)command;
-(void)deleteTags:(CDVInvokedUrlCommand*)command; -(void)deleteTags:(CDVInvokedUrlCommand*)command;
@@ -76,7 +74,6 @@
/* /*
* 以下为js中可监听到的事件 * 以下为js中可监听到的事件
* jpush.openNotification 点击推送消息启动或唤醒app * jpush.openNotification 点击推送消息启动或唤醒app
* jpush.setTagsWithAlias 设置标签、别名完成
* jpush.receiveMessage 收到自定义消息 * jpush.receiveMessage 收到自定义消息
* jpush.receiveNotification 前台收到推送 * jpush.receiveNotification 前台收到推送
* jpush.backgroundNotification 后台收到推送 * jpush.backgroundNotification 后台收到推送

View File

@@ -87,23 +87,6 @@
}); });
} }
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
NSString *alias = [command argumentAtIndex:0];
NSArray *tags = [command argumentAtIndex:1];
[JPUSHService setTags:[NSSet setWithArray:tags]
alias:alias
fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
CDVPluginResult *result;
if (iResCode == 0) {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
} else {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
}
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}];
}
-(void)setTags:(CDVInvokedUrlCommand*)command { -(void)setTags:(CDVInvokedUrlCommand*)command {
NSDictionary* params = [command.arguments objectAtIndex:0]; NSDictionary* params = [command.arguments objectAtIndex:0];
NSNumber* sequence = params[@"sequence"]; NSNumber* sequence = params[@"sequence"];

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.0.6 #define JPUSH_VERSION_NUMBER 3.0.7
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>

View File

@@ -70,20 +70,6 @@ JPushPlugin.prototype.clearLocalNotifications = function () {
} }
} }
JPushPlugin.prototype.setTagsWithAlias = function (tags, alias, successCallback, errorCallback) {
if (tags == null) {
this.setAlias(alias)
return
}
if (alias == null) {
this.setTags(tags)
return
}
var arrayTagWithAlias = [tags]
arrayTagWithAlias.unshift(alias)
this.callNative('setTagsWithAlias', arrayTagWithAlias, successCallback, errorCallback)
}
/** /**
* 设置标签。 * 设置标签。
* 注意:该接口是覆盖逻辑,而不是增量逻辑。即新的调用会覆盖之前的设置。 * 注意:该接口是覆盖逻辑,而不是增量逻辑。即新的调用会覆盖之前的设置。