add new iterface 'isPushStopped' and 'resumePush' for platform iOS

This commit is contained in:
zhangqinghe 2015-03-30 10:28:01 +08:00
parent 58b8cd45b2
commit 27378f6ca0
3 changed files with 44 additions and 7 deletions

View File

@ -35,12 +35,11 @@
<framework src="CFNetwork.framework" weak="true" />
<framework src="CoreFoundation.framework" weak="true" />
<framework src="CoreTelephony.framework" weak="true" />
<framework src="SystemConfiguration.framework" weak="true" />
<framework src="CoreGraphics.framework" weak="true" />
<framework src="Foundation.framework" weak="true" />
<framework src="CoreFoundation.framework" weak="true" />
<framework src="UIKit.framework" weak="true" />
<framework src="CoreTelephony.framework" weak="true" />
<framework src="Security.framework" weak="true" />
<framework src="libz.dylib" weak="true" />

View File

@ -45,7 +45,46 @@
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
object:self];
}
-(void)resumePush:(CDVInvokedUrlCommand*)command{
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
//categories
[APService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
UIUserNotificationTypeSound |
UIUserNotificationTypeAlert)
categories:nil];
} else {
//categories nil
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)
categories:nil];
}
#else
//categories nil
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)
categories:nil];
#endif
}
-(void)isPushStopped:(CDVInvokedUrlCommand*)command{
NSNumber *result;
if ([[UIApplication sharedApplication] isRegisteredForRemoteNotifications ]) {
result=@(1);
}else{
result=@(0);
}
CDVPluginResult * pushResult=[self pluginResultForValue:result];
if (pushResult) {
[self succeedWithPluginResult:pushResult withCallbackID:command.callbackId];
} else {
[self failWithCallbackID:command.callbackId];
}}
-(void)setTags:(CDVInvokedUrlCommand *)command{

View File

@ -199,10 +199,9 @@ JPushPlugin.prototype.stopPush = function(){
}
JPushPlugin.prototype.resumePush = function(){
if(device.platform == "Android") {
data=[]
this.call_native("resumePush",data,null);
}
}
JPushPlugin.prototype.setDebugMode = function(mode){
if(device.platform == "Android") {
@ -224,10 +223,10 @@ JPushPlugin.prototype.setLatestNotificationNum = function(num){
}
JPushPlugin.prototype.isPushStopped = function(callback){
if(device.platform == "Android") {
data=[];
this.call_native("isPushStopped",data,callback)
}
}
JPushPlugin.prototype.init = function(){