Browse Source

Merge branch 'delete_unused_permisstions' into 'master'

删除不必要的权限

See merge request BA/react-native-permissions!1
wd 7 years ago
parent
commit
bd298ecc24

+ 0 - 17
ios/Permissions/RNPAudioVideo.h

@@ -1,17 +0,0 @@
-//
-//  RNPAudioVideo.h
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPAudioVideo : NSObject
-
-+ (NSString *)getStatus:(NSString *)type;
-+ (void)request:(NSString *)type completionHandler:(void (^)(NSString *))completionHandler;
-
-@end

+ 0 - 48
ios/Permissions/RNPAudioVideo.m

@@ -1,48 +0,0 @@
-//
-//  RNPCamera.m
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import "RNPAudioVideo.h"
-
-#import <AVFoundation/AVFoundation.h>
-
-@implementation RNPAudioVideo
-
-+ (NSString *)getStatus:(NSString *)type
-{
-    int status = [AVCaptureDevice authorizationStatusForMediaType:[self typeFromString:type]];
-    switch (status) {
-        case AVAuthorizationStatusAuthorized:
-            return RNPStatusAuthorized;
-        case AVAuthorizationStatusDenied:
-            return RNPStatusDenied;
-        case AVAuthorizationStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-}
-
-+ (void)request:(NSString *)type completionHandler:(void (^)(NSString *))completionHandler
-{
-    [AVCaptureDevice requestAccessForMediaType:[self typeFromString:type]
-                             completionHandler:^(BOOL granted) {
-                                 dispatch_async(dispatch_get_main_queue(), ^{
-                                     completionHandler([RNPAudioVideo getStatus:type]);
-                                 });
-                             }];
-}
-
-+ (NSString *)typeFromString:(NSString *)string {
-    if ([string isEqualToString:@"audio"]) {
-        return AVMediaTypeAudio;
-    } else {
-        return AVMediaTypeVideo;
-    }
-}
-
-@end

+ 0 - 16
ios/Permissions/RNPBackgroundRefresh.h

@@ -1,16 +0,0 @@
-//
-//  RNPBackgroundRefresh.h
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPBackgroundRefresh : NSObject
-
-+ (NSString *)getStatus;
-
-@end

+ 0 - 28
ios/Permissions/RNPBackgroundRefresh.m

@@ -1,28 +0,0 @@
-//
-//  RNPBackgroundRefresh.m
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import "RNPBackgroundRefresh.h"
-
-@implementation RNPBackgroundRefresh
-
-+(NSString *)getStatus
-{
-    int status = [[UIApplication sharedApplication] backgroundRefreshStatus];
-    switch (status) {
-        case UIBackgroundRefreshStatusAvailable:
-            return RNPStatusAuthorized;
-        case UIBackgroundRefreshStatusDenied:
-            return RNPStatusDenied;
-        case UIBackgroundRefreshStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-
-}
-@end

+ 0 - 17
ios/Permissions/RNPBluetooth.h

@@ -1,17 +0,0 @@
-//
-//  RNPBluetooth.h
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPBluetooth : NSObject
-
-+ (NSString *)getStatus;
-- (void)request:(void (^)(NSString *))completionHandler;
-
-@end

+ 0 - 66
ios/Permissions/RNPBluetooth.m

@@ -1,66 +0,0 @@
-//
-//  RNPBluetooth.m
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import "RNPBluetooth.h"
-#import <CoreBluetooth/CoreBluetooth.h>
-
-@interface RNPBluetooth() <CBPeripheralDelegate>
-@property (strong, nonatomic) CBPeripheralManager* peripheralManager;
-@property (copy) void (^completionHandler)(NSString *);
-@end
-
-@implementation RNPBluetooth
-
-+ (NSString *)getStatus
-{
-    int status = [CBPeripheralManager authorizationStatus];
-    switch (status) {
-        case CBPeripheralManagerAuthorizationStatusAuthorized:
-            return RNPStatusAuthorized;
-        case CBPeripheralManagerAuthorizationStatusDenied:
-            return RNPStatusDenied;
-        case CBPeripheralManagerAuthorizationStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-}
-
-- (void)request:(void (^)(NSString *))completionHandler
-{
-    NSString *status = [RNPBluetooth getStatus];
-    
-    if (status == RNPStatusUndetermined) {
-        self.completionHandler = completionHandler;
-        
-        self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil];
-        [self.peripheralManager startAdvertising:@{}];
-    } else {
-        completionHandler(status);
-    }
-}
-
-- (void) peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheralManager
-{
-    if (self.peripheralManager) {
-        [self.peripheralManager stopAdvertising];
-        self.peripheralManager.delegate = nil;
-        self.peripheralManager = nil;
-    }
-    
-    if (self.completionHandler) {
-        //for some reason, checking permission right away returns denied. need to wait a tiny bit
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-            self.completionHandler([self.class getStatus]);
-            self.completionHandler = nil;
-        });
-    }
-    
-}
-
-@end

