Parcourir la source

Replace Table Automatic Upload

Marino Faggiana il y a 8 ans
Parent
commit
3d075ca4d1

+ 0 - 20
Nextcloud.xcodeproj/project.pbxproj

@@ -31,12 +31,6 @@
 		F708CF881E56E8CC00271D8B /* TableShare+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF601E56E8CC00271D8B /* TableShare+CoreDataProperties.m */; };
 		F708CF891E56E8CC00271D8B /* TableShare+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF601E56E8CC00271D8B /* TableShare+CoreDataProperties.m */; };
 		F708CF8A1E56E8CC00271D8B /* TableShare+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF601E56E8CC00271D8B /* TableShare+CoreDataProperties.m */; };
-		F708CF911E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF661E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m */; };
-		F708CF921E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF661E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m */; };
-		F708CF931E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF661E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m */; };
-		F708CF941E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF681E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m */; };
-		F708CF951E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF681E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m */; };
-		F708CF961E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF681E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m */; };
 		F708CF971E56E8CC00271D8B /* TableAccount+CoreDataClass.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF6A1E56E8CC00271D8B /* TableAccount+CoreDataClass.m */; };
 		F708CF981E56E8CC00271D8B /* TableAccount+CoreDataClass.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF6A1E56E8CC00271D8B /* TableAccount+CoreDataClass.m */; };
 		F708CF991E56E8CC00271D8B /* TableAccount+CoreDataClass.m in Sources */ = {isa = PBXBuildFile; fileRef = F708CF6A1E56E8CC00271D8B /* TableAccount+CoreDataClass.m */; };
@@ -782,10 +776,6 @@
 		F708CF5E1E56E8CC00271D8B /* TableShare+CoreDataClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TableShare+CoreDataClass.m"; sourceTree = "<group>"; };
 		F708CF5F1E56E8CC00271D8B /* TableShare+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TableShare+CoreDataProperties.h"; sourceTree = "<group>"; };
 		F708CF601E56E8CC00271D8B /* TableShare+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TableShare+CoreDataProperties.m"; sourceTree = "<group>"; };
-		F708CF651E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TableAutomaticUpload+CoreDataClass.h"; sourceTree = "<group>"; };
-		F708CF661E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TableAutomaticUpload+CoreDataClass.m"; sourceTree = "<group>"; };
-		F708CF671E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TableAutomaticUpload+CoreDataProperties.h"; sourceTree = "<group>"; };
-		F708CF681E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TableAutomaticUpload+CoreDataProperties.m"; sourceTree = "<group>"; };
 		F708CF691E56E8CC00271D8B /* TableAccount+CoreDataClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TableAccount+CoreDataClass.h"; sourceTree = "<group>"; };
 		F708CF6A1E56E8CC00271D8B /* TableAccount+CoreDataClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TableAccount+CoreDataClass.m"; sourceTree = "<group>"; };
 		F708CF6B1E56E8CC00271D8B /* TableAccount+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TableAccount+CoreDataProperties.h"; sourceTree = "<group>"; };
@@ -2836,10 +2826,6 @@
 				F708CF5E1E56E8CC00271D8B /* TableShare+CoreDataClass.m */,
 				F708CF5F1E56E8CC00271D8B /* TableShare+CoreDataProperties.h */,
 				F708CF601E56E8CC00271D8B /* TableShare+CoreDataProperties.m */,
-				F708CF651E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.h */,
-				F708CF661E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m */,
-				F708CF671E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.h */,
-				F708CF681E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m */,
 				F708CF691E56E8CC00271D8B /* TableAccount+CoreDataClass.h */,
 				F708CF6A1E56E8CC00271D8B /* TableAccount+CoreDataClass.m */,
 				F708CF6B1E56E8CC00271D8B /* TableAccount+CoreDataProperties.h */,
@@ -3956,7 +3942,6 @@
 				F732BA0B1D76DBA500E9878B /* CCNetworking.m in Sources */,
 				F71459DD1D12E3B700CAFEEC /* CCCoreData.m in Sources */,
 				F71459E11D12E3B700CAFEEC /* CCHud.m in Sources */,
