Skip to content

Commit

Permalink
Fix deprecations + remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
ettore committed Feb 5, 2024
1 parent 851bcc5 commit 585651b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
5 changes: 2 additions & 3 deletions NYPLAudiobookToolkit/DRM/FeedbookDRMProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ class FeedbookDRMProcessor {

guard status == noErr else {
if #available(iOS 11.3, *) {
var errorMessage = ""
SecCopyErrorMessageString(status, &errorMessage)
ATLog(.error, "Failed to verify data - \(errorMessage)")
let err = SecCopyErrorMessageString(status, nil) ?? "" as CFString
ATLog(.error, "Failed to verify data - status: \(status.description) - error: \(err)")
} else {
ATLog(.error, "Failed to verify data - \(status.description)")
}
Expand Down
2 changes: 1 addition & 1 deletion NYPLAudiobookToolkit/Network/OverdriveDownloadTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class OverdriveDownloadTask: DownloadTask {

/// For monitoring download task with long download time.
private var fetchStartTime: Date?
/// Timer for monitoring the duration of the download task takes to complete.
/// Timer for monitoring how long the download task takes to complete.
/// We log a warning statement by calling the delegates
/// when the download task reaches 30s and 180s marks.
private var monitoringTimer: NYPLRepeatingTimer?
Expand Down
4 changes: 1 addition & 3 deletions NYPLAudiobookToolkit/UI/AudiobookCoverImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ public class AudiobookCoverImageView: UIImageView {
contentMode = .scaleAspectFill
isAccessibilityElement = true
accessibilityLabel = NSLocalizedString("Cover", bundle: Bundle.audiobookToolkit()!, value: "Cover", comment:"The art on an album cover.")
if #available(iOS 11.0, *) {
accessibilityIgnoresInvertColors = true
}
accessibilityIgnoresInvertColors = true
}

required init?(coder aDecoder: NSCoder) {
Expand Down
19 changes: 1 addition & 18 deletions NYPLAudiobookToolkit/UI/AudiobookPlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,24 +331,7 @@ private let tocImageName = "table_of_contents"
}

func audioRoutingBarButtonItem() -> UIBarButtonItem {
let view: UIView
if #available(iOS 11.0, *) {
view = AVRoutePickerView()
} else {
let volumeView = MPVolumeView()
volumeView.showsVolumeSlider = false
volumeView.showsRouteButton = true
// Set tint of route button: https://stackoverflow.com/a/33016391
for view in volumeView.subviews {
if view.isKind(of: UIButton.self) {
let buttonOnVolumeView = view as! UIButton
volumeView.setRouteButtonImage(buttonOnVolumeView.currentImage?.withRenderingMode(.alwaysTemplate), for: .normal)
break
}
}
volumeView.sizeToFit()
view = volumeView
}
let view = AVRoutePickerView()
let buttonItem = UIBarButtonItem(customView: view)
buttonItem.width = audioRouteButtonWidth
buttonItem.isAccessibilityElement = true
Expand Down
26 changes: 6 additions & 20 deletions NYPLAudiobookToolkit/Utils/NYPLColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class NYPLColor {
if #available(iOS 13.0, *),
UIScreen.main.traitCollection.userInterfaceStyle == .light {
return .systemBackground
} else if #available(iOS 11.0, *),
let color = UIColor(named: ColorAsset.primaryBackground.rawValue) {
} else if let color = UIColor(named: ColorAsset.primaryBackground.rawValue) {
return color
}

Expand All @@ -34,8 +33,7 @@ class NYPLColor {
if #available(iOS 13.0, *),
UIScreen.main.traitCollection.userInterfaceStyle == .light {
return .label
} else if #available(iOS 11.0, *),
let color = UIColor(named: ColorAsset.primaryText.rawValue) {
} else if let color = UIColor(named: ColorAsset.primaryText.rawValue) {
return color
}

Expand All @@ -46,8 +44,7 @@ class NYPLColor {
if #available(iOS 13.0, *),
UIScreen.main.traitCollection.userInterfaceStyle == .light {
return .secondarySystemBackground
} else if #available(iOS 11.0, *),
let color = UIColor(named: ColorAsset.secondaryBackground.rawValue) {
} else if let color = UIColor(named: ColorAsset.secondaryBackground.rawValue) {
return color
}

Expand All @@ -58,29 +55,18 @@ class NYPLColor {
if #available(iOS 13.0, *),
UIScreen.main.traitCollection.userInterfaceStyle == .light {
return .link
} else if #available(iOS 11.0, *),
let color = UIColor(named: ColorAsset.action.rawValue) {
} else if let color = UIColor(named: ColorAsset.action.rawValue) {
return color
}

return .systemBlue
}

static var disabledFieldTextColor: UIColor {
if #available(iOS 11.0, *),
let color = UIColor(named: ColorAsset.disabledFieldText.rawValue) {
return color
}

return .lightGray
UIColor(named: ColorAsset.disabledFieldText.rawValue) ?? .lightGray
}

static var progressBarBackgroundColor: UIColor {
if #available(iOS 11.0, *),
let color = UIColor(named: ColorAsset.progressBarBackground.rawValue) {
return color
}

return .darkGray
UIColor(named: ColorAsset.progressBarBackground.rawValue) ?? .darkGray
}
}

0 comments on commit 585651b

Please sign in to comment.