Browse Source

added automaticDownloadImage

marinofaggiana 4 years ago
parent
commit
76fafa77ab

+ 19 - 0
iOSClient/Settings/CCAdvanced.m

@@ -91,6 +91,20 @@
     [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
     [section addFormRow:row];
     
+    // Automatic download image
+    
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    section.footerTitle = NSLocalizedString(@"_automatic_Download_Image_footer_", nil);
+    
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"automaticDownloadImage" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_automatic_Download_Image_", nil)];
+    row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
+    if ([CCUtility getAutomaticDownloadImage]) row.value = @"1";
+    else row.value = @"0";
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
+    [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
+    [section addFormRow:row];
+    
     // Section : Files App --------------------------------------------------------------
     
     if (![NCBrandOptions sharedInstance].disable_openin_file) {
@@ -284,6 +298,11 @@
         [CCUtility setDisableLocalCacheAfterUpload:[[rowDescriptor.value valueData] boolValue]];
     }
     
+    if ([rowDescriptor.tag isEqualToString:@"automaticDownloadImage"]) {
+        
+        [CCUtility setAutomaticDownloadImage:[[rowDescriptor.value valueData] boolValue]];
+    }
+    
     if ([rowDescriptor.tag isEqualToString:@"disablefilesapp"]) {
         
         [CCUtility setDisableFilesApp:[[rowDescriptor.value valueData] boolValue]];

+ 2 - 7
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -707,9 +707,7 @@ extension NCViewerImage: NCViewerImageZoomDelegate {
     }
     
     func didAppearImageZoom(viewerImageZoom: NCViewerImageZoom, metadata: tableMetadata) {
-        
-        var automaticDownloadImage = false
-        
+                
         videoStop()
 
         if (currentMetadata.typeFile == k_metadataTypeFile_video || currentMetadata.typeFile == k_metadataTypeFile_audio) {
@@ -725,10 +723,7 @@ extension NCViewerImage: NCViewerImageZoomDelegate {
         let ext = CCUtility.getExtension(metadata.fileNameView)
         
         // DOWNLOAD FILE
-        if metadata.typeFile == k_metadataTypeFile_image && !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) && metadata.session == "" && CCUtility.getAutomaticDownloadImage() {
-            automaticDownloadImage = true
-        }
-        if automaticDownloadImage || ((metadata.contentType == "image/heic" &&  metadata.hasPreview == false) || ext == "GIF" || ext == "SVG" || isFolderEncrypted) && metadata.session == "" && !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
+        if (metadata.typeFile == k_metadataTypeFile_image && CCUtility.getAutomaticDownloadImage()) || ((metadata.contentType == "image/heic" &&  metadata.hasPreview == false) || ext == "GIF" || ext == "SVG" || isFolderEncrypted) && metadata.session == "" && !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
             NCOperationQueue.shared.download(metadata: metadata, selector: "", setFavorite: false)
         }