Browse Source

Use `NCAskAuthorization` for auto upload

- prevent autmoatic limited photos alert, bc the photo picker has an option for that already
Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 years ago
parent
commit
a1889dc51e

+ 2 - 0
iOSClient/Brand/iOSClient.plist

@@ -85,6 +85,8 @@
 		<string>Inconsolata-ExtraBold.ttf</string>
 		<string>Inconsolata-Black.ttf</string>
 	</array>
+	<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
+	<true/>
 	<key>UIBackgroundModes</key>
 	<array>
 		<string>audio</string>

+ 1 - 14
iOSClient/Settings/CCManageAutoUpload.m

@@ -219,20 +219,7 @@
     [super viewWillAppear:animated];
     
     appDelegate.activeViewController = self;
-    
-    // Request permission for camera roll access
-    [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
-        switch (status) {
-            case PHAuthorizationStatusRestricted:
-                NSLog(@"[LOG] user can't grant access to camera roll");
-                break;
-            case PHAuthorizationStatusDenied:
-                NSLog(@"[LOG] user denied access to camera roll");
-                break;
-            default:
-                break;
-        }
-    }];
+    [[NCAskAuthorization shared] askAuthorizationPhotoLibraryWithViewController:self completion:^(BOOL status) { }];
 }
 
 - (void)initialize

+ 1 - 1
iOSClient/Utility/NCAskAuthorization.swift

@@ -67,7 +67,7 @@ class NCAskAuthorization: NSObject {
         }
     }
 
-    func askAuthorizationPhotoLibrary(viewController: UIViewController?, completion: @escaping (_ hasPermission: Bool) -> Void) {
+    @objc func askAuthorizationPhotoLibrary(viewController: UIViewController?, completion: @escaping (_ hasPermission: Bool) -> Void) {
 
         switch PHPhotoLibrary.authorizationStatus() {
         case PHAuthorizationStatus.authorized: