mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-04-21 15:56:23 +08:00
iOS添加手机号设置接口
This commit is contained in:
parent
fad4745e01
commit
bc9e441fe2
@ -73,6 +73,9 @@ static NSMutableDictionary *_jpushEventCache;
|
|||||||
-(void)addDismissActions:(CDVInvokedUrlCommand*)command;
|
-(void)addDismissActions:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)addNotificationActions:(CDVInvokedUrlCommand*)command;
|
-(void)addNotificationActions:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
// 设置手机号
|
||||||
|
-(void)setMobileNumber:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 以下为js中可监听到的事件
|
* 以下为js中可监听到的事件
|
||||||
* jpush.openNotification 点击推送消息启动或唤醒app
|
* jpush.openNotification 点击推送消息启动或唤醒app
|
||||||
|
@ -510,6 +510,29 @@
|
|||||||
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
|
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - 设置手机号
|
||||||
|
-(void)setMobileNumber:(CDVInvokedUrlCommand *)command {
|
||||||
|
NSDictionary* params = [command.arguments objectAtIndex:0];
|
||||||
|
NSNumber* sequence = params[@"sequence"];
|
||||||
|
NSString* number = params[@"mobileNumber"];
|
||||||
|
[JPUSHService setMobileNumber:number completion:^(NSError *error) {
|
||||||
|
NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
|
||||||
|
[dic setObject:sequence forKey:@"sequence"];
|
||||||
|
CDVPluginResult* result;
|
||||||
|
if (error) {
|
||||||
|
[dic setValue:[NSNumber numberWithUnsignedInteger:error.code] forKey:@"code"];
|
||||||
|
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// success
|
||||||
|
[dic setObject:number forKey:@"mobileNumber"];
|
||||||
|
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic];
|
||||||
|
}
|
||||||
|
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
||||||
|
}];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - 内部方法
|
#pragma mark - 内部方法
|
||||||
|
|
||||||
+(void)setupJPushSDK:(NSDictionary*)userInfo{
|
+(void)setupJPushSDK:(NSDictionary*)userInfo{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user