+ 0 - 17
ios/Permissions/RNPContacts.h

@@ -1,17 +0,0 @@
-//
-//  RNPContacts.h
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPContacts : NSObject
-
-+ (NSString *)getStatus;
-+ (void)request:(void (^)(NSString *))completionHandler;
-
-@end

+ 0 - 69
ios/Permissions/RNPContacts.m

@@ -1,69 +0,0 @@
-//
-//  RNPContacts.m
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import "RNPContacts.h"
-#import <AddressBook/AddressBook.h>
-
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
-@import Contacts;
-#endif
-
-@implementation RNPContacts
-
-+ (NSString *)getStatus
-{
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
-    int status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
-    switch (status) {
-        case CNAuthorizationStatusAuthorized:
-            return RNPStatusAuthorized;
-        case CNAuthorizationStatusDenied:
-            return RNPStatusDenied;
-        case CNAuthorizationStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-#else
-    int status = ABAddressBookGetAuthorizationStatus();
-    switch (status) {
-        case kABAuthorizationStatusAuthorized:
-            return RNPStatusAuthorized;
-        case kABAuthorizationStatusDenied:
-            return RNPStatusDenied;
-        case kABAuthorizationStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-#endif
-}
-
-+ (void)request:(void (^)(NSString *))completionHandler
-{
-    void (^handler)(BOOL, NSError * _Nullable) =  ^(BOOL granted, NSError * _Nullable error) {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            completionHandler([self.class getStatus]);
-        });
-    };
-    
-    
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
-    CNContactStore *contactStore = [[CNContactStore alloc] init];
-    [contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:handler];
-#else
-    CFErrorRef error = nil;
-    ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(nil, &error);
-    ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
-        NSError *err = (__bridge NSError *)error;
-        handler(granted, err);
-    });
-#endif
-}
-
-@end

+ 0 - 17
ios/Permissions/RNPEvent.h

@@ -1,17 +0,0 @@
-//
-//  RNPEvent.h
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPEvent : NSObject
-
-+ (NSString *)getStatus:(NSString *)type;
-+ (void)request:(NSString *)type completionHandler:(void (^)(NSString *))completionHandler;
-
-@end

+ 0 - 48
ios/Permissions/RNPEvent.m

@@ -1,48 +0,0 @@
-//
-//  RNPEvent.m
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import "RNPEvent.h"
-#import <EventKit/EventKit.h>
-
-@implementation RNPEvent
-
-+ (NSString *)getStatus:(NSString *)type
-{
-    int status = [EKEventStore authorizationStatusForEntityType:[self typeFromString:type]];
-
-    switch (status) {
-        case EKAuthorizationStatusAuthorized:
-            return RNPStatusAuthorized;
-        case EKAuthorizationStatusDenied:
-            return RNPStatusDenied;
-        case EKAuthorizationStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-}
-
-+ (void)request:(NSString *)type completionHandler:(void (^)(NSString *))completionHandler
-{
-    EKEventStore *aStore = [[EKEventStore alloc] init];
-    [aStore requestAccessToEntityType:[self typeFromString:type] completion:^(BOOL granted, NSError *error) {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            completionHandler([self getStatus:type]);
-        });
-    }];
-}
-
-+(EKEntityType)typeFromString:(NSString *)string {
-    if ([string isEqualToString:@"reminder"]) {
-        return EKEntityTypeReminder;
-    } else {
-        return EKEntityTypeEvent;
-    }
-}
-
-@end

+ 1 - 5
ios/Permissions/RNPLocation.m

@@ -45,11 +45,7 @@
             self.locationManager.delegate = self;
         }
 
