Explorar o código

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

More iOS 8 fixes
Yonah Forst %!s(int64=9) %!d(string=hai) anos
pai
achega
e6f25fa5f5
Modificáronse 2 ficheiros con 3 adicións e 29 borrados
  1. 2 2
      ReactNativePermissions.xcodeproj/project.pbxproj
  2. 1 27
      permissions/RNPPhoto.m

+ 2 - 2
ReactNativePermissions.xcodeproj/project.pbxproj

@@ -225,7 +225,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
@@ -262,7 +262,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				VALIDATE_PRODUCT = YES;

+ 1 - 27
permissions/RNPPhoto.m

@@ -10,15 +10,12 @@
 #import <AddressBook/AddressBook.h>
 #import <AssetsLibrary/AssetsLibrary.h>
 
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
 @import Photos;
-#endif
 
 @implementation RNPPhoto
 
 + (NSString *)getStatus
 {
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
     int status = [PHPhotoLibrary authorizationStatus];
     switch (status) {
         case PHAuthorizationStatusAuthorized:
@@ -30,19 +27,6 @@
         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
@@ -52,19 +36,9 @@
             completionHandler([self.class getStatus]);
         });
     };
-    
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
+
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
         handler();
     }];
-#else
-    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
-    [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
-        handler();
-        *stop = YES;
-    } failureBlock:^(NSError *error) {
-        handler();
-    }];
-#endif
 }
 @end