-				F708CF921E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m in Sources */,
 				F71459E41D12E3B700CAFEEC /* RNDecryptor.m in Sources */,
 				F71459E61D12E3B700CAFEEC /* NYXImagesHelper.m in Sources */,
 				F71459E91D12E3B700CAFEEC /* UIImage+Enhancing.m in Sources */,
@@ -3977,7 +3962,6 @@
 				F7145A001D12E3B700CAFEEC /* CCGlobal.m in Sources */,
 				F7145A011D12E3B700CAFEEC /* UIImage+Blurring.m in Sources */,
 				F7145A041D12E3B700CAFEEC /* CCloadItemData.swift in Sources */,
-				F708CF951E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m in Sources */,
 				F73CC07F1E813DFF006E3047 /* BKTouchIDSwitchView.m in Sources */,
 				F76B3CCF1EAE01BD00921AC9 /* NCBrand.swift in Sources */,
 				F73CC0761E813DFF006E3047 /* BKPasscodeViewController.m in Sources */,
@@ -3995,7 +3979,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				F708CF781E56E8CC00271D8B /* TableLocalFile+CoreDataProperties.m in Sources */,
-				F708CF931E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m in Sources */,
 				F74344801E127ED3001CC831 /* NSString+Base64.m in Sources */,
 				F708CF871E56E8CC00271D8B /* TableShare+CoreDataClass.m in Sources */,
 				F708CF9C1E56E8CC00271D8B /* TableAccount+CoreDataProperties.m in Sources */,
@@ -4047,7 +4030,6 @@
 				F743447C1E127EB2001CC831 /* NSString+TruncateToWidth.m in Sources */,
 				F708CF751E56E8CC00271D8B /* TableLocalFile+CoreDataClass.m in Sources */,
 				F74344831E127F80001CC831 /* RNCryptor.m in Sources */,
-				F708CF961E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -4224,7 +4206,6 @@
 				F73CC06F1E813DFF006E3047 /* BKPasscodeInputView.m in Sources */,
 				F77B0E6A1D118A16002130FE /* RNDecryptor.m in Sources */,
 				F73CC0751E813DFF006E3047 /* BKPasscodeViewController.m in Sources */,
-				F708CF941E56E8CC00271D8B /* TableAutomaticUpload+CoreDataProperties.m in Sources */,
 				F750374D1DBFA91A008FB480 /* ALView+PureLayout.m in Sources */,
 				F7F06E8F1DBFACC600099AE9 /* NSDateFormatter+CTAssetsPickerController.m in Sources */,
 				F7F6AC4E1E525AD300E8EB45 /* CCManageCryptoCloud.m in Sources */,
@@ -4243,7 +4224,6 @@
 				F77B0E801D118A16002130FE /* ZSSRichTextEditor.m in Sources */,
 				F7F06EC91DBFACC600099AE9 /* CTAssetsViewControllerTransition.m in Sources */,
 				F7659A661DC0B760004860C4 /* PSTCollectionViewLayout.m in Sources */,
-				F708CF911E56E8CC00271D8B /* TableAutomaticUpload+CoreDataClass.m in Sources */,
 				F75037511DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m in Sources */,
 				F762CAFA1EACB66200B38484 /* XLFormDateCell.m in Sources */,
 				F73C41501E82E51F000137C0 /* TableExternalSites+CoreDataClass.m in Sources */,

+ 9 - 9
iOSClient/AppDelegate.m

@@ -961,7 +961,7 @@
         if (((OCnetworking *)operation).isExecuting == NO) _queueNumUploadWWan++;
 
     // Total
-    NSUInteger total = _queueNunDownload + _queueNumDownloadWWan + _queueNumUpload + _queueNumUploadWWan + [CCCoreData countTableAutomaticUploadForAccount:self.activeAccount selector:nil];
+    NSUInteger total = _queueNunDownload + _queueNumDownloadWWan + _queueNumUpload + _queueNumUploadWWan + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount selector:nil];
     
     [UIApplication sharedApplication].applicationIconBadgeNumber = total;
     
@@ -1297,9 +1297,9 @@
     _automaticUploadInProgress = YES;
     
     NSArray *uploadInQueue = [CCCoreData getTableMetadataUploadAccount:app.activeAccount];
-    NSArray *recordAutomaticUploadInLock = [CCCoreData getAllLockTableAutomaticUploadForAccount:_activeAccount];
+    NSArray *recordAutomaticUploadInLock =  [[NCManageDatabase sharedInstance] getAllLockAutomaticUploadForAccount:_activeAccount];
     
