Skip to content
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
7 changes: 6 additions & 1 deletion Sources/LCP/Authentications/LCPDialogViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ final class LCPDialogViewController: UIViewController {

/// Makes sure the form contents is scrollable when the keyboard is visible.
@objc func keyboardWillChangeFrame(_ note: Notification) {
guard let window = UIApplication.shared.keyWindow, let scrollView = scrollView, let scrollViewSuperview = scrollView.superview, let info = note.userInfo else {
guard
let window = view.window,
let scrollView = scrollView,
let scrollViewSuperview = scrollView.superview,
let info = note.userInfo
else {
return
}

Expand Down
21 changes: 7 additions & 14 deletions Sources/Navigator/EPUB/EPUBSpreadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,7 @@ extension EPUBSpreadView: UIScrollViewDelegate {
}
}

extension EPUBSpreadView: WKUIDelegate {
func webView(_ webView: WKWebView, shouldPreviewElement elementInfo: WKPreviewElementInfo) -> Bool {
// Preview allowed only if the link is not internal
guard let url = elementInfo.linkURL?.httpURL else {
return true
}
return url.isRelative(to: viewModel.publicationBaseURL)
}
}
extension EPUBSpreadView: WKUIDelegate {}

extension EPUBSpreadView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: UIGestureRecognizer) -> Bool {
Expand All @@ -517,19 +509,20 @@ private extension EPUBSpreadView {
func updateActivityIndicator() {
switch viewModel.theme {
case .dark:
createActivityIndicator(style: .white)
createActivityIndicator(color: .white)
default:
createActivityIndicator(style: .gray)
createActivityIndicator(color: .systemGray)
}
}

func createActivityIndicator(style: UIActivityIndicatorView.Style) {
guard activityIndicatorView?.style != style else {
func createActivityIndicator(color: UIColor) {
guard activityIndicatorView?.color != color else {
return
}

activityIndicatorView?.removeFromSuperview()
let view = UIActivityIndicatorView(style: style)
let view = UIActivityIndicatorView(style: .medium)
view.color = color
view.translatesAutoresizingMaskIntoConstraints = false
addSubview(view)
view.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
Expand Down
2 changes: 1 addition & 1 deletion Sources/Navigator/EditingAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct EditingAction: Hashable {
/// Search Web.
public static let lookup = EditingAction(kind: .native(["lookup", "_lookup:", "define:", "_define:"]))

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

/// Translate the text selection.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Navigator/TTS/AVTTSEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class AVTTSEngine: NSObject, TTSEngine, AVSpeechSynthesizerDelegate, Logg
synthesizer.delegate = self
}

@available(*, deprecated, message: "The audio session is now configured through the `PublicationSpeechSynthesizer`")
@available(*, unavailable, message: "The audio session is now configured through the `PublicationSpeechSynthesizer`")
public convenience init(
audioSessionConfig: AudioSession.Configuration? = nil,
delegate: AVTTSEngineDelegate? = nil
Expand Down
8 changes: 6 additions & 2 deletions Sources/Navigator/Toolkit/Extensions/UIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ extension UIView {
/// We use that instead of pinning the content directly to the safe area layout guides to avoid
/// the view shifting when the status bar is toggled.
var notchAreaInsets: UIEdgeInsets {
var windowSafeAreaInsets = window?.safeAreaInsets ?? safeAreaInsets
guard let window = window else {
return safeAreaInsets
}

var windowSafeAreaInsets = window.safeAreaInsets

// Trick to ignore the status bar on devices without notches (pre iPhone X).
// Notch height is usually at least 44pts tall.
let statusBarSize = UIApplication.shared.statusBarFrame.size
let statusBarSize = window.windowScene?.statusBarManager?.statusBarFrame.size ?? .zero
// The frame is in the coordinate space of the window, so it might be swapped in landscape.
let statusBarHeight = min(statusBarSize.width, statusBarSize.height)
if statusBarHeight < 44, windowSafeAreaInsets.top == statusBarHeight {
Expand Down
24 changes: 4 additions & 20 deletions Sources/Shared/Publication/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public struct Link: JSONEquatable, Hashable, Sendable {

// MARK: Copy

@available(*, deprecated, message: "Make a mutable copy of the struct instead")
@available(*, unavailable, message: "Make a mutable copy of the struct instead")
/// Makes a copy of the `Link`, after modifying some of its properties.
public func copy(
href: String? = nil,
Expand All @@ -223,21 +223,7 @@ public struct Link: JSONEquatable, Hashable, Sendable {
alternates: [Link]? = nil,
children: [Link]? = nil
) -> Link {
Link(
href: href ?? self.href,
mediaType: mediaType ?? self.mediaType,
templated: templated ?? self.templated,
title: title ?? self.title,
rels: rels ?? self.rels,
properties: properties ?? self.properties,
height: height ?? self.height,
width: width ?? self.width,
bitrate: bitrate ?? self.bitrate,
duration: duration ?? self.duration,
languages: languages ?? self.languages,
alternates: alternates ?? self.alternates,
children: children ?? self.children
)
fatalError()
}

/// Merges in the given additional other `properties`.
Expand All @@ -246,11 +232,9 @@ public struct Link: JSONEquatable, Hashable, Sendable {
}

/// Makes a copy of this `Link` after merging in the given additional other `properties`.
@available(*, deprecated, message: "Use `addProperties` on a mutable copy")
@available(*, unavailable, message: "Use `addProperties` on a mutable copy")
public func addingProperties(_ properties: [String: Any]) -> Link {
var copy = self
copy.addProperties(properties)
return copy
fatalError()
}
}

Expand Down
12 changes: 2 additions & 10 deletions Sources/Shared/Publication/Manifest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public struct Manifest: JSONEquatable, Hashable, Sendable {
}

/// Makes a copy of the `Manifest`, after modifying some of its properties.
@available(*, deprecated, message: "Make a mutable copy of the struct instead")
@available(*, unavailable, message: "Make a mutable copy of the struct instead")
public func copy(
context: [String]? = nil,
metadata: Metadata? = nil,
Expand All @@ -196,14 +196,6 @@ public struct Manifest: JSONEquatable, Hashable, Sendable {
tableOfContents: [Link]? = nil,
subcollections: [String: [PublicationCollection]]? = nil
) -> Manifest {
Manifest(
context: context ?? self.context,
metadata: metadata ?? self.metadata,
links: links ?? self.links,
readingOrder: readingOrder ?? self.readingOrder,
resources: resources ?? self.resources,
tableOfContents: tableOfContents ?? self.tableOfContents,
subcollections: subcollections ?? self.subcollections
)
fatalError()
}
}
2 changes: 1 addition & 1 deletion Sources/Shared/Publication/Properties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public struct Properties: Hashable, Loggable, WarningLogger, Sendable {
}

/// Makes a copy of this `Properties` after merging in the given additional other `properties`.
@available(*, deprecated, message: "Use `add` on a mutable copy")
@available(*, unavailable, message: "Use `add` on a mutable copy")
public func adding(_ properties: JSONDictionary.Wrapped) -> Properties {
var copy = self
copy.add(properties)
Expand Down
3 changes: 1 addition & 2 deletions Sources/Shared/Publication/Publication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ public class Publication: Closeable, Loggable {
public init(
manifest: Manifest,
container: Container,
servicesBuilder: PublicationServicesBuilder = .init(),
setupPublication: ((Publication) -> Void)? = nil
servicesBuilder: PublicationServicesBuilder = .init()
) {
self.manifest = manifest
self.container = container
Expand Down
4 changes: 2 additions & 2 deletions Sources/Shared/Toolkit/Data/Resource/Resource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public extension Resource {
@available(*, unavailable, message: "Use the async variant")
var length: ResourceResult<UInt64> { fatalError() }

@available(*, deprecated, renamed: "sourceURL")
@available(*, unavailable, renamed: "sourceURL")
var file: FileURL? { fatalError() }

@available(*, unavailable, message: "Use the async variant")
func read(range: Range<UInt64>?) -> ResourceResult<Data> { fatalError() }

@available(*, deprecated, message: "Use the async variant")
@available(*, unavailable, message: "Use the async variant")
func stream(range: Range<UInt64>?, consume: @escaping (Data) -> Void, completion: @escaping (ReadResult<Void>) -> Void) -> Cancellable {
fatalError()
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Shared/Toolkit/Media/AudioSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import AVFoundation
import Foundation
import UIKit

@available(*, deprecated, message: "Use `AudioSession` instead")
@available(*, unavailable, message: "Use `AudioSession` instead")
public typealias _AudioSession = AudioSession
@available(*, deprecated, message: "Use `AudioSessionUser` instead")
@available(*, unavailable, message: "Use `AudioSessionUser` instead")
public typealias _AudioSessionUser = AudioSessionUser

/// An user of the `AudioSession`, for example a media player object.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Toolkit/Media/NowPlayingInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation
import MediaPlayer
import UIKit

@available(*, deprecated, message: "Use `NowPlayingInfo` instead")
@available(*, unavailable, message: "Use `NowPlayingInfo` instead")
public typealias _NowPlayingInfo = NowPlayingInfo

/// Manages the Now Playing media item displayed on the lock screen.
Expand Down