-        if ([type isEqualToString:@"always"]) {
-            [self.locationManager requestAlwaysAuthorization];
-        } else {
-            [self.locationManager requestWhenInUseAuthorization];
-        }
+        [self.locationManager requestWhenInUseAuthorization];
     } else {
         if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse && [type isEqualToString:@"always"]) {
             completionHandler(RNPStatusDenied);

+ 0 - 17
ios/Permissions/RNPMediaLibrary.h

@@ -1,17 +0,0 @@
-//
-//  RNPMediaLibrary.h
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPMediaLibrary : NSObject
-
-+ (NSString *)getStatus;
-+ (void)request:(void (^)(NSString *))completionHandler;
-
-@end

+ 0 - 41
ios/Permissions/RNPMediaLibrary.m

@@ -1,41 +0,0 @@
-//
-//  RNPPhoto.m
-//  ReactNativePermissions
-//
-//  Created by Yonah Forst on 11/07/16.
-//  Copyright © 2016 Yonah Forst. All rights reserved.
-//
-
-#import "RNPMediaLibrary.h"
-#import <MediaPlayer/MediaPlayer.h>
-
-@implementation RNPMediaLibrary
-
-+ (NSString *)getStatus
-{
-    int status = [MPMediaLibrary authorizationStatus];
-    switch (status) {
-        case MPMediaLibraryAuthorizationStatusAuthorized:
-            return RNPStatusAuthorized;
-        case MPMediaLibraryAuthorizationStatusDenied:
-            return RNPStatusDenied;
-        case MPMediaLibraryAuthorizationStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-}
-
-+ (void)request:(void (^)(NSString *))completionHandler
-{
-    void (^handler)(void) =  ^(void) {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            completionHandler([self.class getStatus]);
-        });
-    };
-    
-    [MPMediaLibrary requestAuthorization:^(MPMediaLibraryAuthorizationStatus status){
-        handler();
-    }];
-}
-@end

+ 0 - 14
ios/Permissions/RNPMotion.h

@@ -1,14 +0,0 @@
-//
-//  RNPMotion.h
-//  ReactNativePermissions
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPMotion : NSObject
-
-+ (NSString *)getStatus;
-+ (void)request:(void (^)(NSString *))completionHandler;
-
-@end

+ 0 - 62
ios/Permissions/RNPMotion.m

@@ -1,62 +0,0 @@
-//
-//  RNPMotion.m
-//  ReactNativePermissions
-//
-
-#import "RNPMotion.h"
-#import <CoreMotion/CoreMotion.h>
-
-@implementation RNPMotion
-
-+ (NSString *)getStatus
-{
-    if (![CMMotionActivityManager isActivityAvailable]) {
-        return RNPStatusRestricted;
-    }
-    
-    if (@available(iOS 11.0, *)) {
-        CMAuthorizationStatus status = [CMMotionActivityManager authorizationStatus];
-        
-        switch (status) {
-            case CMAuthorizationStatusAuthorized:
-                return RNPStatusAuthorized;
-            case CMAuthorizationStatusDenied:
-                return RNPStatusDenied;
-            case CMAuthorizationStatusNotDetermined:
-                return RNPStatusUndetermined;
-            case CMAuthorizationStatusRestricted:
-                return RNPStatusRestricted;
-            default:
-                return RNPStatusUndetermined;
-        }
-    } else {
-        return RNPStatusRestricted;
-    }
-}
-
-+ (void)request:(void (^)(NSString *))completionHandler
-{
-    __block NSString *status = [RNPMotion getStatus];
-    
-    if ([status isEqual: RNPStatusUndetermined]) {
-        __block CMMotionActivityManager *activityManager = [[CMMotionActivityManager alloc] init];
-        __block NSOperationQueue *motionActivityQueue = [[NSOperationQueue alloc] init];
-        [activityManager queryActivityStartingFromDate:[NSDate distantPast] toDate:[NSDate date] toQueue:motionActivityQueue withHandler:^(NSArray *activities, NSError *error) {
-            if (error) {
-                status = RNPStatusDenied;
-            } else if (activities || !error) {
-                status = RNPStatusAuthorized;
-            }
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                completionHandler(status);
-            });
-            
-            activityManager = nil;
-            motionActivityQueue = nil;
-        }];
-    } else {
-        completionHandler(status);
-    }
-}
-@end

+ 0 - 17
ios/Permissions/RNPSpeechRecognition.h

