소스 검색

Improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 년 전
부모
커밋
424389d16b
2개의 변경된 파일54개의 추가작업 그리고 7개의 파일을 삭제
  1. 52 7
      iOSClient/Main/Create cloud/NCUploadScanDocument.swift
  2. 2 0
      iOSClient/Supporting Files/en.lproj/Localizable.strings

+ 52 - 7
iOSClient/Main/Create cloud/NCUploadScanDocument.swift

@@ -34,6 +34,10 @@ struct NCUploadScanDocumentTest: View {
 
     @State var currentValue = 1.0
     @State var password: String = ""
+    @State var isSecured: Bool = true
+    @State var isTextRecognition = true
+    @State var urlPreviewFile: URL = Bundle.main.url(forResource: "Reasons to use Nextcloud", withExtension: "pdf")!
+
 
     var body: some View {
 
@@ -53,7 +57,6 @@ struct NCUploadScanDocumentTest: View {
                                     .frame(width: NCBrandSettings.shared.settingsSizeImage, height: NCBrandSettings.shared.settingsSizeImage)
                                     .foregroundColor(Color(NCBrandColor.shared.brand))
                             }
-
                             Spacer()
                         }
                         .contentShape(Rectangle())
@@ -73,15 +76,57 @@ struct NCUploadScanDocumentTest: View {
                     }
 
                     Section(header: Text(NSLocalizedString("_preview_", comment: ""))) {
-                        let fileUrl = Bundle.main.url(forResource: "Reasons to use Nextcloud", withExtension: "pdf")!
-                        PDFKitRepresentedView(fileUrl)
-                            .frame(width: .infinity, height: geo.size.height / 3)
+                        PDFKitRepresentedView(urlPreviewFile)
+                            .frame(width: .infinity, height: geo.size.height / 4)
                     }
 
-                    Section(header: Text(NSLocalizedString("_pdf_password_", comment: ""))) {
+                    Section(header: Text(NSLocalizedString("_file_creation_", comment: ""))) {
+                        HStack {
+                            Group {
+                                Image(systemName: "ellipsis.rectangle")
+                                    .resizable()
+                                    .scaledToFit()
+                                    .frame(width: NCBrandSettings.shared.settingsSizeImage, height: NCBrandSettings.shared.settingsSizeImage)
+                                    .foregroundColor(Color(NCBrandColor.shared.brand))
+                                Text(NSLocalizedString("_password_", comment: ""))
+                                if isSecured {
+                                    SecureField(NSLocalizedString("_enter_password_", comment: ""), text: $password)
+                                        .multilineTextAlignment(.trailing)
+                                } else {
+                                    TextField(NSLocalizedString("_enter_password_", comment: ""), text: $password)
+                                        .multilineTextAlignment(.trailing)
+                                }
+                            }
+                            Button(action: {
+                                isSecured.toggle()
+                            }) {
+                                Image(systemName: self.isSecured ? "eye.slash" : "eye")
+                                    .accentColor(.gray)
+                            }
+                        }
+
                         HStack {
-                            Text(NSLocalizedString("_password_", comment: ""))
-                            SecureField("Enter password...", text: $password)
+                            Image(systemName: "text.viewfinder")
+                                .resizable()
+                                .scaledToFit()
+                                .frame(width: NCBrandSettings.shared.settingsSizeImage, height: NCBrandSettings.shared.settingsSizeImage)
+                                .foregroundColor(Color(NCBrandColor.shared.brand))
+                            Toggle(NSLocalizedString("_text_recognition_", comment: ""), isOn: $isTextRecognition)
+                                .toggleStyle(SwitchToggleStyle(tint: Color(NCBrandColor.shared.brand)))
+                        }
+
+                        HStack {
+                            Label {
+                                Text(NSLocalizedString("_filename_", comment: ""))
+                            } icon: {
+                                Image(systemName: "character.textbox")
+                                    .renderingMode(.template)
+                                    .resizable()
+                                    .scaledToFit()
+                                    .frame(width: NCBrandSettings.shared.settingsSizeImage, height: NCBrandSettings.shared.settingsSizeImage)
+                                    .foregroundColor(Color(NCBrandColor.shared.brand))
+                            }
+                            TextField(NSLocalizedString("_enter_password_", comment: ""), text: $password)
                                 .multilineTextAlignment(.trailing)
                         }
                     }

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

@@ -287,6 +287,7 @@
 "_acknowledgements_"            = "Acknowledgements";
 "_settings_"                    = "Settings";
 "_passcode_"                    = "Password";
+"_enter_password_"              = "Enter password …";
 "_lock_"                        = "Lock";
 "_lock_active_"                 = "Lock: On";
 "_lock_not_active_"             = "Lock: Off";
@@ -913,6 +914,7 @@
 "_calendar_contacts_"       = "Calendar and Contacts";
 "_mobile_config_"           = "Download the configuration profile";
 "_calendar_contacts_footer_"    = "After the downloading you need to go to the Settings app to install it. If a profile is not installed within 8 minutes of downloading it, it is automatically deleted";
+"_preview_"                 = "Preview";
 
 // Video
 "_select_trace_"            = "Select the trace";