-    for (TableAutomaticUpload *tableAutomaticUpload in recordAutomaticUploadInLock) {
+    for (tableAutomaticUpload *tableAutomaticUpload in recordAutomaticUploadInLock) {
         
         BOOL recordFound = NO;
         
@@ -1309,12 +1309,12 @@
         }
         
         if (!recordFound)
-            [CCCoreData unlockTableAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:tableAutomaticUpload.assetLocalIdentifier];
+            [[NCManageDatabase sharedInstance] unlockAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:tableAutomaticUpload.assetLocalIdentifier];
     }
 
     // ------------------------- <selectorUploadAutomatic> -------------------------
     
-    metadataNet = [CCCoreData getTableAutomaticUploadForAccount:self.activeAccount selector:selectorUploadAutomatic];
+    metadataNet = [[NCManageDatabase sharedInstance] getAutomaticUploadForAccount:self.activeAccount selector:selectorUploadAutomatic];
     
     while (metadataNet) {
         
@@ -1328,10 +1328,10 @@
             
             [[NCManageDatabase sharedInstance] addActivityClient:metadataNet.fileName fileID:metadataNet.assetLocalIdentifier action:k_activityDebugActionUpload selector:selectorUploadAutomatic note:@"Internal error image/video not found [0]" type:k_activityTypeFailure verbose:k_activityVerboseHigh account:_activeAccount activeUrl:_activeUrl];
             
-            [CCCoreData deleteTableAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:metadataNet.assetLocalIdentifier];
+            [[NCManageDatabase sharedInstance] deleteAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:metadataNet.assetLocalIdentifier];
         }
 
-        metadataNet = [CCCoreData getTableAutomaticUploadForAccount:self.activeAccount selector:selectorUploadAutomatic];
+        metadataNet =  [[NCManageDatabase sharedInstance] getAutomaticUploadForAccount:self.activeAccount selector:selectorUploadAutomatic];
     }
     
     // ------------------------- <selectorUploadAutomaticAll> -------------------------
@@ -1359,7 +1359,7 @@
         return;
     }
     
-    metadataNet = [CCCoreData getTableAutomaticUploadForAccount:self.activeAccount selector:selectorUploadAutomaticAll];
+    metadataNet =  [[NCManageDatabase sharedInstance] getAutomaticUploadForAccount:self.activeAccount selector:selectorUploadAutomaticAll];
     if (metadataNet) {
         
         PHFetchResult *result = [PHAsset fetchAssetsWithLocalIdentifiers:@[metadataNet.assetLocalIdentifier] options:nil];
@@ -1372,7 +1372,7 @@
             
             [[NCManageDatabase sharedInstance] addActivityClient:metadataNet.fileName fileID:metadataNet.assetLocalIdentifier action:k_activityDebugActionUpload selector:selectorUploadAutomatic note:@"Internal error image/video not found [0]" type:k_activityTypeFailure verbose:k_activityVerboseHigh account:_activeAccount activeUrl:_activeUrl];
             
-            [CCCoreData deleteTableAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:metadataNet.assetLocalIdentifier];            
+            [[NCManageDatabase sharedInstance] deleteAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:metadataNet.assetLocalIdentifier];            
         }
     }
     

+ 0 - 11
iOSClient/FileSystem/CCCoreData.h

@@ -40,7 +40,6 @@
 #import "TableDirectory+CoreDataClass.h"
 #import "TableLocalFile+CoreDataClass.h"
 #import "TableShare+CoreDataClass.h"
-#import "TableAutomaticUpload+CoreDataClass.h"
 #import "TableExternalSites+CoreDataClass.h"
 
 @interface CCCoreData : NSObject
@@ -176,15 +175,6 @@
 + (void)setGeoInformationLocalFromFileID:(NSString *)fileID exifDate:(NSDate *)exifDate exifLatitude:(NSString *)exifLatitude exifLongitude:(NSString *)exifLongitude activeAccount:(NSString *)activeAccount;
 + (void)setGeoInformationLocalNull;
 
