瀏覽代碼

removePhotoCameraRoll

Marino Faggiana 1 年之前
父節點
當前提交
c28729807f

+ 1 - 1
iOSClient/Networking/NCNetworking.swift

@@ -648,7 +648,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
             metadata.status = NCGlobal.shared.metadataStatusNormal
 
             // Delete Asset on Photos album
-            if CCUtility.getRemovePhotoCameraRoll() && !metadata.assetLocalIdentifier.isEmpty {
+            if NCKeychain().removePhotoCameraRoll, !metadata.assetLocalIdentifier.isEmpty {
                 metadata.deleteAssetLocalIdentifier = true
             }
 

+ 2 - 2
iOSClient/Settings/CCAdvanced.m

@@ -78,7 +78,7 @@
 
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"removePhotoCameraRoll" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_remove_photo_CameraRoll_", nil)];
     row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
-    if ([CCUtility getRemovePhotoCameraRoll]) row.value = @"1";
+    if ([[[NCKeychain alloc] init] removePhotoCameraRoll]) row.value = @"1";
     else row.value = @0;
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
     [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
@@ -328,7 +328,7 @@
 
     if ([rowDescriptor.tag isEqualToString:@"removePhotoCameraRoll"]) {
 
-        [CCUtility setRemovePhotoCameraRoll:[[rowDescriptor.value valueData] boolValue]];
+        [[NCKeychain alloc] init].removePhotoCameraRoll = [[rowDescriptor.value valueData] boolValue];
     }
 
     if ([rowDescriptor.tag isEqualToString:@"disablefilesapp"]) {

+ 0 - 3
iOSClient/Utility/CCUtility.h

@@ -76,9 +76,6 @@
 + (BOOL)getPrivacyScreenEnabled;
 + (void)setPrivacyScreenEnabled:(BOOL)set;
 
-+ (BOOL)getRemovePhotoCameraRoll;
-+ (void)setRemovePhotoCameraRoll:(BOOL)set;
-
 // ===== Varius =====
 
 + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;

+ 0 - 11
iOSClient/Utility/CCUtility.m

@@ -245,17 +245,6 @@
     [UICKeyChainStore setString:sSet forKey:@"privacyScreen" service:NCGlobal.shared.serviceShareKeyChain];
 }
 
-+ (BOOL)getRemovePhotoCameraRoll
-{
-    return [[UICKeyChainStore stringForKey:@"removePhotoCameraRoll" service:NCGlobal.shared.serviceShareKeyChain] boolValue];
-}
-
-+ (void)setRemovePhotoCameraRoll:(BOOL)set
-{
-    NSString *sSet = (set) ? @"true" : @"false";
-    [UICKeyChainStore setString:sSet forKey:@"removePhotoCameraRoll" service:NCGlobal.shared.serviceShareKeyChain];
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Various =====
 #pragma --------------------------------------------------------------------------------------------

+ 13 - 0
iOSClient/Utility/NCKeychain.swift

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