Marino Faggiana 7 жил өмнө
parent
commit
c55148a30f

+ 3 - 0
iOSClient/Networking/CCNetworking.m

@@ -492,6 +492,9 @@
     if (delegate)
         [_delegates setObject:delegate forKey:fileID];
     
+    if (fileID.length == 0)
+        return;
+    
     tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", fileID]];
     
     if (downloadData) {

+ 15 - 6
iOSClient/Settings/CCAdvanced.m

@@ -123,6 +123,13 @@
     return [super initWithForm:form];
 }
 
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    
+    _hud = [[CCHud alloc] initWithView:[[[UIApplication sharedApplication] delegate] window]];
+}
+
 // Apparirà
 - (void)viewWillAppear:(BOOL)animated
 {
@@ -304,11 +311,11 @@
         
         [self.hud visibleHudTitle:NSLocalizedString(@"_remove_cache_", nil) mode:MBProgressHUDModeIndeterminate color:nil];
         
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC),dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            [app cancelAllOperations];
-            
-            [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
+        [app cancelAllOperations];
+        
+        [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
+
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC),dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
             [[NSURLCache sharedURLCache] setMemoryCapacity:0];
             [[NSURLCache sharedURLCache] setDiskCapacity:0];
@@ -334,9 +341,11 @@
             [self recalculateSize];
             
             dispatch_async(dispatch_get_main_queue(), ^{
+                // Close HUD
+                [self.hud hideHud];
                 // Inizialized home
                 [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil];
-                [self.hud hideHud];
+
             });
         });
     }]];