瀏覽代碼

fix

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 年之前
父節點
當前提交
31b6438c8d
共有 2 個文件被更改,包括 27 次插入23 次删除
  1. 3 23
      iOSClient/Scan document/NCUploadScanDocument.swift
  2. 24 0
      iOSClient/Select/NCSelect.swift

+ 3 - 23
iOSClient/Scan document/NCUploadScanDocument.swift

@@ -45,7 +45,7 @@ class NCHostingUploadScanDocumentView: NSObject {
 class NCUploadScanDocument: ObservableObject {
 
     internal var userBaseUrl: NCUserBaseUrl
-    internal var serverUrl: String
+
     internal var metadata = tableMetadata()
     internal var images: [UIImage]
 
@@ -54,6 +54,7 @@ class NCUploadScanDocument: ObservableObject {
     internal var quality: Double = 0
     internal var removeAllFiles: Bool = false
 
+    @Published var serverUrl: String
     @Published var showHUD: Bool = false
 
     init(images: [UIImage], userBaseUrl: NCUserBaseUrl, serverUrl: String) {
@@ -496,7 +497,7 @@ struct UploadScanDocumentView: View {
         }
         .background(Color(UIColor.systemGroupedBackground))
         .sheet(isPresented: $isPresentedSelect) {
-            NCSelectScanDocument(delegate: uploadScanDocument)
+            NCSelectViewControllerRepresentable(delegate: uploadScanDocument)
         }
         .sheet(isPresented: $isPresentedUploadConflict) {
             NCUploadConflictRepresentedView(uploadScanDocument: uploadScanDocument)
@@ -543,27 +544,6 @@ struct ButtonUploadScanDocumenStyle: ButtonStyle {
 
 // MARK: - UIViewControllerRepresentable
 
-struct NCSelectScanDocument: UIViewControllerRepresentable {
-
-    typealias UIViewControllerType = UINavigationController
-    @ObservedObject var delegate: NCUploadScanDocument
-
-    func makeUIViewController(context: Context) -> UINavigationController {
-
-        let storyboard = UIStoryboard(name: "NCSelect", bundle: nil)
-        let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController
-        let viewController = navigationController?.topViewController as? NCSelect
-
-        viewController?.delegate = delegate
-        viewController?.typeOfCommandView = .selectCreateFolder
-        viewController?.includeDirectoryE2EEncryption = true
-
-        return navigationController!
-    }
-
-    func updateUIViewController(_ uiViewController: UINavigationController, context: Context) { }
-}
-
 struct NCUploadConflictRepresentedView: UIViewControllerRepresentable {
 
     typealias UIViewControllerType = NCCreateFormUploadConflict

+ 24 - 0
iOSClient/Select/NCSelect.swift

@@ -22,6 +22,7 @@
 //
 
 import UIKit
+import SwiftUI
 import NextcloudKit
 
 @objc protocol NCSelectDelegate {
@@ -836,3 +837,26 @@ class NCSelectCommandView: UIView {
         selectView?.valueChangedSwitchOverwrite(sender)
     }
 }
+
+// MARK: - UIViewControllerRepresentable
+
+struct NCSelectViewControllerRepresentable: UIViewControllerRepresentable {
+
+    typealias UIViewControllerType = UINavigationController
+    var delegate: NCSelectDelegate
+
+    func makeUIViewController(context: Context) -> UINavigationController {
+
+        let storyboard = UIStoryboard(name: "NCSelect", bundle: nil)
+        let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController
+        let viewController = navigationController?.topViewController as? NCSelect
+
+        viewController?.delegate = delegate
+        viewController?.typeOfCommandView = .selectCreateFolder
+        viewController?.includeDirectoryE2EEncryption = true
+
+        return navigationController!
+    }
+
+    func updateUIViewController(_ uiViewController: UINavigationController, context: Context) { }
+}