Skip to content

Commit 163a235

Browse files
authored
Clean up deprecated APIs (#594)
1 parent 2a4ff02 commit 163a235

Some content is hidden

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

55 files changed

+0
-2052
lines changed

Sources/Adapters/GCDWebServer/GCDHTTPServer.swift

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ public enum GCDHTTPServerError: Error {
1919

2020
/// Implementation of `HTTPServer` using ReadiumGCDWebServer under the hood.
2121
public class GCDHTTPServer: HTTPServer, Loggable {
22-
/// Shared instance of the HTTP server.
23-
@available(*, unavailable, message: "Create your own shared instance")
24-
public static var shared: GCDHTTPServer { fatalError() }
25-
2622
/// The actual underlying HTTP server instance.
2723
private let server = ReadiumGCDWebServer()
2824

Sources/LCP/LCPAcquisition.swift

-38
This file was deleted.

Sources/LCP/LCPLicense.swift

-10
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,4 @@ public extension LCPLicense {
5252
func renewLoan(with delegate: LCPRenewDelegate) async -> Result<Void, LCPError> {
5353
await renewLoan(with: delegate, prefersWebPage: false)
5454
}
55-
56-
@available(*, unavailable, message: "Use the async variant.")
57-
func renewLoan(with delegate: LCPRenewDelegate, prefersWebPage: Bool, completion: @escaping (CancellableResult<Void, LCPError>) -> Void) {
58-
fatalError()
59-
}
60-
61-
@available(*, unavailable, message: "Use the async variant.")
62-
func returnPublication(completion: @escaping (LCPError?) -> Void) {
63-
fatalError()
64-
}
6555
}

Sources/LCP/LCPService.swift

-35
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ public final class LCPService: Loggable {
2121
private let licenses: LicensesService
2222
private let assetRetriever: AssetRetriever
2323

24-
@available(*, unavailable, message: "Provide a `licenseRepository` and `passphraseRepository`, following the migration guide")
25-
public init(
26-
client: LCPClient,
27-
httpClient: HTTPClient = DefaultHTTPClient()
28-
) {
29-
fatalError()
30-
}
31-
3224
/// - Parameter deviceName: Device name used when registering a license to an LSD server.
3325
/// If not provided, the device name will be the default `UIDevice.current.name`.
3426
public init(
@@ -72,11 +64,6 @@ public final class LCPService: Loggable {
7264
self.assetRetriever = assetRetriever
7365
}
7466

75-
@available(*, unavailable, message: "Check the conformance of the file `Format` to the `lcp` specification instead.")
76-
public func isLCPProtected(_ file: FileURL) async -> Bool {
77-
fatalError()
78-
}
79-
8067
/// Acquires a protected publication from an LCPL.
8168
public func acquirePublication(
8269
from lcpl: LicenseDocumentSource,
@@ -139,28 +126,6 @@ public final class LCPService: Loggable {
139126
return .failure(.wrap(error))
140127
}
141128
}
142-
143-
@available(*, unavailable, message: "Use the async variant.")
144-
@discardableResult
145-
public func acquirePublication(from lcpl: FileURL, onProgress: @escaping (LCPAcquisition.Progress) -> Void = { _ in }, completion: @escaping (CancellableResult<LCPAcquisition.Publication, LCPError>) -> Void) -> LCPAcquisition {
146-
fatalError()
147-
}
148-
149-
@available(*, unavailable, message: "Use the async variant using an `Asset`.")
150-
public func retrieveLicense(
151-
from publication: FileURL,
152-
authentication: LCPAuthenticating = LCPDialogAuthentication(),
153-
allowUserInteraction: Bool = true,
154-
sender: Any? = nil,
155-
completion: @escaping (CancellableResult<LCPLicense?, LCPError>) -> Void
156-
) {
157-
fatalError()
158-
}
159-
160-
@available(*, unavailable, message: "Pass explicitly an `LCPDialogAuthentication()` for the same behavior as before")
161-
public func contentProtection() -> ContentProtection {
162-
contentProtection(with: LCPDialogAuthentication())
163-
}
164129
}
165130

166131
/// Source of an LCP License Document (LCPL) file.

Sources/LCP/License/Model/Components/Link.swift

-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ public struct Link {
6060
return HTTPURL(string: href)
6161
}
6262

63-
/// Expands the href without any template context.
64-
@available(*, unavailable, message: "Use url() instead")
65-
var url: URL? { fatalError() }
66-
6763
var mediaType: MediaType? {
6864
type.flatMap { MediaType($0) }
6965
}

Sources/Navigator/Audiobook/AudioNavigator.swift

-12
Original file line numberDiff line numberDiff line change
@@ -533,15 +533,3 @@ private extension CMTime {
533533
isNumeric ? seconds : 0
534534
}
535535
}
536-
537-
@available(*, unavailable, renamed: "AudioNavigator")
538-
public typealias _AudioNavigator = AudioNavigator
539-
540-
@available(*, unavailable, renamed: "AudioNavigatorDelegate")
541-
public typealias _AudioNavigatorDelegate = AudioNavigatorDelegate
542-
543-
@available(*, unavailable, renamed: "AudioNavigator")
544-
public typealias _MediaNavigator = AudioNavigator
545-
546-
@available(*, unavailable, renamed: "AudioNavigatorDelegate")
547-
public typealias _MediaNavigatorDelegate = AudioNavigatorDelegate

Sources/Navigator/CBZ/CBZNavigatorViewController.swift

-8
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ open class CBZNavigatorViewController:
7676
}
7777
}
7878

79-
@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate the HTTP server")
80-
public convenience init(publication: Publication, initialLocation: Locator? = nil) {
81-
fatalError()
82-
}
83-
8479
private let tasks = CancellableTasks()
8580

8681
private init(
@@ -169,9 +164,6 @@ open class CBZNavigatorViewController:
169164
return imageViewController.index
170165
}
171166

172-
@available(*, unavailable, renamed: "currentLocation")
173-
public var currentPosition: Locator? { fatalError() }
174-
175167
@discardableResult
176168
private func goToResourceAtIndex(_ index: Int, options: NavigatorGoOptions, isJump: Bool) async -> Bool {
177169
guard let imageViewController = imageViewController(at: index) else {

Sources/Navigator/EPUB/EPUBNavigatorViewController.swift

-21
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
119119
didSet { updateCurrentLocation() }
120120
}
121121

122-
@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate to the Preferences API")
123-
public var userSettings: Any { fatalError() }
124-
125122
/// Navigation state.
126123
private enum State: Equatable {
127124
/// Initializing the navigator.
@@ -278,16 +275,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
278275
)
279276
}
280277

281-
@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate the HTTP server and settings API")
282-
public convenience init(
283-
publication: Publication,
284-
initialLocation: Locator? = nil,
285-
resourcesServer: ResourcesServer,
286-
config: Configuration = .init()
287-
) {
288-
fatalError()
289-
}
290-
291278
private init(
292279
viewModel: EPUBNavigatorViewModel,
293280
initialLocation: Locator?,
@@ -470,9 +457,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
470457
return moved
471458
}
472459

473-
@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate to the Preferences API")
474-
public func updateUserSettingStyle() {}
475-
476460
// MARK: - Pagination and spreads
477461

478462
private var paginationView: PaginationView?
@@ -851,11 +835,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
851835
return await spreadView.evaluateScript(script)
852836
}
853837

