mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-01-19 05:22:57 +08:00
add new iterface 'isPushStopped' and 'resumePush' for platform iOS
This commit is contained in:
parent
58b8cd45b2
commit
27378f6ca0
@ -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" />
|
||||
|
||||
|
@ -46,6 +46,45 @@
|
||||
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{
|
||||
|
||||
|
||||
|
@ -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(){
|
||||
|
Loading…
Reference in New Issue
Block a user