forked from github/jpush-phonegap-plugin
Merge branch 'dev'
This commit is contained in:
commit
13b36b746c
@ -154,7 +154,9 @@
|
|||||||
</service>
|
</service>
|
||||||
|
|
||||||
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||||
<receiver android:name="cn.jpush.phonegap.MyReceiver" android:enabled="true">
|
<receiver
|
||||||
|
android:name="cn.jiguang.cordova.push.MyReceiver"
|
||||||
|
android:enabled="true">
|
||||||
<intent-filter android:priority="1000">
|
<intent-filter android:priority="1000">
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
|
||||||
<!-- Required 显示通知栏 -->
|
<!-- Required 显示通知栏 -->
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.jpush.phonegap;
|
package cn.jiguang.cordova.push;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.jpush.phonegap;
|
package cn.jiguang.cordova.push;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -99,24 +99,45 @@
|
|||||||
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
|
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
|
||||||
NSString *alias = [command argumentAtIndex:0];
|
NSString *alias = [command argumentAtIndex:0];
|
||||||
NSArray *tags = [command argumentAtIndex:1];
|
NSArray *tags = [command argumentAtIndex:1];
|
||||||
|
|
||||||
[JPUSHService setTags:[NSSet setWithArray:tags]
|
[JPUSHService setTags:[NSSet setWithArray:tags]
|
||||||
alias:alias
|
alias:alias
|
||||||
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
|
||||||
object:self];
|
CDVPluginResult *result;
|
||||||
|
if (iResCode == 0) {
|
||||||
|
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
|
||||||
|
} else {
|
||||||
|
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
|
||||||
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setTags:(CDVInvokedUrlCommand*)command{
|
-(void)setTags:(CDVInvokedUrlCommand*)command{
|
||||||
NSArray *tags = command.arguments;
|
NSArray *tags = command.arguments;
|
||||||
[JPUSHService setTags:[NSSet setWithArray:tags]
|
[JPUSHService setTags:[NSSet setWithArray:tags]
|
||||||
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
alias:nil
|
||||||
object:self];
|
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];
|
||||||
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setAlias:(CDVInvokedUrlCommand*)command{
|
-(void)setAlias:(CDVInvokedUrlCommand*)command{
|
||||||
NSString *alias = [command argumentAtIndex:0];
|
NSString *alias = [command argumentAtIndex:0];
|
||||||
[JPUSHService setAlias:alias
|
[JPUSHService setTags:nil
|
||||||
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
alias:alias
|
||||||
object:self];
|
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];
|
||||||
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
|
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
|
||||||
@ -259,9 +280,15 @@
|
|||||||
}
|
}
|
||||||
UNNotificationCategory *category;
|
UNNotificationCategory *category;
|
||||||
if (dimiss) {
|
if (dimiss) {
|
||||||
category = [UNNotificationCategory categoryWithIdentifier:categoryId actions:actions intentIdentifiers:@[] options:UNNotificationCategoryOptionCustomDismissAction];
|
category = [UNNotificationCategory categoryWithIdentifier:categoryId
|
||||||
|
actions:actions
|
||||||
|
intentIdentifiers:@[]
|
||||||
|
options:UNNotificationCategoryOptionCustomDismissAction];
|
||||||
} else {
|
} else {
|
||||||
category = [UNNotificationCategory categoryWithIdentifier:categoryId actions:actions intentIdentifiers:@[] options:UNNotificationCategoryOptionNone];
|
category = [UNNotificationCategory categoryWithIdentifier:categoryId
|
||||||
|
actions:actions
|
||||||
|
intentIdentifiers:@[]
|
||||||
|
options:UNNotificationCategoryOptionNone];
|
||||||
}
|
}
|
||||||
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
|
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
|
||||||
}
|
}
|
||||||
@ -318,16 +345,17 @@
|
|||||||
|
|
||||||
#pragma mark 设置标签及别名回调
|
#pragma mark 设置标签及别名回调
|
||||||
-(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias {
|
-(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias {
|
||||||
NSDictionary *dict = @{@"resultCode":[NSNumber numberWithInt:resultCode],
|
if (resultCode == 0) { // Success
|
||||||
@"tags" :tags == nil ? [NSNull null] : [tags allObjects],
|
|
||||||
@"alias" :alias == nil ? [NSNull null] : alias
|
} else {
|
||||||
};
|
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_SetTagsWithAlias jsString:[dict toJsonString]];
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)networkDidReceiveMessage:(NSNotification *)notification {
|
- (void)networkDidReceiveMessage:(NSNotification *)notification {
|
||||||
if (notification && notification.userInfo) {
|
if (notification && notification.userInfo) {
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveMessage jsString:[notification.userInfo toJsonString]];
|
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveMessage
|
||||||
|
jsString:[notification.userInfo toJsonString]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user