浏览代码

add includeHiddenFilesFilter

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 年之前
父节点
当前提交
67362ecfea
共有 3 个文件被更改,包括 8 次插入2 次删除
  1. 3 1
      iOSClient/Data/NCDataSource.swift
  2. 4 0
      iOSClient/NCGlobal.swift
  3. 1 1
      iOSClient/Networking/NCNetworking.swift

+ 3 - 1
iOSClient/Data/NCDataSource.swift

@@ -51,7 +51,9 @@ class NCDataSource: NSObject {
     init(metadatas: [tableMetadata], account: String, directory: tableDirectory? = nil, sort: String? = "none", ascending: Bool? = false, directoryOnTop: Bool? = true, favoriteOnTop: Bool? = true, filterLivePhoto: Bool? = true, groupByField: String = "name", providers: [NKSearchProvider]? = nil, searchResults: [NKSearchResult]? = nil) {
         super.init()
 
-        self.metadatas = metadatas
+        self.metadatas = metadatas.filter({
+            !NCGlobal.shared.includeHiddenFiles.contains($0.fileNameView)
+        })
         self.directory = directory
         self.shares = NCManageDatabase.shared.getTableShares(account: account)
         self.localFiles = NCManageDatabase.shared.getTableLocalFile(account: account)

+ 4 - 0
iOSClient/NCGlobal.swift

@@ -322,6 +322,10 @@ class NCGlobal: NSObject {
     let metadataStatusUploading: Int                = 3
     let metadataStatusUploadError: Int              = 4
 
+    //  Hidden files included in the read
+    //
+    let includeHiddenFiles: [String]                = [".LivePhoto"]
+
     // Notification Center
     //
     @objc let notificationCenterApplicationDidEnterBackground   = "applicationDidEnterBackground"

+ 1 - 1
iOSClient/Networking/NCNetworking.swift

@@ -764,7 +764,7 @@ import Photos
 
         let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue)
         
-        NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in
+        NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), includeHiddenFiles: NCGlobal.shared.includeHiddenFiles ,options: options) { account, files, _, error in
             guard error == .success else {
                 completion(account, nil, nil, nil, nil, nil, error)
                 return