Browse Source

Add option show hidden files

Marino Faggiana 7 years ago
parent
commit
74a5c88f3e

+ 15 - 0
iOSClient/Networking/OCNetworking.m

@@ -289,6 +289,7 @@
     [communication readFolder:_metadataNet.serverUrl withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         NSMutableArray *metadatas = [NSMutableArray new];
+        BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
         
         // Check items > 0
         if ([items count] == 0) {
@@ -367,6 +368,10 @@
                 if (_isCryptoCloudMode == NO && [CCUtility isFileCryptated:fileName])
                     continue;
                 
+                // Skip hidden files
+                if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
+                    continue;
+                
                 if (itemDto.isDirectory) {
                         
                     fileName = [fileName substringToIndex:[fileName length] - 1];
@@ -449,6 +454,7 @@
     [communication search:path folder:folder fileName: [NSString stringWithFormat:@"%%%@%%", _metadataNet.fileName] depth:_metadataNet.options dateLastModified:dateLastModified withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         NSMutableArray *metadatas = [NSMutableArray new];
+        BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
         
         NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
         NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:_activeUrl];
@@ -469,6 +475,10 @@
                 
                 if ([CCUtility isFileCryptated:fileName])
                     continue;
+                
+                // Skip hidden files
+                if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
+                    continue;
             
                 // ----- BUG #942 ---------
                 if ([itemDto.etag length] == 0) {
@@ -595,6 +605,7 @@
     [communication listingFavorites:path folder:folder withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         NSMutableArray *metadatas = [NSMutableArray new];
+        BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
         
         NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
         NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:_activeUrl];
@@ -628,6 +639,10 @@
             if ([CCUtility isFileCryptated:fileName])
                 continue;
             
+            // Skip hidden files
+            if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
+                continue;
+            
             // ----- BUG #942 ---------
             if ([itemDto.etag length] == 0) {
 #ifndef EXTENSION

+ 24 - 17
iOSClient/Settings/CCAdvanced.m

@@ -72,7 +72,7 @@
     
     // Section OTTIMIZATIONS -------------------------------------------------
     
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_optimized_photos_", nil)];
+    section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
     section.footerTitle = NSLocalizedString(@"_optimized_photos_how_", nil);
     
@@ -82,7 +82,7 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
     
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_upload_del_photos_", nil)];
+    section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
     section.footerTitle = NSLocalizedString(@"_upload_del_photos_how_", nil);
     
@@ -92,6 +92,17 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
 
+    // Section HIDDEN FILES -------------------------------------------------
+
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"showHiddenFiles" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_show_hidden_files_", nil)];
+    if ([CCUtility getShowHiddenFiles]) row.value = @"1";
+    else row.value = @"0";
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [section addFormRow:row];
+    
     // Section CLEAR CACHE -------------------------------------------------
     
     section = [XLFormSectionDescriptor formSection];
@@ -156,11 +167,7 @@
     
     if ([rowDescriptor.tag isEqualToString:@"activityVerboseHigh"]) {
         
-        if ([[rowDescriptor.value valueData] boolValue] == YES) {
-            [CCUtility setActivityVerboseHigh:true];
-        } else {
-            [CCUtility setActivityVerboseHigh:false];
-        }
+        [CCUtility setActivityVerboseHigh:[[rowDescriptor.value valueData] boolValue]];
         
         // Clear Date read Activity for force reload datasource
         app.activeActivity.storeDateFirstActivity = nil;
@@ -168,20 +175,20 @@
     
     if ([rowDescriptor.tag isEqualToString:@"optimizedphoto"]) {
         
-        if ([[rowDescriptor.value valueData] boolValue] == YES) {
-            [CCUtility setOptimizedPhoto:YES];
-        } else {
-            [CCUtility setOptimizedPhoto:NO];
-        }
+        [CCUtility setOptimizedPhoto:[[rowDescriptor.value valueData] boolValue]];
     }
     
     if ([rowDescriptor.tag isEqualToString:@"uploadremovephoto"]) {
         
-        if ([[rowDescriptor.value valueData] boolValue] == YES) {
-            [CCUtility setUploadAndRemovePhoto:YES];
-        } else {
-            [CCUtility setUploadAndRemovePhoto:NO];
-        }
+        [CCUtility setUploadAndRemovePhoto:[[rowDescriptor.value valueData] boolValue]];
+    }
+    
+    if ([rowDescriptor.tag isEqualToString:@"showHiddenFiles"]) {
+        
+        [CCUtility setShowHiddenFiles:[[rowDescriptor.value valueData] boolValue]];
+        
+        // force reload
+        [[NCManageDatabase sharedInstance] setClearAllDateReadDirectory];
     }
 }
 

+ 2 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -196,12 +196,13 @@
 "_help_activity_clear_"         = "Clear activity";
 
 
-// Manage Optimizations
+// Manage Advanced
 
 "_optimized_photos_"            = "Optimized photos resolution";
 "_upload_del_photos_"           = "Remove files after upload";
 "_optimized_photos_how_"        = "If your iPhone is low on space, full-resolution photos are automatically replaced with optimized versions. The full-resolution versions are stored in your Cloud.";
 "_upload_del_photos_how_"       = "Files will be removed from device memory after they’ve been uploaded to the Cloud. They will remain in the camera roll. Just download the files to see them.";
+"_show_hidden_files_"           = "Show hidden files";
 
 // Login