Skip to content

Commit ac83f6b

Browse files
authored
Merge pull request #925 from huangshuni/master
iOS新增获取通知权限开关的接口,修改版本号为3.0.3
2 parents cb1aa1e + bf4590f commit ac83f6b

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"dependencies": {
1010
"jcore-react-native": "2.1.3",
11-
"jpush-react-native": "3.0.2",
11+
"jpush-react-native": "3.0.3",
1212
"react": "16.8.6",
1313
"react-native": "0.60.5",
1414
"update": "^0.7.4"

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ export default class JPush {
323323
static isNotificationEnabled(callback){
324324
if (Platform.OS == "android"){
325325
JPushModule.isNotificationEnabled(callback)
326+
} else {
327+
JPushModule.isNotificationEnabled(callback)
326328
}
327329
}
328330

ios/RCTJPushModule/RCTJPushModule.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@ - (id)init
191191
}];
192192
}
193193

194+
RCT_EXPORT_METHOD(isNotificationEnabled:(RCTResponseSenderBlock) callback) {
195+
[JPUSHService requestNotificationAuthorization:^(JPAuthorizationStatus status) {
196+
if (status <= JPAuthorizationStatusDenied) {
197+
callback(@[@(NO)]);
198+
}else {
199+
callback(@[@(YES)]);
200+
}
201+
}];
202+
}
203+
194204
//tag
195205
RCT_EXPORT_METHOD(addTags:(NSDictionary *)params)
196206
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"types": "index.d.ts",
77
"license": "ISC",
88
"author": "wicked.tc130",
9-
"version": "3.0.2",
9+
"version": "3.0.3",
1010
"repository": {
1111
"type": "git",
1212
"url": "https://github.com/jpush/jpush-react-native"

0 commit comments

Comments
 (0)