marinofaggiana 4 年之前
父节点
当前提交
c203900fe1
共有 2 个文件被更改,包括 15 次插入13 次删除
  1. 3 9
      iOSClient/Settings/CCManageAutoUpload.m
  2. 12 4
      iOSClient/Utility/NCAskAuthorization.swift

+ 3 - 9
iOSClient/Settings/CCManageAutoUpload.m

@@ -259,9 +259,7 @@
                 [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadVideo" state:YES];
             }
             
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
-                [[NCAutoUpload shared] alignPhotoLibrary];
-            });
+            [[NCAutoUpload shared] alignPhotoLibrary];
             
         } else {
             
@@ -328,9 +326,7 @@
         [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadImage" state:[[rowDescriptor.value valueData] boolValue]];
 
         if ([[rowDescriptor.value valueData] boolValue] == YES) {
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
-                [[NCAutoUpload shared] alignPhotoLibrary];
-            });
+            [[NCAutoUpload shared] alignPhotoLibrary];
         }
     }
     
@@ -344,9 +340,7 @@
         [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadVideo" state:[[rowDescriptor.value valueData] boolValue]];
 
         if ([[rowDescriptor.value valueData] boolValue] == YES){
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
-                [[NCAutoUpload shared] alignPhotoLibrary];
-            });
+            [[NCAutoUpload shared] alignPhotoLibrary];
         }
     }
     

+ 12 - 4
iOSClient/Utility/NCAskAuthorization.swift

@@ -44,7 +44,9 @@ class NCAskAuthorization: NSObject {
             alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { action in
                 completion(false)
             }))
-            viewController?.present(alert, animated: true, completion: nil)
+            DispatchQueue.main.async {
+                viewController?.present(alert, animated: true, completion: nil)
+            }
             break
         case AVAudioSession.RecordPermission.undetermined:
             AVAudioSession.sharedInstance().requestRecordPermission { (allowed) in
@@ -78,7 +80,9 @@ class NCAskAuthorization: NSObject {
             alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { action in
                 completion(false)
             }))
-            viewController?.present(alert, animated: true, completion: nil)
+            DispatchQueue.main.async {
+                viewController?.present(alert, animated: true, completion: nil)
+            }
             break
         case PHAuthorizationStatus.notDetermined:
             PHPhotoLibrary.requestAuthorization { (allowed) in
@@ -112,10 +116,14 @@ class NCAskAuthorization: NSObject {
             alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { action in
                 completion(false)
             }))
-            viewController?.present(alert, animated: true, completion: nil)
+            DispatchQueue.main.async {
+                viewController?.present(alert, animated: true, completion: nil)
+            }
             break
         case CLAuthorizationStatus.notDetermined:
-            NCAutoUpload.shared.startSignificantChangeUpdates()
+            DispatchQueue.main.async {
+                NCAutoUpload.shared.startSignificantChangeUpdates()
+            }
             completion(false)
             break
         default: