Ver código fonte

Improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 anos atrás
pai
commit
e5118988ae

+ 3 - 4
iOSClient/Main/Create cloud/NCUploadScanDocument.swift

@@ -354,12 +354,10 @@ struct UploadScanDocumentView: View {
     @State var isSecuredPassword: Bool = true
     @State var isTextRecognition: Bool = CCUtility.getTextRecognitionStatus()
     @State var quality = CCUtility.getQualityScanDocument()
-
+    @State var removeAllFiles: Bool = CCUtility.getDeleteAllScanImages()
     @State var isPresentedSelect = false
     @State var isPresentedUploadConflict = false
 
-    @State var removeAllFiles = false
-
     var metadatasConflict: [tableMetadata] = []
 
     @ObservedObject var uploadScanDocument: NCUploadScanDocument
@@ -449,7 +447,7 @@ struct UploadScanDocumentView: View {
                             .accentColor(Color(NCBrandColor.shared.brand))
                         }
                         PDFKitRepresentedView(quality: $quality, isTextRecognition: $isTextRecognition, uploadScanDocument: uploadScanDocument)
-                            .frame(maxWidth: .infinity, minHeight: geo.size.height / 2.6)
+                            .frame(maxWidth: .infinity, minHeight: geo.size.height / 3.5)
                     }.complexModifier { view in
                         if #available(iOS 15, *) {
                             view.listRowSeparator(.hidden)
@@ -461,6 +459,7 @@ struct UploadScanDocumentView: View {
                         Toggle(NSLocalizedString("_delete_all_scanned_images_", comment: ""), isOn: $removeAllFiles)
                             .toggleStyle(SwitchToggleStyle(tint: Color(NCBrandColor.shared.brand)))
                             .onChange(of: removeAllFiles) { newValue in
+                                CCUtility.setDeleteAllScanImages(newValue)
 
                             }
 

+ 2 - 0
iOSClient/Utility/CCUtility.h

@@ -156,6 +156,8 @@
 
 + (BOOL)getTextRecognitionStatus;
 + (void)setTextRecognitionStatus:(BOOL)value;
++ (BOOL)getDeleteAllScanImages;
++ (void)setDeleteAllScanImages:(BOOL)value;
 + (NSString *)getDirectoryScanDocument;
 + (void)setDirectoryScanDocument:(NSString *)value;
 + (double)getQualityScanDocument;

+ 11 - 0
iOSClient/Utility/CCUtility.m

@@ -604,6 +604,17 @@
     [UICKeyChainStore setString:valueString forKey:@"textRecognitionStatus" service:NCGlobal.shared.serviceShareKeyChain];
 }
 
++ (BOOL)getDeleteAllScanImages
+{
+    return [[UICKeyChainStore stringForKey:@"deleteAllScanImages" service:NCGlobal.shared.serviceShareKeyChain] boolValue];
+}
+
++ (void)setDeleteAllScanImages:(BOOL)value
+{
+    NSString *valueString = (value) ? @"true" : @"false";
+    [UICKeyChainStore setString:valueString forKey:@"deleteAllScanImages" service:NCGlobal.shared.serviceShareKeyChain];
+}
+
 + (NSString *)getDirectoryScanDocument
 {
     return [UICKeyChainStore stringForKey:@"directoryScanDocuments" service:NCGlobal.shared.serviceShareKeyChain];