854-
@available(*, unavailable, message: "Use the async variant")
855-
public func evaluateJavaScript(_ script: String, completion: ((Result<Any, Error>) -> Void)? = nil) {
856-
fatalError()
857-
}
858-
859838
// MARK: - UIAccessibilityAction
860839

861840
override open func accessibilityScroll(_ direction: UIAccessibilityScrollDirection) -> Bool {

Sources/Navigator/EPUB/EPUBNavigatorViewModel.swift

-9
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ final class EPUBNavigatorViewModel: Loggable {
8585
}
8686
}
8787

88-
@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate the Settings API")
89-
convenience init(
90-
publication: Publication,
91-
config: EPUBNavigatorViewController.Configuration,
92-
resourcesServer: ResourcesServer
93-
) {
94-
fatalError()
95-
}
96-
9788
private init(
9889
publication: Publication,
9990
config: EPUBNavigatorViewController.Configuration,

Sources/Navigator/EPUB/UserSettings.swift

-33
This file was deleted.

Sources/Navigator/EditingAction.swift

-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ public struct EditingAction: Hashable {
3131
/// Search Web.
3232
public static let lookup = EditingAction(kind: .native(["lookup", "_lookup:", "define:", "_define:"]))
3333

34-
@available(*, unavailable, message: "lookup and define were merged", renamed: "lookup")
35-
public static let define = lookup
36-
3734
/// Translate the text selection.
3835
public static let translate = EditingAction(kind: .native(["translate:", "_translate:"]))
3936

Sources/Navigator/Navigator.swift

-20
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,6 @@ public extension Navigator {
9797
func goBackward(options: NavigatorGoOptions = NavigatorGoOptions()) async -> Bool {
9898
await goBackward(options: options)
9999
}
100-
101-
@available(*, unavailable, message: "Use the async variant")
102-
func go(to locator: Locator, animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
103-
fatalError()
104-
}
105-
106-
@available(*, unavailable, message: "Use the async variant")
107-
func go(to link: Link, animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
108-
fatalError()
109-
}
110-
111-
@available(*, unavailable, message: "Use the async variant")
112-
func goForward(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
113-
fatalError()
114-
}
115-
116-
@available(*, unavailable, message: "Use the async variant")
117-
func goBackward(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
118-
fatalError()
119-
}
120100
}
121101

122102
@MainActor public protocol NavigatorDelegate: AnyObject {

Sources/Navigator/PDF/PDFNavigatorViewController.swift

-4
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,6 @@ open class PDFNavigatorViewController:
339339
?? pdfViewDefaultBackgroundColor
340340
}
341341

342-
/// Override to customize the PDFDocumentView.
343-
@available(*, unavailable, message: "Override the PDFNavigatorDelegate instead")
344-
open func setupPDFView() {}
345-
346342
@objc private func didTap(_ gesture: UITapGestureRecognizer) {
347343
let location = gesture.location(in: view)
348344
let pointer = Pointer.touch(TouchPointer(id: ObjectIdentifier(gesture)))

Sources/Navigator/TTS/AVTTSEngine.swift

-8
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ public class AVTTSEngine: NSObject, TTSEngine, AVSpeechSynthesizerDelegate, Logg
4747
synthesizer.delegate = self
4848
}
4949

50-
@available(*, unavailable, message: "The audio session is now configured through the `PublicationSpeechSynthesizer`")
51-
public convenience init(
52-
audioSessionConfig: AudioSession.Configuration? = nil,
53-
delegate: AVTTSEngineDelegate? = nil
54-
) {
55-
self.init(delegate: delegate)
56-
}
57-
5850
public lazy var availableVoices: [TTSVoice] =
5951
AVSpeechSynthesisVoice.speechVoices()
6052
.map { TTSVoice(voice: $0) }

Sources/Navigator/TTS/TTSEngine.swift

-9
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ public extension TTSEngine {
3131
func voiceWithIdentifier(_ identifier: String) -> TTSVoice? {
3232
availableVoices.first { $0.identifier == identifier }
3333
}
34-
35-
@available(*, unavailable, message: "Use the async variant")
36-
func speak(
37-
_ utterance: TTSUtterance,
38-
onSpeakRange: @escaping (Range<String.Index>) -> Void,
39-
completion: @escaping (Result<Void, TTSError>) -> Void
40-
) -> Cancellable {
41-
fatalError()
42-
}
4334
}
4435

4536
public enum TTSError: Error {

Sources/Navigator/VisualNavigator.swift

-21
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public protocol VisualNavigator: Navigator, InputObservable {
4141
func firstVisibleElementLocator() async -> Locator?
4242
}
4343

44-
public extension VisualNavigator {
45-
/// Current reading progression direction.
46-
@available(*, unavailable, message: "Use `presentation.readingProgression` instead", renamed: "presentation.readingProgression")
47-
var readingProgression: ReadiumShared.ReadingProgression { fatalError() }
48-
}
49-
5044
public extension VisualNavigator {
5145
func firstVisibleElementLocator() async -> Locator? {
5246
currentLocation
@@ -71,21 +65,6 @@ public extension VisualNavigator {
7165
return await goBackward(options: options)
7266
}
7367
}
74-
75-
@available(*, unavailable, message: "Use the async variant")
76-
func firstVisibleElementLocator(completion: @escaping (Locator?) -> Void) {
77-
fatalError()
78-
}
79-
80-
@available(*, unavailable, message: "Use the async variant")
81-
func goLeft(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
82-
fatalError()
83-
}
84-
85-
@available(*, unavailable, message: "Use the async variant")
86-
func goRight(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
87-
fatalError()
88-
}
8968
}
9069

9170
public struct VisualNavigatorPresentation {

Sources/Shared/Logger/Logger.swift

-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66

77
import Foundation
88

9-
@available(*, unavailable, renamed: "ReadiumEnableLog")
10-
public func R2EnableLog(withMinimumSeverityLevel level: SeverityLevel, customLogger: LoggerType = LoggerStub()) {
11-
fatalError()
12-
}
13-
149
/// Initialize the Logger.
1510
/// Default logger is the `LoggerStub` class
1611
///

0 commit comments

Comments
 (0)