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
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class FilterChipButton: UIView {
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)

if #available(iOS 13, *), traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
applyColors()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ extension GravatarButtonView {
extension GravatarButtonView {

private struct StandardBorder {
static var color: UIColor {
if #available(iOS 13, *) {
return .separator
}

return .gray(.shade20)
}
static let color: UIColor = .separator

static let width = CGFloat(0.5)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ class TimeSelectionView: UIView {

private lazy var timePicker: UIDatePicker = {
let datePicker = UIDatePicker()

if #available(iOS 13.4, *) {
datePicker.preferredDatePickerStyle = .wheels
}

datePicker.preferredDatePickerStyle = .wheels
datePicker.datePickerMode = .time
datePicker.translatesAutoresizingMaskIntoConstraints = false
datePicker.setDate(selectedTime, animated: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ class DomainSuggestionsTableViewController: UITableViewController {
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)

if #available(iOS 13, *) {
if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
tableView.reloadData()
}
if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
tableView.reloadData()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ class GutenbergWebNavigationController: UINavigationController {
super.present(viewControllerToPresent, animated: flag, completion: completion)
}

guard
#available(iOS 13, *),
let menuViewControllerClass = NSClassFromString("UIDocumentMenuViewController"), // Silence deprecation warning.
guard let menuViewControllerClass = NSClassFromString("UIDocumentMenuViewController"), // Silence deprecation warning.
viewControllerToPresent.isKind(of: menuViewControllerClass),
UIDevice.current.userInterfaceIdiom == .phone
else {
Expand Down
19 changes: 4 additions & 15 deletions WordPress/Classes/ViewRelated/Gutenberg/Views/GutenGhostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,11 @@ class GutenGhostView: UIView {
}

private extension UIColor {
static var ghostToolbarBackground: UIColor {
if #available(iOS 13, *) {
return UIColor(light: .clear, dark: UIColor.colorFromHex("2e2e2e"))
}
return .clear
}
static let ghostToolbarBackground = UIColor(light: .clear, dark: UIColor.colorFromHex("2e2e2e"))

static var ghostBlockBackground: UIColor {
return UIColor(light: .clear, dark: .systemGray5)
}
static let ghostBlockBackground = UIColor(light: .clear, dark: .systemGray5)

static var beatEndColor: UIColor {
return UIColor(light: .systemGray6, dark: .clear)
}
static let beatEndColor = UIColor(light: .systemGray6, dark: .clear)

static var background: UIColor {
return .systemBackground
}
static let background = UIColor.systemBackground
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ class AuthorFilterViewController: UITableViewController {
tableView.separatorColor = .clear
tableView.isScrollEnabled = false
tableView.showsVerticalScrollIndicator = false
if #available(iOS 13, *) {
tableView.contentInset = .zero
} else {
tableView.contentInset = UIEdgeInsets(top: -Metrics.topinset, left: 0, bottom: 0, right: 0)
}
tableView.contentInset = .zero
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ class PostTagPickerViewController: UIViewController {

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if #available(iOS 13, *) {
textViewContainer.layer.borderColor = UIColor.divider.cgColor
}
textViewContainer.layer.borderColor = UIColor.divider.cgColor
}

@objc func doneButtonPressed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,17 @@ class ReaderWebView: WKWebView {
/// Maps app colors to CSS colors to be applied in the webview
///
private func cssColors() -> String {
if #available(iOS 13, *) {
return """
@media (prefers-color-scheme: dark) {
\(mappedCSSColors(.dark))
}

@media (prefers-color-scheme: light) {
\(mappedCSSColors(.light))
}
"""
}
return """
@media (prefers-color-scheme: dark) {
\(mappedCSSColors(.dark))
}

return lightCSSColors()
@media (prefers-color-scheme: light) {
\(mappedCSSColors(.light))
}
"""
}

/// If iOS 13, returns light and dark colors
///
@available(iOS 13, *)
private func mappedCSSColors(_ style: UIUserInterfaceStyle) -> String {
let trait = UITraitCollection(userInterfaceStyle: style)
UIColor(light: .muriel(color: .gray, .shade40),
Expand All @@ -196,21 +189,4 @@ class ReaderWebView: WKWebView {
}
"""
}

/// If iOS 12 or below, returns only light colors
///
private func lightCSSColors() -> String {
return """
:root {
--color-text: #\(UIColor.text.hexString() ?? "");
--color-neutral-0: #\(UIColor.listForegroundUnread.hexString() ?? "");
--color-neutral-10: #\(UIColor(color: .muriel(color: .gray, .shade10)).hexString() ?? "");
--color-neutral-40: #\(UIColor(color: .muriel(color: .gray, .shade40)).hexString() ?? "");
--color-neutral-50: #\(UIColor.textSubtle.hexString() ?? "");
--color-neutral-70: #\(UIColor.text.hexString() ?? "");
--main-link-color: #\(UIColor.primary.hexString() ?? "");
--main-link-active-color: #\(UIColor.primaryDark.hexString() ?? "");
}
"""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ class ReaderInterestsStyleGuide {
}

// MARK: - Next Button
public class var buttonContainerViewBackgroundColor: UIColor {
if #available(iOS 13, *) {
return .tertiarySystemBackground
}

return .white
}
public static let buttonContainerViewBackgroundColor: UIColor = .tertiarySystemBackground

public class func applyNextButtonStyle(button: FancyButton) {
let disabledBackgroundColor: UIColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ final class SearchTextField: UITextField {
}()

private lazy var activityIndicator: UIActivityIndicatorView = {
let activityIndicator: UIActivityIndicatorView
if #available(iOS 13, *) {
activityIndicator = UIActivityIndicatorView(style: .medium)
} else {
activityIndicator = UIActivityIndicatorView(style: .gray)
}
let activityIndicator = UIActivityIndicatorView(style: .medium)
activityIndicator.backgroundColor = UIColor.clear

return activityIndicator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,7 @@ extension WPStyleGuide {
static let selectedDay = UIColor.accent
}

static var mapBackground: UIColor {
if #available(iOS 13, *) {
return .systemGray4
}
return .neutral(.shade10)
}
static let mapBackground: UIColor = .systemGray4

// MARK: - Posting Activity Collection View Styles

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ private extension CountriesMapView {
}

func mapColors() -> [UIColor] {
if #available(iOS 13, *) {
if traitCollection.userInterfaceStyle == .dark {
return [.primary(.shade90), .primary]
}
if traitCollection.userInterfaceStyle == .dark {
return [.primary(.shade90), .primary]
} else {
return [.primary(.shade5), .primary]
}
return [.primary(.shade5), .primary]
}

func setGradientColors() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ class WidgetStyles: NSObject {
static let headlineFont = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .headline).pointSize)
static let footnoteNote = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .footnote).pointSize)

static var separatorColor: UIColor = {
if #available(iOS 13, *) {
return .separator
} else {
return .divider
}
}()
static let separatorColor: UIColor = .separator

static var separatorVibrancyEffect: UIVibrancyEffect = {
if #available(iOS 13, *) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class WPRichContentView: UITextView {
return formattedAttributedString(for: string, style: style)
}

@available(iOS 13, *)
class func formattedAttributedString(for string: String, style: UIUserInterfaceStyle) -> NSAttributedString {
let trait = UITraitCollection(userInterfaceStyle: style)
let style = AttributedStringStyle(textColorHex: UIColor.text.color(for: trait).hexString() ?? fallbackTextColorHex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ class ExtensionPresentationController: UIPresentationController {
presentedView?.layer.cornerRadius = Appearance.cornerRadius
presentedView?.clipsToBounds = true
}
guard #available(iOS 13, *) else {
presentedView?.frame = frameOfPresentedViewInContainerView
return
}
presentedView?.frame = viewFrame
}

Expand Down