Skip to content

Commit 3089502

Browse files
V 6.2.1 (#3245)
1 parent c6ec16e commit 3089502

File tree

8 files changed

+24
-35
lines changed

8 files changed

+24
-35
lines changed

Nextcloud.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5503,7 +5503,7 @@
55035503
CLANG_WARN_UNREACHABLE_CODE = YES;
55045504
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
55055505
COPY_PHASE_STRIP = NO;
5506-
CURRENT_PROJECT_VERSION = 4;
5506+
CURRENT_PROJECT_VERSION = 0;
55075507
DEBUG_INFORMATION_FORMAT = dwarf;
55085508
DEVELOPMENT_TEAM = NKUJUXUJ3B;
55095509
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -5530,7 +5530,7 @@
55305530
"@executable_path/Frameworks",
55315531
"@executable_path/../../Frameworks",
55325532
);
5533-
MARKETING_VERSION = 6.1.9;
5533+
MARKETING_VERSION = 6.2.1;
55345534
ONLY_ACTIVE_ARCH = YES;
55355535
OTHER_CFLAGS = "-v";
55365536
OTHER_LDFLAGS = "";
@@ -5569,7 +5569,7 @@
55695569
CLANG_WARN_UNREACHABLE_CODE = YES;
55705570
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
55715571
COPY_PHASE_STRIP = NO;
5572-
CURRENT_PROJECT_VERSION = 4;
5572+
CURRENT_PROJECT_VERSION = 0;
55735573
DEVELOPMENT_TEAM = NKUJUXUJ3B;
55745574
ENABLE_STRICT_OBJC_MSGSEND = YES;
55755575
ENABLE_TESTABILITY = YES;
@@ -5593,7 +5593,7 @@
55935593
"@executable_path/Frameworks",
55945594
"@executable_path/../../Frameworks",
55955595
);
5596-
MARKETING_VERSION = 6.1.9;
5596+
MARKETING_VERSION = 6.2.1;
55975597
ONLY_ACTIVE_ARCH = YES;
55985598
OTHER_CFLAGS = "-v";
55995599
OTHER_LDFLAGS = "";

