Skip to content

Commit

Permalink
V 6.2.1 (#3245)
Browse files Browse the repository at this point in the history
  • Loading branch information
marinofaggiana authored Dec 20, 2024
1 parent c6ec16e commit 3089502
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 35 deletions.
8 changes: 4 additions & 4 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5503,7 +5503,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 0;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -5530,7 +5530,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 6.1.9;
MARKETING_VERSION = 6.2.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -5569,7 +5569,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -5593,7 +5593,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 6.1.9;
MARKETING_VERSION = 6.2.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down
12 changes: 7 additions & 5 deletions iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NCFiles: NCCollectionViewCommon {
internal var fileNameBlink: String?
internal var fileNameOpen: String?
internal var matadatasHash: String = ""
internal var semaphoreReloadDataSource = DispatchSemaphore(value: 1)
internal var reloadDataSourceInProgress: Bool = false

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
Expand Down Expand Up @@ -122,10 +122,12 @@ class NCFiles: NCCollectionViewCommon {
// MARK: - DataSource

override func reloadDataSource() {
guard !isSearchingMode else {
guard !isSearchingMode,
!reloadDataSourceInProgress
else {
return super.reloadDataSource()
}
self.semaphoreReloadDataSource.wait()
reloadDataSourceInProgress = true

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

if metadatas.isEmpty {
self.semaphoreReloadDataSource.signal()
reloadDataSourceInProgress = false
return super.reloadDataSource()
}

self.dataSource.caching(metadatas: metadatas, dataSourceMetadatas: dataSourceMetadatas) { updated in
self.semaphoreReloadDataSource.signal()
self.reloadDataSourceInProgress = false
if updated || self.isNumberOfItemsInAllSectionsNull || self.numberOfItemsInAllSections != metadatas.count {
super.reloadDataSource()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ class NCCollectionViewDataSource: NSObject {
counter += 1
}

DispatchQueue.main.async {
return completion(updated)
}
return completion(updated)
}
}

Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Media/NCMedia+CollectionViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension NCMedia: UICollectionViewDataSource {
if kind == mediaSectionHeader {
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFirstHeaderEmptyData", for: indexPath) as? NCSectionFirstHeaderEmptyData else { return NCSectionFirstHeaderEmptyData() }
header.emptyImage.image = utility.loadImage(named: "photo", colors: [NCBrandColor.shared.getElement(account: session.account)])
if self.hasRunSearchMedia {
if self.searchMediaInProgress {
header.emptyTitle.text = NSLocalizedString("_search_in_progress_", comment: "")
} else {
header.emptyTitle.text = NSLocalizedString("_tutorial_photo_view_", comment: "")
Expand Down
22 changes: 7 additions & 15 deletions iOSClient/Media/NCMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ class NCMedia: UIViewController {
@IBOutlet weak var menuButton: UIButton!
@IBOutlet weak var gradientView: UIView!

let semaphoreSearchMedia = DispatchSemaphore(value: 1)
let semaphoreNotificationCenter = DispatchSemaphore(value: 1)

let layout = NCMediaLayout()
var layoutType = NCGlobal.shared.mediaLayoutRatio
var documentPickerViewController: NCDocumentPickerViewController?
Expand All @@ -55,7 +52,7 @@ class NCMedia: UIViewController {
var fileSelect: [String] = []
var filesExists: ThreadSafeArray<String> = ThreadSafeArray()
var ocIdDoNotExists: ThreadSafeArray<String> = ThreadSafeArray()
var hasRunSearchMedia: Bool = false
var searchMediaInProgress: Bool = false
var attributesZoomIn: UIMenuElement.Attributes = []
var attributesZoomOut: UIMenuElement.Attributes = []
let gradient: CAGradientLayer = CAGradientLayer()
Expand Down Expand Up @@ -255,23 +252,18 @@ class NCMedia: UIViewController {

@objc func deleteFile(_ notification: NSNotification) {
guard let userInfo = notification.userInfo as NSDictionary?,
let error = userInfo["error"] as? NKError else { return }

semaphoreNotificationCenter.wait()
let error = userInfo["error"] as? NKError
else {
return
}

if error.errorCode == self.global.errorResourceNotFound,
let ocId = userInfo["ocId"] as? String {
self.database.deleteMetadataOcId(ocId)
self.loadDataSource {
self.semaphoreNotificationCenter.signal()
}
self.loadDataSource()
} else if error != .success {
NCContentPresenter().showError(error: error)
self.loadDataSource {
self.semaphoreNotificationCenter.signal()
}
} else {
semaphoreNotificationCenter.signal()
self.loadDataSource()
}
}

Expand Down
11 changes: 4 additions & 7 deletions iOSClient/Media/NCMediaDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,20 @@ extension NCMedia {
@objc func searchMediaUI(_ distant: Bool = false) {
let session = self.session
guard self.isViewActived,
!self.hasRunSearchMedia,
!self.searchMediaInProgress,
!self.isPinchGestureActive,
!self.showOnlyImages,
!self.showOnlyVideos,
!isEditMode,
NCNetworking.shared.downloadThumbnailQueue.operationCount == 0,
let tableAccount = database.getTableAccount(predicate: NSPredicate(format: "account == %@", session.account))
else { return }
self.searchMediaInProgress = true

let limit = max(self.collectionView.visibleCells.count * 3, 300)
let visibleCells = self.collectionView?.indexPathsForVisibleItems.sorted(by: { $0.row < $1.row }).compactMap({ self.collectionView?.cellForItem(at: $0) })

DispatchQueue.global(qos: .background).async {
self.semaphoreSearchMedia.wait()
self.hasRunSearchMedia = true

var lessDate = Date.distantFuture
var greaterDate = Date.distantPast
let countMetadatas = self.dataSource.metadatas.count
Expand Down Expand Up @@ -157,11 +156,9 @@ extension NCMedia {
self.collectionViewReloadData()
}

self.semaphoreSearchMedia.signal()

DispatchQueue.main.async {
self.activityIndicator.stopAnimating()
self.hasRunSearchMedia = false
self.searchMediaInProgress = false

if self.dataSource.metadatas.isEmpty {
self.collectionViewReloadData()
Expand Down
Binary file modified iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
Binary file not shown.
Binary file modified iOSClient/Supporting Files/tr.lproj/Localizable.strings
Binary file not shown.

0 comments on commit 3089502

Please sign in to comment.