From 3089502d8d5a48b6d95e4e4a8aa8dfffa5cf3b0a Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Fri, 20 Dec 2024 10:45:13 +0100 Subject: [PATCH] V 6.2.1 (#3245) --- Nextcloud.xcodeproj/project.pbxproj | 8 +++---- iOSClient/Files/NCFiles.swift | 12 ++++++---- .../NCCollectionViewDataSource.swift | 4 +--- .../NCMedia+CollectionViewDataSource.swift | 2 +- iOSClient/Media/NCMedia.swift | 22 ++++++------------ iOSClient/Media/NCMediaDataSource.swift | 11 ++++----- .../cs-CZ.lproj/Localizable.strings | Bin 141584 -> 141660 bytes .../tr.lproj/Localizable.strings | Bin 142840 -> 142922 bytes 8 files changed, 24 insertions(+), 35 deletions(-) diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 8409f7a395..0679464d5b 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -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; @@ -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 = ""; @@ -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; @@ -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 = ""; diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 0bb1dc3f75..dcd604cf8d 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -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) @@ -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) @@ -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() } diff --git a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift index ce16734496..f6bf0b3ca3 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewDataSource.swift @@ -290,9 +290,7 @@ class NCCollectionViewDataSource: NSObject { counter += 1 } - DispatchQueue.main.async { - return completion(updated) - } + return completion(updated) } } diff --git a/iOSClient/Media/NCMedia+CollectionViewDataSource.swift b/iOSClient/Media/NCMedia+CollectionViewDataSource.swift index fd767902d9..a4fa07c62e 100644 --- a/iOSClient/Media/NCMedia+CollectionViewDataSource.swift +++ b/iOSClient/Media/NCMedia+CollectionViewDataSource.swift @@ -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: "") diff --git a/iOSClient/Media/NCMedia.swift b/iOSClient/Media/NCMedia.swift index 1592201655..222591a080 100644 --- a/iOSClient/Media/NCMedia.swift +++ b/iOSClient/Media/NCMedia.swift @@ -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? @@ -55,7 +52,7 @@ class NCMedia: UIViewController { var fileSelect: [String] = [] var filesExists: ThreadSafeArray = ThreadSafeArray() var ocIdDoNotExists: ThreadSafeArray = ThreadSafeArray() - var hasRunSearchMedia: Bool = false + var searchMediaInProgress: Bool = false var attributesZoomIn: UIMenuElement.Attributes = [] var attributesZoomOut: UIMenuElement.Attributes = [] let gradient: CAGradientLayer = CAGradientLayer() @@ -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() } } diff --git a/iOSClient/Media/NCMediaDataSource.swift b/iOSClient/Media/NCMediaDataSource.swift index cf59a79031..4a62a534c3 100644 --- a/iOSClient/Media/NCMediaDataSource.swift +++ b/iOSClient/Media/NCMediaDataSource.swift @@ -50,7 +50,7 @@ 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, @@ -58,13 +58,12 @@ extension NCMedia { 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 @@ -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() diff --git a/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings b/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings index 6a98162edea1bd82c6fa969ce0c1cd40c9a9fc9f..cf54e9966388831235a944a8851d3b7bbb0e46ff 100644 GIT binary patch delta 228 zcmbPmiQ~>CjtyrLChw`{n||anqsVl-MT`QIXH@Vs|4Z2ZFM%;ka=L*6P<5dPpV?vCq4bbG)BJZ4Ko;7SVI|t7<{Jp*E32_mzvHfu)S{@<20t}izYHk zZFiW-sH8dl9}iHc$4)U(1%^7thYTqUc?=I36o7OhLkUCT_Qpeu*JY-^yU)lrz2PCy zBAEw_9E?TN10OIdPv^PMXtMp*ea0rW>Hk6**(NX8tT8!aGtcx%Y)t2B bG%lN=5@=unLnLD+Ll)TB%I&M!nNk%2ObbyM delta 330 zcmca}iDSYgjtyrLIGq_X7!n!s7}6&PCW=mGsuXGFO5Dzs$QUMR9L`Y0kPnh#P+%x! zC}v0n^7DX-bAc=cpiB{vECBM0fv_CRPuae@it(hhvL{eo8BivNA(J5ms0yOD3~Yh| zLnuQKgU|Na(-=20NoN98mcUKU0jdSr0~N5H8q|0NAS)5*oE)GIkdr_Lf-KGj>MLO= zp8oJ2qv>|J2aHW>j3LuY*_j-tKVxJ1Bpm`&QUp{~4Azp&kPPI5Gyo0R{+*pERS^I` Cfl-hE diff --git a/iOSClient/Supporting Files/tr.lproj/Localizable.strings b/iOSClient/Supporting Files/tr.lproj/Localizable.strings index 84975739284af26b118f730d33cd4f779e519f2c..de4ab6a7598c4f55b10421cb5f54222dfb545646 100644 GIT binary patch delta 712 zcmaJ;O-NKx6h7x>qw_|`vFSCMqR+yDL8e54&>$3}h@qW9tC?pGHO%;$W*nI}iyCQD zixzRBQz5N_3`9ms9!QB0v}jQz1Vt_~VP+TE4@4Msp4PU-y_fsl?|kR`&i(Pe?!`)7 zc_U6U*SaZcYZNgL^2Rg+EqIMRjEkPfUVPq<26(%3~450z=X8m6ff+gmv;C{$#zOME_gW8i@WL8 zML%Y^VIS^w3MGuTa{E=Rr}(n~SEexRs3|;BPm8gz&(+Do1<^8jeGP*?18jjZBAw>T zw{bt8dWg-=>@=z!ymTKutm0xX`WrRc_^LUd7I4wWpAVp)BHy)80?tALQeeP{B+AM; zA@?lZc&$5cpX2E^9Hcj~PCf0SFeSJy_t=`kO^?^a_fgq>7s_*~Q2BE?U31~})EFaZWh`)GMgzsLG1dr$2 z_@t)#@C7<&Fk3e%}F;mYMv(h^`;S_#L%t& zJ6LKO)_qCQO$cH_mCdIZY_#P1Z>I94G1J|XcbzuXld=5o8~2rzV}knG|8JPxOaKO z0|mj&&4S1q1Q!RXAn2^1;36)r4i27kFCjJRAQv9@-S6*w=X~Frk7GYRjBWp{9K9^7 zq9v4uc%ozt_jQ~VX-Q4I`0>?zd`_R=oRKD8wN%B&jowN+i2O?oEIy)Fl68F z@bz)nNy!P2SsU!1`*V}KEk3H399C-^`^)Hb{I!%zwof^k`&&`E6*-UgURVYa7G#$j z=zyq08NfX<%!CjL=$&xI{_4NBgXL-L~L|_XZ zfdNet>bTj?7&#&ZUPuLL3t;OYa}jSh4HJYyXdOUfCJpF1-Ff01&c*L?d(QTNilS(P zX&{_Nb2U^X3M(0L`x2%5UN}41gY(7$Dv?)