Skip to content

Clean up deprecated APIs #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Sources/Adapters/GCDWebServer/GCDHTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ public enum GCDHTTPServerError: Error {

/// Implementation of `HTTPServer` using ReadiumGCDWebServer under the hood.
public class GCDHTTPServer: HTTPServer, Loggable {
/// Shared instance of the HTTP server.
@available(*, unavailable, message: "Create your own shared instance")
public static var shared: GCDHTTPServer { fatalError() }

/// The actual underlying HTTP server instance.
private let server = ReadiumGCDWebServer()

Expand Down
38 changes: 0 additions & 38 deletions Sources/LCP/LCPAcquisition.swift

This file was deleted.

10 changes: 0 additions & 10 deletions Sources/LCP/LCPLicense.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,4 @@ public extension LCPLicense {
func renewLoan(with delegate: LCPRenewDelegate) async -> Result<Void, LCPError> {
await renewLoan(with: delegate, prefersWebPage: false)
}

@available(*, unavailable, message: "Use the async variant.")
func renewLoan(with delegate: LCPRenewDelegate, prefersWebPage: Bool, completion: @escaping (CancellableResult<Void, LCPError>) -> Void) {
fatalError()
}

@available(*, unavailable, message: "Use the async variant.")
func returnPublication(completion: @escaping (LCPError?) -> Void) {
fatalError()
}
}
35 changes: 0 additions & 35 deletions Sources/LCP/LCPService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ public final class LCPService: Loggable {
private let licenses: LicensesService
private let assetRetriever: AssetRetriever

@available(*, unavailable, message: "Provide a `licenseRepository` and `passphraseRepository`, following the migration guide")
public init(
client: LCPClient,
httpClient: HTTPClient = DefaultHTTPClient()
) {
fatalError()
}

/// - Parameter deviceName: Device name used when registering a license to an LSD server.
/// If not provided, the device name will be the default `UIDevice.current.name`.
public init(
Expand Down Expand Up @@ -72,11 +64,6 @@ public final class LCPService: Loggable {
self.assetRetriever = assetRetriever
}

@available(*, unavailable, message: "Check the conformance of the file `Format` to the `lcp` specification instead.")
public func isLCPProtected(_ file: FileURL) async -> Bool {
fatalError()
}

/// Acquires a protected publication from an LCPL.
public func acquirePublication(
from lcpl: LicenseDocumentSource,
Expand Down Expand Up @@ -139,28 +126,6 @@ public final class LCPService: Loggable {
return .failure(.wrap(error))
}
}

@available(*, unavailable, message: "Use the async variant.")
@discardableResult
public func acquirePublication(from lcpl: FileURL, onProgress: @escaping (LCPAcquisition.Progress) -> Void = { _ in }, completion: @escaping (CancellableResult<LCPAcquisition.Publication, LCPError>) -> Void) -> LCPAcquisition {
fatalError()
}

@available(*, unavailable, message: "Use the async variant using an `Asset`.")
public func retrieveLicense(
from publication: FileURL,
authentication: LCPAuthenticating = LCPDialogAuthentication(),
allowUserInteraction: Bool = true,
sender: Any? = nil,
completion: @escaping (CancellableResult<LCPLicense?, LCPError>) -> Void
) {
fatalError()
}

@available(*, unavailable, message: "Pass explicitly an `LCPDialogAuthentication()` for the same behavior as before")
public func contentProtection() -> ContentProtection {
contentProtection(with: LCPDialogAuthentication())
}
}

/// Source of an LCP License Document (LCPL) file.
Expand Down
4 changes: 0 additions & 4 deletions Sources/LCP/License/Model/Components/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ public struct Link {
return HTTPURL(string: href)
}

/// Expands the href without any template context.
@available(*, unavailable, message: "Use url() instead")
var url: URL? { fatalError() }

var mediaType: MediaType? {
type.flatMap { MediaType($0) }
}
Expand Down
12 changes: 0 additions & 12 deletions Sources/Navigator/Audiobook/AudioNavigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,3 @@ private extension CMTime {
isNumeric ? seconds : 0
}
}

@available(*, unavailable, renamed: "AudioNavigator")
public typealias _AudioNavigator = AudioNavigator

@available(*, unavailable, renamed: "AudioNavigatorDelegate")
public typealias _AudioNavigatorDelegate = AudioNavigatorDelegate

@available(*, unavailable, renamed: "AudioNavigator")
public typealias _MediaNavigator = AudioNavigator

@available(*, unavailable, renamed: "AudioNavigatorDelegate")
public typealias _MediaNavigatorDelegate = AudioNavigatorDelegate
8 changes: 0 additions & 8 deletions Sources/Navigator/CBZ/CBZNavigatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ open class CBZNavigatorViewController:
}
}

