From d3e8e28851366797e7067a2a74b349fe58300aa5 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 8 Aug 2026 09:48:03 +0200 Subject: [PATCH 1/2] fix: show loading state while media data source builds Route media collection updates through the safe reload helper. Signed-off-by: Marino Faggiana --- iOSClient/Media/NCMedia+CollectionViewDataSource.swift | 2 +- iOSClient/Media/NCMedia+Command.swift | 4 ++-- iOSClient/Media/NCMedia.swift | 1 + iOSClient/Media/NCMediaDataSource.swift | 8 ++++++++ iOSClient/Media/NCMediaPinchGesture.swift | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/iOSClient/Media/NCMedia+CollectionViewDataSource.swift b/iOSClient/Media/NCMedia+CollectionViewDataSource.swift index bfa2d42a35..e035058123 100644 --- a/iOSClient/Media/NCMedia+CollectionViewDataSource.swift +++ b/iOSClient/Media/NCMedia+CollectionViewDataSource.swift @@ -30,7 +30,7 @@ extension NCMedia: UICollectionViewDataSource { ] ) - if searchMediaInProgress { + if searchMediaInProgress || datasourceMediaInProgress { header.emptyTitle.text = NSLocalizedString( "_search_in_progress_", comment: "" diff --git a/iOSClient/Media/NCMedia+Command.swift b/iOSClient/Media/NCMedia+Command.swift index e4c5aa80e9..49ca20374f 100644 --- a/iOSClient/Media/NCMedia+Command.swift +++ b/iOSClient/Media/NCMedia+Command.swift @@ -24,7 +24,7 @@ extension NCMedia { } } - self.collectionView.reloadData() + collectionViewReloadData() Task { await (self.navigationController as? NCMainNavigationController)?.setNavigationLeftItems() @@ -216,7 +216,7 @@ extension NCMedia { navigationItem.leftBarButtonItems = items.isEmpty ? nil : items if items.isEmpty { - collectionView.reloadData() + collectionViewReloadData() } } } diff --git a/iOSClient/Media/NCMedia.swift b/iOSClient/Media/NCMedia.swift index 5c5f63ad6f..ea1f63c9a3 100644 --- a/iOSClient/Media/NCMedia.swift +++ b/iOSClient/Media/NCMedia.swift @@ -76,6 +76,7 @@ class NCMedia: UIViewController { var searchMediaTask: Task? var buildDataSourceTask: Task? + var datasourceMediaInProgress: Bool = false var searchMediaInProgress: Bool = false { didSet { guard oldValue != searchMediaInProgress else { diff --git a/iOSClient/Media/NCMediaDataSource.swift b/iOSClient/Media/NCMediaDataSource.swift index 89e3ad1294..52e66f13b5 100644 --- a/iOSClient/Media/NCMediaDataSource.swift +++ b/iOSClient/Media/NCMediaDataSource.swift @@ -8,6 +8,14 @@ import RealmSwift extension NCMedia { func loadDataSource(forced: Bool = false) async { + defer { + datasourceMediaInProgress = false + } + datasourceMediaInProgress = true + if self.dataSource.isEmpty() { + collectionViewReloadData() + } + let account = self.session.account guard !Task.isCancelled else { diff --git a/iOSClient/Media/NCMediaPinchGesture.swift b/iOSClient/Media/NCMediaPinchGesture.swift index 97b0d71f95..deada6633b 100644 --- a/iOSClient/Media/NCMediaPinchGesture.swift +++ b/iOSClient/Media/NCMediaPinchGesture.swift @@ -45,7 +45,7 @@ extension NCMedia { options: .transitionCrossDissolve ) { self.collectionView.collectionViewLayout.invalidateLayout() - self.collectionView.reloadData() + self.collectionViewReloadData() self.collectionView.layoutIfNeeded() guard let updatedAttributes = self.collectionView From 7a258d576cc27110403da4a09faf62f749c774ef Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 8 Aug 2026 09:50:32 +0200 Subject: [PATCH 2/2] chore: bump project build number to 4 Signed-off-by: Marino Faggiana --- Nextcloud.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 41551bde3e..de8ca8de54 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -6323,7 +6323,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = NKUJUXUJ3B; @@ -6391,7 +6391,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = NKUJUXUJ3B;