From fdb3fe90ece23537edf9c02a33782e9a1c38b6c9 Mon Sep 17 00:00:00 2001 From: Miltiadis Vasilakis Date: Tue, 17 Sep 2024 12:22:22 +0300 Subject: [PATCH] Update dependencies (#1011) * Update SPM dependencies * Fix warnings * Update GitHub tests --- .github/workflows/run-tests.yml | 4 ++-- .../Controllers/RedirectWebViewHandler.swift | 2 +- Zotero.xcodeproj/project.pbxproj | 18 +++++++++--------- .../xcshareddata/swiftpm/Package.resolved | 16 ++++++++-------- Zotero/Controllers/API/Alamofire+RxSwift.swift | 4 ++-- Zotero/Controllers/API/ApiOperation.swift | 2 +- .../AttachmentDownloader.swift | 14 +++++--------- .../RemoteAttachmentDownloadOperation.swift | 2 +- .../RemoteAttachmentDownloader.swift | 4 ++-- .../IdentifierLookupController.swift | 2 +- Zotero/Extensions/AsynchronousOperation.swift | 2 +- .../Extensions/CoreGraphics+Extensions.swift | 2 +- Zotero/Models/Database/Database.swift | 2 +- .../Items/Views/ItemsViewController.swift | 3 +-- .../PDF/Views/PDFDocumentViewController.swift | 8 +++++--- 15 files changed, 41 insertions(+), 44 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 99230b476..d012cf38b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,8 +14,8 @@ jobs: runs-on: macos-14 strategy: matrix: - xcode: ["15.3"] - ios_version: ["17.4"] + xcode: ["16.0"] + ios_version: ["18.0"] device_name: ["iPhone 15"] steps: diff --git a/ZShare/Controllers/RedirectWebViewHandler.swift b/ZShare/Controllers/RedirectWebViewHandler.swift index 8206850d4..1631f7215 100644 --- a/ZShare/Controllers/RedirectWebViewHandler.swift +++ b/ZShare/Controllers/RedirectWebViewHandler.swift @@ -7,7 +7,7 @@ // import UIKit -import WebKit +@preconcurrency import WebKit import CocoaLumberjackSwift import RxSwift diff --git a/Zotero.xcodeproj/project.pbxproj b/Zotero.xcodeproj/project.pbxproj index 6bab26b8e..b95ea4f70 100644 --- a/Zotero.xcodeproj/project.pbxproj +++ b/Zotero.xcodeproj/project.pbxproj @@ -6040,7 +6040,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.32; + MARKETING_VERSION = 1.0.41; PRODUCT_BUNDLE_IDENTIFIER = org.zotero.ios.Zotero; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6077,7 +6077,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.32; + MARKETING_VERSION = 1.0.41; PRODUCT_BUNDLE_IDENTIFIER = org.zotero.ios.Zotero; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6218,7 +6218,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.24; + MARKETING_VERSION = 1.0.41; PRODUCT_BUNDLE_IDENTIFIER = org.zotero.ios.Zotero.ZShare; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6252,7 +6252,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.24; + MARKETING_VERSION = 1.0.41; PRODUCT_BUNDLE_IDENTIFIER = org.zotero.ios.Zotero.ZShare; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6353,7 +6353,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.32; + MARKETING_VERSION = 1.0.41; PRODUCT_BUNDLE_IDENTIFIER = org.zotero.ios.Zotero; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6444,7 +6444,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.24; + MARKETING_VERSION = 1.0.41; PRODUCT_BUNDLE_IDENTIFIER = org.zotero.ios.Zotero.ZShare; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6574,7 +6574,7 @@ repositoryURL = "https://github.com/Quick/Nimble"; requirement = { kind = exactVersion; - version = 13.4.0; + version = 13.5.0; }; }; B356A38E2524A6BA003F1943 /* XCRemoteSwiftPackageReference "Quick" */ = { @@ -6606,7 +6606,7 @@ repositoryURL = "https://github.com/realm/realm-cocoa"; requirement = { kind = exactVersion; - version = 10.53.0; + version = 20.0.0; }; }; B35E4B8B25248B3C000EA134 /* XCRemoteSwiftPackageReference "RxSwift" */ = { @@ -6622,7 +6622,7 @@ repositoryURL = "https://github.com/PSPDFKit/PSPDFKit-SP"; requirement = { kind = exactVersion; - version = 13.9.0; + version = 14.0.0; }; }; B3D84BEE27919FDE005DDD7C /* XCRemoteSwiftPackageReference "Starscream" */ = { diff --git a/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 71d86dcde..a3032655c 100644 --- a/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -51,8 +51,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Quick/Nimble", "state" : { - "revision" : "54b4e52183f16fe806014cbfd63718a84f8ba072", - "version" : "13.4.0" + "revision" : "cecacf00ddf36c1efff8d14beb65087f2a676be9", + "version" : "13.5.0" } }, { @@ -78,8 +78,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/PSPDFKit/PSPDFKit-SP", "state" : { - "revision" : "3388fc5a4beeacda3e0b0a3ba6ec1766e55ad1d9", - "version" : "13.9.0" + "revision" : "39c61f0746177e6f7795d6f9b62fe0c39a1d7de2", + "version" : "14.0.0" } }, { @@ -96,8 +96,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-cocoa", "state" : { - "revision" : "9815e6c29d43cb5314add5dff8705c5476ab556c", - "version" : "10.53.0" + "revision" : "7ea8be1f74034bae860120d58d3491c4fcedff5b", + "version" : "20.0.0" } }, { @@ -105,8 +105,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-core.git", "state" : { - "revision" : "c2552e1d36867cb42b28130e894a81fc17081062", - "version" : "14.12.0" + "revision" : "f98720a07e6150c41c953e1937108225550ba155", + "version" : "20.0.0" } }, { diff --git a/Zotero/Controllers/API/Alamofire+RxSwift.swift b/Zotero/Controllers/API/Alamofire+RxSwift.swift index 7256210f5..569c5d353 100644 --- a/Zotero/Controllers/API/Alamofire+RxSwift.swift +++ b/Zotero/Controllers/API/Alamofire+RxSwift.swift @@ -12,7 +12,7 @@ import Alamofire import CocoaLumberjackSwift import RxSwift -struct AFResponseError: Error { +struct AFResponseError: Error, @unchecked Sendable { let url: URL? let httpMethod: String? let error: AFError @@ -114,7 +114,7 @@ extension DataRequest { } } -extension Request: ReactiveCompatible {} +extension Request: @retroactive ReactiveCompatible {} extension Reactive where Base: DataRequest { func loggedResponseDataWithResponseError(queue: DispatchQueue, encoding: ApiParameterEncoding, logParams: ApiLogParameters) -> Observable<(Data?, HTTPURLResponse)> { diff --git a/Zotero/Controllers/API/ApiOperation.swift b/Zotero/Controllers/API/ApiOperation.swift index fef8d17c5..5ee263608 100644 --- a/Zotero/Controllers/API/ApiOperation.swift +++ b/Zotero/Controllers/API/ApiOperation.swift @@ -10,7 +10,7 @@ import Foundation import RxSwift -class ApiOperation: AsynchronousOperation { +class ApiOperation: AsynchronousOperation, @unchecked Sendable { private let apiRequest: ApiRequest private let responseQueue: DispatchQueue private let completion: (Swift.Result<(Data?, HTTPURLResponse), Error>) -> Void diff --git a/Zotero/Controllers/Attachment Downloader/AttachmentDownloader.swift b/Zotero/Controllers/Attachment Downloader/AttachmentDownloader.swift index 6dfa1b9d0..955123c29 100644 --- a/Zotero/Controllers/Attachment Downloader/AttachmentDownloader.swift +++ b/Zotero/Controllers/Attachment Downloader/AttachmentDownloader.swift @@ -158,11 +158,7 @@ final class AttachmentDownloader: NSObject { .disposed(by: disposeBag) func resumeDownloads(tasks: [URLSessionTask], downloader: AttachmentDownloader) { - var taskIds: Set = [] - for task in tasks { - taskIds.insert(task.taskIdentifier) - } - + let taskIds: Set = Set(tasks.map { $0.taskIdentifier }) downloader.dbQueue.async { [weak downloader] in guard let downloader else { return } let (cancelledTaskIds, activeDownloads, downloadsToRestore) = loadDatabaseDownloads( @@ -216,7 +212,7 @@ final class AttachmentDownloader: NSObject { } } - func loadDatabaseDownloads(existingTaskIds: Set, dbStorage: DbStorage, dbQueue: DispatchQueue, fileStorage: FileStorage) -> (Set, [(Int, EnqueuedDownload)], [EnqueuedDownload]) { + @Sendable func loadDatabaseDownloads(existingTaskIds: Set, dbStorage: DbStorage, dbQueue: DispatchQueue, fileStorage: FileStorage) -> (Set, [(Int, EnqueuedDownload)], [EnqueuedDownload]) { var cancelledTaskIds: Set = [] var activeDownloads: [(Int, EnqueuedDownload)] = [] var downloadsToRestore: [EnqueuedDownload] = [] @@ -258,7 +254,7 @@ final class AttachmentDownloader: NSObject { return (cancelledTaskIds, activeDownloads, downloadsToRestore) } - func storeDownloadData(for downloads: [(Int, EnqueuedDownload)], downloader: AttachmentDownloader) -> [(Download, Swift.Error)] { + @Sendable func storeDownloadData(for downloads: [(Int, EnqueuedDownload)], downloader: AttachmentDownloader) -> [(Download, Swift.Error)] { var failed: [(Download, Swift.Error)] = [] for (taskId, enqueuedDownload) in downloads { DDLogInfo("AttachmentDownloader: cached \(taskId); \(enqueuedDownload.download.key); (\(enqueuedDownload.download.parentKey ?? "-")); \(enqueuedDownload.download.libraryId)") @@ -445,8 +441,8 @@ final class AttachmentDownloader: NSObject { func downloadIfNeeded(attachment: Attachment, parentKey: String?, scheduler: SchedulerType = MainScheduler.instance, completion: @escaping (Result<(), Swift.Error>) -> Void) { observable .observe(on: scheduler) - .subscribe(onNext: { [weak self] update in - guard let self, update.libraryId == attachment.libraryId && update.key == attachment.key else { return } + .subscribe(onNext: { update in + guard update.libraryId == attachment.libraryId && update.key == attachment.key else { return } switch update.kind { case .ready: completion(.success(())) diff --git a/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloadOperation.swift b/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloadOperation.swift index 84e23a893..c9b0fee16 100644 --- a/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloadOperation.swift +++ b/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloadOperation.swift @@ -12,7 +12,7 @@ import Alamofire import RxSwift import CocoaLumberjackSwift -class RemoteAttachmentDownloadOperation: AsynchronousOperation { +class RemoteAttachmentDownloadOperation: AsynchronousOperation, @unchecked Sendable { private enum State { case downloading, done } diff --git a/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloader.swift b/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloader.swift index 9754ef171..0a984dabd 100644 --- a/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloader.swift +++ b/Zotero/Controllers/Attachment Downloader/RemoteAttachmentDownloader.swift @@ -146,7 +146,7 @@ final class RemoteAttachmentDownloader { return (download, operation) - func finish(download: Download, file: File, attachment: Attachment, parentKey: String, result: Result<(), Swift.Error>) { + @Sendable func finish(download: Download, file: File, attachment: Attachment, parentKey: String, result: Result<(), Swift.Error>) { operations[download] = nil progressObservers[download] = nil resetBatchDataIfNeeded() @@ -171,7 +171,7 @@ final class RemoteAttachmentDownloader { } } - func observe(progress: Progress, attachment: Attachment, download: Download) { + @Sendable func observe(progress: Progress, attachment: Attachment, download: Download) { let observer = progress.observe(\.fractionCompleted) { [weak self] progress, _ in self?.observable.on(.next(Update(download: download, kind: .progress(CGFloat(progress.fractionCompleted))))) } diff --git a/Zotero/Controllers/IdentifierLookupController.swift b/Zotero/Controllers/IdentifierLookupController.swift index deb874eb7..bd451672e 100644 --- a/Zotero/Controllers/IdentifierLookupController.swift +++ b/Zotero/Controllers/IdentifierLookupController.swift @@ -525,7 +525,7 @@ final class IdentifierLookupController { } } - func cleanup(completion: @escaping (Bool) -> Void) { + @Sendable func cleanup(completion: @escaping (Bool) -> Void) { lookupData = [:] lookupSavedCount = 0 lookupFailedCount = 0 diff --git a/Zotero/Extensions/AsynchronousOperation.swift b/Zotero/Extensions/AsynchronousOperation.swift index a16b126fc..08adfebf9 100644 --- a/Zotero/Extensions/AsynchronousOperation.swift +++ b/Zotero/Extensions/AsynchronousOperation.swift @@ -8,7 +8,7 @@ import Foundation -class AsynchronousOperation: Operation { +class AsynchronousOperation: Operation, @unchecked Sendable { private enum State: String { case ready = "isReady" case executing = "isExecuting" diff --git a/Zotero/Extensions/CoreGraphics+Extensions.swift b/Zotero/Extensions/CoreGraphics+Extensions.swift index c53b4e49d..ec1ff5028 100644 --- a/Zotero/Extensions/CoreGraphics+Extensions.swift +++ b/Zotero/Extensions/CoreGraphics+Extensions.swift @@ -59,7 +59,7 @@ extension CGPoint { } } -extension CGSize: Hashable { +extension CGSize: @retroactive Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(width) hasher.combine(height) diff --git a/Zotero/Models/Database/Database.swift b/Zotero/Models/Database/Database.swift index cad39b78c..763fb2f6d 100644 --- a/Zotero/Models/Database/Database.swift +++ b/Zotero/Models/Database/Database.swift @@ -101,7 +101,7 @@ struct Database { let fields = oldObject["fields"] as? List, let index = fields.firstIndex(where: { $0["key"] as? String == FieldKeys.Item.Annotation.color }), let color = fields[index]["value"] as? String, - let newColor = AnnotationsConfig.colorVariationMap[color], + let newColor = colorVariationMap[color], color != newColor else { return } diff --git a/Zotero/Scenes/Detail/Items/Views/ItemsViewController.swift b/Zotero/Scenes/Detail/Items/Views/ItemsViewController.swift index 75b1b4784..644ba72d6 100644 --- a/Zotero/Scenes/Detail/Items/Views/ItemsViewController.swift +++ b/Zotero/Scenes/Detail/Items/Views/ItemsViewController.swift @@ -499,7 +499,6 @@ final class ItemsViewController: UIViewController { var image: UIImage? var title: String? let primaryAction: UIAction? - var menu: UIMenu? let accessibilityLabel: String switch type { @@ -548,7 +547,7 @@ final class ItemsViewController: UIViewController { } } - let item = UIBarButtonItem(title: title, image: image, primaryAction: primaryAction, menu: menu) + let item = UIBarButtonItem(title: title, image: image, primaryAction: primaryAction) item.tag = type.rawValue item.accessibilityLabel = accessibilityLabel return item diff --git a/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift b/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift index 400223bfb..a808e6686 100644 --- a/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift +++ b/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift @@ -953,12 +953,14 @@ extension PDFDocumentViewController: UIPencilInteractionDelegate { let color = viewModel.state.toolColors[previous] toggle(annotationTool: previous, color: color, tappedWithStylus: true) - case .showColorPalette, .showInkAttributes: + case .showColorPalette, .showInkAttributes, .showContextualPalette: self.parentDelegate?.showToolOptions() - case .ignore: break + case .runSystemShortcut, .ignore: + break - @unknown default: break + @unknown default: + break } } }