@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate the HTTP server")
public convenience init(publication: Publication, initialLocation: Locator? = nil) {
fatalError()
}

private let tasks = CancellableTasks()

private init(
Expand Down Expand Up @@ -169,9 +164,6 @@ open class CBZNavigatorViewController:
return imageViewController.index
}

@available(*, unavailable, renamed: "currentLocation")
public var currentPosition: Locator? { fatalError() }

@discardableResult
private func goToResourceAtIndex(_ index: Int, options: NavigatorGoOptions, isJump: Bool) async -> Bool {
guard let imageViewController = imageViewController(at: index) else {
Expand Down
21 changes: 0 additions & 21 deletions Sources/Navigator/EPUB/EPUBNavigatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
didSet { updateCurrentLocation() }
}

@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate to the Preferences API")
public var userSettings: Any { fatalError() }

/// Navigation state.
private enum State: Equatable {
/// Initializing the navigator.
Expand Down Expand Up @@ -278,16 +275,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
)
}

@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate the HTTP server and settings API")
public convenience init(
publication: Publication,
initialLocation: Locator? = nil,
resourcesServer: ResourcesServer,
config: Configuration = .init()
) {
fatalError()
}

private init(
viewModel: EPUBNavigatorViewModel,
initialLocation: Locator?,
Expand Down Expand Up @@ -470,9 +457,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
return moved
}

@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate to the Preferences API")
public func updateUserSettingStyle() {}

// MARK: - Pagination and spreads

private var paginationView: PaginationView?
Expand Down Expand Up @@ -851,11 +835,6 @@ open class EPUBNavigatorViewController: InputObservableViewController,
return await spreadView.evaluateScript(script)
}

@available(*, unavailable, message: "Use the async variant")
public func evaluateJavaScript(_ script: String, completion: ((Result<Any, Error>) -> Void)? = nil) {
fatalError()
}

// MARK: - UIAccessibilityAction

override open func accessibilityScroll(_ direction: UIAccessibilityScrollDirection) -> Bool {
Expand Down
9 changes: 0 additions & 9 deletions Sources/Navigator/EPUB/EPUBNavigatorViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ final class EPUBNavigatorViewModel: Loggable {
}
}

@available(*, unavailable, message: "See the 2.5.0 migration guide to migrate the Settings API")
convenience init(
publication: Publication,
config: EPUBNavigatorViewController.Configuration,
resourcesServer: ResourcesServer
) {
fatalError()
}

