Эх сурвалжийг харах

Change function loadAutomaticUpload

Marino Faggiana 8 жил өмнө
parent
commit
74349eb8e3

+ 4 - 1
iOSClient/AppDelegate.h

@@ -60,7 +60,7 @@
 @property double currentLatitude;
 @property double currentLongitude;
 
-// ownCloud & Nextcloud
+// Nextcloud
 @property BOOL hasServerForbiddenCharactersSupport;
 @property BOOL hasServerShareSupport;
 @property BOOL hasServerShareeSupport;
@@ -90,6 +90,9 @@
 @property (nonatomic, strong) NSMutableDictionary *sharesLink;
 @property (nonatomic, strong) NSMutableDictionary *sharesUserAndGroup;
 
+// Check new Asset Photos/Video in progress 
+@property BOOL automaticCheckAssetInProgress;
+
 // UploadFromOtherUpp
 @property (nonatomic, strong) NSString *fileNameUpload;
 

+ 15 - 8
iOSClient/AppDelegate.m

@@ -173,16 +173,19 @@
     _netQueueUploadWWan.name = k_upload_queuewwan;
     _netQueueUploadWWan.maxConcurrentOperationCount = k_maxConcurrentOperationDownloadUpload;
     
+    // Check new Asset Photos/Video in progress  
+    _automaticCheckAssetInProgress = NO;
+    
     // Add notification change session
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionChanged:) name:k_networkingSessionNotification object:nil];
         
     // Initialization Share
-    self.sharesID = [[NSMutableDictionary alloc] init];
-    self.sharesLink = [[NSMutableDictionary alloc] init];
-    self.sharesUserAndGroup = [[NSMutableDictionary alloc] init];
+    self.sharesID = [NSMutableDictionary new];
+    self.sharesLink = [NSMutableDictionary new];
+    self.sharesUserAndGroup = [NSMutableDictionary new];
     
     // Initialization Notification
-    self.listOfNotifications = [[NSMutableArray alloc] init];
+    self.listOfNotifications = [NSMutableArray new];
     
     // Verify Session in progress and Init date task
     self.sessionDateLastDownloadTasks = [NSDate date];
@@ -378,16 +381,16 @@
 
 - (void)process
 {
-// BACKGROND & FOREGROUND
+    // BACKGROND & FOREGROUND
 
-// ONLY BACKGROUND
     
     if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
-    
+
+        // ONLY BACKGROUND
        
     } else {
 
-// ONLY FOREFROUND
+        // ONLY FOREFROUND
         
         [app performSelectorOnMainThread:@selector(loadAutomaticUpload) withObject:nil waitUntilDone:NO];
     
@@ -1211,6 +1214,10 @@
 {
     CCMetadataNet *metadataNet;
     
+    // Is loading new Asset ?
+    if (_automaticCheckAssetInProgress)
+        return;
+    
     NSArray *uploadInQueue = [CCCoreData getTableMetadataUploadAccount:app.activeAccount];
     NSArray *recordAutomaticUploadInLock = [CCCoreData getAllLockTableAutomaticUploadForAccount:_activeAccount];
     

+ 6 - 7
iOSClient/PhotosCameraUpload/CCPhotosCameraUpload.m

@@ -39,7 +39,6 @@
     NSMutableArray *_queueMetadatas;
     NSMutableArray *_selectedMetadatas;
     NSUInteger _numSelectedMetadatas;
-    BOOL _AutomaticCameraUploadInProgress;      // START/STOP new request : initStateCameraUpload
     
     CCSectionDataSourceMetadata *_sectionDataSource;
     
@@ -1066,8 +1065,8 @@
     CCManageAsset *manageAsset = [[CCManageAsset alloc] init];
     NSMutableArray *newItemsToUpload;
     
-    // CHECK : initStateCameraUpload
-    if (_AutomaticCameraUploadInProgress)
+    // Is loading new Asset ?
+    if (app.automaticCheckAssetInProgress)
         return;
     
     // Check Asset : NEW or FULL
@@ -1087,8 +1086,8 @@
     if ([newItemsToUpload count] == 0)
         return;
     
-    // STOP new request : initStateCameraUpload
-    _AutomaticCameraUploadInProgress = YES;
+    // STOP
+    app.automaticCheckAssetInProgress = YES;
     
     // Disable idle timer
     [[UIApplication sharedApplication] setIdleTimerDisabled: YES];
@@ -1224,8 +1223,8 @@
 {
     [_hud hideHud];
     
-    // START new request : initStateCameraUpload
-    _AutomaticCameraUploadInProgress = NO;
+    // START
+    app.automaticCheckAssetInProgress = NO;
     
     // Enable idle timer
     [[UIApplication sharedApplication] setIdleTimerDisabled:NO];