diff --git a/CHANGELOG.md b/CHANGELOG.md index 658b54359..635d00aa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ All notable changes to this project will be documented in this file. Take a look **Warning:** Features marked as *alpha* may change or be removed in a future release without notice. Use with caution. -## [Unreleased] + + +## [3.0.0-alpha.2] ### Added @@ -746,3 +748,4 @@ progression. Now if no reading progression is set, the `effectiveReadingProgress [2.7.1]: https://github.com/readium/swift-toolkit/compare/2.7.0...2.7.1 [2.7.2]: https://github.com/readium/swift-toolkit/compare/2.7.1...2.7.2 [3.0.0-alpha.1]: https://github.com/readium/swift-toolkit/compare/2.7.1...3.0.0-alpha.1 +[3.0.0-alpha.2]: https://github.com/readium/swift-toolkit/compare/3.0.0-alpha.1...3.0.0-alpha.2 diff --git a/README.md b/README.md index 2529f578b..117b49dd8 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ If you're stuck, find more information at [developer.apple.com](https://develope Add the following to your `Cartfile`: ``` -github "readium/swift-toolkit" ~> 3.0.0-alpha.1 +github "readium/swift-toolkit" ~> 3.0.0-alpha.2 ``` Then, [follow the usual Carthage steps](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) to add the Readium libraries to your project. @@ -72,12 +72,12 @@ Refer to the following table to know which dependencies are required for each Re Add the following `pod` statements to your `Podfile` for the Readium libraries you want to use: ``` -pod 'ReadiumShared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.1/Support/CocoaPods/ReadiumShared.podspec' -pod 'ReadiumStreamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.1/Support/CocoaPods/ReadiumStreamer.podspec' -pod 'ReadiumNavigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.1/Support/CocoaPods/ReadiumNavigator.podspec' -pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.1/Support/CocoaPods/ReadiumOPDS.podspec' -pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.1/Support/CocoaPods/ReadiumLCP.podspec' -pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.1/Support/CocoaPods/ReadiumInternal.podspec' +pod 'ReadiumShared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.2/Support/CocoaPods/ReadiumShared.podspec' +pod 'ReadiumStreamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.2/Support/CocoaPods/ReadiumStreamer.podspec' +pod 'ReadiumNavigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.2/Support/CocoaPods/ReadiumNavigator.podspec' +pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.2/Support/CocoaPods/ReadiumOPDS.podspec' +pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.2/Support/CocoaPods/ReadiumLCP.podspec' +pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.2/Support/CocoaPods/ReadiumInternal.podspec' # Required if you use ReadiumAdapterGCDWebServer. pod 'ReadiumGCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/4.0.0/GCDWebServer.podspec' diff --git a/Support/CocoaPods/ReadiumAdapterGCDWebServer.podspec b/Support/CocoaPods/ReadiumAdapterGCDWebServer.podspec index 8b8965845..e08381dce 100644 --- a/Support/CocoaPods/ReadiumAdapterGCDWebServer.podspec +++ b/Support/CocoaPods/ReadiumAdapterGCDWebServer.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumAdapterGCDWebServer" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Adapter to use GCDWebServer as an HTTP server in Readium" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => "https://github.com/readium/swift-toolkit.git", :branch => "develop" } + s.source = { :git => "https://github.com/readium/swift-toolkit.git", :tag => "3.0.0-alpha.2" } s.requires_arc = true s.source_files = "Sources/Adapters/GCDWebServer/**/*.{m,h,swift}" s.platform = :ios diff --git a/Support/CocoaPods/ReadiumAdapterLCPSQLite.podspec b/Support/CocoaPods/ReadiumAdapterLCPSQLite.podspec index 261290bb2..ffd01cc21 100644 --- a/Support/CocoaPods/ReadiumAdapterLCPSQLite.podspec +++ b/Support/CocoaPods/ReadiumAdapterLCPSQLite.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumAdapterLCPSQLite" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Adapter to use SQLite.swift for the Readium LCP repositories" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => "https://github.com/readium/swift-toolkit.git", :branch => "develop" } + s.source = { :git => "https://github.com/readium/swift-toolkit.git", :tag => "3.0.0-alpha.2" } s.requires_arc = true s.source_files = "Sources/Adapters/LCPSQLite/**/*.{m,h,swift}" s.platform = :ios diff --git a/Support/CocoaPods/ReadiumInternal.podspec b/Support/CocoaPods/ReadiumInternal.podspec index 808d16ba1..ff8b6e700 100644 --- a/Support/CocoaPods/ReadiumInternal.podspec +++ b/Support/CocoaPods/ReadiumInternal.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumInternal" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Private utilities used by the Readium modules" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => "https://github.com/readium/swift-toolkit.git", :branch => "develop" } + s.source = { :git => "https://github.com/readium/swift-toolkit.git", :tag => "3.0.0-alpha.2" } s.requires_arc = true s.source_files = "Sources/Internal/**/*.{m,h,swift}" s.platform = :ios diff --git a/Support/CocoaPods/ReadiumLCP.podspec b/Support/CocoaPods/ReadiumLCP.podspec index ba98205fb..3f1817f72 100644 --- a/Support/CocoaPods/ReadiumLCP.podspec +++ b/Support/CocoaPods/ReadiumLCP.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumLCP" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Readium LCP" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => "https://github.com/readium/swift-toolkit.git", :branch => "develop" } + s.source = { :git => "https://github.com/readium/swift-toolkit.git", :tag => "3.0.0-alpha.2" } s.requires_arc = true s.resource_bundles = { 'ReadiumLCP' => [ diff --git a/Support/CocoaPods/ReadiumNavigator.podspec b/Support/CocoaPods/ReadiumNavigator.podspec index 1823b54e8..267d6028e 100644 --- a/Support/CocoaPods/ReadiumNavigator.podspec +++ b/Support/CocoaPods/ReadiumNavigator.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumNavigator" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Readium Navigator" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => "https://github.com/readium/swift-toolkit.git", :branch => "develop" } + s.source = { :git => "https://github.com/readium/swift-toolkit.git", :tag => "3.0.0-alpha.2" } s.requires_arc = true s.resource_bundles = { 'ReadiumNavigator' => [ diff --git a/Support/CocoaPods/ReadiumOPDS.podspec b/Support/CocoaPods/ReadiumOPDS.podspec index 5dda011d0..d514e808b 100644 --- a/Support/CocoaPods/ReadiumOPDS.podspec +++ b/Support/CocoaPods/ReadiumOPDS.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumOPDS" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Readium OPDS" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => "https://github.com/readium/swift-toolkit.git", :branch => "develop" } + s.source = { :git => "https://github.com/readium/swift-toolkit.git", :tag => "3.0.0-alpha.2" } s.requires_arc = true s.resource_bundles = { 'ReadiumOPDS' => ['Sources/OPDS/Resources/**'], diff --git a/Support/CocoaPods/ReadiumShared.podspec b/Support/CocoaPods/ReadiumShared.podspec index bb8ed79b9..2316d5855 100644 --- a/Support/CocoaPods/ReadiumShared.podspec +++ b/Support/CocoaPods/ReadiumShared.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumShared" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Readium Shared" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => 'https://github.com/readium/swift-toolkit.git', :branch => "develop" } + s.source = { :git => 'https://github.com/readium/swift-toolkit.git', :tag => "3.0.0-alpha.2" } s.exclude_files = ["Sources/Shared/Toolkit/ZIP/ZIPFoundation.swift"] s.requires_arc = true s.resource_bundles = { diff --git a/Support/CocoaPods/ReadiumStreamer.podspec b/Support/CocoaPods/ReadiumStreamer.podspec index d717ef0d9..4199a91c8 100644 --- a/Support/CocoaPods/ReadiumStreamer.podspec +++ b/Support/CocoaPods/ReadiumStreamer.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "ReadiumStreamer" - s.version = "3.0.0-alpha.1" + s.version = "3.0.0-alpha.2" s.license = "BSD 3-Clause License" s.summary = "Readium Streamer" s.homepage = "http://readium.github.io" s.author = { "Readium" => "contact@readium.org" } - s.source = { :git => "https://github.com/readium/swift-toolkit.git", :branch => "develop" } + s.source = { :git => "https://github.com/readium/swift-toolkit.git", :tag => "3.0.0-alpha.2" } s.requires_arc = true s.resource_bundles = { 'ReadiumStreamer' => [ diff --git a/TestApp/Sources/App/Readium.swift b/TestApp/Sources/App/Readium.swift index f68bce5fa..3ec960557 100644 --- a/TestApp/Sources/App/Readium.swift +++ b/TestApp/Sources/App/Readium.swift @@ -209,3 +209,66 @@ extension ReadiumNavigator.TTSError: UserErrorConvertible { } } } + +#if LCP + + extension LCPError: UserErrorConvertible { + func userError() -> UserError { + UserError(cause: self) { + switch self { + case .missingPassphrase: + return "lcp_error_missing_passphrase".localized + case .notALicenseDocument, .licenseIntegrity, .licenseProfileNotSupported, .parsing: + return "lcp_error_invalid_license".localized + case .licenseIsBusy, .licenseInteractionNotAvailable: + return "lcp_error_invalid_operation".localized + case .licenseContainer: + return "lcp_error_container".localized + case .crlFetching, .runtime, .unknown: + return "lcp_error_internal".localized + case .network: + return "lcp_error_network".localized + case let .licenseStatus(error): + let dateFormatter = DateFormatter() + dateFormatter.dateStyle = .medium + + switch error { + case let .cancelled(date): + return "lcp_error_status_cancelled".localized(dateFormatter.string(from: date)) + case let .returned(date): + return "lcp_error_status_returned".localized(dateFormatter.string(from: date)) + + case let .expired(start: start, end: end): + if start > Date() { + return "lcp_error_status_expired_start".localized(dateFormatter.string(from: start)) + } else { + return "lcp_error_status_expired_end".localized(dateFormatter.string(from: end)) + } + + case let .revoked(date, devicesCount): + return "lcp_error_status_revoked".localized(dateFormatter.string(from: date), devicesCount) + } + case let .licenseRenew(error): + switch error { + case .renewFailed: + return "lcp_error_renew_failed".localized + case .invalidRenewalPeriod: + return "lcp_error_invalid_renewal_period".localized + case .unexpectedServerError: + return "lcp_error_network".localized + } + case let .licenseReturn(error): + switch error { + case .returnFailed: + return "lcp_error_return_failed".localized + case .alreadyReturnedOrExpired: + return "lcp_error_already_returned_or_expired".localized + case .unexpectedServerError: + return "lcp_error_network".localized + } + } + } + } + } + +#endif diff --git a/TestApp/Sources/Info.plist b/TestApp/Sources/Info.plist index b6df21c8f..4f09d65ca 100644 --- a/TestApp/Sources/Info.plist +++ b/TestApp/Sources/Info.plist @@ -252,9 +252,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0.0-alpha.1 + 3.0.0-alpha.2 CFBundleVersion - 3.0.0-alpha.1 + 3.0.0-alpha.2 LSRequiresIPhoneOS LSSupportsOpeningDocumentsInPlace diff --git a/TestApp/Sources/LCP/LCPError.swift b/TestApp/Sources/LCP/LCPError.swift deleted file mode 100644 index 508817820..000000000 --- a/TestApp/Sources/LCP/LCPError.swift +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright 2024 Readium Foundation. All rights reserved. -// Use of this source code is governed by the BSD-style license -// available in the top-level LICENSE file of the project. -// - -import Foundation -import ReadiumLCP - -extension LCPError: UserErrorConvertible { - func userError() -> UserError { - UserError(cause: self) { - switch self { - case .missingPassphrase: - return "lcp_error_missing_passphrase".localized - case .notALicenseDocument, .licenseIntegrity, .licenseProfileNotSupported, .parsing: - return "lcp_error_invalid_license".localized - case .licenseIsBusy, .licenseInteractionNotAvailable: - return "lcp_error_invalid_operation".localized - case .licenseContainer: - return "lcp_error_container".localized - case .crlFetching, .runtime, .unknown: - return "lcp_error_internal".localized - case .network: - return "lcp_error_network".localized - case let .licenseStatus(error): - let dateFormatter = DateFormatter() - dateFormatter.dateStyle = .medium - - switch error { - case let .cancelled(date): - return "lcp_error_status_cancelled".localized(dateFormatter.string(from: date)) - case let .returned(date): - return "lcp_error_status_returned".localized(dateFormatter.string(from: date)) - - case let .expired(start: start, end: end): - if start > Date() { - return "lcp_error_status_expired_start".localized(dateFormatter.string(from: start)) - } else { - return "lcp_error_status_expired_end".localized(dateFormatter.string(from: end)) - } - - case let .revoked(date, devicesCount): - return "lcp_error_status_revoked".localized(dateFormatter.string(from: date), devicesCount) - } - case let .licenseRenew(error): - switch error { - case .renewFailed: - return "lcp_error_renew_failed".localized - case .invalidRenewalPeriod: - return "lcp_error_invalid_renewal_period".localized - case .unexpectedServerError: - return "lcp_error_network".localized - } - case let .licenseReturn(error): - switch error { - case .returnFailed: - return "lcp_error_return_failed".localized - case .alreadyReturnedOrExpired: - return "lcp_error_already_returned_or_expired".localized - case .unexpectedServerError: - return "lcp_error_network".localized - } - } - } - } -}