Finish migration away from AppAssets to AppImage and AppColor.

This commit is contained in:
Brent Simmons
2025-01-30 12:58:14 -08:00
parent 6db201f827
commit 0dfb284f67
37 changed files with 179 additions and 638 deletions

View File

@@ -16,7 +16,7 @@ final class AddComboTableViewCell: VibrantTableViewCell {
override func updateVibrancy(animated: Bool) {
super.updateVibrancy(animated: animated)
let iconTintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : AppAssets.secondaryAccentColor
let iconTintColor = isHighlighted || isSelected ? AppColor.vibrantText : AppColor.secondaryAccent
if animated {
UIView.animate(withDuration: Self.duration) {
self.icon.tintColor = iconTintColor

View File

@@ -16,7 +16,7 @@ final class SelectComboTableViewCell: VibrantTableViewCell {
override func updateVibrancy(animated: Bool) {
super.updateVibrancy(animated: animated)
let iconTintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
let iconTintColor = isHighlighted || isSelected ? AppColor.vibrantText : UIColor.label
if animated {
UIView.animate(withDuration: Self.duration) {
self.icon.tintColor = iconTintColor

View File

@@ -1,281 +0,0 @@
//
// AppAssets.swift
// NetNewsWire
//
// Created by Maurice Parker on 4/8/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import UIKit
import RSCore
import Account
struct AppAssets {
// static var accountBazQuxImage: UIImage = {
// return UIImage(named: "accountBazQux")!
// }()
// static var accountCloudKitImage: UIImage = {
// return UIImage(named: "accountCloudKit")!
// }()
//
// static var accountFeedbinImage: UIImage = {
// return UIImage(named: "accountFeedbin")!
// }()
//
// static var accountFeedlyImage: UIImage = {
// return UIImage(named: "accountFeedly")!
// }()
//
// static var accountFreshRSSImage: UIImage = {
// return UIImage(named: "accountFreshRSS")!
// }()
//
// static var accountInoreaderImage: UIImage = {
// return UIImage(named: "accountInoreader")!
// }()
//
// static var accountLocalPadImage: UIImage = {
// return UIImage(named: "accountLocalPad")!
// }()
//
// static var accountLocalPhoneImage: UIImage = {
// return UIImage(named: "accountLocalPhone")!
// }()
//
// static var accountNewsBlurImage: UIImage = {
// return UIImage(named: "accountNewsBlur")!
// }()
//
// static var accountTheOldReaderImage: UIImage = {
// return UIImage(named: "accountTheOldReader")!
// }()
// static let nnwFeedIcon = RSImage(named: "nnwFeedIcon")!
// static var articleExtractorError: UIImage = {
// return UIImage(named: "articleExtractorError")!
// }()
//
// static var articleExtractorOff: UIImage = {
// return UIImage(named: "articleExtractorOff")!
// }()
//
// static var articleExtractorOffSF: UIImage = {
// return UIImage(systemName: "doc.plaintext")!
// }()
//
// static var articleExtractorOffTinted: UIImage = {
// let image = UIImage(named: "articleExtractorOff")!
// return image.tinted(color: AppAssets.primaryAccentColor)!
// }()
//
// static var articleExtractorOn: UIImage = {
// return UIImage(named: "articleExtractorOn")!
// }()
//
// static var articleExtractorOnSF: UIImage = {
// return UIImage(named: "articleExtractorOnSF")!
// }()
//
// static var articleExtractorOnTinted: UIImage = {
// let image = UIImage(named: "articleExtractorOn")!
// return image.tinted(color: AppAssets.primaryAccentColor)!
// }()
static var iconBackgroundColor: UIColor = {
return UIColor(named: "iconBackgroundColor")!
}()
// static var circleClosedImage: UIImage = {
// return UIImage(systemName: "largecircle.fill.circle")!
// }()
// static var circleOpenImage: UIImage = {
// return UIImage(systemName: "circle")!
// }()
// static var disclosureImage: UIImage = {
// return UIImage(named: "disclosure")!
// }()
// static var copyImage: UIImage = {
// return UIImage(systemName: "doc.on.doc")!
// }()
// static var deactivateImage: UIImage = {
// UIImage(systemName: "minus.circle")!
// }()
// static var editImage: UIImage = {
// UIImage(systemName: "square.and.pencil")!
// }()
// static var faviconTemplateImage: RSImage = {
// return RSImage(named: "faviconTemplateImage")!
// }()
// static var filterInactiveImage: UIImage = {
// UIImage(systemName: "line.horizontal.3.decrease.circle")!
// }()
// static var filterActiveImage: UIImage = {
// UIImage(systemName: "line.horizontal.3.decrease.circle.fill")!
// }()
// static var folderOutlinePlus: UIImage = {
// UIImage(systemName: "folder.badge.plus")!
// }()
static var fullScreenBackgroundColor: UIColor = {
return UIColor(named: "fullScreenBackgroundColor")!
}()
// static var infoImage: UIImage = {
// UIImage(systemName: "info.circle")!
// }()
// static var markAllAsReadImage: UIImage = {
// return UIImage(named: "markAllAsRead")!
// }()
// static var markBelowAsReadImage: UIImage = {
// return UIImage(systemName: "arrowtriangle.down.circle")!
// }()
// static var markAboveAsReadImage: UIImage = {
// return UIImage(systemName: "arrowtriangle.up.circle")!
// }()
static var folderImage: IconImage = {
return IconImage(UIImage(systemName: "folder.fill")!, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
}()
// static var moreImage: UIImage = {
// return UIImage(systemName: "ellipsis.circle")!
// }()
// static var nextArticleImage: UIImage = {
// return UIImage(systemName: "chevron.down")!
// }()
// static var nextUnreadArticleImage: UIImage = {
// return UIImage(systemName: "chevron.down.circle")!
// }()
// static var plus: UIImage = {
// UIImage(systemName: "plus")!
// }()
// static var prevArticleImage: UIImage = {
// return UIImage(systemName: "chevron.up")!
// }()
// static var openInSidebarImage: UIImage = {
// return UIImage(systemName: "arrow.turn.down.left")!
// }()
static var primaryAccentColor: UIColor {
return UIColor(named: "primaryAccentColor")!
}
// static var safariImage: UIImage = {
// return UIImage(systemName: "safari")!
// }()
static var searchFeedImage: IconImage = {
return IconImage(UIImage(systemName: "magnifyingglass")!, isSymbol: true)
}()
static var secondaryAccentColor: UIColor {
return UIColor(named: "secondaryAccentColor")!
}
static var sectionHeaderColor: UIColor = {
return UIColor(named: "sectionHeaderColor")!
}()
// static var shareImage: UIImage = {
// return UIImage(systemName: "square.and.arrow.up")!
// }()
// static var smartFeedImage: UIImage = {
// return UIImage(systemName: "gear")!
// }()
static var starColor: UIColor = {
return UIColor(named: "starColor")!
}()
static var starClosedImage: UIImage = {
return UIImage(systemName: "star.fill")!
}()
static var starOpenImage: UIImage = {
return UIImage(systemName: "star")!
}()
static var starredFeedImage: IconImage {
let image = UIImage(systemName: "star.fill")!
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.starColor.cgColor)
}
static var tickMarkColor: UIColor = {
return UIColor(named: "tickMarkColor")!
}()
// static var timelineStarImage: UIImage = {
// let image = UIImage(systemName: "star.fill")!
// return image.withTintColor(AppAssets.starColor, renderingMode: .alwaysOriginal)
// }()
static var todayFeedImage: IconImage {
let image = UIImage(systemName: "sun.max.fill")!
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: UIColor.systemOrange.cgColor)
}
// static var trashImage: UIImage = {
// return UIImage(systemName: "trash")!
// }()
static var unreadFeedImage: IconImage {
let image = UIImage(systemName: "largecircle.fill.circle")!
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
}
static var vibrantTextColor: UIColor = {
return UIColor(named: "vibrantTextColor")!
}()
static var controlBackgroundColor: UIColor = {
return UIColor(named: "controlBackgroundColor")!
}()
// static func image(for accountType: AccountType) -> UIImage? {
// switch accountType {
// case .onMyMac:
// if UIDevice.current.userInterfaceIdiom == .pad {
// return AppAssets.accountLocalPadImage
// } else {
// return AppAssets.accountLocalPhoneImage
// }
// case .cloudKit:
// return AppAssets.accountCloudKitImage
// case .feedbin:
// return AppAssets.accountFeedbinImage
// case .feedly:
// return AppAssets.accountFeedlyImage
// case .freshRSS:
// return AppAssets.accountFreshRSSImage
// case .newsBlur:
// return AppAssets.accountNewsBlurImage
// case .inoreader:
// return AppAssets.accountInoreaderImage
// case .bazQux:
// return AppAsset.accountBazQuxImage
// case .theOldReader:
// return AppAssets.accountTheOldReaderImage
// }
// }
}

View File

@@ -233,10 +233,10 @@ final class ArticleViewController: UIViewController {
}
if article.status.starred {
starBarButtonItem.image = AppAssets.starClosedImage
starBarButtonItem.image = AppImage.starClosed
starBarButtonItem.accLabelText = NSLocalizedString("Selected - Star Article", comment: "Selected - Star Article")
} else {
starBarButtonItem.image = AppAssets.starOpenImage
starBarButtonItem.image = AppImage.starOpen
starBarButtonItem.accLabelText = NSLocalizedString("Star Article", comment: "Star Article")
}
}

View File

@@ -41,7 +41,7 @@ final class ImageTransition: NSObject, UIViewControllerAnimatedTransitioning {
let fromView = transitionContext.view(forKey: .from)!
fromView.removeFromSuperview()
transitionContext.containerView.backgroundColor = AppAssets.fullScreenBackgroundColor
transitionContext.containerView.backgroundColor = AppColor.fullScreenBackground
transitionContext.containerView.addSubview(imageView)
webViewController?.hideClickedImage()

View File

@@ -751,7 +751,7 @@ private extension WebViewController {
func toggleStarredAction() -> UIAction {
let starred = article?.status.starred ?? false
let title = starred ? NSLocalizedString("Mark as Unstarred", comment: "Mark as Unstarred") : NSLocalizedString("Mark as Starred", comment: "Mark as Starred")
let starredImage = starred ? AppAssets.starOpenImage : AppAssets.starClosedImage
let starredImage = starred ? AppImage.starOpen : AppImage.starClosed
return UIAction(title: title, image: starredImage) { [weak self] _ in
self?.coordinator.toggleStarredForCurrentArticle()
}

View File

@@ -111,7 +111,7 @@ private extension IconView {
private func updateBackgroundColor() {
if !isBackgroundSuppressed && ((iconImage != nil && isVerticalBackgroundExposed) || !isDiscernable) {
backgroundColor = AppAssets.iconBackgroundColor
backgroundColor = AppColor.iconBackground
} else {
backgroundColor = nil
}

View File

@@ -171,12 +171,12 @@ final class MainFeedTableViewCell: VibrantTableViewCell {
let iconTintColor: UIColor
if isHighlighted || isSelected {
iconTintColor = AppAssets.vibrantTextColor
iconTintColor = AppColor.vibrantText
} else {
if let preferredColor = iconImage?.preferredColor {
iconTintColor = UIColor(cgColor: preferredColor)
} else {
iconTintColor = AppAssets.secondaryAccentColor
iconTintColor = AppColor.secondaryAccent
}
}
@@ -207,7 +207,7 @@ private extension MainFeedTableViewCell {
disclosureButton = NonIntrinsicButton(type: .roundedRect)
disclosureButton!.addTarget(self, action: #selector(buttonPressed(_:)), for: UIControl.Event.touchUpInside)
disclosureButton?.setImage(AppImage.disclosure, for: .normal)
disclosureButton?.tintColor = AppAssets.controlBackgroundColor
disclosureButton?.tintColor = AppColor.controlBackground
disclosureButton?.imageView?.contentMode = .center
disclosureButton?.imageView?.clipsToBounds = false
disclosureButton?.addInteraction(UIPointerInteraction())

View File

@@ -203,7 +203,7 @@ private extension MainFeedTableViewSectionHeader {
func addBackgroundView() {
self.backgroundView = UIView(frame: self.bounds)
self.backgroundView?.backgroundColor = AppAssets.sectionHeaderColor
self.backgroundView?.backgroundColor = AppColor.sectionHeader
}
}

View File

@@ -15,7 +15,7 @@ class MainFeedUnreadCountView: UIView {
}
let cornerRadius = 8.0
let bgColor = AppAssets.controlBackgroundColor
let bgColor = AppColor.controlBackground
var textColor: UIColor {
return UIColor.white
}

View File

@@ -62,16 +62,16 @@ final class MainTimelineTableViewCell: VibrantTableViewCell {
if animated {
UIView.animate(withDuration: Self.duration) {
if self.isHighlighted || self.isSelected {
self.unreadIndicatorView.backgroundColor = AppAssets.vibrantTextColor
self.unreadIndicatorView.backgroundColor = AppColor.vibrantText
} else {
self.unreadIndicatorView.backgroundColor = AppAssets.secondaryAccentColor
self.unreadIndicatorView.backgroundColor = AppColor.secondaryAccent
}
}
} else {
if self.isHighlighted || self.isSelected {
self.unreadIndicatorView.backgroundColor = AppAssets.vibrantTextColor
self.unreadIndicatorView.backgroundColor = AppColor.vibrantText
} else {
self.unreadIndicatorView.backgroundColor = AppAssets.secondaryAccentColor
self.unreadIndicatorView.backgroundColor = AppColor.secondaryAccent
}
}
}

View File

@@ -27,7 +27,7 @@ final class MainTimelineUnreadCountView: MainFeedUnreadCountView {
let cornerRadii = CGSize(width: cornerRadius, height: cornerRadius)
let rect = CGRect(x: 1, y: 1, width: bounds.width - 2, height: bounds.height - 2)
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: .allCorners, cornerRadii: cornerRadii)
AppAssets.primaryAccentColor.setFill()
AppColor.accent.setFill()
path.fill()
if unreadCount > 0 {

View File

@@ -283,7 +283,7 @@ final class TimelineViewController: UITableViewController, UndoableCommandRunner
}
readAction.image = article.status.read ? AppImage.circleClosed : AppImage.circleOpen
readAction.backgroundColor = AppAssets.primaryAccentColor
readAction.backgroundColor = AppColor.accent
return UISwipeActionsConfiguration(actions: [readAction])
}
@@ -302,8 +302,8 @@ final class TimelineViewController: UITableViewController, UndoableCommandRunner
completion(true)
}
starAction.image = article.status.starred ? AppAssets.starOpenImage : AppAssets.starClosedImage
starAction.backgroundColor = AppAssets.starColor
starAction.image = article.status.starred ? AppImage.starOpen : AppImage.starClosed
starAction.backgroundColor = AppColor.star
// Set up the read action
let moreTitle = NSLocalizedString("More", comment: "More")
@@ -805,7 +805,7 @@ private extension TimelineViewController {
let title = article.status.starred ?
NSLocalizedString("Mark as Unstarred", comment: "Mark as Unstarred") :
NSLocalizedString("Mark as Starred", comment: "Mark as Starred")
let image = article.status.starred ? AppAssets.starOpenImage : AppAssets.starClosedImage
let image = article.status.starred ? AppImage.starOpen : AppImage.starClosed
let action = UIAction(title: title, image: image) { [weak self] _ in
self?.coordinator.toggleStar(article)

View File

@@ -19,7 +19,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
window!.tintColor = AppAssets.primaryAccentColor
window!.tintColor = AppColor.accent
updateUserInterfaceStyle()
UINavigationBar.appearance().scrollEdgeAppearance = UINavigationBarAppearance()

View File

@@ -17,7 +17,7 @@ final class SettingsComboTableViewCell: VibrantTableViewCell {
super.updateVibrancy(animated: animated)
updateLabelVibrancy(comboNameLabel, color: labelColor, animated: animated)
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
let tintColor = isHighlighted || isSelected ? AppColor.vibrantText : UIColor.label
if animated {
UIView.animate(withDuration: Self.duration) {
self.comboImage?.tintColor = tintColor

View File

@@ -84,7 +84,7 @@ private extension TimelinePreviewTableViewController {
status: status
)
let iconImage = IconImage(AppImage.faviconTemplate.withTintColor(AppAssets.secondaryAccentColor))
let iconImage = IconImage(AppImage.faviconTemplate.withTintColor(AppColor.secondaryAccent))
return MainTimelineCellData(
article: prototypeArticle,

View File

@@ -48,7 +48,7 @@ final class ShareFolderPickerController: UITableViewController {
if let account = container as? ExtensionAccount {
cell.icon.image = AppImage.account(account.type)
} else {
cell.icon.image = AppAssets.folderImage.image
cell.icon.image = AppImage.folder.image
}
cell.label?.text = container?.name ?? ""

View File

@@ -53,11 +53,11 @@ private extension InteractiveNavigationController {
scrollEdgeStandardAppearance.backgroundColor = .systemBackground
navigationBar.scrollEdgeAppearance = scrollEdgeStandardAppearance
navigationBar.tintColor = AppAssets.primaryAccentColor
navigationBar.tintColor = AppColor.accent
let toolbarAppearance = UIToolbarAppearance()
toolbar.standardAppearance = toolbarAppearance
toolbar.compactAppearance = toolbarAppearance
toolbar.tintColor = AppAssets.primaryAccentColor
toolbar.tintColor = AppColor.accent
}
}

View File

@@ -36,7 +36,7 @@ final class TickMarkSlider: UISlider {
let tick = UIView()
tick.translatesAutoresizingMaskIntoConstraints = false
tick.backgroundColor = AppAssets.tickMarkColor
tick.backgroundColor = AppColor.tickMark
insertSubview(tick, at: 0)
tick.widthAnchor.constraint(equalToConstant: 3).isActive = true

View File

@@ -10,7 +10,7 @@ import UIKit
final class VibrantButton: UIButton {
@IBInspectable var backgroundHighlightColor: UIColor = AppAssets.secondaryAccentColor
@IBInspectable var backgroundHighlightColor: UIColor = AppColor.secondaryAccent
override init(frame: CGRect) {
super.init(frame: frame)
@@ -22,8 +22,8 @@ final class VibrantButton: UIButton {
}
private func commonInit() {
setTitleColor(AppAssets.vibrantTextColor, for: .highlighted)
let disabledColor = AppAssets.secondaryAccentColor.withAlphaComponent(0.5)
setTitleColor(AppColor.vibrantText, for: .highlighted)
let disabledColor = AppColor.secondaryAccent.withAlphaComponent(0.5)
setTitleColor(disabledColor, for: .disabled)
}

View File

@@ -21,7 +21,6 @@ final class VibrantLabel: UILabel {
}
private func commonInit() {
highlightedTextColor = AppAssets.vibrantTextColor
highlightedTextColor = AppColor.vibrantText
}
}

View File

@@ -13,11 +13,11 @@ class VibrantTableViewCell: UITableViewCell {
static let duration: TimeInterval = 0.6
var labelColor: UIColor {
return isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
return isHighlighted || isSelected ? AppColor.vibrantText : UIColor.label
}
var secondaryLabelColor: UIColor {
return isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.secondaryLabel
return isHighlighted || isSelected ? AppColor.vibrantText : UIColor.secondaryLabel
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
@@ -47,7 +47,7 @@ class VibrantTableViewCell: UITableViewCell {
/// Subclass overrides should call super
func applyThemeProperties() {
let selectedBackgroundView = UIView(frame: .zero)
selectedBackgroundView.backgroundColor = AppAssets.secondaryAccentColor
selectedBackgroundView.backgroundColor = AppColor.secondaryAccent
self.selectedBackgroundView = selectedBackgroundView
}
@@ -80,7 +80,7 @@ final class VibrantBasicTableViewCell: VibrantTableViewCell {
@IBInspectable var imageSelected: UIImage?
var iconTint: UIColor {
return isHighlighted || isSelected ? labelColor : AppAssets.primaryAccentColor
return isHighlighted || isSelected ? labelColor : AppColor.accent
}
var iconImage: UIImage? {