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; 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