diff --git a/ZShare/ViewModels/ExtensionViewModel.swift b/ZShare/ViewModels/ExtensionViewModel.swift index 1ffec8186..c54e4ee53 100644 --- a/ZShare/ViewModels/ExtensionViewModel.swift +++ b/ZShare/ViewModels/ExtensionViewModel.swift @@ -10,6 +10,7 @@ import Combine import Foundation import MobileCoreServices import WebKit +import UniformTypeIdentifiers import Alamofire import CocoaLumberjackSwift @@ -377,13 +378,13 @@ final class ExtensionViewModel { } private func loadProviderData(from itemProvider: NSItemProvider) -> Observable> { - if itemProvider.hasItemConformingToTypeIdentifier(kUTTypePropertyList as String) { + if itemProvider.hasItemConformingToTypeIdentifier(UTType.propertyList.identifier) { DDLogInfo("ExtensionViewModel: item provider for property list") return self.loadWebData(from: itemProvider) - } else if itemProvider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) { + } else if itemProvider.hasItemConformingToTypeIdentifier(UTType.url.identifier) { DDLogInfo("ExtensionViewModel: item provider for URL") return self.loadUrl(from: itemProvider) - } else if itemProvider.hasItemConformingToTypeIdentifier(kUTTypePlainText as String) { + } else if itemProvider.hasItemConformingToTypeIdentifier(UTType.plainText.identifier) { DDLogInfo("ExtensionViewModel: item provider for plain text") return self.loadPlainText(from: itemProvider) } @@ -498,7 +499,7 @@ final class ExtensionViewModel { DDLogInfo("ExtensionViewModel: load item provider") - itemProvider.loadItem(forTypeIdentifier: (kUTTypeURL as String), options: nil, completionHandler: { item, error -> Void in + itemProvider.loadItem(forTypeIdentifier: (UTType.url.identifier), options: nil, completionHandler: { item, error -> Void in DDLogInfo("ExtensionViewModel: loaded item provider") if let error = error { DDLogError("ExtensionViewModel: url load error - \(error)") @@ -533,7 +534,7 @@ final class ExtensionViewModel { DDLogInfo("ExtensionViewModel: load item provider") - itemProvider.loadItem(forTypeIdentifier: (kUTTypePropertyList as String), options: nil, completionHandler: { item, error -> Void in + itemProvider.loadItem(forTypeIdentifier: (UTType.propertyList.identifier), options: nil, completionHandler: { item, error -> Void in DDLogInfo("ExtensionViewModel: loaded item provider") if let error = error { DDLogError("ExtensionViewModel: web data load error - \(error)") @@ -583,7 +584,7 @@ final class ExtensionViewModel { DDLogInfo("ExtensionViewModel: load item provider") - itemProvider.loadItem(forTypeIdentifier: (kUTTypePlainText as String), options: nil, completionHandler: { item, error -> Void in + itemProvider.loadItem(forTypeIdentifier: (UTType.plainText.identifier), options: nil, completionHandler: { item, error -> Void in DDLogInfo("ExtensionViewModel: loaded item provider") if let error = error { DDLogError("ExtensionViewModel: url plaintext error - \(error)") diff --git a/Zotero.xcodeproj/project.pbxproj b/Zotero.xcodeproj/project.pbxproj index 4ad7ef864..0f68e1ab4 100644 --- a/Zotero.xcodeproj/project.pbxproj +++ b/Zotero.xcodeproj/project.pbxproj @@ -774,7 +774,6 @@ B3830CEA255451DC00910FE0 /* TagPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3830CE8255451DC00910FE0 /* TagPickerViewController.swift */; }; B3830CF625545EE400910FE0 /* TagPickerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3830CF425545EE400910FE0 /* TagPickerCell.swift */; }; B3830CF725545EE400910FE0 /* TagPickerCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = B3830CF525545EE400910FE0 /* TagPickerCell.xib */; }; - B3841080281AC752006751B0 /* UITableViewDiffableDataSource+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B384107F281AC752006751B0 /* UITableViewDiffableDataSource+Extensions.swift */; }; B385B70E25C03E7E0073CA6F /* PDFExportState.swift in Sources */ = {isa = PBXBuildFile; fileRef = B385B70D25C03E7E0073CA6F /* PDFExportState.swift */; }; B386328626C5499900183062 /* TranslatorsAndStylesController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B36A988C2428E059005D5790 /* TranslatorsAndStylesController.swift */; }; B3863FC82AD819AB005082F0 /* EndItemDetailEditingDbRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3863FC72AD819AB005082F0 /* EndItemDetailEditingDbRequest.swift */; }; @@ -1720,7 +1719,6 @@ B3830CE8255451DC00910FE0 /* TagPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TagPickerViewController.swift; sourceTree = ""; }; B3830CF425545EE400910FE0 /* TagPickerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagPickerCell.swift; sourceTree = ""; }; B3830CF525545EE400910FE0 /* TagPickerCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TagPickerCell.xib; sourceTree = ""; }; - B384107F281AC752006751B0 /* UITableViewDiffableDataSource+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewDiffableDataSource+Extensions.swift"; sourceTree = ""; }; B385B70D25C03E7E0073CA6F /* PDFExportState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PDFExportState.swift; sourceTree = ""; }; B3863FC72AD819AB005082F0 /* EndItemDetailEditingDbRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EndItemDetailEditingDbRequest.swift; sourceTree = ""; }; B3863FC92AD830DE005082F0 /* DeleteCreatorItemDetailDbRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteCreatorItemDetailDbRequest.swift; sourceTree = ""; }; @@ -2433,7 +2431,6 @@ B3593ADB24B60A7600CA0B57 /* UISearchBar+Extensions.swift */, B36C07DD26FB264800C855A9 /* UITableView+Extensions.swift */, B3B953D12459B4D800FC96DB /* UITableViewCell+SwiftUI.swift */, - B384107F281AC752006751B0 /* UITableViewDiffableDataSource+Extensions.swift */, B305651223FC051E003304F2 /* UIView+Extensions.swift */, B305650E23FC051E003304F2 /* UIViewController+Extensions.swift */, B340831228F983CF0087D1A1 /* URL+Extensions.swift */, @@ -4821,7 +4818,6 @@ B305660A23FC051E003304F2 /* RegisterUploadRequest.swift in Sources */, B31CC57F28646D8E0055C114 /* ManualLookupAction.swift in Sources */, B3E8FE582714323200F51458 /* SavingSettingsAction.swift in Sources */, - B3841080281AC752006751B0 /* UITableViewDiffableDataSource+Extensions.swift in Sources */, B3ADBCB827CFB64B00B7041F /* PDFSettingsViewController.swift in Sources */, B305662B23FC051F003304F2 /* SyncProgressHandler.swift in Sources */, B3F09AE629CAFF860084E4D8 /* TagFilterActionHandler.swift in Sources */, @@ -5628,7 +5624,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -5686,7 +5682,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -5717,7 +5713,7 @@ ); GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; INFOPLIST_FILE = Zotero/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -5754,7 +5750,7 @@ ); GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; INFOPLIST_FILE = Zotero/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -5787,7 +5783,7 @@ "TESTING=1", ); INFOPLIST_FILE = ZoteroTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -5814,7 +5810,7 @@ COPY_PHASE_STRIP = YES; DEVELOPMENT_TEAM = 8LAYR367YV; INFOPLIST_FILE = ZoteroTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -5840,7 +5836,7 @@ COPY_PHASE_STRIP = YES; DEVELOPMENT_TEAM = 8LAYR367YV; INFOPLIST_FILE = ZoteroUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -5866,7 +5862,7 @@ COPY_PHASE_STRIP = YES; DEVELOPMENT_TEAM = 8LAYR367YV; INFOPLIST_FILE = ZoteroUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -5896,7 +5892,7 @@ "$(PROJECT_DIR)", ); INFOPLIST_FILE = ZShare/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -5927,7 +5923,7 @@ "$(PROJECT_DIR)", ); INFOPLIST_FILE = ZShare/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.7; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -6024,7 +6020,7 @@ repositoryURL = "https://github.com/RxSwiftCommunity/RxSwiftExt"; requirement = { kind = exactVersion; - version = 6.2.0; + version = 6.2.1; }; }; B356A3792524A63D003F1943 /* XCRemoteSwiftPackageReference "SwiftyGif" */ = { @@ -6040,7 +6036,7 @@ repositoryURL = "https://github.com/weichsel/ZIPFoundation"; requirement = { kind = exactVersion; - version = 0.9.16; + version = 0.9.17; }; }; B356A3882524A698003F1943 /* XCRemoteSwiftPackageReference "Nimble" */ = { @@ -6080,7 +6076,7 @@ repositoryURL = "https://github.com/realm/realm-cocoa"; requirement = { kind = exactVersion; - version = 10.42.2; + version = 10.43.1; }; }; B35E4B8B25248B3C000EA134 /* XCRemoteSwiftPackageReference "RxSwift" */ = { @@ -6096,7 +6092,7 @@ repositoryURL = "https://github.com/PSPDFKit/PSPDFKit-SP"; requirement = { kind = exactVersion; - version = 12.3.1; + version = 13.0.1; }; }; B3D84BEE27919FDE005DDD7C /* XCRemoteSwiftPackageReference "Starscream" */ = { diff --git a/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 29a87eb52..16af7d309 100644 --- a/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Zotero.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -77,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/PSPDFKit/PSPDFKit-SP", "state" : { - "revision" : "33f91d1c5cac1a68876582bf05b561a9155a410c", - "version" : "12.3.1" + "revision" : "324c9a623e879e7a1ff8aa8e1968739619ae538d", + "version" : "13.0.1" } }, { @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-cocoa", "state" : { - "revision" : "2ce1ef9a5d48d34470bfd21d3b722fa9c05c0b4e", - "version" : "10.42.2" + "revision" : "a3da8c91ee44c7610d4b1100bd3079ddca26ab84", + "version" : "10.43.1" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-core", "state" : { - "revision" : "1eb93c9619f6a05b5a91c2719690606016802e0b", - "version" : "13.20.1" + "revision" : "c569bec4d04da84030d94f376437bc4efda3686b", + "version" : "13.23.1" } }, { @@ -122,8 +122,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/RxSwiftCommunity/RxSwiftExt", "state" : { - "revision" : "a8065d19acbdee55c6e2b2d9a17a420e34ab8d83", - "version" : "6.2.0" + "revision" : "eb4adf9f00a21b3efc3869a5218a6d7517e95222", + "version" : "6.2.1" } }, { @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/weichsel/ZIPFoundation", "state" : { - "revision" : "43ec568034b3731101dbf7670765d671c30f54f3", - "version" : "0.9.16" + "revision" : "a3f5c2bae0f04b0bce9ef3c4ba6bd1031a0564c4", + "version" : "0.9.17" } } ], diff --git a/Zotero/Extensions/String+Extensions.swift b/Zotero/Extensions/String+Extensions.swift index 798d39235..613146006 100644 --- a/Zotero/Extensions/String+Extensions.swift +++ b/Zotero/Extensions/String+Extensions.swift @@ -8,15 +8,11 @@ import Foundation import CoreServices +import UniformTypeIdentifiers extension String { var mimeTypeFromExtension: String? { - if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, self as NSString, nil)?.takeRetainedValue() { - if let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() { - return mimetype as String - } - } - return nil + UTType(tag: self, tagClass: .filenameExtension, conformingTo: nil)?.preferredMIMEType } var extensionFromMimeType: String? { @@ -36,10 +32,7 @@ extension String { default: break } - guard let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, self as CFString, nil), - let ext = UTTypeCopyPreferredTagWithClass(uti.takeRetainedValue(), kUTTagClassFilenameExtension) - else { return nil } - return ext.takeRetainedValue() as String + return UTType(tag: self, tagClass: .mimeType, conformingTo: nil)?.preferredFilenameExtension } var strippedHtmlTags: String { diff --git a/Zotero/Extensions/UIPasteboard+Extensions.swift b/Zotero/Extensions/UIPasteboard+Extensions.swift index 98f53caa0..a511e765d 100644 --- a/Zotero/Extensions/UIPasteboard+Extensions.swift +++ b/Zotero/Extensions/UIPasteboard+Extensions.swift @@ -8,6 +8,7 @@ import MobileCoreServices import UIKit +import UniformTypeIdentifiers import CocoaLumberjackSwift @@ -19,12 +20,12 @@ extension UIPasteboard { return } - var item: [String: Any] = [(kUTTypePlainText as String): plaintext, (kUTTypeHTML as String): htmlData] + var item: [String: Any] = [UTType.plainText.identifier: plaintext, UTType.html.identifier: htmlData] do { let attrString = try NSAttributedString(data: htmlData, options: [.documentType: NSAttributedString.DocumentType.html], documentAttributes: nil) let data = try attrString.data(from: NSRange(location: 0, length: attrString.length), documentAttributes: [.documentType: NSAttributedString.DocumentType.rtf]) - item[kUTTypeRTF as String] = data + item[UTType.rtf.identifier] = data } catch let error { DDLogError("UIPasteboard: can't convert html to attributed string or rtf - \(error)") } diff --git a/Zotero/Extensions/UITableViewDiffableDataSource+Extensions.swift b/Zotero/Extensions/UITableViewDiffableDataSource+Extensions.swift deleted file mode 100644 index f94bb3595..000000000 --- a/Zotero/Extensions/UITableViewDiffableDataSource+Extensions.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// UITableViewDiffableDataSource+Extensions.swift -// Zotero -// -// Created by Michal Rentka on 28.04.2022. -// Copyright © 2022 Corporation for Digital Scholarship. All rights reserved. -// - -import UIKit - -extension UITableViewDiffableDataSource { - func section(for section: Int) -> SectionIdentifierType? { - if #available(iOS 15.0, *) { - return self.sectionIdentifier(for: section) - } else { - let snapshot = self.snapshot() - if section < snapshot.sectionIdentifiers.count { - return snapshot.sectionIdentifiers[section] - } - return nil - } - } - - func sectionIndex(for section: SectionIdentifierType) -> Int? { - if #available(iOS 15.0, *) { - return self.index(for: section) - } else { - let snapshot = self.snapshot() - if let index = snapshot.sectionIdentifiers.firstIndex(of: section) { - return index - } - return nil - } - } -} - -extension UICollectionViewDiffableDataSource { - func section(for section: Int) -> SectionIdentifierType? { - if #available(iOS 15.0, *) { - return self.sectionIdentifier(for: section) - } else { - let snapshot = self.snapshot() - if section < snapshot.sectionIdentifiers.count { - return snapshot.sectionIdentifiers[section] - } - return nil - } - } - - func sectionIndex(for section: SectionIdentifierType) -> Int? { - if #available(iOS 15.0, *) { - return self.index(for: section) - } else { - let snapshot = self.snapshot() - if let index = snapshot.sectionIdentifiers.firstIndex(of: section) { - return index - } - return nil - } - } -} diff --git a/Zotero/Models/StringAttributes.swift b/Zotero/Models/StringAttributes.swift index 48d9b8d51..09b2a407c 100644 --- a/Zotero/Models/StringAttributes.swift +++ b/Zotero/Models/StringAttributes.swift @@ -122,8 +122,8 @@ enum StringAttribute: CaseIterable { case .smallcaps: descriptorAttributes[.featureSettings] = [ - [UIFontDescriptor.FeatureKey.featureIdentifier: kLowerCaseType, UIFontDescriptor.FeatureKey.typeIdentifier: kLowerCaseSmallCapsSelector], - [UIFontDescriptor.FeatureKey.featureIdentifier: kUpperCaseType, UIFontDescriptor.FeatureKey.typeIdentifier: kUpperCaseSmallCapsSelector] + [UIFontDescriptor.FeatureKey.type: kLowerCaseType, UIFontDescriptor.FeatureKey.selector: kLowerCaseSmallCapsSelector], + [UIFontDescriptor.FeatureKey.type: kUpperCaseType, UIFontDescriptor.FeatureKey.selector: kUpperCaseSmallCapsSelector] ] } } diff --git a/Zotero/Scenes/Detail/ItemDetail/Views/ItemDetailCollectionViewHandler.swift b/Zotero/Scenes/Detail/ItemDetail/Views/ItemDetailCollectionViewHandler.swift index 6e2361400..cbc7d8d59 100644 --- a/Zotero/Scenes/Detail/ItemDetail/Views/ItemDetailCollectionViewHandler.swift +++ b/Zotero/Scenes/Detail/ItemDetail/Views/ItemDetailCollectionViewHandler.swift @@ -594,7 +594,7 @@ final class ItemDetailCollectionViewHandler: NSObject { // MARK: - Layout private func layoutMargins(for indexPath: IndexPath) -> UIEdgeInsets { - guard let section = self.dataSource.section(for: indexPath.section)?.section else { return UIEdgeInsets() } + guard let section = dataSource.sectionIdentifier(for: indexPath.section)?.section else { return UIEdgeInsets() } let isEditing = self.viewModel.state.isEditing let isFirstRow = indexPath.row == 0 @@ -609,7 +609,7 @@ final class ItemDetailCollectionViewHandler: NSObject { var supplementaryItems: [NSCollectionLayoutBoundarySupplementaryItem] = [] - if let section = self.dataSource.section(for: index) { + if let section = dataSource.sectionIdentifier(for: index) { self.setupSeparators(in: &configuration, section: section) self.setupSwipeActions(in: &configuration) if let header = self.createHeader(for: section.section) { @@ -945,7 +945,7 @@ extension ItemDetailCollectionViewHandler: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, targetIndexPathForMoveOfItemFromOriginalIndexPath originalIndexPath: IndexPath, atCurrentIndexPath currentIndexPath: IndexPath, toProposedIndexPath proposedIndexPath: IndexPath) -> IndexPath { - let section = self.dataSource.section(for: proposedIndexPath.section)?.section + let section = dataSource.sectionIdentifier(for: proposedIndexPath.section)?.section if section != .creators { return originalIndexPath } if let row = self.dataSource.itemIdentifier(for: proposedIndexPath) { switch row { diff --git a/Zotero/Scenes/Detail/Lookup/Views/ManualLookupViewController.swift b/Zotero/Scenes/Detail/Lookup/Views/ManualLookupViewController.swift index 4ebc4e947..f6ae80329 100644 --- a/Zotero/Scenes/Detail/Lookup/Views/ManualLookupViewController.swift +++ b/Zotero/Scenes/Detail/Lookup/Views/ManualLookupViewController.swift @@ -185,7 +185,7 @@ class ManualLookupViewController: UIViewController { let responder = LiveTextResponder(viewModel: self.viewModel) - if #available(iOS 15.0, *), responder.canPerformAction(#selector(UIResponder.captureTextFromCamera), withSender: self.scanButton) { + if responder.canPerformAction(#selector(UIResponder.captureTextFromCamera), withSender: self.scanButton) { var configuration = self.scanButton.configuration ?? UIButton.Configuration.bordered() configuration.title = L10n.scanText configuration.image = UIImage(systemName: "text.viewfinder") @@ -195,8 +195,6 @@ class ManualLookupViewController: UIViewController { self.scanButton.addAction(.captureTextFromCamera(responder: responder, identifier: nil), for: .touchUpInside) self.liveTextResponder = responder - } else { - self.scanButton.isHidden = true } let isPhone = UIDevice.current.userInterfaceIdiom == .phone diff --git a/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift b/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift index 3799a2115..fa6c3f69b 100644 --- a/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift +++ b/Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift @@ -838,27 +838,15 @@ extension UIMenu.Identifier { extension UIAction { fileprivate func replacing(title: String? = nil, handler: @escaping UIActionHandler) -> UIAction { - if #available(iOS 15.0, *) { - return UIAction( - title: title ?? self.title, - subtitle: self.subtitle, - image: title != nil ? nil : self.image, - identifier: self.identifier, - discoverabilityTitle: self.discoverabilityTitle, - attributes: self.attributes, - state: self.state, - handler: handler - ) - } else { - return UIAction( - title: title ?? self.title, - image: title != nil ? nil : self.image, - identifier: self.identifier, - discoverabilityTitle: self.discoverabilityTitle, - attributes: self.attributes, - state: self.state, - handler: handler - ) - } + UIAction( + title: title ?? self.title, + subtitle: self.subtitle, + image: title != nil ? nil : self.image, + identifier: self.identifier, + discoverabilityTitle: self.discoverabilityTitle, + attributes: self.attributes, + state: self.state, + handler: handler + ) } } diff --git a/Zotero/Scenes/Detail/PDF/Views/SearchBar.swift b/Zotero/Scenes/Detail/PDF/Views/SearchBar.swift index 07a2f7c70..31e9684c3 100644 --- a/Zotero/Scenes/Detail/PDF/Views/SearchBar.swift +++ b/Zotero/Scenes/Detail/PDF/Views/SearchBar.swift @@ -109,15 +109,10 @@ final class SearchBar: UIView { let clearImage = UIImage(systemName: "xmark.circle.fill", withConfiguration: UIImage.SymbolConfiguration(scale: .medium))?.withRenderingMode(.alwaysTemplate) - if #available(iOS 15.0, *) { - var clearConfiguration = UIButton.Configuration.plain() - clearConfiguration.contentInsets = NSDirectionalEdgeInsets(top: 8, leading: self.cornerRadius, bottom: 8, trailing: self.cornerRadius) - clearConfiguration.image = clearImage - clear.configuration = clearConfiguration - } else { - clear.setImage(clearImage, for: .normal) - clear.contentEdgeInsets = UIEdgeInsets(top: 8, left: self.cornerRadius, bottom: 8, right: self.cornerRadius) - } + var clearConfiguration = UIButton.Configuration.plain() + clearConfiguration.contentInsets = NSDirectionalEdgeInsets(top: 8, leading: self.cornerRadius, bottom: 8, trailing: self.cornerRadius) + clearConfiguration.image = clearImage + clear.configuration = clearConfiguration let cancel = UIButton(type: .custom) cancel.translatesAutoresizingMaskIntoConstraints = false