From 5cab772262997566d99363a455f38d6c2c53ce95 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Tue, 16 Dec 2025 10:16:46 +0100 Subject: [PATCH 1/6] fix --- .../NCCollectionViewCommon+CollectionViewDataSource.swift | 2 +- .../Main/Collection Common/NCCollectionViewDataSource.swift | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift index 3325b714da..f1b42cadcf 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift @@ -523,7 +523,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { emptyTitle = NSLocalizedString("_search_no_record_found_", comment: "") } emptyDescription = NSLocalizedString("_search_instruction_", comment: "") - } else if self.searchDataSourceTask?.state == .running { + } else if self.searchDataSourceTask?.state == .running || !self.dataSource.isInizialized { emptyImage = utility.loadImage(named: "wifi", colors: [NCBrandColor.shared.getElement(account: session.account)]) emptyTitle = NSLocalizedString("_request_in_progress_", comment: "") emptyDescription = "" diff --git a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift index 52cb15b3fe..f675563809 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift @@ -21,6 +21,8 @@ class NCCollectionViewDataSource: NSObject { private var directoryOnTop: Bool = true private var favoriteOnTop: Bool = true + public var isInizialized: Bool = false + override init() { super.init() } init(metadatas: [tableMetadata], @@ -31,6 +33,7 @@ class NCCollectionViewDataSource: NSObject { super.init() removeAll() + self.isInizialized = true self.metadatas = metadatas self.layoutForView = layoutForView if let account { From 5960424dd9c3932b6fbe03d5603e82f621fb303e Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Tue, 16 Dec 2025 15:25:53 +0100 Subject: [PATCH 2/6] renamed --- iOSClient/Favorites/NCFavorite.swift | 4 ++-- iOSClient/Files/NCFiles.swift | 4 ++-- iOSClient/Groupfolders/NCGroupfolders.swift | 4 ++-- .../NCCollectionViewCommon+CollectionViewDataSource.swift | 2 +- .../Main/Collection Common/NCCollectionViewCommon.swift | 5 +++-- .../Main/Collection Common/NCCollectionViewDataSource.swift | 4 +--- iOSClient/Recent/NCRecent.swift | 4 ++-- iOSClient/Shares/NCShares.swift | 6 +++--- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/iOSClient/Favorites/NCFavorite.swift b/iOSClient/Favorites/NCFavorite.swift index 0f8736c3d1..cb5bd4cfb6 100644 --- a/iOSClient/Favorites/NCFavorite.swift +++ b/iOSClient/Favorites/NCFavorite.swift @@ -71,7 +71,7 @@ class NCFavorite: NCCollectionViewCommon { override func getServerData(forced: Bool = false) async { defer { - restoreDefaultTitle() + stopGUIGetServerData() startSyncMetadata(metadatas: self.dataSource.getMetadatas()) } @@ -80,7 +80,7 @@ class NCFavorite: NCCollectionViewCommon { return } - showLoadingTitle() + startGUIGetServerData() let showHiddenFiles = NCPreferences().getShowHiddenFiles(account: session.account) let resultsListingFavorites = await NextcloudKit.shared.listingFavoritesAsync(showHiddenFiles: showHiddenFiles, diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 565fe12e30..2a443ab17d 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -181,7 +181,7 @@ class NCFiles: NCCollectionViewCommon { override func getServerData(forced: Bool = false) async { defer { - restoreDefaultTitle() + stopGUIGetServerData() startSyncMetadata(metadatas: self.dataSource.getMetadatas()) } @@ -266,7 +266,7 @@ class NCFiles: NCCollectionViewCommon { return (nil, NKError(), reloadRequired) } - showLoadingTitle() + startGUIGetServerData() let options = NKRequestOptions(timeout: 180) let (account, metadataFolder, metadatas, error) = await NCNetworking.shared.readFolderAsync(serverUrl: serverUrl, diff --git a/iOSClient/Groupfolders/NCGroupfolders.swift b/iOSClient/Groupfolders/NCGroupfolders.swift index 09c31c428c..5709711ddd 100644 --- a/iOSClient/Groupfolders/NCGroupfolders.swift +++ b/iOSClient/Groupfolders/NCGroupfolders.swift @@ -89,7 +89,7 @@ class NCGroupfolders: NCCollectionViewCommon { override func getServerData(forced: Bool = false) async { defer { - restoreDefaultTitle() + stopGUIGetServerData() } // If is already in-flight, do nothing @@ -97,7 +97,7 @@ class NCGroupfolders: NCCollectionViewCommon { return } - showLoadingTitle() + startGUIGetServerData() let homeServerUrl = utilityFileSystem.getHomeServer(session: session) let showHiddenFiles = NCPreferences().getShowHiddenFiles(account: session.account) diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift index f1b42cadcf..6d933601ee 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift @@ -523,7 +523,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { emptyTitle = NSLocalizedString("_search_no_record_found_", comment: "") } emptyDescription = NSLocalizedString("_search_instruction_", comment: "") - } else if self.searchDataSourceTask?.state == .running || !self.dataSource.isInizialized { + } else if self.searchDataSourceTask?.state == .running || !self.dataSource.hasGetServerData { emptyImage = utility.loadImage(named: "wifi", colors: [NCBrandColor.shared.getElement(account: session.account)]) emptyTitle = NSLocalizedString("_request_in_progress_", comment: "") emptyDescription = "" diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index 03b4ad892d..60f2a5af79 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -524,7 +524,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS func accountSettingsDidDismiss(tblAccount: tableAccount?, controller: NCMainTabBarController?) { } @MainActor - func showLoadingTitle() { + func startGUIGetServerData() { // Don't show spinner on iPad root folder if UIDevice.current.userInterfaceIdiom == .pad, (self.serverUrl == self.utilityFileSystem.getHomeServer(session: self.session)) || self.serverUrl.isEmpty { @@ -548,9 +548,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS } @MainActor - func restoreDefaultTitle() { + func stopGUIGetServerData() { self.navigationItem.titleView = nil self.navigationItem.title = self.titleCurrentFolder + self.dataSource.hasGetServerData = true } // MARK: - SEARCH diff --git a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift index f675563809..f8aeb76e4d 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift @@ -20,8 +20,7 @@ class NCCollectionViewDataSource: NSObject { private var layoutForView: NCDBLayoutForView? private var directoryOnTop: Bool = true private var favoriteOnTop: Bool = true - - public var isInizialized: Bool = false + public var hasGetServerData: Bool = false override init() { super.init() } @@ -33,7 +32,6 @@ class NCCollectionViewDataSource: NSObject { super.init() removeAll() - self.isInizialized = true self.metadatas = metadatas self.layoutForView = layoutForView if let account { diff --git a/iOSClient/Recent/NCRecent.swift b/iOSClient/Recent/NCRecent.swift index d1ebd85b42..2379b3ab4e 100644 --- a/iOSClient/Recent/NCRecent.swift +++ b/iOSClient/Recent/NCRecent.swift @@ -83,7 +83,7 @@ class NCRecent: NCCollectionViewCommon { override func getServerData(forced: Bool = false) async { defer { - restoreDefaultTitle() + stopGUIGetServerData() } // If is already in-flight, do nothing @@ -160,7 +160,7 @@ class NCRecent: NCCollectionViewCommon { let requestBody = String(format: requestBodyRecent, "/files/" + session.userId, lessDateString) let showHiddenFiles = NCPreferences().getShowHiddenFiles(account: session.account) - showLoadingTitle() + startGUIGetServerData() let resultsSearch = await NextcloudKit.shared.searchBodyRequestAsync(serverUrl: session.urlBase, requestBody: requestBody, diff --git a/iOSClient/Shares/NCShares.swift b/iOSClient/Shares/NCShares.swift index f60b9f8d81..c00af453eb 100644 --- a/iOSClient/Shares/NCShares.swift +++ b/iOSClient/Shares/NCShares.swift @@ -76,7 +76,7 @@ class NCShares: NCCollectionViewCommon { return } - showLoadingTitle() + startGUIGetServerData() let resultsReadShares = await NextcloudKit.shared.readSharesAsync(parameters: NKShareParameter(), account: session.account) { task in Task { @@ -88,8 +88,8 @@ class NCShares: NCCollectionViewCommon { } guard resultsReadShares.error == .success else { + self.stopGUIGetServerData() await self.reloadDataSource() - self.restoreDefaultTitle() return } @@ -134,7 +134,7 @@ class NCShares: NCCollectionViewCommon { } Task { - await self.restoreDefaultTitle() + await self.stopGUIGetServerData() await self.reloadDataSource() await self.startSyncMetadata(metadatas: self.dataSource.getMetadatas()) } From ec1de1839c16af9845a8c29ebc54f114c3382153 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Tue, 16 Dec 2025 15:32:31 +0100 Subject: [PATCH 3/6] Update NCCollectionViewCommon.swift --- .../Main/Collection Common/NCCollectionViewCommon.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index 60f2a5af79..26f86a1990 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -525,6 +525,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS @MainActor func startGUIGetServerData() { + self.dataSource.hasGetServerData = false + // Don't show spinner on iPad root folder if UIDevice.current.userInterfaceIdiom == .pad, (self.serverUrl == self.utilityFileSystem.getHomeServer(session: self.session)) || self.serverUrl.isEmpty { @@ -549,9 +551,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS @MainActor func stopGUIGetServerData() { + self.dataSource.hasGetServerData = true + self.navigationItem.titleView = nil self.navigationItem.title = self.titleCurrentFolder - self.dataSource.hasGetServerData = true } // MARK: - SEARCH From 044580ea07c18744c79b41e12646e064ecc85960 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Tue, 16 Dec 2025 17:25:29 +0100 Subject: [PATCH 4/6] cod --- .../Main/Collection Common/NCCollectionViewCommon.swift | 2 +- iOSClient/Offline/NCOffline.swift | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index 26f86a1990..ba684af491 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -526,6 +526,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS @MainActor func startGUIGetServerData() { self.dataSource.hasGetServerData = false + self.collectionView.reloadData() // Don't show spinner on iPad root folder if UIDevice.current.userInterfaceIdiom == .pad, @@ -552,7 +553,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS @MainActor func stopGUIGetServerData() { self.dataSource.hasGetServerData = true - self.navigationItem.titleView = nil self.navigationItem.title = self.titleCurrentFolder } diff --git a/iOSClient/Offline/NCOffline.swift b/iOSClient/Offline/NCOffline.swift index 1d3d282b89..c677762068 100644 --- a/iOSClient/Offline/NCOffline.swift +++ b/iOSClient/Offline/NCOffline.swift @@ -47,7 +47,7 @@ class NCOffline: NCCollectionViewCommon { super.viewWillAppear(animated) Task { - await self.reloadDataSource() + await getServerData() } } @@ -86,6 +86,10 @@ class NCOffline: NCCollectionViewCommon { } override func getServerData(forced: Bool = false) async { + defer { + stopGUIGetServerData() + } + await self.reloadDataSource() } } From f4880061e63d2a336c80a3a3f3694e479793867d Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Tue, 16 Dec 2025 18:50:06 +0100 Subject: [PATCH 5/6] Update NCNetworking+WebDAV.swift --- iOSClient/Networking/NCNetworking+WebDAV.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/iOSClient/Networking/NCNetworking+WebDAV.swift b/iOSClient/Networking/NCNetworking+WebDAV.swift index fdb2c8428a..2d3d19b5e7 100644 --- a/iOSClient/Networking/NCNetworking+WebDAV.swift +++ b/iOSClient/Networking/NCNetworking+WebDAV.swift @@ -26,6 +26,7 @@ extension NCNetworking { name: "readFileOrFolder") await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task) } + taskHandler(task) } guard resultsReadFolder.error == .success, let files = resultsReadFolder.files else { From bc9a1ea41ad45b4ff11376776cead16765789eb0 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 17 Dec 2025 08:46:13 +0100 Subject: [PATCH 6/6] cod Signed-off-by: Marino Faggiana --- ...llectionViewCommon+CollectionViewDataSource.swift | 2 +- .../Collection Common/NCCollectionViewCommon.swift | 4 ++-- .../NCCollectionViewDataSource.swift | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift index 6d933601ee..e8080bb079 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDataSource.swift @@ -523,7 +523,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { emptyTitle = NSLocalizedString("_search_no_record_found_", comment: "") } emptyDescription = NSLocalizedString("_search_instruction_", comment: "") - } else if self.searchDataSourceTask?.state == .running || !self.dataSource.hasGetServerData { + } else if self.searchDataSourceTask?.state == .running || !self.dataSource.getGetServerData() { emptyImage = utility.loadImage(named: "wifi", colors: [NCBrandColor.shared.getElement(account: session.account)]) emptyTitle = NSLocalizedString("_request_in_progress_", comment: "") emptyDescription = "" diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index ba684af491..ad09d5b6f2 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -525,7 +525,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS @MainActor func startGUIGetServerData() { - self.dataSource.hasGetServerData = false + self.dataSource.setGetServerData(false) self.collectionView.reloadData() // Don't show spinner on iPad root folder @@ -552,7 +552,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS @MainActor func stopGUIGetServerData() { - self.dataSource.hasGetServerData = true + self.dataSource.setGetServerData(true) self.navigationItem.titleView = nil self.navigationItem.title = self.titleCurrentFolder } diff --git a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift index f8aeb76e4d..0de361ad3a 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift @@ -20,7 +20,7 @@ class NCCollectionViewDataSource: NSObject { private var layoutForView: NCDBLayoutForView? private var directoryOnTop: Bool = true private var favoriteOnTop: Bool = true - public var hasGetServerData: Bool = false + private var hasGetServerData: Bool = true override init() { super.init() } @@ -49,6 +49,16 @@ class NCCollectionViewDataSource: NSObject { // MARK: - + func getGetServerData() -> Bool { + return hasGetServerData + } + + func setGetServerData(_ state: Bool) { + hasGetServerData = state + } + + // MARK: - + func removeAll() { self.metadatas.removeAll() self.metadatasForSection.removeAll()