marinofaggiana 5 年之前
父节点
当前提交
f7c27f2866

+ 1 - 1
iOSClient/Brand/File_Provider_Extension.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.23.8</string>
 	<key>CFBundleVersion</key>
-	<string>23</string>
+	<string>24</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 1 - 1
iOSClient/Brand/Share.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.23.8</string>
 	<key>CFBundleVersion</key>
-	<string>23</string>
+	<string>24</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 1 - 1
iOSClient/Brand/iOSClient.plist

@@ -63,7 +63,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>23</string>
+	<string>24</string>
 	<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
 	<true/>
 	<key>Fabric</key>

+ 9 - 4
iOSClient/Networking/CCNetworking.m

@@ -1150,9 +1150,6 @@
                 [CCUtility moveFileAtPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], tempFileID] toPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], metadata.fileID]];
             }
         }
-                 
-        // Add Local
-        [[NCManageDatabase sharedInstance] addLocalFileWithMetadata:metadata];
         
 #ifndef EXTENSION
         
@@ -1178,7 +1175,15 @@
                 }];
             }
         }
-#endif
+ #endif
+        
+        // Add Local or Remove from cache
+        if ([CCUtility getDisableLocalCacheAfterUpload]) {
+            [[NSFileManager defaultManager] removeItemAtPath:[CCUtility getDirectoryProviderStorageFileID:metadata.fileID] error:nil];
+        } else {
+            // Add Local
+            [[NCManageDatabase sharedInstance] addLocalFileWithMetadata:metadata];
+        }
     }
     
     // Detect E2EE

+ 17 - 0
iOSClient/Settings/CCAdvanced.m

@@ -70,6 +70,18 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
     
+    // Disable Local Cache After Upload
+    
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    section.footerTitle = NSLocalizedString(@"_disableLocalCacheAfterUpload_footer_", nil);
+    
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disableLocalCacheAfterUpload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disableLocalCacheAfterUpload_", nil)];
+    if ([CCUtility getDisableLocalCacheAfterUpload]) row.value = @"1";
+    else row.value = @"0";
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [section addFormRow:row];
+    
     // Section : Files App --------------------------------------------------------------
     
     if (![NCBrandOptions sharedInstance].disable_openin_file) {
@@ -175,6 +187,11 @@
         [CCUtility setFormatCompatibility:[[rowDescriptor.value valueData] boolValue]];
     }
     
+    if ([rowDescriptor.tag isEqualToString:@"disableLocalCacheAfterUpload"]) {
+        
+        [CCUtility setDisableLocalCacheAfterUpload:[[rowDescriptor.value valueData] boolValue]];
+    }
+    
     if ([rowDescriptor.tag isEqualToString:@"disablefilesapp"]) {
         
         [CCUtility setDisableFilesApp:[[rowDescriptor.value valueData] boolValue]];

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

@@ -211,6 +211,8 @@
 "_disable_files_app_footer_"    = "Do not permit the access of files across the Apple Files application";
 "_trial_"                       = "Trial";
 "_trial_expired_day_"           = "Days remaining";
+"_disableLocalCacheAfterUpload_footer_" = "After uploading the file, do not keep it in the local cache";
+"_disableLocalCacheAfterUpload_"        = "Disable local cache";
 
 // Manage AutoUpload
 

+ 3 - 0
iOSClient/Utility/CCUtility.h

@@ -165,6 +165,9 @@
 + (BOOL)getCertificateError:(NSString *)account;
 + (void)setCertificateError:(NSString *)account error:(BOOL)error;
 
++ (BOOL)getDisableLocalCacheAfterUpload;
++ (void)setDisableLocalCacheAfterUpload:(BOOL)disable;
+
 // ===== Varius =====
 
 + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;

+ 12 - 0
iOSClient/Utility/CCUtility.m

@@ -650,6 +650,18 @@
     
     [UICKeyChainStore setString:sError forKey:key service:k_serviceShareKeyChain];
 }
+
++ (BOOL)getDisableLocalCacheAfterUpload
+{
+    return [[UICKeyChainStore stringForKey:@"disableLocalCacheAfterUpload" service:k_serviceShareKeyChain] boolValue];
+}
+
++ (void)setDisableLocalCacheAfterUpload:(BOOL)disable
+{
+    NSString *sDisable = (disable) ? @"true" : @"false";
+    [UICKeyChainStore setString:sDisable forKey:@"disableLocalCacheAfterUpload" service:k_serviceShareKeyChain];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Various =====
 #pragma --------------------------------------------------------------------------------------------