Marino Faggiana hai 1 ano
pai
achega
686237d6c9

+ 1 - 1
iOSClient/AppDelegate.swift

@@ -238,7 +238,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         WidgetCenter.shared.reloadAllTimelines()
 
         // Clear older files
-        let days = CCUtility.getCleanUpDay()
+        let days = NCKeychain().cleanUpDay
         if let directory = CCUtility.getDirectoryProviderStorage() {
             NCUtilityFileSystem.shared.cleanUp(directory: directory, days: TimeInterval(days))
         }

+ 2 - 2
iOSClient/Settings/CCAdvanced.m

@@ -200,7 +200,7 @@
 
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"deleteoldfiles" rowType:XLFormRowDescriptorTypeSelectorPush title:NSLocalizedString(@"_delete_old_files_", nil)];
     
-    switch (CCUtility.getCleanUpDay) {
+    switch ([[NCKeychain alloc] init].cleanUpDay) {
         case 0:
             row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:NSLocalizedString(@"_never_", nil)];
             break;
@@ -359,7 +359,7 @@
     if ([rowDescriptor.tag isEqualToString:@"deleteoldfiles"]) {
         
         NSInteger days = [[rowDescriptor.value valueData] intValue];
-        [CCUtility setCleanUpDay:days];
+        [[NCKeychain alloc] init].cleanUpDay = days;
     }
 }
 

+ 0 - 3
iOSClient/Utility/CCUtility.h

@@ -70,9 +70,6 @@
 + (double)getQualityScanDocument;
 + (void)setQualityScanDocument:(double)value;
 
-+ (NSInteger)getCleanUpDay;
-+ (void)setCleanUpDay:(NSInteger)days;
-
 // ===== Varius =====
 
 + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;

+ 0 - 18
iOSClient/Utility/CCUtility.m

@@ -216,24 +216,6 @@
     [UICKeyChainStore setString:valueString forKey:@"qualityScanDocument" service:NCGlobal.shared.serviceShareKeyChain];
 }
 
-+ (NSInteger)getCleanUpDay
-{
-    NSString *size = [UICKeyChainStore stringForKey:@"cleanUpDay" service:NCGlobal.shared.serviceShareKeyChain];
-
-    if (size == nil) {
-        NSInteger days = [[NCBrandOptions shared] cleanUpDay];
-        return days;
-    } else {
-        return [size integerValue];
-    }
-}
-
-+ (void)setCleanUpDay:(NSInteger)days
-{
-    NSString *daysString = [@(days) stringValue];
-    [UICKeyChainStore setString:daysString forKey:@"cleanUpDay" service:NCGlobal.shared.serviceShareKeyChain];
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Various =====
 #pragma --------------------------------------------------------------------------------------------

+ 13 - 0
iOSClient/Utility/NCKeychain.swift

@@ -240,6 +240,19 @@ import KeychainAccess
         }
     }
 
+    @objc var cleanUpDay: Int {
+        get {
+            migrate(key: "cleanUpDay")
+            if let value = try? keychain.get("cleanUpDay"), let result = Int(value) {
+                return result
+            }
+            return NCBrandOptions.shared.cleanUpDay
+        }
+        set {
+            keychain["cleanUpDay"] = String(newValue)
+        }
+    }
+
     // MARK: -
 
     private func migrate(key: String) {