Darin Wilson 8 years ago
parent
commit
396ead6c3f
1 changed files with 1 additions and 27 deletions
  1. 1
    27
      permissions/RNPPhoto.m

+ 1
- 27
permissions/RNPPhoto.m View File

10
 #import <AddressBook/AddressBook.h>
10
 #import <AddressBook/AddressBook.h>
11
 #import <AssetsLibrary/AssetsLibrary.h>
11
 #import <AssetsLibrary/AssetsLibrary.h>
12
 
12
 
13
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
14
 @import Photos;
13
 @import Photos;
15
-#endif
16
 
14
 
17
 @implementation RNPPhoto
15
 @implementation RNPPhoto
18
 
16
 
19
 + (NSString *)getStatus
17
 + (NSString *)getStatus
20
 {
18
 {
21
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
22
     int status = [PHPhotoLibrary authorizationStatus];
19
     int status = [PHPhotoLibrary authorizationStatus];
23
     switch (status) {
20
     switch (status) {
24
         case PHAuthorizationStatusAuthorized:
21
         case PHAuthorizationStatusAuthorized:
30
         default:
27
         default:
31
             return RNPStatusUndetermined;
28
             return RNPStatusUndetermined;
32
     }
29
     }
33
-#else
34
-    int status = ABAddressBookGetAuthorizationStatus();
35
-    switch (status) {
36
-        case kABAuthorizationStatusAuthorized:
37
-            return RNPStatusAuthorized;
38
-        case kABAuthorizationStatusDenied:
39
-            return RNPStatusDenied;
40
-        case kABAuthorizationStatusRestricted:
41
-            return RNPStatusRestricted;
42
-        default:
43
-            return RNPStatusUndetermined;
44
-    }
45
-#endif
46
 }
30
 }
47
 
31
 
48
 + (void)request:(void (^)(NSString *))completionHandler
32
 + (void)request:(void (^)(NSString *))completionHandler
52
             completionHandler([self.class getStatus]);
36
             completionHandler([self.class getStatus]);
53
         });
37
         });
54
     };
38
     };
55
-    
56
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
39
+
57
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
40
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
58
         handler();
41
         handler();
59
     }];
42
     }];
60
-#else
61
-    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
62
-    [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
63
-        handler();
64
-        *stop = YES;
65
-    } failureBlock:^(NSError *error) {
66
-        handler();
67
-    }];
68
-#endif
69
 }
43
 }
70
 @end
44
 @end