diff --git a/.travis.yml b/.travis.yml index 86c5a926..6caddc77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: swift -osx_image: xcode12.2 +osx_image: xcode12.5 xcode_project: r2-shared-swift.xcodeproj xcode_scheme: r2-shared-swift -xcode_destination: platform=iOS Simulator,OS=13.7,name=iPhone X -xcode_sdk: iphonesimulator13.7 +xcode_destination: platform=iOS Simulator,OS=14.5.1,name=iPhone X +xcode_sdk: iphonesimulator14.5.1 branches: only: @@ -18,6 +18,11 @@ before_install: - brew update - brew outdated carthage || brew upgrade carthage - carthage bootstrap --verbose --no-use-binaries --use-xcframeworks --platform iOS --cache-builds + # The project expects .framework but we can only build XCFrameworks with Carthage on Xcode 12+. + # As a workaround, this will extract the .framework generated from the .xcframework files. + # See https://github.com/readium/r2-testapp-swift/issues/351#issuecomment-829250100 + - mkdir -p Carthage/Build/iOS + - cp -r Carthage/Build/*.xcframework/ios-arm64_armv7/*.framework Carthage/Build/iOS script: - xcodebuild clean build -quiet diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c677195..7bbd7491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file. **Warning:** Features marked as *experimental* may change or be removed in a future release without notice. Use with caution. - + + +## [2.0.0] + +### Deprecated + +* All APIs deprecated in previous versions are now unavailable. +* `DownloadSession` is deprecated and will be removed in the next major version. Please migrate to your own download solution. + ## [2.0.0-beta.2] @@ -98,3 +106,4 @@ All notable changes to this project will be documented in this file. [2.0.0-alpha.2]: https://github.com/readium/r2-shared-swift/compare/2.0.0-alpha.1...2.0.0-alpha.2 [2.0.0-beta.1]: https://github.com/readium/r2-shared-swift/compare/2.0.0-alpha.2...2.0.0-beta.1 [2.0.0-beta.2]: https://github.com/readium/r2-shared-swift/compare/2.0.0-beta.1...2.0.0-beta.2 +[2.0.0]: https://github.com/readium/r2-shared-swift/compare/2.0.0-beta.2...2.0.0 diff --git a/R2Shared.podspec b/R2Shared.podspec index 68ad3f6a..6b27b0dd 100644 --- a/R2Shared.podspec +++ b/R2Shared.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'R2Shared' - s.version = '2.0.0-beta.2' + s.version = '2.0.0' s.license = 'BSD 3-Clause License' s.summary = 'R2 Shared' s.homepage = 'http://readium.github.io' diff --git a/r2-shared-swift.xcodeproj/project.pbxproj b/r2-shared-swift.xcodeproj/project.pbxproj index 0d885c82..ed017277 100644 --- a/r2-shared-swift.xcodeproj/project.pbxproj +++ b/r2-shared-swift.xcodeproj/project.pbxproj @@ -1106,7 +1106,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0940; - LastUpgradeCheck = 1240; + LastUpgradeCheck = 1250; ORGANIZATIONNAME = Readium; TargetAttributes = { CA6161E921FB257700D2CFE3 = { diff --git a/r2-shared-swift.xcodeproj/xcshareddata/xcschemes/r2-shared-swift.xcscheme b/r2-shared-swift.xcodeproj/xcshareddata/xcschemes/r2-shared-swift.xcscheme index 18025845..d291241f 100644 --- a/r2-shared-swift.xcodeproj/xcshareddata/xcschemes/r2-shared-swift.xcscheme +++ b/r2-shared-swift.xcodeproj/xcshareddata/xcschemes/r2-shared-swift.xcscheme @@ -1,6 +1,6 @@ Void) { completion(nil) } - @available(*, deprecated, message: "Use `LCPLicense.returnPublication` instead") + @available(*, unavailable, message: "Use `LCPLicense.returnPublication` instead") public func `return`(completion: @escaping (Error?) -> Void) { completion(nil) } - @available(*, deprecated, message: "Checking for the rights is handled by r2-lcp-swift now") + @available(*, unavailable, message: "Checking for the rights is handled by r2-lcp-swift now") public func areRightsValid() throws {} - @available(*, deprecated, message: "Registering the device is handled by r2-lcp-swift now") + @available(*, unavailable, message: "Registering the device is handled by r2-lcp-swift now") public func register() {} - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func currentStatus() -> String { return "" } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func lastUpdate() -> Date { return Date() } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func issued() -> Date { return Date() } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func provider() -> URL { return URL(fileURLWithPath: "/") } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func rightsEnd() -> Date? { return nil } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func potentialRightsEnd() -> Date? { return nil } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func rightsStart() -> Date? { return nil } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func rightsPrints() -> Int? { return nil } - @available(*, deprecated, message: "Update DrmManagementTableViewController from r2-testapp-swift") + @available(*, unavailable, message: "Update DrmManagementTableViewController from r2-testapp-swift") public func rightsCopies() -> Int? { return nil } diff --git a/r2-shared-swift/Publication/ContentLayout.swift b/r2-shared-swift/Publication/ContentLayout.swift index e3a1c0ed..f577466c 100644 --- a/r2-shared-swift/Publication/ContentLayout.swift +++ b/r2-shared-swift/Publication/ContentLayout.swift @@ -11,7 +11,7 @@ import Foundation -@available(*, deprecated, message: "Use `publication.metadata.effectiveReadingProgression` instead") +@available(*, unavailable, message: "Use `publication.metadata.effectiveReadingProgression` instead") public enum ContentLayout: String { case rtl = "rtl" case ltr = "ltr" diff --git a/r2-shared-swift/Publication/Link.swift b/r2-shared-swift/Publication/Link.swift index f2aa52ca..6cba414b 100644 --- a/r2-shared-swift/Publication/Link.swift +++ b/r2-shared-swift/Publication/Link.swift @@ -292,17 +292,17 @@ extension Array where Element == Link { } } - @available(*, deprecated, message: "This API will be removed.") + @available(*, unavailable, message: "This API will be removed.") public func firstIndex(withProperty otherProperty: String, matching: T, recursively: Bool = false) -> Int? { return firstIndex { ($0.properties.otherProperties[otherProperty] as? T) == matching } } - @available(*, deprecated, renamed: "first(withHREF:)") + @available(*, unavailable, renamed: "first(withHREF:)") public func first(withHref href: String) -> Link? { return first(withHREF: href) } - @available(*, deprecated, renamed: "firstIndex(withHREF:)") + @available(*, unavailable, renamed: "firstIndex(withHREF:)") public func firstIndex(withHref href: String) -> Int? { return firstIndex(withHREF: href) } diff --git a/r2-shared-swift/Publication/Locator.swift b/r2-shared-swift/Publication/Locator.swift index aa1340aa..a1cae058 100644 --- a/r2-shared-swift/Publication/Locator.swift +++ b/r2-shared-swift/Publication/Locator.swift @@ -207,7 +207,7 @@ public struct Locator: Hashable, CustomStringConvertible, Loggable { fatalError() } - @available(*, deprecated, message: "Use `fragments.first` instead") + @available(*, unavailable, message: "Use `fragments.first` instead") public var fragment: String? { fragments.first } } diff --git a/r2-shared-swift/Publication/Publication+Deprecated.swift b/r2-shared-swift/Publication/Publication+Deprecated.swift index 6106cdda..925f6108 100644 --- a/r2-shared-swift/Publication/Publication+Deprecated.swift +++ b/r2-shared-swift/Publication/Publication+Deprecated.swift @@ -11,17 +11,17 @@ import Foundation -@available(*, deprecated, renamed: "Publication") +@available(*, unavailable, renamed: "Publication") public typealias WebPublication = Publication extension Publication { - @available(*, deprecated, renamed: "init(manifest:)") + @available(*, unavailable, renamed: "init(manifest:)") public convenience init() { self.init(manifest: Manifest(metadata: Metadata(title: ""))) } - @available(*, deprecated, renamed: "init(format:formatVersion:manifest:)") + @available(*, unavailable, renamed: "init(format:formatVersion:manifest:)") public convenience init(format: Format = .unknown, formatVersion: String? = nil, positionListFactory: @escaping (Publication) -> [Locator] = { _ in [] }, context: [String] = [], metadata: Metadata, links: [Link] = [], readingOrder: [Link] = [], resources: [Link] = [], tableOfContents: [Link] = [], otherCollections: [String: [PublicationCollection]] = [:]) { self.init( manifest: Manifest(context: context, metadata: metadata, links: links, readingOrder: readingOrder, resources: resources, tableOfContents: tableOfContents, subcollections: otherCollections), @@ -35,7 +35,7 @@ extension Publication { fatalError("Not available.") } - @available(*, deprecated, renamed: "formatVersion") + @available(*, unavailable, renamed: "formatVersion") public var version: Double { guard let versionString = formatVersion, let version = Double(versionString) else @@ -50,13 +50,13 @@ extension Publication { @available(*, unavailable, message: "Implement `PositionsService` instead") public var positionListFactory: (Publication) -> [Locator] { { _ in [] } } - @available(*, deprecated, renamed: "baseURL") + @available(*, unavailable, renamed: "baseURL") public var baseUrl: URL? { return baseURL } @available(*, unavailable, message: "This is not used anymore, don't set it") public var updatedDate: Date { Date() } - @available(*, deprecated, message: "Check the publication's type using `format` instead") + @available(*, unavailable, message: "Check the publication's type using `format` instead") public var internalData: [String: String] { // The code in the testapp used to check a property in `publication.internalData["type"]` to know which kind of publication this is. // To avoid breaking any app, we reproduce this value here: @@ -84,26 +84,26 @@ extension Publication { fatalError("Not available") } - @available(*, deprecated, renamed: "positions") + @available(*, unavailable, renamed: "positions") public var positionList: [Locator] { positions } - @available(*, deprecated, renamed: "positionsByResource") - public var positionListByResource: [String: [Locator]] { positionsByResource } + @available(*, unavailable, renamed: "positionsByResource") + public var positionListByResource: [String: [Locator]] { [:] } - @available(*, deprecated, renamed: "subcollections") + @available(*, unavailable, renamed: "subcollections") public var otherCollections: [String: [PublicationCollection]] { subcollections } - @available(*, deprecated, renamed: "link(withHREF:)") + @available(*, unavailable, renamed: "link(withHREF:)") public func resource(withRelativePath path: String) -> Link? { return link(withHREF: path) } - @available(*, deprecated, renamed: "link(withHREF:)") + @available(*, unavailable, renamed: "link(withHREF:)") public func resource(withHref href: String) -> Link? { return link(withHREF: href) } - @available(*, deprecated, message: "Use `setSelfLink` instead") + @available(*, unavailable, message: "Use `setSelfLink` instead") public func addSelfLink(endpoint: String, for baseURL: URL) { let manifestURL = baseURL.appendingPathComponent("\(endpoint)/manifest.json") setSelfLink(href: manifestURL.absoluteString) @@ -112,12 +112,12 @@ extension Publication { @available(*, unavailable, message: "`Publication` is now immutable") func setCollectionLinks(_ links: [Link], forRole role: String) {} - @available(*, deprecated, renamed: "link(withHREF:)") + @available(*, unavailable, renamed: "link(withHREF:)") public func link(withHref href: String) -> Link? { return link(withHREF: href) } - @available(*, deprecated, message: "This will be removed in a future version") + @available(*, unavailable, message: "This will be removed in a future version") public func link(where predicate: (Link) -> Bool) -> Link? { return (resources + readingOrder + links).first(where: predicate) } @@ -127,17 +127,17 @@ extension Publication { return link?.url(relativeTo: baseURL) } - @available(*, deprecated, message: "Use `link.url(relativeTo: publication.baseURL)` instead") + @available(*, unavailable, message: "Use `link.url(relativeTo: publication.baseURL)` instead") public func url(to link: Link?) -> URL? { return link?.url(relativeTo: baseURL) } - @available(*, deprecated, message: "Use `link.url(relativeTo: publication.baseURL)` instead") + @available(*, unavailable, message: "Use `link.url(relativeTo: publication.baseURL)` instead") public func url(to href: String?) -> URL? { return href.flatMap { link(withHREF: $0)?.url(relativeTo: baseURL) } } - @available(*, deprecated, message: "Use `cover` to get the `UIImage` directly, or `link(withRel: \"cover\")` if you really want the cover link", renamed: "cover") + @available(*, unavailable, message: "Use `cover` to get the `UIImage` directly, or `link(withRel: \"cover\")` if you really want the cover link", renamed: "cover") public var coverLink: Link? { link(withRel: .cover) } @available(*, unavailable, message: "Use `metadata.effectiveReadingProgression` instead", renamed: "metadata.effectiveReadingProgression") @@ -150,25 +150,25 @@ extension Publication { extension Publication { - @available(*, deprecated, renamed: "listOfAudioClips") + @available(*, unavailable, renamed: "listOfAudioClips") public var listOfAudioFiles: [Link] { listOfAudioClips } - @available(*, deprecated, renamed: "listOfVideoClips") + @available(*, unavailable, renamed: "listOfVideoClips") public var listOfVideos: [Link] { listOfVideoClips } } -@available(*, deprecated, renamed: "LocalizedString") +@available(*, unavailable, renamed: "LocalizedString") public typealias MultilangString = LocalizedString extension LocalizedString { - @available(*, deprecated, message: "Get with the property `string`") + @available(*, unavailable, message: "Get with the property `string`") public var singleString: String? { string.isEmpty ? nil : string } - @available(*, deprecated, message: "Get with `string(forLanguageCode:)`") + @available(*, unavailable, message: "Get with `string(forLanguageCode:)`") public var multiString: [String: String] { guard case .localized(let strings) = self else { return [:] @@ -176,7 +176,7 @@ extension LocalizedString { return strings } - @available(*, deprecated, renamed: "LocalizedString.localized") + @available(*, unavailable, renamed: "LocalizedString.localized") public init() { self = .localized([:]) } @@ -185,13 +185,13 @@ extension LocalizedString { extension Metadata { - @available(*, deprecated, renamed: "type") + @available(*, unavailable, renamed: "type") public var rdfType: String? { type } - @available(*, deprecated, renamed: "localizedTitle") + @available(*, unavailable, renamed: "localizedTitle") public var multilangTitle: LocalizedString { localizedTitle } - @available(*, deprecated, renamed: "localizedSubtitle") + @available(*, unavailable, renamed: "localizedSubtitle") public var multilangSubtitle: LocalizedString? { localizedSubtitle } @available(*, unavailable, message: "Not used anymore, you can store the rights in `otherMetadata[\"rights\"]` if necessary") @@ -200,27 +200,27 @@ extension Metadata { @available(*, unavailable, message: "Not used anymore, you can store the source in `otherMetadata[\"source\"]` if necessary") public var source: String? { nil } - @available(*, deprecated, renamed: "init(title:)") + @available(*, unavailable, renamed: "init(title:)") public init() { self.init(title: "") } - @available(*, deprecated, message: "Use `localizedTitle.string(forLanguageCode:)` instead") + @available(*, unavailable, message: "Use `localizedTitle.string(forLanguageCode:)` instead") public func titleForLang(_ lang: String) -> String? { return localizedTitle.string(forLanguageCode: lang) } - @available(*, deprecated, message: "Use `localizedSubtitle.string(forLanguageCode:)` instead") + @available(*, unavailable, message: "Use `localizedSubtitle.string(forLanguageCode:)` instead") public func subtitleForLang(_ lang: String) -> String? { return localizedSubtitle?.string(forLanguageCode: lang) } - @available(*, deprecated, renamed: "init(json:)") + @available(*, unavailable, renamed: "init(json:)") public static func parse(metadataDict: [String: Any]) throws -> Metadata { return try Metadata(json: metadataDict, normalizeHREF: { $0 }) } - @available(*, deprecated, renamed: "presentation") + @available(*, unavailable, renamed: "presentation") public var rendition: EPUBRendition { presentation } @available(*, unavailable, message: "Use `effectiveReadingProgression` instead", renamed: "effectiveReadingProgression") @@ -233,17 +233,17 @@ extension Metadata { extension PublicationCollection { - @available(*, deprecated, renamed: "subcollections") + @available(*, unavailable, renamed: "subcollections") public var otherCollections: [String: [PublicationCollection]] { subcollections } } extension Contributor { - @available(*, deprecated, renamed: "localizedName") + @available(*, unavailable, renamed: "localizedName") public var multilangName: LocalizedString { localizedName } - @available(*, deprecated, renamed: "init(name:)") + @available(*, unavailable, renamed: "init(name:)") public init() { self.init(name: "") } @@ -262,7 +262,7 @@ extension Contributor { extension Subject { - @available(*, deprecated, renamed: "init(name:)") + @available(*, unavailable, renamed: "init(name:)") public init() { self.init(name: "") } @@ -271,21 +271,21 @@ extension Subject { extension Link { - @available(*, deprecated, renamed: "type") + @available(*, unavailable, renamed: "type") public var typeLink: String? { type } - @available(*, deprecated, renamed: "rels") + @available(*, unavailable, renamed: "rels") public var rel: [String] { rels.map { $0.string } } - @available(*, deprecated, renamed: "href") + @available(*, unavailable, renamed: "href") public var absoluteHref: String? { href } - @available(*, deprecated, renamed: "init(href:)") + @available(*, unavailable, renamed: "init(href:)") public init() { self.init(href: "") } - @available(*, deprecated, renamed: "init(json:warnings:normalizeHREF:)") + @available(*, unavailable, renamed: "init(json:warnings:normalizeHREF:)") public init(json: Any, warnings: WarningLogger? = nil, normalizeHref: (String) -> String) throws { try self.init(json: json, warnings: warnings, normalizeHREF: normalizeHref) } @@ -303,7 +303,7 @@ extension Link { extension Array where Element == Link { - @available(*, deprecated, renamed: "init(json:warnings:normalizeHREF:)") + @available(*, unavailable, renamed: "init(json:warnings:normalizeHREF:)") public init(json: Any?, warnings: WarningLogger? = nil, normalizeHref: (String) -> String) { self.init(json: json, warnings: warnings, normalizeHREF: normalizeHref) } @@ -312,13 +312,13 @@ extension Array where Element == Link { extension Properties { - @available(*, deprecated, renamed: "Presentation.Orientation") + @available(*, unavailable, renamed: "Presentation.Orientation") public typealias Orientation = Presentation.Orientation - @available(*, deprecated, renamed: "Presentation.Page") + @available(*, unavailable, renamed: "Presentation.Page") public typealias Page = Presentation.Page - @available(*, deprecated, renamed: "indirectAcquisitions") + @available(*, unavailable, renamed: "indirectAcquisitions") public var indirectAcquisition: [OPDSAcquisition] { indirectAcquisitions } @@ -336,43 +336,43 @@ extension Properties { extension Presentation { - @available(*, deprecated, renamed: "EPUBLayout") + @available(*, unavailable, renamed: "EPUBLayout") public typealias Layout = EPUBLayout } -@available(*, deprecated, renamed: "OPDSPrice") +@available(*, unavailable, renamed: "OPDSPrice") public typealias Price = OPDSPrice -@available(*, deprecated, renamed: "OPDSAcquisition") +@available(*, unavailable, renamed: "OPDSAcquisition") public typealias IndirectAcquisition = OPDSAcquisition extension OPDSAcquisition { - @available(*, deprecated, renamed: "type") + @available(*, unavailable, renamed: "type") public var typeAcquisition: String { type } - @available(*, deprecated, renamed: "children") + @available(*, unavailable, renamed: "children") public var child: [OPDSAcquisition] { children } } -@available(*, deprecated, renamed: "ContentLayout") +@available(*, unavailable, renamed: "ContentLayout") public typealias ContentLayoutStyle = ContentLayout -@available(*, deprecated, renamed: "Presentation") +@available(*, unavailable, renamed: "Presentation") public typealias EPUBRendition = Presentation -@available(*, deprecated, renamed: "Encryption") +@available(*, unavailable, renamed: "Encryption") public typealias EPUBEncryption = Encryption -@available(*, deprecated, renamed: "Locator.Locations") +@available(*, unavailable, renamed: "Locator.Locations") public typealias Locations = Locator.Locations -@available(*, deprecated, renamed: "Locator.Text") +@available(*, unavailable, renamed: "Locator.Text") public typealias LocatorText = Locator.Text -@available(*, deprecated, message: "Use your own Bookmark model in your app, this one is not used by Readium 2 anymore") +@available(*, unavailable, message: "Use your own Bookmark model in your app, this one is not used by Readium 2 anymore") public class Bookmark { public var id: Int64? public var bookID: Int = 0 diff --git a/r2-shared-swift/Publication/Services/Positions/PositionsService.swift b/r2-shared-swift/Publication/Services/Positions/PositionsService.swift index e7f630c6..c076803c 100644 --- a/r2-shared-swift/Publication/Services/Positions/PositionsService.swift +++ b/r2-shared-swift/Publication/Services/Positions/PositionsService.swift @@ -87,7 +87,7 @@ public extension Publication { } /// List of all the positions in each resource, indexed by their `href`. - @available(*, deprecated, message: "Use `positionsByReadingOrder` instead", renamed: "positionsByReadingOrder") + @available(*, unavailable, message: "Use `positionsByReadingOrder` instead", renamed: "positionsByReadingOrder") var positionsByResource: [String: [Locator]] { Dictionary(grouping: positions, by: { $0.href }) } diff --git a/r2-shared-swift/Toolkit/DocumentTypes.swift b/r2-shared-swift/Toolkit/DocumentTypes.swift index 0170c8a1..d4414341 100644 --- a/r2-shared-swift/Toolkit/DocumentTypes.swift +++ b/r2-shared-swift/Toolkit/DocumentTypes.swift @@ -152,7 +152,7 @@ public struct DocumentType: Equatable, Loggable { ?? mediaTypes.first } - @available(*, deprecated, renamed: "preferredMediaType") + @available(*, unavailable, renamed: "preferredMediaType") public var format: MediaType? { preferredMediaType } } @@ -165,21 +165,19 @@ extension DocumentTypes { // See this commit for an example of the changes to do in your reading app: // https://github.com/readium/r2-testapp-swift/commit/7e98784c01f781c962aab87cd79af09dde900b00 - @available(*, deprecated, message: "Use `main.utis` instead", renamed: "main.supportedUTIs") + @available(*, unavailable, message: "Use `main.utis` instead", renamed: "main.supportedUTIs") public static let utis: [String] = main.supportedUTIs - @available(*, deprecated, message: "Use `main.supportsMediaType()` instead", renamed: "main.supportsMediaType()") + @available(*, unavailable, message: "Use `main.supportsMediaType()` instead", renamed: "main.supportsMediaType()") public static let contentTypes: [String] = main.supportedMediaTypes.map { $0.string } - @available(*, deprecated, message: "Use `main.supportsFileExtension()` instead", renamed: "main.supportsFileExtension()") + @available(*, unavailable, message: "Use `main.supportsFileExtension()` instead", renamed: "main.supportsFileExtension()") public static let extensions: [String] = main.supportedFileExtensions /// Returns the content type for the given URL. - @available(*, deprecated, message: "Use `Format.of` to determine the format of a file from its media type or file extension") - public static func contentType(for url: URL?) -> String? { - return contentType(forExtension: url?.pathExtension) - } + @available(*, unavailable, message: "Use `Format.of` to determine the format of a file from its media type or file extension") + public static func contentType(for url: URL?) -> String? { nil } /// Returns the content type for the given document extension. - @available(*, deprecated, message: "Use `Format.of` to determine the format of a file from its media type or file extension") + @available(*, unavailable, message: "Use `Format.of` to determine the format of a file from its media type or file extension") public static func contentType(forExtension ext: String?) -> String? { guard let fileExtension = ext else { return nil @@ -188,7 +186,7 @@ extension DocumentTypes { } /// Returns the document extension for given content type. - @available(*, deprecated, message: "Use `Format.of` to determine the format of a file from its media type or file extension") + @available(*, unavailable, message: "Use `Format.of` to determine the format of a file from its media type or file extension") public static func `extension`(forContentType contentType: String?) -> String? { guard let mediaType = contentType else { return nil diff --git a/r2-shared-swift/Toolkit/DownloadSession.swift b/r2-shared-swift/Toolkit/DownloadSession.swift index da611f0f..676cebf2 100644 --- a/r2-shared-swift/Toolkit/DownloadSession.swift +++ b/r2-shared-swift/Toolkit/DownloadSession.swift @@ -8,6 +8,7 @@ import Foundation +@available(*, deprecated, message: "This API will be removed in the future, please use your own download solution in your app") public protocol DownloadDisplayDelegate { func didStartDownload(task:URLSessionDownloadTask, description:String); func didFinishDownload(task:URLSessionDownloadTask); @@ -17,6 +18,7 @@ public protocol DownloadDisplayDelegate { /// Represents the percent-based progress of the download. +@available(*, deprecated, message: "This API will be removed in the future, please use your own download solution in your app") public enum DownloadProgress { /// Undetermined progress, a spinner should be shown to the user. case infinite @@ -24,7 +26,7 @@ public enum DownloadProgress { case finite(Float) } - +@available(*, deprecated, message: "This API will be removed in the future, please use your own download solution in your app") public class DownloadSession: NSObject, URLSessionDelegate, URLSessionDownloadDelegate { public typealias CompletionHandler = (URL?, URLResponse?, Error?, URLSessionDownloadTask) -> Bool? diff --git a/r2-shared-swift/Toolkit/Media Type/MediaType+Deprecated.swift b/r2-shared-swift/Toolkit/Media Type/MediaType+Deprecated.swift index 23750b73..eda987ef 100644 --- a/r2-shared-swift/Toolkit/Media Type/MediaType+Deprecated.swift +++ b/r2-shared-swift/Toolkit/Media Type/MediaType+Deprecated.swift @@ -6,14 +6,14 @@ import Foundation -@available(*, deprecated, message: "Format and MediaType got merged together", renamed: "MediaType") +@available(*, unavailable, message: "Format and MediaType got merged together", renamed: "MediaType") public typealias Format = MediaType @available(*, unavailable, renamed: "MediaTypeSnifferContext") public typealias FormatSnifferContext = MediaTypeSnifferContext public extension MediaType { - @available(*, deprecated, message: "Format and MediaType got merged together") + @available(*, unavailable, message: "Format and MediaType got merged together") var mediaType: MediaType { self } @available(*, unavailable, renamed: "readiumAudiobook") @@ -24,11 +24,11 @@ public extension MediaType { static var webpub: MediaType { readiumWebPub } @available(*, unavailable, renamed: "readiumWebPubManifest") static var webpubManifest: MediaType { readiumWebPubManifest } - @available(*, deprecated, renamed: "lcpLicenseDocument") + @available(*, unavailable, renamed: "lcpLicenseDocument") static var lcpLicense: MediaType { lcpLicenseDocument } - @available(*, deprecated, renamed: "opds1") + @available(*, unavailable, renamed: "opds1") static var opds1Feed: MediaType { opds1 } - @available(*, deprecated, renamed: "opds2") + @available(*, unavailable, renamed: "opds2") static var opds2Feed: MediaType { opds2 } } @@ -43,4 +43,4 @@ public extension URLResponse { return sniffMediaType(data: data, mediaTypes: mediaTypes, fileExtensions: fileExtensions, sniffers: sniffers) } -} \ No newline at end of file +} diff --git a/r2-shared-swiftTests/Publication/Services/Positions/PositionsServiceTests.swift b/r2-shared-swiftTests/Publication/Services/Positions/PositionsServiceTests.swift index 0d46f53c..047f8400 100644 --- a/r2-shared-swiftTests/Publication/Services/Positions/PositionsServiceTests.swift +++ b/r2-shared-swiftTests/Publication/Services/Positions/PositionsServiceTests.swift @@ -152,9 +152,9 @@ class PositionsServiceTests: XCTestCase { XCTAssertEqual(publication.positions, positions.flatMap { $0 }) XCTAssertEqual( - publication.positionsByResource, + publication.positionsByReadingOrder, [ - "res": [ + [ Locator( href: "res", type: "application/xml", @@ -164,7 +164,7 @@ class PositionsServiceTests: XCTestCase { ) ) ], - "chap1": [ + [ Locator( href: "chap1", type: "image/png", @@ -174,7 +174,7 @@ class PositionsServiceTests: XCTestCase { ) ) ], - "chap2": [ + [ Locator( href: "chap2", type: "image/png",