marinofaggiana 3 жил өмнө
parent
commit
269425b9cc

+ 52 - 3
iOSClient/Settings/CCAdvanced.m

@@ -232,13 +232,56 @@
         [self presentViewController:capabilities animated:YES completion:nil];
     };
     [section addFormRow:row];
-
-    // Section CLEAR CACHE -------------------------------------------------
     
-    section = [XLFormSectionDescriptor formSection];
+    // Section : CleanUp / Clear cache --------------------------------------------------------------
+
+    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_cleanup_", nil)];
     [form addFormSection:section];
     section.footerTitle = NSLocalizedString(@"_clear_cache_footer_", nil);
 
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"deleteoldfiles" rowType:XLFormRowDescriptorTypeSelectorPush title:NSLocalizedString(@"_delete_old_files_", nil)];
+    
+    switch (CCUtility.getCleanUpDay) {
+        case 0:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:NSLocalizedString(@"_never_", nil)];
+            break;
+        case 365:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(365) displayText:NSLocalizedString(@"_1_year_", nil)];
+            break;
+        case 180:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(180) displayText:NSLocalizedString(@"_6_months_", nil)];
+            break;
+        case 90:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(90) displayText:NSLocalizedString(@"_3_months_", nil)];
+            break;
+        case 30:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(30) displayText:NSLocalizedString(@"_1_months_", nil)];
+            break;
+        case 7:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(7) displayText:NSLocalizedString(@"_1_week_", nil)];
+            break;
+        case 1:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:NSLocalizedString(@"_1_day_", nil)];
+            break;
+        default:
+            row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:NSLocalizedString(@"_never_", nil)];
+            break;
+    }
+    
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
+    [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
+    row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
+    row.selectorTitle = NSLocalizedString(@"_delete_old_files_", nil);
+    row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:NSLocalizedString(@"_never_", nil)],
+                            [XLFormOptionsObject formOptionsObjectWithValue:@(365) displayText:NSLocalizedString(@"_1_year_", nil)],
+                            [XLFormOptionsObject formOptionsObjectWithValue:@(180) displayText:NSLocalizedString(@"_6_months_", nil)],
+                            [XLFormOptionsObject formOptionsObjectWithValue:@(90) displayText:NSLocalizedString(@"_3_months_", nil)],
+                            [XLFormOptionsObject formOptionsObjectWithValue:@(30) displayText:NSLocalizedString(@"_1_months_", nil)],
+                            [XLFormOptionsObject formOptionsObjectWithValue:@(7) displayText:NSLocalizedString(@"_1_week_", nil)],
+                            [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:NSLocalizedString(@"_1_day_", nil)],
+                            ];
+    [section addFormRow:row];
+        
     // Clear cache
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"azzeracache" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_clear_cache_", nil)];
     row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
@@ -352,6 +395,12 @@
         NSInteger chunkSize = [[rowDescriptor.value valueData] intValue];
         [CCUtility setChunkSize:chunkSize];
     }
+    
+    if ([rowDescriptor.tag isEqualToString:@"deleteoldfiles"]) {
+        
+        NSInteger days = [[rowDescriptor.value valueData] intValue];
+        [CCUtility setCleanUpDay:days];
+    }
 }
 
 #pragma mark - Clear Cache

+ 1 - 27
iOSClient/Settings/NCSettings.m

@@ -110,22 +110,6 @@
     
     [section addFormRow:row];
     
-    // Section : CleanUp --------------------------------------------------------------
-
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_cleanup_", nil)];
-    [form addFormSection:section];
-    
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"removeoldfiles" rowType:XLFormRowDescriptorTypeStepCounter title:NSLocalizedString(@"_remove_old_files_", nil)];
-    row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
-    row.value = [NSString stringWithFormat:@"%ld", CCUtility.getCleanUpDay];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
-    [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
-    [row.cellConfigAtConfigure setObject:@YES forKey:@"stepControl.wraps"];
-    [row.cellConfigAtConfigure setObject:@1 forKey:@"stepControl.stepValue"];
-    [row.cellConfigAtConfigure setObject:@0 forKey:@"stepControl.minimumValue"];
-    [row.cellConfigAtConfigure setObject:@365 forKey:@"stepControl.maximumValue"];
-    [section addFormRow:row];
-    
     // Section Advanced -------------------------------------------------
     
     section = [XLFormSectionDescriptor formSection];
@@ -282,12 +266,6 @@
             [CCUtility setEnableTouchFaceID:false];
         }
     }
-    
-    if ([rowDescriptor.tag isEqualToString:@"removeoldfiles"]) {
-        
-        NSInteger days = [[rowDescriptor.value valueData] intValue];
-        [CCUtility setCleanUpDay:days];
-    }
 }
 
 #pragma mark -
@@ -417,11 +395,7 @@
             sectionName = NSLocalizedString(@"_lock_protection_no_screen_footer_", nil);
         }
         break;
-        case 3: {
-            sectionName = NSLocalizedString(@"_remove_old_files_desc_", nil);
-        }
-        break;
-        case 5: {
+        case 4: {
                                 
             NSString *versionServer = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesVersionString];
             NSString *themingName = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesThemingName];

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

@@ -804,8 +804,15 @@
 "_discard_changes_"         = "Close and discard changes";
 "_message_disable_overwrite_livephoto_" = "This image it's a Live Photo, the overwrite will not possible";
 "_cleanup_"                 = "Cleanup";
-"_remove_old_files_desc_"   = "Remove all unused files from the chosen days (0-365, 0 is disabled)";
-"_remove_old_files_"        = "Remove all files older than days";
+"_delete_old_files_desc_"   = "Delete old files to free up space";
+"_delete_old_files_"        = "Delete all files older than";
+"_never_"                   = "Never";
+"_1_year_"                  = "1 Year";
+"_6_months_"                = "6 Months";
+"_3_months_"                = "3 Months";
+"_1_months_"                = "1 Months";
+"_1_week_"                  = "1 Week";
+"_1_day_"                   = "1 Day";
 
 // ----------------------------------------------------------------------------------------------------------------------------------
 // IM