iOSClient/Files/NCFiles.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class NCFiles: NCCollectionViewCommon {
3131
internal var fileNameBlink: String?
3232
internal var fileNameOpen: String?
3333
internal var matadatasHash: String = ""
34-
internal var semaphoreReloadDataSource = DispatchSemaphore(value: 1)
34+
internal var reloadDataSourceInProgress: Bool = false
3535

3636
required init?(coder aDecoder: NSCoder) {
3737
super.init(coder: aDecoder)
@@ -122,10 +122,12 @@ class NCFiles: NCCollectionViewCommon {
122122
// MARK: - DataSource
123123

124124
override func reloadDataSource() {
125-
guard !isSearchingMode else {
125+
guard !isSearchingMode,
126+
!reloadDataSourceInProgress
127+
else {
126128
return super.reloadDataSource()
127129
}
128-
self.semaphoreReloadDataSource.wait()
130+
reloadDataSourceInProgress = true
129131

130132
var predicate = self.defaultPredicate
131133
let predicateDirectory = NSPredicate(format: "account == %@ AND serverUrl == %@", session.account, self.serverUrl)
@@ -143,12 +145,12 @@ class NCFiles: NCCollectionViewCommon {
143145
self.dataSource = NCCollectionViewDataSource(metadatas: metadatas, layoutForView: layoutForView)
144146

145147
if metadatas.isEmpty {
146-
self.semaphoreReloadDataSource.signal()
148+
reloadDataSourceInProgress = false
147149
return super.reloadDataSource()
148150
}
149151

150152
self.dataSource.caching(metadatas: metadatas, dataSourceMetadatas: dataSourceMetadatas) { updated in
151-
self.semaphoreReloadDataSource.signal()
153+
self.reloadDataSourceInProgress = false
152154
if updated || self.isNumberOfItemsInAllSectionsNull || self.numberOfItemsInAllSections != metadatas.count {
153155
super.reloadDataSource()
154156
}

iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,7 @@ class NCCollectionViewDataSource: NSObject {
290290
counter += 1
291291
}
292292

293-
DispatchQueue.main.async {
294-
return completion(updated)
295-
}
293+
return completion(updated)
296294
}
297295
}
298296

iOSClient/Media/NCMedia+CollectionViewDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension NCMedia: UICollectionViewDataSource {
3030
if kind == mediaSectionHeader {
3131
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFirstHeaderEmptyData", for: indexPath) as? NCSectionFirstHeaderEmptyData else { return NCSectionFirstHeaderEmptyData() }
3232
header.emptyImage.image = utility.loadImage(named: "photo", colors: [NCBrandColor.shared.getElement(account: session.account)])
33-
if self.hasRunSearchMedia {
33+
if self.searchMediaInProgress {
3434
header.emptyTitle.text = NSLocalizedString("_search_in_progress_", comment: "")
3535
} else {
3636
header.emptyTitle.text = NSLocalizedString("_tutorial_photo_view_", comment: "")

iOSClient/Media/NCMedia.swift

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ class NCMedia: UIViewController {
3636
@IBOutlet weak var menuButton: UIButton!
3737
@IBOutlet weak var gradientView: UIView!
3838

39-
let semaphoreSearchMedia = DispatchSemaphore(value: 1)
40-
let semaphoreNotificationCenter = DispatchSemaphore(value: 1)
41-
4239
let layout = NCMediaLayout()
4340
var layoutType = NCGlobal.shared.mediaLayoutRatio
4441
var documentPickerViewController: NCDocumentPickerViewController?
@@ -55,7 +52,7 @@ class NCMedia: UIViewController {
5552
var fileSelect: [String] = []
5653
var filesExists: ThreadSafeArray<String> = ThreadSafeArray()
5754
var ocIdDoNotExists: ThreadSafeArray<String> = ThreadSafeArray()
58-
var hasRunSearchMedia: Bool = false
55+
var searchMediaInProgress: Bool = false
5956
var attributesZoomIn: UIMenuElement.Attributes = []
6057
var attributesZoomOut: UIMenuElement.Attributes = []
6158
let gradient: CAGradientLayer = CAGradientLayer()
@@ -255,23 +252,18 @@ class NCMedia: UIViewController {
255252

256253
@objc func deleteFile(_ notification: NSNotification) {
257254
guard let userInfo = notification.userInfo as NSDictionary?,
258-
let error = userInfo["error"] as? NKError else { return }
259-
260-
semaphoreNotificationCenter.wait()
255+
let error = userInfo["error"] as? NKError
256+
else {
257+
return
258+
}
261259

262260
if error.errorCode == self.global.errorResourceNotFound,
263261
let ocId = userInfo["ocId"] as? String {
264262
self.database.deleteMetadataOcId(ocId)
265-
self.loadDataSource {
266-
self.semaphoreNotificationCenter.signal()
267-
}
263+
self.loadDataSource()
268264
} else if error != .success {
269265
NCContentPresenter().showError(error: error)
270-
self.loadDataSource {
271-
self.semaphoreNotificationCenter.signal()
272-
}
273-
} else {
274-
semaphoreNotificationCenter.signal()
266+
self.loadDataSource()
275267
}
276268
}
277269

iOSClient/Media/NCMediaDataSource.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,20 @@ extension NCMedia {
5050
@objc func searchMediaUI(_ distant: Bool = false) {
5151
let session = self.session
5252
guard self.isViewActived,
53-
!self.hasRunSearchMedia,
53+
!self.searchMediaInProgress,
5454
!self.isPinchGestureActive,
5555
!self.showOnlyImages,
5656
!self.showOnlyVideos,
5757
!isEditMode,
5858
NCNetworking.shared.downloadThumbnailQueue.operationCount == 0,
5959
let tableAccount = database.getTableAccount(predicate: NSPredicate(format: "account == %@", session.account))
6060
else { return }
61+
self.searchMediaInProgress = true
62+
6163
let limit = max(self.collectionView.visibleCells.count * 3, 300)
6264
let visibleCells = self.collectionView?.indexPathsForVisibleItems.sorted(by: { $0.row < $1.row }).compactMap({ self.collectionView?.cellForItem(at: $0) })
6365

6466
DispatchQueue.global(qos: .background).async {
65-
self.semaphoreSearchMedia.wait()
66-
self.hasRunSearchMedia = true
67-
6867
var lessDate = Date.distantFuture
6968
var greaterDate = Date.distantPast
7069
let countMetadatas = self.dataSource.metadatas.count
@@ -157,11 +156,9 @@ extension NCMedia {
157156
self.collectionViewReloadData()
158157
}
159158

160-
self.semaphoreSearchMedia.signal()
161-
162159
DispatchQueue.main.async {
163160
self.activityIndicator.stopAnimating()
164-
self.hasRunSearchMedia = false
161+
self.searchMediaInProgress = false
165162

166163
if self.dataSource.metadatas.isEmpty {
167164
self.collectionViewReloadData()
76 Bytes
Binary file not shown.
82 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)