|
@@ -255,13 +255,15 @@ RCT_REMAP_METHOD(bluetoothPermissionStatus, bluetoothPermission:(RCTPromiseResol
|
255
|
255
|
|
256
|
256
|
}
|
257
|
257
|
|
258
|
|
-//problem here is that we can only return Authorized or Undetermined
|
|
258
|
+//problem here is that we can we can't know if the user was never prompted for permission, or if they were prompted and deneied
|
259
|
259
|
RCT_REMAP_METHOD(notificationPermissionStatus, notificationPermission:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
260
|
260
|
{
|
261
|
261
|
if ([[UIApplication sharedApplication] respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {
|
262
|
262
|
// iOS8+
|
263
|
|
- if ([[UIApplication sharedApplication] isRegisteredForRemoteNotifications]) {
|
264
|
|
- return resolve(@(RNPermissionsStatusAuthorized));
|
|
263
|
+ BOOL isRegistered = [[UIApplication sharedApplication] isRegisteredForRemoteNotifications];
|
|
264
|
+ BOOL isEnabled = [[[UIApplication sharedApplication] currentUserNotificationSettings] types] != UIUserNotificationTypeNone;
|
|
265
|
+ if (isRegistered || isEnabled) {
|
|
266
|
+ return resolve(@(isEnabled ? RNPermissionsStatusAuthorized : RNPermissionsStatusDenied));
|
265
|
267
|
}
|
266
|
268
|
else {
|
267
|
269
|
return resolve(@(RNPermissionsStatusUndetermined));
|
|
@@ -277,7 +279,6 @@ RCT_REMAP_METHOD(notificationPermissionStatus, notificationPermission:(RCTPromis
|
277
|
279
|
#else
|
278
|
280
|
return resolve(@(RNPermissionsStatusUndetermined));
|
279
|
281
|
#endif
|
280
|
|
-
|
281
|
282
|
}
|
282
|
283
|
}
|
283
|
284
|
|