Эх сурвалжийг харах

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 жил өмнө
parent
commit
e738acce71

+ 3 - 12
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -54,7 +54,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     internal var groupByField = "name"
     internal var providers: [NCCSearchProvider]?
     internal var searchResults: [NCCSearchResult]?
-    internal var timerUnifiedSearch: Timer?
 
     internal var listLayout: NCListLayout!
     internal var gridLayout: NCGridLayout!
@@ -1033,15 +1032,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
 
     @objc func reloadDataSourceNetwork(forced: Bool = false) { }
 
-    @objc func unifiedSearchFilesTimer() {
-        if NCOperationQueue.shared.dataSourceAddSectionCount() == 0 {
-            self.timerUnifiedSearch?.invalidate()
-            self.refreshControl.endRefreshing()
-            self.isReloadDataSourceNetworkInProgress = false
-            self.collectionView.reloadData()
-        }
-    }
-
     @objc func networkSearch() {
         guard !appDelegate.account.isEmpty, let literalSearch = literalSearch, !literalSearch.isEmpty
         else {
@@ -1057,7 +1047,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
 
         let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
         if serverVersionMajor >= NCGlobal.shared.nextcloudVersion20 {
-            self.timerUnifiedSearch?.invalidate()
             NCNetworking.shared.unifiedSearchFiles(urlBase: appDelegate, literal: literalSearch) { allProviders in
                 self.providers = allProviders
                 self.searchResults = []
@@ -1075,7 +1064,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 guard let metadatas = metadatas, metadatas.count > 0, self.isSearching , let searchResult = searchResult else { return }
                 NCOperationQueue.shared.dataSourceAddSection(collectionViewCommon: self, metadatas: metadatas, searchResult: searchResult)
             } completion: {errorCode, errorDescription in
-                self.timerUnifiedSearch = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(self.unifiedSearchFilesTimer), userInfo: nil, repeats: true)
+                self.refreshControl.endRefreshing()
+                self.isReloadDataSourceNetworkInProgress = false
+                self.collectionView.reloadData()
             }
 
         } else {