@@ -1,17 +0,0 @@
-//
-//  RNPSpeechRecognition.h
-//  ReactNativePermissions
-//
-//  Created by Tres Trantham on 1/11/17.
-//  Copyright © 2017 Yonah Forst. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "RCTConvert+RNPStatus.h"
-
-@interface RNPSpeechRecognition : NSObject
-
-+ (NSString *)getStatus;
-+ (void)request:(void (^)(NSString *))completionHandler;
-
-@end

+ 0 - 44
ios/Permissions/RNPSpeechRecognition.m

@@ -1,44 +0,0 @@
-//
-//  RNPSpeechRecognition.m
-//  ReactNativePermissions
-//
-//  Created by Tres Trantham on 1/11/17.
-//  Copyright © 2017 Yonah Forst. All rights reserved.
-//
-
-#import "RNPSpeechRecognition.h"
-#import <Speech/Speech.h>
-
-@implementation RNPSpeechRecognition
-
-+ (NSString *)getStatus
-{
-
-  int status = [SFSpeechRecognizer authorizationStatus];
-
-  switch (status) {
-      case SFSpeechRecognizerAuthorizationStatusAuthorized:
-          return RNPStatusAuthorized;
-      case SFSpeechRecognizerAuthorizationStatusDenied:
-          return RNPStatusDenied;
-      case SFSpeechRecognizerAuthorizationStatusRestricted:
-          return RNPStatusRestricted;
-      default:
-          return RNPStatusUndetermined;
-  }
-}
-
-+ (void)request:(void (^)(NSString *))completionHandler
-{
-    void (^handler)(void) =  ^(void) {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            completionHandler([self.class getStatus]);
-        });
-    };
-
-    [SFSpeechRecognizer requestAuthorization:^(SFSpeechRecognizerAuthorizationStatus status) {
-        handler();
-    }];
-}
-
-@end

+ 0 - 10
ios/RCTConvert+RNPStatus.h

@@ -23,18 +23,8 @@ static NSString* RNPStatusRestricted = @"restricted";
 typedef NS_ENUM(NSInteger, RNPType) {
     RNPTypeUnknown,
     RNPTypeLocation,
-    RNPTypeCamera,
-    RNPTypeMicrophone,
     RNPTypePhoto,
-    RNPTypeContacts,
-    RNPTypeEvent,
-    RNPTypeReminder,
-    RNPTypeBluetooth,
     RNPTypeNotification,
-    RNPTypeBackgroundRefresh,
-    RNPTypeSpeechRecognition,
-    RNPTypeMediaLibrary,
-    RNPTypeMotion
 };
 
 @interface RCTConvert (RNPStatus)

+ 1 - 11
ios/RCTConvert+RNPStatus.m

@@ -11,18 +11,8 @@
 @implementation RCTConvert (RNPStatus)
 
 RCT_ENUM_CONVERTER(RNPType, (@{ @"location" : @(RNPTypeLocation),
-                                @"camera" : @(RNPTypeCamera),
-                                @"microphone" : @(RNPTypeMicrophone),
                                 @"photo" : @(RNPTypePhoto),
-                                @"contacts" : @(RNPTypeContacts),
-                                @"event" : @(RNPTypeEvent),
-                                @"reminder" : @(RNPTypeReminder),
-                                @"bluetooth" : @(RNPTypeBluetooth),
-                                @"notification" : @(RNPTypeNotification),
-                                @"backgroundRefresh": @(RNPTypeBackgroundRefresh),
-                                @"speechRecognition": @(RNPTypeSpeechRecognition),
-                                @"mediaLibrary": @(RNPTypeMediaLibrary),
-                                @"motion": @(RNPTypeMotion)
+                                @"notification" : @(RNPTypeNotification)
                                 }),
                                 RNPTypeUnknown, integerValue)
 

+ 0 - 71
ios/ReactNativePermissions.m

@@ -35,22 +35,13 @@
 #endif
 
 #import "RNPLocation.h"
-#import "RNPBluetooth.h"
 #import "RNPNotification.h"
-#import "RNPAudioVideo.h"
-#import "RNPEvent.h"
 #import "RNPPhoto.h"
-#import "RNPContacts.h"
-#import "RNPBackgroundRefresh.h"
-#import "RNPSpeechRecognition.h"
-#import "RNPMediaLibrary.h"
-#import "RNPMotion.h"
 
 
 @interface ReactNativePermissions()
 @property (strong, nonatomic) RNPLocation *locationMgr;
 @property (strong, nonatomic) RNPNotification *notificationMgr;