-// ===== Automatic Upload =====
-
-+ (BOOL)addTableAutomaticUpload:(CCMetadataNet *)metadataNet account:(NSString *)account;
-+ (CCMetadataNet *)getTableAutomaticUploadForAccount:(NSString *)account selector:(NSString *)selector;
-+ (NSArray *)getAllLockTableAutomaticUploadForAccount:(NSString *)account;
-+ (void)unlockTableAutomaticUploadForAccount:(NSString *)account assetLocalIdentifier:(NSString *)assetLocalIdentifier;
-+ (void)deleteTableAutomaticUploadForAccount:(NSString *)account assetLocalIdentifier:(NSString *)assetLocalIdentifier;
-+ (NSUInteger)countTableAutomaticUploadForAccount:(NSString *)account selector:(NSString *)selector;
-
 // ===== Share =====
 
 + (void)setShareLink:(NSString *)share fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl sharesLink:(NSMutableDictionary *)sharesLink activeAccount:(NSString *)activeAccount;
@@ -220,7 +210,6 @@
 + (void)moveAllUserToGroup;
 
 + (void)flushTableAccount:(NSString *)account;
-+ (void)flushTableAutomaticUploadAccount:(NSString *)account selector:(NSString *)selector;
 + (void)flushTableDirectoryAccount:(NSString *)account;
 + (void)flushTableExternalSitesAccount:(NSString *)account;
 + (void)flushTableLocalFileAccount:(NSString *)account;

+ 0 - 136
iOSClient/FileSystem/CCCoreData.m

@@ -1456,109 +1456,6 @@
     }];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Automatic Upload =====
