Explorar el Código

Merge pull request #17 from darinwilson/more-ios-8-fixes

More iOS 8 fixes
Yonah Forst hace 8 años
padre
commit
e6f25fa5f5
Se han modificado 2 ficheros con 3 adiciones y 29 borrados
  1. 2
    2
      ReactNativePermissions.xcodeproj/project.pbxproj
  2. 1
    27
      permissions/RNPPhoto.m

+ 2
- 2
ReactNativePermissions.xcodeproj/project.pbxproj Ver fichero

@@ -225,7 +225,7 @@
225 225
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
226 226
 				GCC_WARN_UNUSED_FUNCTION = YES;
227 227
 				GCC_WARN_UNUSED_VARIABLE = YES;
228
-				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
228
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
229 229
 				MTL_ENABLE_DEBUG_INFO = YES;
230 230
 				ONLY_ACTIVE_ARCH = YES;
231 231
 				SDKROOT = iphoneos;
@@ -262,7 +262,7 @@
262 262
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
263 263
 				GCC_WARN_UNUSED_FUNCTION = YES;
264 264
 				GCC_WARN_UNUSED_VARIABLE = YES;
265
-				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
265
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
266 266
 				MTL_ENABLE_DEBUG_INFO = NO;
267 267
 				SDKROOT = iphoneos;
268 268
 				VALIDATE_PRODUCT = YES;

+ 1
- 27
permissions/RNPPhoto.m Ver fichero

@@ -10,15 +10,12 @@
10 10
 #import <AddressBook/AddressBook.h>
11 11
 #import <AssetsLibrary/AssetsLibrary.h>
12 12
 
13
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
14 13
 @import Photos;
15
-#endif
16 14
 
17 15
 @implementation RNPPhoto
18 16
 
19 17
 + (NSString *)getStatus
20 18
 {
21
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
22 19
     int status = [PHPhotoLibrary authorizationStatus];
23 20
     switch (status) {
24 21
         case PHAuthorizationStatusAuthorized:
@@ -30,19 +27,6 @@
30 27
         default:
31 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 32
 + (void)request:(void (^)(NSString *))completionHandler
@@ -52,19 +36,9 @@
52 36
             completionHandler([self.class getStatus]);
53 37
         });
54 38
     };
55
-    
56
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
39
+
57 40
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
58 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 44
 @end