-@property (strong, nonatomic) RNPBluetooth *bluetoothMgr;
 @end
 
 @implementation ReactNativePermissions
@@ -118,42 +109,12 @@ RCT_REMAP_METHOD(getPermissionStatus, getPermissionStatus:(RNPType)type json:(id
             status = [RNPLocation getStatusForType:locationPermissionType];
             break;
         }
-        case RNPTypeCamera:
-            status = [RNPAudioVideo getStatus:@"video"];
-            break;
-        case RNPTypeMicrophone:
-            status = [RNPAudioVideo getStatus:@"audio"];
-            break;
         case RNPTypePhoto:
             status = [RNPPhoto getStatus];
             break;
-        case RNPTypeContacts:
-            status = [RNPContacts getStatus];
-            break;
-        case RNPTypeEvent:
-            status = [RNPEvent getStatus:@"event"];
-            break;
-        case RNPTypeReminder:
-            status = [RNPEvent getStatus:@"reminder"];
-            break;
-        case RNPTypeBluetooth:
-            status = [RNPBluetooth getStatus];
-            break;
         case RNPTypeNotification:
             status = [RNPNotification getStatus];
             break;
-        case RNPTypeBackgroundRefresh:
-            status = [RNPBackgroundRefresh getStatus];
-            break;
-        case RNPTypeSpeechRecognition:
-            status = [RNPSpeechRecognition getStatus];
-            break;
-        case RNPTypeMediaLibrary:
-            status = [RNPMediaLibrary getStatus];
-            break;
-        case RNPTypeMotion:
-            status = [RNPMotion getStatus];
-            break;
         default:
             break;
     }
@@ -168,33 +129,13 @@ RCT_REMAP_METHOD(requestPermission, permissionType:(RNPType)type json:(id)json r
     switch (type) {
         case RNPTypeLocation:
             return [self requestLocation:json resolve:resolve];
-        case RNPTypeCamera:
-            return [RNPAudioVideo request:@"video" completionHandler:resolve];
-        case RNPTypeMicrophone:
-            return [RNPAudioVideo request:@"audio" completionHandler:resolve];
         case RNPTypePhoto:
             return [RNPPhoto request:resolve];
-        case RNPTypeContacts:
-            return [RNPContacts request:resolve];
-        case RNPTypeEvent:
-            return [RNPEvent request:@"event" completionHandler:resolve];
-        case RNPTypeReminder:
-            return [RNPEvent request:@"reminder" completionHandler:resolve];
-        case RNPTypeBluetooth:
-            return [self requestBluetooth:resolve];
         case RNPTypeNotification:
             return [self requestNotification:json resolve:resolve];
-        case RNPTypeSpeechRecognition:
-            return [RNPSpeechRecognition request:resolve];
-        case RNPTypeMediaLibrary:
-            return [RNPMediaLibrary request:resolve];
-        case RNPTypeMotion:
-            return [RNPMotion request:resolve];
         default:
             break;
     }
-
-
 }
 
 - (void) requestLocation:(id)json resolve:(RCTPromiseResolveBlock)resolve
@@ -232,16 +173,4 @@ RCT_REMAP_METHOD(requestPermission, permissionType:(RNPType)type json:(id)json r
 }
 
 
-- (void) requestBluetooth:(RCTPromiseResolveBlock)resolve
-{
-    if (self.bluetoothMgr == nil) {
-        self.bluetoothMgr = [[RNPBluetooth alloc] init];
-    }
-
-    [self.bluetoothMgr request:resolve];
-}
-
-
-
-
 @end

+ 0 - 50
ios/ReactNativePermissions.xcodeproj/project.pbxproj

@@ -7,20 +7,11 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		488FE29C200BC8A100E05AB0 /* RNPMediaLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = 488FE29B200BC8A100E05AB0 /* RNPMediaLibrary.m */; };
-		488FE2A2200BCED100E05AB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 488FE2A1200BCEC900E05AB0 /* MediaPlayer.framework */; };
 		669581F71FE4416B008596CD /* RCTConvert+RNPStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 669581F41FE4416B008596CD /* RCTConvert+RNPStatus.m */; };
 		669581F81FE4416B008596CD /* ReactNativePermissions.m in Sources */ = {isa = PBXBuildFile; fileRef = 669581F51FE4416B008596CD /* ReactNativePermissions.m */; };