private init(
publication: Publication,
config: EPUBNavigatorViewController.Configuration,
Expand Down
33 changes: 0 additions & 33 deletions Sources/Navigator/EPUB/UserSettings.swift

This file was deleted.

3 changes: 0 additions & 3 deletions Sources/Navigator/EditingAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public struct EditingAction: Hashable {
/// Search Web.
public static let lookup = EditingAction(kind: .native(["lookup", "_lookup:", "define:", "_define:"]))

@available(*, unavailable, message: "lookup and define were merged", renamed: "lookup")
public static let define = lookup

/// Translate the text selection.
public static let translate = EditingAction(kind: .native(["translate:", "_translate:"]))

Expand Down
20 changes: 0 additions & 20 deletions Sources/Navigator/Navigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,6 @@ public extension Navigator {
func goBackward(options: NavigatorGoOptions = NavigatorGoOptions()) async -> Bool {
await goBackward(options: options)
}

@available(*, unavailable, message: "Use the async variant")
func go(to locator: Locator, animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
fatalError()
}

@available(*, unavailable, message: "Use the async variant")
func go(to link: Link, animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
fatalError()
}

@available(*, unavailable, message: "Use the async variant")
func goForward(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
fatalError()
}

@available(*, unavailable, message: "Use the async variant")
func goBackward(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
fatalError()
}
}

@MainActor public protocol NavigatorDelegate: AnyObject {
Expand Down
4 changes: 0 additions & 4 deletions Sources/Navigator/PDF/PDFNavigatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,6 @@ open class PDFNavigatorViewController:
?? pdfViewDefaultBackgroundColor
}

/// Override to customize the PDFDocumentView.
@available(*, unavailable, message: "Override the PDFNavigatorDelegate instead")
open func setupPDFView() {}

@objc private func didTap(_ gesture: UITapGestureRecognizer) {
let location = gesture.location(in: view)
let pointer = Pointer.touch(TouchPointer(id: ObjectIdentifier(gesture)))
Expand Down
8 changes: 0 additions & 8 deletions Sources/Navigator/TTS/AVTTSEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ public class AVTTSEngine: NSObject, TTSEngine, AVSpeechSynthesizerDelegate, Logg
synthesizer.delegate = self
}

@available(*, unavailable, message: "The audio session is now configured through the `PublicationSpeechSynthesizer`")
public convenience init(
audioSessionConfig: AudioSession.Configuration? = nil,
delegate: AVTTSEngineDelegate? = nil
) {
self.init(delegate: delegate)
}

public lazy var availableVoices: [TTSVoice] =
AVSpeechSynthesisVoice.speechVoices()
.map { TTSVoice(voice: $0) }
Expand Down
9 changes: 0 additions & 9 deletions Sources/Navigator/TTS/TTSEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ public extension TTSEngine {
func voiceWithIdentifier(_ identifier: String) -> TTSVoice? {
availableVoices.first { $0.identifier == identifier }
}

@available(*, unavailable, message: "Use the async variant")
func speak(
_ utterance: TTSUtterance,
onSpeakRange: @escaping (Range<String.Index>) -> Void,
completion: @escaping (Result<Void, TTSError>) -> Void
) -> Cancellable {
fatalError()
}
}

public enum TTSError: Error {
Expand Down
21 changes: 0 additions & 21 deletions Sources/Navigator/VisualNavigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ public protocol VisualNavigator: Navigator, InputObservable {
func firstVisibleElementLocator() async -> Locator?
}

public extension VisualNavigator {
/// Current reading progression direction.
@available(*, unavailable, message: "Use `presentation.readingProgression` instead", renamed: "presentation.readingProgression")
var readingProgression: ReadiumShared.ReadingProgression { fatalError() }
}

public extension VisualNavigator {
func firstVisibleElementLocator() async -> Locator? {
currentLocation
Expand All @@ -71,21 +65,6 @@ public extension VisualNavigator {
return await goBackward(options: options)
}
}

@available(*, unavailable, message: "Use the async variant")
func firstVisibleElementLocator(completion: @escaping (Locator?) -> Void) {
fatalError()
}

@available(*, unavailable, message: "Use the async variant")
func goLeft(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
fatalError()
}

@available(*, unavailable, message: "Use the async variant")
func goRight(animated: Bool = false, completion: @escaping () -> Void = {}) -> Bool {
fatalError()
}
}

public struct VisualNavigatorPresentation {
Expand Down
5 changes: 0 additions & 5 deletions Sources/Shared/Logger/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

import Foundation

@available(*, unavailable, renamed: "ReadiumEnableLog")
public func R2EnableLog(withMinimumSeverityLevel level: SeverityLevel, customLogger: LoggerType = LoggerStub()) {
fatalError()
}

/// Initialize the Logger.
/// Default logger is the `LoggerStub` class
///
Expand Down
Loading