瀏覽代碼

improved code (E2EE directory)

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 年之前
父節點
當前提交
4ede69f917
共有 2 個文件被更改,包括 20 次插入2 次删除
  1. 10 1
      iOSClient/Main/Create cloud/NCUploadAssets.swift
  2. 10 1
      iOSClient/Scan document/NCUploadScanDocument.swift

+ 10 - 1
iOSClient/Main/Create cloud/NCUploadAssets.swift

@@ -145,6 +145,15 @@ struct UploadAssetsView: View {
         }
         }
     }
     }
 
 
+    func getTextServerUrl(_ serverUrl: String) -> String {
+
+        if let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", uploadAssets.userBaseUrl.account, serverUrl)), let metadata = NCManageDatabase.shared.getMetadataFromOcId(directory.ocId) {
+            return (metadata.fileNameView)
+        } else {
+            return (serverUrl as NSString).lastPathComponent
+        }
+    }
+
     func setFileNameMask(fileName: String?) -> String {
     func setFileNameMask(fileName: String?) -> String {
 
 
         guard let asset = uploadAssets.assets.first?.phAsset else { return "" }
         guard let asset = uploadAssets.assets.first?.phAsset else { return "" }
@@ -354,7 +363,7 @@ struct UploadAssetsView: View {
                                 Text("/")
                                 Text("/")
                                     .frame(maxWidth: .infinity, alignment: .trailing)
                                     .frame(maxWidth: .infinity, alignment: .trailing)
                             } else {
                             } else {
-                                Text((uploadAssets.serverUrl as NSString).lastPathComponent)
+                                Text(self.getTextServerUrl(uploadAssets.serverUrl))
                                     .frame(maxWidth: .infinity, alignment: .trailing)
                                     .frame(maxWidth: .infinity, alignment: .trailing)
                             }
                             }
                         } icon: {
                         } icon: {

+ 10 - 1
iOSClient/Scan document/NCUploadScanDocument.swift

@@ -372,6 +372,15 @@ struct UploadScanDocumentView: View {
         self.uploadScanDocument = uploadScanDocument
         self.uploadScanDocument = uploadScanDocument
     }
     }
 
 
+    func getTextServerUrl(_ serverUrl: String) -> String {
+
+        if let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", uploadScanDocument.userBaseUrl.account, serverUrl)), let metadata = NCManageDatabase.shared.getMetadataFromOcId(directory.ocId) {
+            return (metadata.fileNameView)
+        } else {
+            return (serverUrl as NSString).lastPathComponent
+        }
+    }
+
     var body: some View {
     var body: some View {
 
 
         GeometryReader { geo in
         GeometryReader { geo in
@@ -384,7 +393,7 @@ struct UploadScanDocumentView: View {
                                     Text("/")
                                     Text("/")
                                         .frame(maxWidth: .infinity, alignment: .trailing)
                                         .frame(maxWidth: .infinity, alignment: .trailing)
                                 } else {
                                 } else {
-                                    Text((uploadScanDocument.serverUrl as NSString).lastPathComponent)
+                                    Text(self.getTextServerUrl(uploadScanDocument.serverUrl))
                                         .frame(maxWidth: .infinity, alignment: .trailing)
                                         .frame(maxWidth: .infinity, alignment: .trailing)
                                 }
                                 }
                             } icon: {
                             } icon: {