Skip to content

Commit 0e5eea0

Browse files
committed
Drop R2 prefix
1 parent 5e32bcc commit 0e5eea0

File tree

283 files changed

+1456
-14675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

283 files changed

+1456
-14675
lines changed

CHANGELOG.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,11 @@ All notable changes to this project will be documented in this file. Take a look
44

55
**Warning:** Features marked as *alpha* may change or be removed in a future release without notice. Use with caution.
66

7-
<!-- ## [Unreleased] -->
8-
9-
## [2.7.0]
10-
11-
### Added
12-
13-
#### Shared
14-
15-
* You can now use `DefaultHTTPClientDelegate.httpClient(_:request:didReceive:completion:)` to handle authentication challenges (e.g. Basic) with `DefaultHTTPClient`.
16-
17-
#### Navigator
18-
19-
* The `AudioNavigator` API has been promoted to stable and ships with a new Preferences API.
20-
* The new `NavigatorDelegate.didFailToLoadResourceAt(_:didFailToLoadResourceAt:withError:)` delegate API notifies when an error occurs while loading a publication resource (contributed by [@ettore](https://github.com/readium/swift-toolkit/pull/400)).
7+
## [Unreleased]
218

229
### Changed
2310

11+
* The `R2Shared`, `R2Streamer` and `R2Navigator` packages are now called `ReadiumShared`, `ReadiumStreamer` and `ReadiumNavigator`.
2412
* Many APIs now expect one of the new URL types (`RelativeURL`, `AbsoluteURL`, `HTTPURL` and `FileURL`). This is helpful because:
2513
* It validates at compile time that we provide a URL that is supported.
2614
* The API's capabilities are better documented, e.g. a download API could look like this : `download(url: HTTPURL) -> FileURL`.
@@ -32,6 +20,20 @@ All notable changes to this project will be documented in this file. Take a look
3220
* Links are not resolved to the `self` URL of a manifest anymore. However, you can still normalize the HREFs yourselves by calling `Manifest.normalizeHREFsToSelf()`.
3321
* `Publication.localizedTitle` is now optional, as we cannot guarantee a publication will always have a title.
3422

23+
24+
## [2.7.0]
25+
26+
### Added
27+
28+
#### Shared
29+
30+
* You can now use `DefaultHTTPClientDelegate.httpClient(_:request:didReceive:completion:)` to handle authentication challenges (e.g. Basic) with `DefaultHTTPClient`.
31+
32+
#### Navigator
33+
34+
* The `AudioNavigator` API has been promoted to stable and ships with a new Preferences API.
35+
* The new `NavigatorDelegate.didFailToLoadResourceAt(_:didFailToLoadResourceAt:withError:)` delegate API notifies when an error occurs while loading a publication resource (contributed by [@ettore](https://github.com/readium/swift-toolkit/pull/400)).
36+
3537
### Fixed
3638

3739
* [#390](https://github.com/readium/swift-toolkit/issues/390) Fixed logger not logging above the minimum severity level (contributed by [@ettore](https://github.com/readium/swift-toolkit/pull/391)).

Documentation/Guides/Navigator Preferences.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ This stateless view displays the actual preferences for a fixed-layout publicati
163163
@ViewBuilder func fixedLayoutUserPreferences(
164164
commit: @escaping () -> Void,
165165
scroll: AnyPreference<Bool>? = nil,
166-
fit: AnyEnumPreference<R2Navigator.Fit>? = nil,
166+
fit: AnyEnumPreference<ReadiumNavigator.Fit>? = nil,
167167
pageSpacing: AnyRangePreference<Double>? = nil
168168
) -> some View {
169169
if let scroll = scroll {

Documentation/Migration Guide.md

+26-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All migration steps necessary in reading apps to upgrade to major versions of th
44

55
## Unreleased
66

7+
### R2 prefix dropped
8+
9+
The `R2` prefix is now deprecated. The `R2Shared`, `R2Streamer` and `R2Navigator` packages were renamed as `ReadiumShared`, `ReadiumStreamer` and `ReadiumNavigator`.
10+
11+
You will need to update your imports, as well as the dependencies you include in your project:
12+
13+
* Swift Package Manager: There's nothing to do.
14+
* Carthage:
15+
* Update the Carthage dependencies and make sure the new `ReadiumShared.xcframework`, `ReadiumStreamer.xcframework` and `ReadiumNavigator.xcframework` were built.
16+
* Replace the old frameworks with the new ones in your project.
17+
* CocoaPods:
18+
* Update the `pod` statements in your `Podfile` with the following, before running `pod install`:
19+
```
20+
pod 'ReadiumShared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0/Support/CocoaPods/ReadiumShared.podspec'
21+
pod 'ReadiumStreamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0/Support/CocoaPods/ReadiumStreamer.podspec'
22+
pod 'ReadiumNavigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0/Support/CocoaPods/ReadiumNavigator.podspec'
23+
```
24+
725
### Migration of HREFs and Locators (bookmarks, annotations, etc.)
826

927
:warning: This requires a database migration in your application, if you were persisting `Locator` objects.
@@ -105,7 +123,7 @@ Instead, the EPUB, PDF and CBZ navigators expect an instance of `HTTPServer` upo
105123
You can implement your own HTTP server using a third-party library. But the easiest way to migrate is to use the one provided in the new Readium package `ReadiumAdapterGCDWebServer`.
106124
107125
```swift
108-
import R2Navigator
126+
import ReadiumNavigator
109127
import ReadiumAdapterGCDWebServer
110128
111129
let navigator = try EPUBNavigatorViewController(
@@ -216,15 +234,15 @@ Then, rebuild the libraries using `carthage update --platform ios --use-xcframew
216234
If you are using CocoaPods, you will need to update the URL to the Podspecs in your `Podfile`:
217235

218236
```diff
219-
+ pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumShared.podspec'
220-
+ pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumStreamer.podspec'
221-
+ pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumNavigator.podspec'
237+
+ pod 'ReadiumShared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumShared.podspec'
238+
+ pod 'ReadiumStreamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumStreamer.podspec'
239+
+ pod 'ReadiumNavigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumNavigator.podspec'
222240
+ pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumOPDS.podspec'
223241
+ pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.2.0/Support/CocoaPods/ReadiumLCP.podspec'
224242

225-
- pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/r2-shared-swift/2.2.0/R2Shared.podspec'
226-
- pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/r2-streamer-swift/2.2.0/R2Streamer.podspec'
227-
- pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/r2-navigator-swift/2.2.0/R2Navigator.podspec'
243+
- pod 'ReadiumShared', podspec: 'https://raw.githubusercontent.com/readium/r2-shared-swift/2.2.0/ReadiumShared.podspec'
244+
- pod 'ReadiumStreamer', podspec: 'https://raw.githubusercontent.com/readium/r2-streamer-swift/2.2.0/ReadiumStreamer.podspec'
245+
- pod 'ReadiumNavigator', podspec: 'https://raw.githubusercontent.com/readium/r2-navigator-swift/2.2.0/ReadiumNavigator.podspec'
228246
- pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/r2-opds-swift/2.2.0/ReadiumOPDS.podspec'
229247
- pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/r2-lcp-swift/2.2.0/ReadiumLCP.podspec'
230248
```
@@ -324,7 +342,7 @@ Migrating a project to XCFrameworks is [explained on Carthage's repository](http
324342

325343
#### Troubleshooting
326344

327-
If after migrating to XCFrameworks you experience some build issues like **Could not find module 'R2Shared' for target 'X'**, try building the `r2-shared-swift` target with Xcode manually, before building your app. If you know of a better way to handle this, [please share it with the community](https://github.com/readium/r2-testapp-swift/issues/new).
345+
If after migrating to XCFrameworks you experience some build issues like **Could not find module 'ReadiumShared' for target 'X'**, try building the `r2-shared-swift` target with Xcode manually, before building your app. If you know of a better way to handle this, [please share it with the community](https://github.com/readium/r2-testapp-swift/issues/new).
328346

329347
### LCP
330348

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ update-scripts:
3232

3333
.PHONY: test
3434
test:
35-
# To limit to a particular test suite: -only-testing:R2SharedTests
35+
# To limit to a particular test suite: -only-testing:ReadiumSharedTests
3636
xcodebuild test -scheme "Readium-Package" -destination "platform=iOS Simulator,name=iPhone 15" | xcbeautify -q
3737

3838
.PHONY: lint-format

Package.swift

+17-17
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ let package = Package(
1212
defaultLocalization: "en",
1313
platforms: [.iOS(.v11)],
1414
products: [
15-
.library(name: "R2Shared", targets: ["R2Shared"]),
16-
.library(name: "R2Streamer", targets: ["R2Streamer"]),
17-
.library(name: "R2Navigator", targets: ["R2Navigator"]),
15+
.library(name: "ReadiumShared", targets: ["ReadiumShared"]),
16+
.library(name: "ReadiumStreamer", targets: ["ReadiumStreamer"]),
17+
.library(name: "ReadiumNavigator", targets: ["ReadiumNavigator"]),
1818
.library(name: "ReadiumOPDS", targets: ["ReadiumOPDS"]),
1919
.library(name: "ReadiumLCP", targets: ["ReadiumLCP"]),
2020

@@ -37,7 +37,7 @@ let package = Package(
3737
],
3838
targets: [
3939
.target(
40-
name: "R2Shared",
40+
name: "ReadiumShared",
4141
dependencies: ["ReadiumInternal", "Fuzi", "SwiftSoup", "Zip"],
4242
path: "Sources/Shared",
4343
exclude: [
@@ -53,42 +53,42 @@ let package = Package(
5353
]
5454
),
5555
.testTarget(
56-
name: "R2SharedTests",
57-
dependencies: ["R2Shared"],
56+
name: "ReadiumSharedTests",
57+
dependencies: ["ReadiumShared"],
5858
path: "Tests/SharedTests",
5959
resources: [
6060
.copy("Fixtures"),
6161
]
6262
),
6363

6464
.target(
65-
name: "R2Streamer",
65+
name: "ReadiumStreamer",
6666
dependencies: [
6767
"CryptoSwift",
6868
"Fuzi",
6969
.product(name: "ReadiumGCDWebServer", package: "GCDWebServer"),
7070
"Zip",
71-
"R2Shared",
71+
"ReadiumShared",
7272
],
7373
path: "Sources/Streamer",
7474
resources: [
7575
.copy("Assets"),
7676
]
7777
),
7878
.testTarget(
79-
name: "R2StreamerTests",
80-
dependencies: ["R2Streamer"],
79+
name: "ReadiumStreamerTests",
80+
dependencies: ["ReadiumStreamer"],
8181
path: "Tests/StreamerTests",
8282
resources: [
8383
.copy("Fixtures"),
8484
]
8585
),
8686

8787
.target(
88-
name: "R2Navigator",
88+
name: "ReadiumNavigator",
8989
dependencies: [
9090
"ReadiumInternal",
91-
"R2Shared",
91+
"ReadiumShared",
9292
"DifferenceKit",
9393
"SwiftSoup",
9494
],
@@ -102,16 +102,16 @@ let package = Package(
102102
]
103103
),
104104
.testTarget(
105-
name: "R2NavigatorTests",
106-
dependencies: ["R2Navigator"],
105+
name: "ReadiumNavigatorTests",
106+
dependencies: ["ReadiumNavigator"],
107107
path: "Tests/NavigatorTests"
108108
),
109109

110110
.target(
111111
name: "ReadiumOPDS",
112112
dependencies: [
113113
"Fuzi",
114-
"R2Shared",
114+
"ReadiumShared",
115115
],
116116
path: "Sources/OPDS"
117117
),
@@ -129,7 +129,7 @@ let package = Package(
129129
dependencies: [
130130
"CryptoSwift",
131131
"ZIPFoundation",
132-
"R2Shared",
132+
"ReadiumShared",
133133
.product(name: "SQLite", package: "SQLite.swift"),
134134
],
135135
path: "Sources/LCP",
@@ -152,7 +152,7 @@ let package = Package(
152152
name: "ReadiumAdapterGCDWebServer",
153153
dependencies: [
154154
.product(name: "ReadiumGCDWebServer", package: "GCDWebServer"),
155-
"R2Shared",
155+
"ReadiumShared",
156156
],
157157
path: "Sources/Adapters/GCDWebServer"
158158
),

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
This toolkit is a modular project, which follows the [Readium Architecture](https://github.com/readium/architecture).
66

7-
* [`R2Shared`](Sources/Shared) – Shared `Publication` models and utilities
8-
* [`R2Streamer`](Sources/Streamer) – Publication parsers and local HTTP server
9-
* [`R2Navigator`](Sources/Navigator) – Plain `UIViewController` classes rendering publications
7+
* [`ReadiumShared`](Sources/Shared) – Shared `Publication` models and utilities
8+
* [`ReadiumStreamer`](Sources/Streamer) – Publication parsers and local HTTP server
9+
* [`ReadiumNavigator`](Sources/Navigator) – Plain `UIViewController` classes rendering publications
1010
* [`ReadiumOPDS`](Sources/OPDS) – Parsers for OPDS catalog feeds
1111
* [`ReadiumLCP`](Sources/LCP) – Service and models for [Readium LCP](https://www.edrlab.org/readium-lcp/)
1212

@@ -53,9 +53,9 @@ Note that Carthage will build all Readium modules and their dependencies, but yo
5353

5454
Refer to the following table to know which dependencies are required for each Readium library.
5555

56-
| | `R2Shared` | `R2Streamer` | `R2Navigator` | `ReadiumOPDS` | `ReadiumLCP` |
56+
| | `ReadiumShared` | `ReadiumStreamer` | `ReadiumNavigator` | `ReadiumOPDS` | `ReadiumLCP` |
5757
|-----------------------|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|
58-
| **`R2Shared`** | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
58+
| **`ReadiumShared`** | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
5959
| **`ReadiumInternal`** | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
6060
| `CryptoSwift` | | :heavy_check_mark: | | | :heavy_check_mark: |
6161
| `DifferenceKit` | | | :heavy_check_mark: | | |
@@ -71,14 +71,14 @@ Refer to the following table to know which dependencies are required for each Re
7171
Add the following `pod` statements to your `Podfile` for the Readium libraries you want to use:
7272

7373
```
74-
pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumShared.podspec'
75-
pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumStreamer.podspec'
76-
pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumNavigator.podspec'
74+
pod 'ReadiumShared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumShared.podspec'
75+
pod 'ReadiumStreamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumStreamer.podspec'
76+
pod 'ReadiumNavigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumNavigator.podspec'
7777
pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumOPDS.podspec'
7878
pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumLCP.podspec'
7979
pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.7.0/Support/CocoaPods/ReadiumInternal.podspec'
8080
81-
# Required if you use R2Streamer.
81+
# Required if you use ReadiumStreamer.
8282
pod 'ReadiumGCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/4.0.0/GCDWebServer.podspec'
8383
```
8484

Sources/Adapters/GCDWebServer/GCDHTTPServer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
//
66

77
import Foundation
8-
import R2Shared
98
import ReadiumGCDWebServer
9+
import ReadiumShared
1010
import UIKit
1111

1212
public enum GCDHTTPServerError: Error {

Sources/Adapters/GCDWebServer/ResourceResponse.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
//
66

77
import Foundation
8-
import R2Shared
98
import ReadiumGCDWebServer
9+
import ReadiumShared
1010

1111
/// Errors thrown by the `WebServerResourceResponse`
1212
///

Sources/LCP/Authentications/LCPDialogAuthentication.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//
66

77
import Foundation
8-
import R2Shared
8+
import ReadiumShared
99
import UIKit
1010

1111
/// An `LCPAuthenticating` implementation presenting a dialog to the user.

Sources/LCP/Authentications/LCPDialogViewController.swift

+13-13
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ final class LCPDialogViewController: UIViewController {
6868

6969
switch reason {
7070
case .passphraseNotFound:
71-
label.text = R2LCPLocalizedString("dialog.reason.passphraseNotFound")
71+
label.text = ReadiumLCPLocalizedString("dialog.reason.passphraseNotFound")
7272
case .invalidPassphrase:
73-
label.text = R2LCPLocalizedString("dialog.reason.invalidPassphrase")
73+
label.text = ReadiumLCPLocalizedString("dialog.reason.invalidPassphrase")
7474
passphraseField.layer.borderWidth = 1
7575
passphraseField.layer.borderColor = UIColor.red.cgColor
7676
}
@@ -84,12 +84,12 @@ final class LCPDialogViewController: UIViewController {
8484
let leftItem = UIBarButtonItem(customView: label)
8585
navigationItem.leftBarButtonItem = leftItem
8686

87-
promptLabel.text = R2LCPLocalizedString("dialog.prompt.message1")
88-
messageLabel.text = String(format: R2LCPLocalizedString("dialog.prompt.message2"), provider)
89-
forgotPassphraseButton.setTitle(R2LCPLocalizedString("dialog.prompt.forgotPassphrase"), for: .normal)
90-
supportButton.setTitle(R2LCPLocalizedString("dialog.prompt.support"), for: .normal)
91-
continueButton.setTitle(R2LCPLocalizedString("dialog.prompt.continue"), for: .normal)
92-
passphraseField.placeholder = R2LCPLocalizedString("dialog.prompt.passphrase")
87+
promptLabel.text = ReadiumLCPLocalizedString("dialog.prompt.message1")
88+
messageLabel.text = String(format: ReadiumLCPLocalizedString("dialog.prompt.message2"), provider)
89+
forgotPassphraseButton.setTitle(ReadiumLCPLocalizedString("dialog.prompt.forgotPassphrase"), for: .normal)
90+
supportButton.setTitle(ReadiumLCPLocalizedString("dialog.prompt.support"), for: .normal)
91+
continueButton.setTitle(ReadiumLCPLocalizedString("dialog.prompt.continue"), for: .normal)
92+
passphraseField.placeholder = ReadiumLCPLocalizedString("dialog.prompt.passphrase")
9393
hintLabel.text = license.hint
9494

9595
navigationItem.rightBarButtonItem = UIBarButtonItem(
@@ -142,24 +142,24 @@ final class LCPDialogViewController: UIViewController {
142142
if let scheme = url.scheme {
143143
switch scheme {
144144
case "http", "https":
145-
return R2LCPLocalizedString("dialog.support.website")
145+
return ReadiumLCPLocalizedString("dialog.support.website")
146146
case "tel":
147-
return R2LCPLocalizedString("dialog.support.phone")
147+
return ReadiumLCPLocalizedString("dialog.support.phone")
148148
case "mailto":
149-
return R2LCPLocalizedString("dialog.support.mail")
149+
return ReadiumLCPLocalizedString("dialog.support.mail")
150150
default:
151151
break
152152
}
153153
}
154-
return R2LCPLocalizedString("dialog.support")
154+
return ReadiumLCPLocalizedString("dialog.support")
155155
}()
156156

157157
let action = UIAlertAction(title: title, style: .default) { _ in
158158
open(url)
159159
}
160160
alert.addAction(action)
161161
}
162-
alert.addAction(UIAlertAction(title: R2LCPLocalizedString("dialog.cancel"), style: .cancel))
162+
alert.addAction(UIAlertAction(title: ReadiumLCPLocalizedString("dialog.cancel"), style: .cancel))
163163

164164
if let popover = alert.popoverPresentationController, let sender = sender as? UIView {
165165
popover.sourceView = sender

Sources/LCP/Content Protection/LCPContentProtection.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//
66

77
import Foundation
8-
import R2Shared
8+
import ReadiumShared
99

1010
final class LCPContentProtection: ContentProtection, Loggable {
1111
private let service: LCPService

0 commit comments

Comments
 (0)