Marino Faggiana пре 7 година
родитељ
комит
0d5ad0fdb3

+ 6 - 12
iOSClient/AutoUpload/NCAutoUpload.m

@@ -316,7 +316,7 @@
     tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
     
     // Check Asset : NEW or FULL
-    PHFetchResult *newAssetToUpload = [self getCameraRollAssets:account assetsFull:assetsFull];
+    PHFetchResult *newAssetToUpload = [self getCameraRollAssets:account assetsFull:assetsFull alignPhotoLibrary:NO];
     
     // News Assets ? if no verify if blocked Table Auto Upload -> Autostart
     if ([newAssetToUpload count] == 0) {
@@ -622,7 +622,7 @@
 #pragma mark ===== get Camera Roll new Asset ====
 #pragma --------------------------------------------------------------------------------------------
 
-- (PHFetchResult *)getCameraRollAssets:(tableAccount *)account assetsFull:(BOOL)assetsFull
+- (PHFetchResult *)getCameraRollAssets:(tableAccount *)account assetsFull:(BOOL)assetsFull alignPhotoLibrary:(BOOL)alignPhotoLibrary
 {
     @synchronized(self) {
         
@@ -636,7 +636,7 @@
 
             NSMutableArray *newAssets =[NSMutableArray new];
             
-            if (account.autoUploadImage && account.autoUploadVideo) {
+            if (alignPhotoLibrary || (account.autoUploadImage && account.autoUploadVideo)) {
                 
                 predicate = [NSCompoundPredicate orPredicateWithSubpredicates:@[predicateImage, predicateVideo]];
                 
@@ -686,10 +686,6 @@
                 return assets;
             }
             
-        } else {
-            
-            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_access_photo_not_enabled_", nil) message:NSLocalizedString(@"_access_photo_not_enabled_msg_", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"_ok_", nil) otherButtonTitles:nil];
-            [alert show];
         }
     }
     
@@ -706,12 +702,10 @@
         
         tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
 
-        if (account.autoUpload) {
-            PHFetchResult *assets = [self getCameraRollAssets:account assetsFull:YES];
-            [[NCManageDatabase sharedInstance] addPhotoLibrary:(NSArray *)assets];
+        PHFetchResult *assets = [self getCameraRollAssets:account assetsFull:YES alignPhotoLibrary:YES];
+        [[NCManageDatabase sharedInstance] addPhotoLibrary:(NSArray *)assets];
             
-            NSLog(@"Align Photo Library %lu", (unsigned long)[assets count]);
-        }
+        NSLog(@"Align Photo Library %lu", (unsigned long)[assets count]);
     });
 }
 

+ 3 - 3
iOSClient/Database/NCDatabase.swift

@@ -188,11 +188,11 @@ class tableMetadata: Object {
     dynamic var sessionID = ""
     dynamic var sessionSelector = ""
     dynamic var sessionSelectorPost = ""
-    dynamic var sessionTaskIdentifier : Int = -1
-    dynamic var sessionTaskIdentifierPlist : Int = -1
+    dynamic var sessionTaskIdentifier: Int = -1
+    dynamic var sessionTaskIdentifierPlist: Int = -1
     dynamic var size: Double = 0
     dynamic var status: Double = 0
-    dynamic var thumbnailExists : Bool = false
+    dynamic var thumbnailExists: Bool = false
     dynamic var title = ""
     dynamic var type = ""
     dynamic var typeFile = ""

+ 4 - 0
iOSClient/Main/CCMore.swift

@@ -399,6 +399,10 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
 
     func loginSuccess(_ loginType: NSInteger) {
         
+        if (UInt32(loginType) != loginModifyPasswordUser.rawValue) {
+            NCAutoUpload.sharedInstance().alignPhotoLibrary()
+        }
+        
         NotificationCenter.default.post(name: NSNotification.Name(rawValue: "initializeMain"), object: nil)
         
         appDelegate.selectedTabBarController(Int(k_tabBarApplicationIndexFile))

+ 5 - 0
iOSClient/Main/CCSplit.m

@@ -24,6 +24,7 @@
 #import "CCSplit.h"
 #import "AppDelegate.h"
 #import "CCLogin.h"
+#import "NCAutoUpload.h"
 #import "NCBridgeSwift.h"
 
 @interface CCSplit () <CCLoginDelegate, CCLoginDelegateWeb>
@@ -132,6 +133,10 @@
 
 - (void)loginSuccess:(NSInteger)loginType
 {
+    // Align Photo Library
+    if (loginType != loginModifyPasswordUser)
+        [[NCAutoUpload sharedInstance] alignPhotoLibrary];
+    
     [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil];
 }
 

+ 1 - 0
iOSClient/Nextcloud-Bridging-Header.h

@@ -8,6 +8,7 @@
 #import "TWMessageBarManager.h"
 #import "CCManageAccount.h"
 #import "CCGraphics.h"
+#import "NCAutoUpload.h"
 
 #import "OCActivity.h"
 #import "OCUserProfile.h"

+ 5 - 0
iOSClient/Settings/CCManageAccount.m

@@ -24,6 +24,7 @@
 #import "CCManageAccount.h"
 #import "AppDelegate.h"
 #import "CCLogin.h"
+#import "NCAutoUpload.h"
 #import "NCBridgeSwift.h"
 
 #define actionSheetCancellaAccount 1
@@ -188,6 +189,10 @@
 
 - (void)loginSuccess:(NSInteger)loginType
 {
+    // Align Photo Library
+    if (loginType != loginModifyPasswordUser)
+        [[NCAutoUpload sharedInstance] alignPhotoLibrary];
+
     if (loginType == loginAddForced)
         [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil];
 }