-		6695820D1FE441A8008596CD /* RNPSpeechRecognition.m in Sources */ = {isa = PBXBuildFile; fileRef = 669581FD1FE441A7008596CD /* RNPSpeechRecognition.m */; };
 		6695820E1FE441A8008596CD /* RNPLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 669581FE1FE441A7008596CD /* RNPLocation.m */; };
-		6695820F1FE441A8008596CD /* RNPBluetooth.m in Sources */ = {isa = PBXBuildFile; fileRef = 669581FF1FE441A7008596CD /* RNPBluetooth.m */; };
-		669582101FE441A8008596CD /* RNPBackgroundRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 669582001FE441A7008596CD /* RNPBackgroundRefresh.m */; };
 		669582111FE441A8008596CD /* RNPNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 669582011FE441A7008596CD /* RNPNotification.m */; };
 		669582121FE441A8008596CD /* RNPPhoto.m in Sources */ = {isa = PBXBuildFile; fileRef = 669582031FE441A7008596CD /* RNPPhoto.m */; };
-		669582131FE441A8008596CD /* RNPAudioVideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 669582071FE441A7008596CD /* RNPAudioVideo.m */; };
-		669582141FE441A8008596CD /* RNPContacts.m in Sources */ = {isa = PBXBuildFile; fileRef = 669582081FE441A8008596CD /* RNPContacts.m */; };
-		669582151FE441A8008596CD /* RNPEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 6695820A1FE441A8008596CD /* RNPEvent.m */; };
-		D0AD62322000657000D89898 /* RNPMotion.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AD62312000657000D89898 /* RNPMotion.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -36,34 +27,18 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		488FE29B200BC8A100E05AB0 /* RNPMediaLibrary.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNPMediaLibrary.m; sourceTree = "<group>"; };
-		488FE29D200BC8D200E05AB0 /* RNPMediaLibrary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNPMediaLibrary.h; sourceTree = "<group>"; };
 		488FE2A1200BCEC900E05AB0 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
 		669581F31FE4416B008596CD /* ReactNativePermissions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactNativePermissions.h; sourceTree = "<group>"; };
 		669581F41FE4416B008596CD /* RCTConvert+RNPStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+RNPStatus.m"; sourceTree = "<group>"; };
 		669581F51FE4416B008596CD /* ReactNativePermissions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactNativePermissions.m; sourceTree = "<group>"; };
 		669581F61FE4416B008596CD /* RCTConvert+RNPStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+RNPStatus.h"; sourceTree = "<group>"; };
-		669581FB1FE441A7008596CD /* RNPContacts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPContacts.h; sourceTree = "<group>"; };
 		669581FC1FE441A7008596CD /* RNPPhoto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPPhoto.h; sourceTree = "<group>"; };
-		669581FD1FE441A7008596CD /* RNPSpeechRecognition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPSpeechRecognition.m; sourceTree = "<group>"; };
 		669581FE1FE441A7008596CD /* RNPLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPLocation.m; sourceTree = "<group>"; };
-		669581FF1FE441A7008596CD /* RNPBluetooth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPBluetooth.m; sourceTree = "<group>"; };
-		669582001FE441A7008596CD /* RNPBackgroundRefresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPBackgroundRefresh.m; sourceTree = "<group>"; };
 		669582011FE441A7008596CD /* RNPNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPNotification.m; sourceTree = "<group>"; };
 		669582021FE441A7008596CD /* RNPLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPLocation.h; sourceTree = "<group>"; };
 		669582031FE441A7008596CD /* RNPPhoto.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPPhoto.m; sourceTree = "<group>"; };
-		669582041FE441A7008596CD /* RNPAudioVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPAudioVideo.h; sourceTree = "<group>"; };
-		669582051FE441A7008596CD /* RNPBackgroundRefresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPBackgroundRefresh.h; sourceTree = "<group>"; };
-		669582061FE441A7008596CD /* RNPEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPEvent.h; sourceTree = "<group>"; };
-		669582071FE441A7008596CD /* RNPAudioVideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPAudioVideo.m; sourceTree = "<group>"; };
-		669582081FE441A8008596CD /* RNPContacts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPContacts.m; sourceTree = "<group>"; };
-		669582091FE441A8008596CD /* RNPBluetooth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPBluetooth.h; sourceTree = "<group>"; };
-		6695820A1FE441A8008596CD /* RNPEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPEvent.m; sourceTree = "<group>"; };
-		6695820B1FE441A8008596CD /* RNPSpeechRecognition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPSpeechRecognition.h; sourceTree = "<group>"; };
 		6695820C1FE441A8008596CD /* RNPNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPNotification.h; sourceTree = "<group>"; };
 		9D23B34F1C767B80008B4819 /* libReactNativePermissions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativePermissions.a; sourceTree = BUILT_PRODUCTS_DIR; };
-		D0AD62302000656F00D89898 /* RNPMotion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPMotion.h; sourceTree = "<group>"; };
-		D0AD62312000657000D89898 /* RNPMotion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPMotion.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -71,7 +46,6 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				488FE2A2200BCED100E05AB0 /* MediaPlayer.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -89,28 +63,12 @@
 		669581FA1FE44191008596CD /* Permissions */ = {
 			isa = PBXGroup;
 			children = (
-				669582041FE441A7008596CD /* RNPAudioVideo.h */,
-				669582071FE441A7008596CD /* RNPAudioVideo.m */,
-				669582051FE441A7008596CD /* RNPBackgroundRefresh.h */,
-				669582001FE441A7008596CD /* RNPBackgroundRefresh.m */,
-				669582091FE441A8008596CD /* RNPBluetooth.h */,
-				669581FF1FE441A7008596CD /* RNPBluetooth.m */,
-				488FE29D200BC8D200E05AB0 /* RNPMediaLibrary.h */,
-				488FE29B200BC8A100E05AB0 /* RNPMediaLibrary.m */,
-				669581FB1FE441A7008596CD /* RNPContacts.h */,
-				669582081FE441A8008596CD /* RNPContacts.m */,
-				669582061FE441A7008596CD /* RNPEvent.h */,
-				6695820A1FE441A8008596CD /* RNPEvent.m */,
-				D0AD62302000656F00D89898 /* RNPMotion.h */,
-				D0AD62312000657000D89898 /* RNPMotion.m */,
 				669582021FE441A7008596CD /* RNPLocation.h */,
 				669581FE1FE441A7008596CD /* RNPLocation.m */,
 				6695820C1FE441A8008596CD /* RNPNotification.h */,
 				669582011FE441A7008596CD /* RNPNotification.m */,
 				669581FC1FE441A7008596CD /* RNPPhoto.h */,
 				669582031FE441A7008596CD /* RNPPhoto.m */,
-				6695820B1FE441A8008596CD /* RNPSpeechRecognition.h */,
-				669581FD1FE441A7008596CD /* RNPSpeechRecognition.m */,
 			);
 			path = Permissions;
 			sourceTree = "<group>";
@@ -193,16 +151,8 @@
 			buildActionMask = 2147483647;
 			files = (
 				669582111FE441A8008596CD /* RNPNotification.m in Sources */,
-				488FE29C200BC8A100E05AB0 /* RNPMediaLibrary.m in Sources */,
-				669582151FE441A8008596CD /* RNPEvent.m in Sources */,
-				669582101FE441A8008596CD /* RNPBackgroundRefresh.m in Sources */,
 				669581F71FE4416B008596CD /* RCTConvert+RNPStatus.m in Sources */,
 				6695820E1FE441A8008596CD /* RNPLocation.m in Sources */,
-				6695820F1FE441A8008596CD /* RNPBluetooth.m in Sources */,
-				669582141FE441A8008596CD /* RNPContacts.m in Sources */,
-				6695820D1FE441A8008596CD /* RNPSpeechRecognition.m in Sources */,
-				669582131FE441A8008596CD /* RNPAudioVideo.m in Sources */,
-				D0AD62322000657000D89898 /* RNPMotion.m in Sources */,
 				669581F81FE4416B008596CD /* ReactNativePermissions.m in Sources */,
 				669582121FE441A8008596CD /* RNPPhoto.m in Sources */,
 			);

+ 1 - 11
lib/permissions.ios.js

@@ -10,18 +10,8 @@ type RequestOptions = string | { type: string, rationale?: Rationale }
 
 const permissionTypes = [
   'location',
-  'camera',
-  'microphone',
   'photo',
-  'contacts',
-  'event',
-  'reminder',
-  'bluetooth',
-  'notification',
-  'backgroundRefresh',
-  'speechRecognition',
-  'mediaLibrary',
-  'motion'
+  'notification'
 ]
 
 const DEFAULTS = {