-#pragma --------------------------------------------------------------------------------------------
-
-+ (BOOL)addTableAutomaticUpload:(CCMetadataNet *)metadataNet account:(NSString *)account
-{
-    NSManagedObjectContext *context = [NSManagedObjectContext MR_context];
-    TableAutomaticUpload *record = nil;
-    
-    // Record exists ?
-    record = [TableAutomaticUpload MR_findFirstWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (assetLocalIdentifier == %@)", account, metadataNet.assetLocalIdentifier] inContext:context];
-    if (record)
-        return NO;
-    
-    record = [TableAutomaticUpload MR_createEntityInContext:context];
-        
-    record.account = account;
-    record.assetLocalIdentifier = metadataNet.assetLocalIdentifier;
-    record.lock = [NSNumber numberWithBool:NO];
-    record.date = [NSDate date];
-    record.fileName = metadataNet.fileName;
-    record.selector = metadataNet.selector;
-    record.selectorPost = metadataNet.selectorPost;
-    record.serverUrl = metadataNet.serverUrl;
-    record.session = metadataNet.session;
-    record.priority = [NSNumber numberWithLong:metadataNet.priority];
-        
-    [context MR_saveToPersistentStoreAndWait];
-    
-    return YES;
-}
-
-+ (CCMetadataNet *)getTableAutomaticUploadForAccount:(NSString *)account selector:(NSString *)selector
-{
-    NSManagedObjectContext *context = [NSManagedObjectContext MR_context];
-    
-    TableAutomaticUpload *record = [TableAutomaticUpload MR_findFirstWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (selector == %@) AND (lock == 0)", account, selector] inContext:context];
-    
-    if (record) {
-    
-        CCMetadataNet *metadataNet = [CCMetadataNet new];
-        
-        metadataNet.action = actionUploadAsset;                             // Default
-        metadataNet.assetLocalIdentifier = record.assetLocalIdentifier;
-        metadataNet.fileName = record.fileName;
-        metadataNet.priority = [record.priority longValue];
-        metadataNet.selector = record.selector;
-        metadataNet.selectorPost = record.selectorPost;
-        metadataNet.serverUrl = record.serverUrl;
-        metadataNet.session = record.session;
-        metadataNet.taskStatus = k_taskStatusResume;                        // Default
-        
-        // LOCK
-        record.lock = [NSNumber numberWithBool:YES];
-        [context MR_saveToPersistentStoreAndWait];
-
-        return metadataNet;
-    }
-    
-    return nil;
-}
-
-+ (NSArray *)getAllLockTableAutomaticUploadForAccount:(NSString *)account
-{
-    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(account == %@) AND (lock == 1)", account];
-    
-    return [TableAutomaticUpload MR_findAllWithPredicate:predicate];
-}
-
-+ (void)unlockTableAutomaticUploadForAccount:(NSString *)account assetLocalIdentifier:(NSString *)assetLocalIdentifier
-{
-    NSManagedObjectContext *context = [NSManagedObjectContext MR_context];
-    
-    TableAutomaticUpload *record = [TableAutomaticUpload MR_findFirstWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (assetLocalIdentifier == %@)", account, assetLocalIdentifier] inContext:context];
-    
-    if (record) {
-        
-        // UN-LOCK
-        record.lock = [NSNumber numberWithBool:NO];
-        [context MR_saveToPersistentStoreAndWait];
-    }
-}
-
-+ (void)deleteTableAutomaticUploadForAccount:(NSString *)account assetLocalIdentifier:(NSString *)assetLocalIdentifier
-{
-    NSManagedObjectContext *context = [NSManagedObjectContext MR_context];
-    
-    TableAutomaticUpload *record = [TableAutomaticUpload MR_findFirstWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (assetLocalIdentifier == %@)", account, assetLocalIdentifier] inContext:context];
-    
-    if (record) {
-        [record MR_deleteEntityInContext:context];
-        [context MR_saveToPersistentStoreAndWait];
-    }
-}
-
-+ (NSUInteger)countTableAutomaticUploadForAccount:(NSString *)account selector:(NSString *)selector
-{
-    if (selector)
-        return [TableAutomaticUpload MR_countOfEntitiesWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (selector == %@)", account, selector]];
-    else
-        return [TableAutomaticUpload MR_countOfEntitiesWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@)", account]];
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Share =====
 #pragma --------------------------------------------------------------------------------------------
@@ -2103,38 +2000,6 @@
     [context MR_saveToPersistentStoreAndWait];
 }
 
-/*
-+ (void)flushTableActivityAccount:(NSString *)account
-{
-    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
-    
-    if (account) {
-        
-        [TableActivity MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@) || (account == '')", account] inContext:context];
-        
-    } else {
-        
-        [TableActivity MR_truncateAllInContext:context];
-    }
-    
-    [context MR_saveToPersistentStoreAndWait];
-}
-*/
-
-+ (void)flushTableAutomaticUploadAccount:(NSString *)account selector:(NSString *)selector
-{
-    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
-    
-    if (account && selector)
-        [TableAutomaticUpload MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (selector == %@)", account, selector] inContext:context];
-    else if (account && !selector )
-        [TableAutomaticUpload MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@)", account] inContext:context];
-    else
-        [TableAutomaticUpload MR_truncateAllInContext:context];
-    
-    [context MR_saveToPersistentStoreAndWait];
-}
-
 + (void)flushTableDirectoryAccount:(NSString *)account
 {
     NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
@@ -2221,7 +2086,6 @@
     NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
     
     [TableAccount MR_truncateAllInContext:context];
-    [TableAutomaticUpload MR_truncateAllInContext:context];
     [TableDirectory MR_truncateAllInContext:context];
     [TableLocalFile MR_truncateAllInContext:context];
     [TableMetadata MR_truncateAllInContext:context];

+ 0 - 20
iOSClient/FileSystem/TableAutomaticUpload+CoreDataClass.h

@@ -1,20 +0,0 @@
-//
-//  TableAutomaticUpload+CoreDataClass.h
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 17/02/17.
-//  Copyright © 2017 TWS. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <CoreData/CoreData.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface TableAutomaticUpload : NSManagedObject
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#import "TableAutomaticUpload+CoreDataProperties.h"

+ 0 - 13
iOSClient/FileSystem/TableAutomaticUpload+CoreDataClass.m

@@ -1,13 +0,0 @@
-//
-//  TableAutomaticUpload+CoreDataClass.m
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 17/02/17.
-//  Copyright © 2017 TWS. All rights reserved.
-//
-
-#import "TableAutomaticUpload+CoreDataClass.h"
-
-@implementation TableAutomaticUpload
-
-@end

+ 0 - 31
iOSClient/FileSystem/TableAutomaticUpload+CoreDataProperties.h

@@ -1,31 +0,0 @@
-//
-//  TableAutomaticUpload+CoreDataProperties.h
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 17/02/17.
-//  Copyright © 2017 TWS. All rights reserved.
-//
-
-#import "TableAutomaticUpload+CoreDataClass.h"
-
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface TableAutomaticUpload (CoreDataProperties)
-
-+ (NSFetchRequest<TableAutomaticUpload *> *)fetchRequest;
-
-@property (nullable, nonatomic, copy) NSString *account;
-@property (nullable, nonatomic, copy) NSDate *date;
-@property (nullable, nonatomic, copy) NSString *fileName;
-@property (nullable, nonatomic, copy) NSString *assetLocalIdentifier;
-@property (nullable, nonatomic, copy) NSNumber *lock;
-@property (nullable, nonatomic, copy) NSNumber *priority;
-@property (nullable, nonatomic, copy) NSString *selector;
-@property (nullable, nonatomic, copy) NSString *selectorPost;
-@property (nullable, nonatomic, copy) NSString *serverUrl;
-@property (nullable, nonatomic, copy) NSString *session;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 28
iOSClient/FileSystem/TableAutomaticUpload+CoreDataProperties.m

@@ -1,28 +0,0 @@
-//
-//  TableAutomaticUpload+CoreDataProperties.m
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 17/02/17.
-//  Copyright © 2017 TWS. All rights reserved.
-//
-
-#import "TableAutomaticUpload+CoreDataProperties.h"
-
-@implementation TableAutomaticUpload (CoreDataProperties)
-
-+ (NSFetchRequest<TableAutomaticUpload *> *)fetchRequest {
-	return [[NSFetchRequest alloc] initWithEntityName:@"TableAutomaticUpload"];
-}
-
-@dynamic account;
-@dynamic date;
-@dynamic fileName;
-@dynamic assetLocalIdentifier;
-@dynamic lock;
-@dynamic priority;
-@dynamic selector;
-@dynamic selectorPost;
-@dynamic serverUrl;
-@dynamic session;
-
-@end

+ 1 - 1
iOSClient/Main/CCMain.m

@@ -3276,7 +3276,7 @@
     if (k_option_disable_multiaccount)
         return;
     
-    if ([app.netQueue operationCount] > 0 || [app.netQueueDownload operationCount] > 0 || [app.netQueueDownloadWWan operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [CCCoreData countTableAutomaticUploadForAccount:app.activeAccount selector:nil] > 0) {
+    if ([app.netQueue operationCount] > 0 || [app.netQueueDownload operationCount] > 0 || [app.netQueueDownloadWWan operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount selector:nil] > 0) {
         
         [app messageNotification:@"_transfers_in_queue_" description:nil visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
         return;

+ 1 - 1
iOSClient/Networking/CCNetworking.m

@@ -1301,7 +1301,7 @@
         
         // Delete record on Table Automatic Upload
         if ([selector isEqualToString:selectorUploadAutomatic] || [selector isEqualToString:selectorUploadAutomaticAll])
-            [CCCoreData deleteTableAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:assetLocalIdentifier];
+            [[NCManageDatabase sharedInstance] deleteAutomaticUploadForAccount:_activeAccount assetLocalIdentifier:assetLocalIdentifier];
         
         NSLog(@"[LOG] Upload file %@ - %@ TaskIdentifier %lu", fileName,fileNamePrint, (unsigned long)uploadTask.taskIdentifier);
     }

+ 1 - 1
iOSClient/PhotosCameraUpload/CCPhotosCameraUpload.m

@@ -1176,7 +1176,7 @@
         metadataNet.session = session;
         metadataNet.taskStatus = k_taskStatusResume;
         
-        if (![CCCoreData addTableAutomaticUpload:metadataNet account:app.activeAccount]) {
+        if (![[NCManageDatabase sharedInstance] addAutomaticUpload:metadataNet account:app.activeAccount]) {
             
             [[NCManageDatabase sharedInstance] addActivityClient:fileName fileID:metadataNet.assetLocalIdentifier action:k_activityDebugActionAutomaticUpload selector:metadataNet.selector note:@"File already present in Table automatic Upload" type:k_activityTypeInfo verbose:k_activityVerboseHigh account:app.activeAccount activeUrl:app.activeUrl];
             

+ 2 - 2
iOSClient/Settings/CCAdvanced.m

@@ -319,8 +319,8 @@
             
             [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:app.activeAccount];
 
-            [CCCoreData flushTableAutomaticUploadAccount:app.activeAccount selector:nil];
-            
+            [[NCManageDatabase sharedInstance] clearTable:[tableAutomaticUpload class] account:app.activeAccount];
+                        
             [[NCManageDatabase sharedInstance] clearTable:[tableCapabilities class] account:app.activeAccount];
             
             [CCCoreData flushTableDirectoryAccount:app.activeAccount];

+ 3 - 3
iOSClient/Settings/CCManageAccount.m

@@ -325,9 +325,9 @@
     [CCCoreData flushTableAccount:account];
     
     [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:account];
-    
-    [CCCoreData flushTableAutomaticUploadAccount:account selector:nil];
+    [[NCManageDatabase sharedInstance] clearTable:[tableAutomaticUpload class] account:app.activeAccount];
     [[NCManageDatabase sharedInstance] clearTable:[tableCapabilities class] account:app.activeAccount];
+    
     [CCCoreData flushTableDirectoryAccount:account];
     [CCCoreData flushTableExternalSitesAccount:account];
     [CCCoreData flushTableLocalFileAccount:account];
@@ -355,7 +355,7 @@
 
 - (void)ChangeDefaultAccount:(NSString *)account
 {
-    if ([app.netQueue operationCount] > 0 || [app.netQueueDownload operationCount] > 0 || [app.netQueueDownloadWWan operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [CCCoreData countTableAutomaticUploadForAccount:app.activeAccount selector:nil] > 0) {
+    if ([app.netQueue operationCount] > 0 || [app.netQueueDownload operationCount] > 0 || [app.netQueueDownloadWWan operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount selector:nil] > 0) {
         
         [app messageNotification:@"_transfers_in_queue_" description:nil visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
         [self UpdateForm];

+ 2 - 8
iOSClient/Settings/CCManageCameraUpload.m

@@ -254,8 +254,7 @@
             [CCCoreData setCameraUploadDateVideo:NULL];
 
             // remove
-            [self dropAutomaticUploadWithSelector:selectorUploadAutomatic];
-            [self dropAutomaticUploadWithSelector:selectorUploadAutomaticAll];
+            [[NCManageDatabase sharedInstance] clearTable:[tableAutomaticUpload class] account:app.activeAccount];
         }
         
         // Initialize Camera Upload
@@ -302,7 +301,7 @@
             
         } else {
             
-            [self dropAutomaticUploadWithSelector:selectorUploadAutomaticAll];
+            [[NCManageDatabase sharedInstance] clearTable:[tableAutomaticUpload class] account:app.activeAccount];
             [CCCoreData setCameraUploadFullPhotosActiveAccount:NO activeAccount:app.activeAccount];
         }
     }
@@ -498,9 +497,4 @@
     return sectionName;
 }
 
-- (void)dropAutomaticUploadWithSelector:(NSString *)selector
-{
-    [CCCoreData flushTableAutomaticUploadAccount:app.activeAccount selector:selector];
-}
-
 @end

+ 0 - 13
iOSClient/cryptocloud.xcdatamodeld/cryptocloud 9.xcdatamodel/contents

@@ -35,18 +35,6 @@
         <attribute name="user" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="webpage" optional="YES" attributeType="String" syncable="YES"/>
     </entity>
-    <entity name="TableAutomaticUpload" representedClassName="TableAutomaticUpload" syncable="YES">
-        <attribute name="account" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="assetLocalIdentifier" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
-        <attribute name="fileName" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="lock" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
-        <attribute name="priority" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
-        <attribute name="selector" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="selectorPost" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="serverUrl" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="session" optional="YES" attributeType="String" syncable="YES"/>
-    </entity>
     <entity name="TableDirectory" representedClassName="TableDirectory" syncable="YES">
         <attribute name="account" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="dateReadDirectory" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
@@ -125,7 +113,6 @@
     </entity>
     <elements>
         <element name="TableAccount" positionX="-6597" positionY="111" width="171" height="540"/>
-        <element name="TableAutomaticUpload" positionX="-6597" positionY="801" width="128" height="195"/>
         <element name="TableDirectory" positionX="-6372" positionY="111" width="162" height="210"/>
         <element name="TableExternalSites" positionX="-6399" positionY="252" width="128" height="150"/>
         <element name="TableLocalFile" positionX="-6138" positionY="111" width="162" height="225"/>