소스 검색

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 년 전
부모
커밋
a1889dc51e
3개의 변경된 파일4개의 추가작업 그리고 15개의 파일을 삭제
  1. 2 0
      iOSClient/Brand/iOSClient.plist
  2. 1 14
      iOSClient/Settings/CCManageAutoUpload.m
  3. 1 1
      iOSClient/Utility/NCAskAuthorization.swift

+ 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: