Marino Faggiana 1 жил өмнө
parent
commit
b4162b85cb

+ 1 - 1
File Provider Extension/FileProviderExtension.swift

@@ -80,7 +80,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate {
                 throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: [:])
                 throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: [:])
             } else if NCKeychain().passcode != nil, NCKeychain().requestPasscodeAtStart {
             } else if NCKeychain().passcode != nil, NCKeychain().requestPasscodeAtStart {
                 throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code": NSNumber(value: NCGlobal.shared.errorUnauthorizedFilesPasscode)])
                 throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code": NSNumber(value: NCGlobal.shared.errorUnauthorizedFilesPasscode)])
-            } else if CCUtility.getDisableFilesApp() || NCBrandOptions.shared.disable_openin_file {
+            } else if NCKeychain().disableFilesApp || NCBrandOptions.shared.disable_openin_file {
                 throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code": NSNumber(value: NCGlobal.shared.errorDisableFilesApp)])
                 throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code": NSNumber(value: NCGlobal.shared.errorDisableFilesApp)])
             }
             }
         }
         }

+ 2 - 2
iOSClient/Settings/CCAdvanced.m

@@ -95,7 +95,7 @@
         // Disable Files App
         // Disable Files App
         row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)];
         row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)];
         row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
         row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
-        if ([CCUtility getDisableFilesApp]) row.value = @"1";
+        if ([[NCKeychain alloc] init].disableFilesApp) row.value = @"1";
         else row.value = @"0";
         else row.value = @"0";
         [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
         [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
         [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
         [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
@@ -333,7 +333,7 @@
 
 
     if ([rowDescriptor.tag isEqualToString:@"disablefilesapp"]) {
     if ([rowDescriptor.tag isEqualToString:@"disablefilesapp"]) {
         
         
-        [CCUtility setDisableFilesApp:[[rowDescriptor.value valueData] boolValue]];
+        [[NCKeychain alloc] init].disableFilesApp = [[rowDescriptor.value valueData] boolValue];
     }
     }
     
     
     if ([rowDescriptor.tag isEqualToString:@"crashservice"]) {
     if ([rowDescriptor.tag isEqualToString:@"crashservice"]) {

+ 0 - 3
iOSClient/Utility/CCUtility.h

@@ -41,9 +41,6 @@
 
 
 + (void)deleteAllChainStore;
 + (void)deleteAllChainStore;
 
 
-+ (BOOL)getDisableFilesApp;
-+ (void)setDisableFilesApp:(BOOL)disable;
-
 + (void)setPushNotificationPublicKey:(NSString *)account data:(NSData *)data;
 + (void)setPushNotificationPublicKey:(NSString *)account data:(NSData *)data;
 + (NSData *)getPushNotificationPublicKey:(NSString *)account;
 + (NSData *)getPushNotificationPublicKey:(NSString *)account;
 + (void)setPushNotificationSubscribingPublicKey:(NSString *)account publicKey:(NSString *)publicKey;
 + (void)setPushNotificationSubscribingPublicKey:(NSString *)account publicKey:(NSString *)publicKey;

+ 0 - 11
iOSClient/Utility/CCUtility.m

@@ -50,17 +50,6 @@
 
 
 #pragma ------------------------------ GET/SET
 #pragma ------------------------------ GET/SET
 
 
-+ (BOOL)getDisableFilesApp
-{
-    return [[UICKeyChainStore stringForKey:@"disablefilesapp" service:NCGlobal.shared.serviceShareKeyChain] boolValue];
-}
-
-+ (void)setDisableFilesApp:(BOOL)disable
-{
-    NSString *sDisable = (disable) ? @"true" : @"false";
-    [UICKeyChainStore setString:sDisable forKey:@"disablefilesapp" service:NCGlobal.shared.serviceShareKeyChain];
-}
-
 + (void)setPushNotificationPublicKey:(NSString *)account data:(NSData *)data
 + (void)setPushNotificationPublicKey:(NSString *)account data:(NSData *)data
 {
 {
     NSString *key = [@"PNPublicKey" stringByAppendingString:account];
     NSString *key = [@"PNPublicKey" stringByAppendingString:account];

+ 13 - 0
iOSClient/Utility/NCKeychain.swift

@@ -149,6 +149,19 @@ import KeychainAccess
         }
         }
     }
     }
 
 
+    @objc var disableFilesApp: Bool {
+        get {
+            migrate(key: "disablefilesapp")
+            if let value = try? keychain.get("disablefilesapp"), let result = Bool(value) {
+                return result
+            }
+            return true
+        }
+        set {
+            keychain["disablefilesapp"] = String(newValue)
+        }
+    }
+
     // MARK: -
     // MARK: -
 
 
     private func migrate(key: String) {
     private func migrate(key: String) {