Flatten AppAsset — the inner structs were too cute.

This commit is contained in:
Brent Simmons 2024-09-30 22:16:54 -07:00
parent c88dc18644
commit 2ae6eaba9f
25 changed files with 119 additions and 120 deletions

View File

@ -31,7 +31,7 @@ extension AppAsset {
static let openInBrowser = RSImage.systemImage("safari") static let openInBrowser = RSImage.systemImage("safari")
static let readClosed = RSImage.systemImage("largecircle.fill.circle") static let readClosed = RSImage.systemImage("largecircle.fill.circle")
static let readOpen = RSImage.systemImage("circle") static let readOpen = RSImage.systemImage("circle")
static let share = AppAsset.share static let share = AppAsset.shareImage
} }
struct PreferencesToolbar { struct PreferencesToolbar {

View File

@ -167,7 +167,7 @@ import Sparkle
os_log(.debug, "Is first run.") os_log(.debug, "Is first run.")
} }
FaviconGenerator.faviconTemplateImage = AppAsset.faviconTemplate FaviconGenerator.faviconTemplateImage = AppAsset.faviconTemplateImage
importFeedsIfNeeded() importFeedsIfNeeded()
updateSortMenuItems() updateSortMenuItems()

View File

@ -25,16 +25,16 @@ final class ArticleExtractorButton: NSButton {
switch buttonState { switch buttonState {
case .error: case .error:
stripAnimatedSublayer() stripAnimatedSublayer()
image = AppAsset.ArticleExtractor.error image = AppAsset.articleExtractorErrorImage
case .animated: case .animated:
image = nil image = nil
needsLayout = true needsLayout = true
case .on: case .on:
stripAnimatedSublayer() stripAnimatedSublayer()
image = AppAsset.ArticleExtractor.on image = AppAsset.articleExtractorOnImage
case .off: case .off:
stripAnimatedSublayer() stripAnimatedSublayer()
image = AppAsset.ArticleExtractor.off image = AppAsset.articleExtractorOffImage
} }
} }
} }
@ -66,7 +66,7 @@ final class ArticleExtractorButton: NSButton {
private func commonInit() { private func commonInit() {
wantsLayer = true wantsLayer = true
bezelStyle = .texturedRounded bezelStyle = .texturedRounded
image = AppAsset.ArticleExtractor.off image = AppAsset.articleExtractorOffImage
imageScaling = .scaleProportionallyDown imageScaling = .scaleProportionallyDown
widthAnchor.constraint(equalTo: heightAnchor).isActive = true widthAnchor.constraint(equalTo: heightAnchor).isActive = true
} }
@ -85,12 +85,12 @@ final class ArticleExtractorButton: NSButton {
} }
private func addAnimatedSublayer(to hostedLayer: CALayer) { private func addAnimatedSublayer(to hostedLayer: CALayer) {
let image1 = AppAsset.ArticleExtractor.off.tinted(with: NSColor.controlTextColor) let image1 = AppAsset.articleExtractorOffImage.tinted(with: NSColor.controlTextColor)
let image2 = AppAsset.ArticleExtractor.on.tinted(with: NSColor.controlTextColor) let image2 = AppAsset.articleExtractorOnImage.tinted(with: NSColor.controlTextColor)
let images = [image1, image2, image1] let images = [image1, image2, image1]
animatedLayer = CALayer() animatedLayer = CALayer()
let imageSize = AppAsset.ArticleExtractor.off.size let imageSize = AppAsset.articleExtractorOffImage.size
animatedLayer!.bounds = CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height) animatedLayer!.bounds = CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height)
animatedLayer!.position = CGPoint(x: bounds.midX, y: bounds.midY) animatedLayer!.position = CGPoint(x: bounds.midX, y: bounds.midY)

View File

@ -813,11 +813,11 @@ extension MainWindowController: NSToolbarDelegate {
case .markAllAsRead: case .markAllAsRead:
let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read") let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
return buildToolbarButton(.markAllAsRead, title, AppAsset.markAllAsRead, "markAllAsRead:") return buildToolbarButton(.markAllAsRead, title, AppAsset.markAllAsReadImage, "markAllAsRead:")
case .toggleReadArticlesFilter: case .toggleReadArticlesFilter:
let title = NSLocalizedString("Read Articles Filter", comment: "Read Articles Filter") let title = NSLocalizedString("Read Articles Filter", comment: "Read Articles Filter")
return buildToolbarButton(.toggleReadArticlesFilter, title, AppAsset.filterInactive, "toggleReadArticlesFilter:") return buildToolbarButton(.toggleReadArticlesFilter, title, AppAsset.filterInactiveImage, "toggleReadArticlesFilter:")
case .timelineTrackingSeparator: case .timelineTrackingSeparator:
return NSTrackingSeparatorToolbarItem(identifier: .timelineTrackingSeparator, splitView: splitViewController!.splitView, dividerIndex: 1) return NSTrackingSeparatorToolbarItem(identifier: .timelineTrackingSeparator, splitView: splitViewController!.splitView, dividerIndex: 1)
@ -1190,7 +1190,7 @@ private extension MainWindowController {
(item as? NSMenuItem)?.title = hideCommand (item as? NSMenuItem)?.title = hideCommand
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton { if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
toolbarItem.toolTip = hideCommand toolbarItem.toolTip = hideCommand
button.image = AppAsset.filterInactive button.image = AppAsset.filterInactiveImage
} }
return false return false
} }
@ -1199,13 +1199,13 @@ private extension MainWindowController {
(item as? NSMenuItem)?.title = showCommand (item as? NSMenuItem)?.title = showCommand
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton { if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
toolbarItem.toolTip = showCommand toolbarItem.toolTip = showCommand
button.image = AppAsset.filterActive button.image = AppAsset.filterActiveImage
} }
} else { } else {
(item as? NSMenuItem)?.title = hideCommand (item as? NSMenuItem)?.title = hideCommand
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton { if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
toolbarItem.toolTip = hideCommand toolbarItem.toolTip = hideCommand
button.image = AppAsset.filterInactive button.image = AppAsset.filterInactiveImage
} }
} }

View File

@ -210,9 +210,9 @@ private extension TimelineContainerViewController {
readFilteredButton.isHidden = false readFilteredButton.isHidden = false
if isReadFiltered { if isReadFiltered {
readFilteredButton.image = AppAsset.filterActive readFilteredButton.image = AppAsset.filterActiveImage
} else { } else {
readFilteredButton.image = AppAsset.filterInactive readFilteredButton.image = AppAsset.filterInactiveImage
} }
} }

View File

@ -40,23 +40,23 @@ class AccountsReaderAPIWindowController: NSWindowController {
if let accountType = accountType { if let accountType = accountType {
switch accountType { switch accountType {
case .freshRSS: case .freshRSS:
titleImageView.image = AppAsset.Account.freshRSS titleImageView.image = AppAsset.freshRSSImage
titleLabel.stringValue = NSLocalizedString("Sign in to your FreshRSS account.", comment: "FreshRSS") titleLabel.stringValue = NSLocalizedString("Sign in to your FreshRSS account.", comment: "FreshRSS")
noAccountTextField.stringValue = NSLocalizedString("Dont have a FreshRSS instance?", comment: "No FreshRSS") noAccountTextField.stringValue = NSLocalizedString("Dont have a FreshRSS instance?", comment: "No FreshRSS")
createAccountButton.title = NSLocalizedString("Find out more", comment: "No FreshRSS Button") createAccountButton.title = NSLocalizedString("Find out more", comment: "No FreshRSS Button")
apiURLTextField.placeholderString = NSLocalizedString("fresh.rss.net/api/greader.php", comment: "FreshRSS API Helper") apiURLTextField.placeholderString = NSLocalizedString("fresh.rss.net/api/greader.php", comment: "FreshRSS API Helper")
case .inoreader: case .inoreader:
titleImageView.image = AppAsset.Account.inoReader titleImageView.image = AppAsset.inoReaderImage
titleLabel.stringValue = NSLocalizedString("Sign in to your InoReader account.", comment: "InoReader") titleLabel.stringValue = NSLocalizedString("Sign in to your InoReader account.", comment: "InoReader")
gridView.row(at: 2).isHidden = true gridView.row(at: 2).isHidden = true
noAccountTextField.stringValue = NSLocalizedString("Dont have an InoReader account?", comment: "No InoReader") noAccountTextField.stringValue = NSLocalizedString("Dont have an InoReader account?", comment: "No InoReader")
case .bazQux: case .bazQux:
titleImageView.image = AppAsset.Account.bazQux titleImageView.image = AppAsset.bazQuxImage
titleLabel.stringValue = NSLocalizedString("Sign in to your BazQux account.", comment: "BazQux") titleLabel.stringValue = NSLocalizedString("Sign in to your BazQux account.", comment: "BazQux")
gridView.row(at: 2).isHidden = true gridView.row(at: 2).isHidden = true
noAccountTextField.stringValue = NSLocalizedString("Dont have a BazQux account?", comment: "No BazQux") noAccountTextField.stringValue = NSLocalizedString("Dont have a BazQux account?", comment: "No BazQux")
case .theOldReader: case .theOldReader:
titleImageView.image = AppAsset.Account.theOldReader titleImageView.image = AppAsset.theOldReaderImage
titleLabel.stringValue = NSLocalizedString("Sign in to your The Old Reader account.", comment: "The Old Reader") titleLabel.stringValue = NSLocalizedString("Sign in to your The Old Reader account.", comment: "The Old Reader")
gridView.row(at: 2).isHidden = true gridView.row(at: 2).isHidden = true
noAccountTextField.stringValue = NSLocalizedString("Dont have a The Old Reader account?", comment: "No OldReader") noAccountTextField.stringValue = NSLocalizedString("Dont have a The Old Reader account?", comment: "No OldReader")

View File

@ -18,13 +18,13 @@ import Images
final class AppAsset { final class AppAsset {
static let markAllAsRead = RSImage.appImage("markAllAsRead") static let markAllAsReadImage = RSImage.appImage("markAllAsRead")
static let faviconTemplate = RSImage.appImage("faviconTemplateImage") static let faviconTemplateImage = RSImage.appImage("faviconTemplateImage")
static let share = RSImage.systemImage("square.and.arrow.up") static let shareImage = RSImage.systemImage("square.and.arrow.up")
static let starColor = RSColor(named: "starColor")! static let starColor = RSColor(named: "starColor")!
@MainActor static let folder: IconImage = { @MainActor static let folderIcon: IconImage = {
#if os(macOS) #if os(macOS)
let image = RSImage.systemImage("folder") let image = RSImage.systemImage("folder")
@ -42,76 +42,75 @@ final class AppAsset {
@MainActor static let searchFeedImage: IconImage = { @MainActor static let searchFeedImage: IconImage = {
#if os(macOS) #if os(macOS)
IconImage(NSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSupressed: true) IconImage(NSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSupressed: true)
#else #else
IconImage(UIImage(systemName: "magnifyingglass")!, isSymbol: true) IconImage(UIImage(systemName: "magnifyingglass")!, isSymbol: true)
#endif #endif
}() }()
// MARK: - Account
struct Account { static let bazQuxImage = RSImage.appImage("accountBazQux")
static let cloudKitImage = RSImage.appImage("accountCloudKit")
static let feedbinImage = RSImage.appImage("accountFeedbin")
static let feedlyImage = RSImage.appImage("accountFeedly")
static let freshRSSImage = RSImage.appImage("accountFreshRSS")
static let inoReaderImage = RSImage.appImage("accountInoreader")
static let localAccountMacImage = RSImage.appImage("accountLocal")
static let localAccountPadImage = RSImage.appImage("accountLocalPad")
static let localAccountPhoneImage = RSImage.appImage("accountLocalPhone")
static let newsBlurImage = RSImage.appImage("accountNewsBlur")
static let theOldReaderImage = RSImage.appImage("accountTheOldReader")
static let bazQux = RSImage.appImage("accountBazQux") @MainActor static func accountImage(for accountType: AccountType) -> RSImage {
static let cloudKit = RSImage.appImage("accountCloudKit")
static let feedbin = RSImage.appImage("accountFeedbin")
static let feedly = RSImage.appImage("accountFeedly")
static let freshRSS = RSImage.appImage("accountFreshRSS")
static let inoReader = RSImage.appImage("accountInoreader")
static let local = RSImage.appImage("accountLocal")
static let localPad = RSImage.appImage("accountLocalPad")
static let localPhone = RSImage.appImage("accountLocalPhone")
static let newsBlur = RSImage.appImage("accountNewsBlur")
static let theOldReader = RSImage.appImage("accountTheOldReader")
@MainActor static func image(for accountType: AccountType) -> RSImage {
switch accountType { switch accountType {
case .onMyMac: case .onMyMac:
#if os(macOS) #if os(macOS)
return AppAsset.Account.local return AppAsset.localAccountMacImage
#elseif os(iOS) #elseif os(iOS)
if UIDevice.current.userInterfaceIdiom == .pad { if UIDevice.current.userInterfaceIdiom == .pad {
return AppAsset.Account.localPad return AppAsset.localAccountPadImage
} else { } else {
return AppAsset.Account.localPhone return AppAsset.localAccountPhoneImage
} }
#endif #endif
case .cloudKit: case .cloudKit:
return AppAsset.Account.cloudKit return AppAsset.cloudKitImage
case .bazQux: case .bazQux:
return AppAsset.Account.bazQux return AppAsset.bazQuxImage
case .feedbin: case .feedbin:
return AppAsset.Account.feedbin return AppAsset.feedbinImage
case .feedly: case .feedly:
return AppAsset.Account.feedly return AppAsset.feedlyImage
case .freshRSS: case .freshRSS:
return AppAsset.Account.freshRSS return AppAsset.freshRSSImage
case .inoreader: case .inoreader:
return AppAsset.Account.inoReader return AppAsset.inoReaderImage
case .newsBlur: case .newsBlur:
return AppAsset.Account.newsBlur return AppAsset.newsBlurImage
case .theOldReader: case .theOldReader:
return AppAsset.Account.theOldReader return AppAsset.theOldReaderImage
}
} }
} }
struct ArticleExtractor { // MARK: - ArticleExtractor
static let error = RSImage.appImage("articleExtractorError") static let articleExtractorErrorImage = RSImage.appImage("articleExtractorError")
static let off = RSImage.appImage("articleExtractorOff") static let articleExtractorOffImage = RSImage.appImage("articleExtractorOff")
static let offSF = RSImage.systemImage("doc.plaintext") static let articleExtractorOffSFImage = RSImage.systemImage("doc.plaintext")
static let on = RSImage.appImage("articleExtractorOn") static let articleExtractorOnImage = RSImage.appImage("articleExtractorOn")
static let onSF = RSImage.appImage("articleExtractorOnSF") static let articleExtractorOnSFImage = RSImage.appImage("articleExtractorOnSF")
}
static let filterActive = RSImage.systemImage("line.horizontal.3.decrease.circle.fill") // MARK: - Filter icon
static let filterInactive = RSImage.systemImage("line.horizontal.3.decrease.circle")
static let filterActiveImage = RSImage.systemImage("line.horizontal.3.decrease.circle.fill")
static let filterInactiveImage = RSImage.systemImage("line.horizontal.3.decrease.circle")
} }

View File

@ -18,7 +18,7 @@ protocol SmallIconProvider {
extension Account: SmallIconProvider { extension Account: SmallIconProvider {
var smallIcon: IconImage? { var smallIcon: IconImage? {
let image = AppAsset.Account.image(for: accountType) let image = AppAsset.accountImage(for: accountType)
return IconImage(image) return IconImage(image)
} }
} }
@ -35,6 +35,6 @@ extension Feed: SmallIconProvider {
extension Folder: SmallIconProvider { extension Folder: SmallIconProvider {
var smallIcon: IconImage? { var smallIcon: IconImage? {
AppAsset.folder AppAsset.folderIcon
} }
} }

View File

@ -56,7 +56,7 @@ class CloudKitAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 { if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAsset.Account.image(for: .cloudKit) headerView.imageView.image = AppAsset.accountImage(for: .cloudKit)
return headerView return headerView
} else { } else {
return super.tableView(tableView, viewForHeaderInSection: section) return super.tableView(tableView, viewForHeaderInSection: section)

View File

@ -69,7 +69,7 @@ class FeedbinAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 { if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAsset.Account.image(for: .feedbin) headerView.imageView.image = AppAsset.accountImage(for: .feedbin)
return headerView return headerView
} else { } else {
return super.tableView(tableView, viewForHeaderInSection: section) return super.tableView(tableView, viewForHeaderInSection: section)

View File

@ -46,7 +46,7 @@ class LocalAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 { if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAsset.Account.image(for: .onMyMac) headerView.imageView.image = AppAsset.accountImage(for: .onMyMac)
return headerView return headerView
} else { } else {
return super.tableView(tableView, viewForHeaderInSection: section) return super.tableView(tableView, viewForHeaderInSection: section)

View File

@ -63,7 +63,7 @@ class NewsBlurAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 { if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAsset.Account.image(for: .newsBlur) headerView.imageView.image = AppAsset.accountImage(for: .newsBlur)
return headerView return headerView
} else { } else {
return super.tableView(tableView, viewForHeaderInSection: section) return super.tableView(tableView, viewForHeaderInSection: section)

View File

@ -230,13 +230,13 @@ class ReaderAPIAccountViewController: UITableViewController {
if let accountType = accountType { if let accountType = accountType {
switch accountType { switch accountType {
case .bazQux: case .bazQux:
return AppAsset.Account.bazQux return AppAsset.bazQuxImage
case .inoreader: case .inoreader:
return AppAsset.Account.inoReader return AppAsset.inoReaderImage
case .theOldReader: case .theOldReader:
return AppAsset.Account.theOldReader return AppAsset.theOldReaderImage
case .freshRSS: case .freshRSS:
return AppAsset.Account.freshRSS return AppAsset.freshRSSImage
default: default:
return nil return nil
} }

View File

@ -73,7 +73,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationC
os_log(.debug, "Is first run.") os_log(.debug, "Is first run.")
} }
FaviconGenerator.faviconTemplateImage = AppAsset.faviconTemplate FaviconGenerator.faviconTemplateImage = AppAsset.faviconTemplateImage
importFeedsIfNeeded() importFeedsIfNeeded()

View File

@ -25,16 +25,16 @@ enum ArticleExtractorButtonState {
switch buttonState { switch buttonState {
case .error: case .error:
stripAnimatedSublayer() stripAnimatedSublayer()
setImage(AppAsset.ArticleExtractor.error, for: .normal) setImage(AppAsset.articleExtractorErrorImage, for: .normal)
case .animated: case .animated:
setImage(nil, for: .normal) setImage(nil, for: .normal)
setNeedsLayout() setNeedsLayout()
case .on: case .on:
stripAnimatedSublayer() stripAnimatedSublayer()
setImage(AppAsset.ArticleExtractor.on, for: .normal) setImage(AppAsset.articleExtractorOnImage, for: .normal)
case .off: case .off:
stripAnimatedSublayer() stripAnimatedSublayer()
setImage(AppAsset.ArticleExtractor.off, for: .normal) setImage(AppAsset.articleExtractorOffImage, for: .normal)
} }
} }
} }
@ -77,7 +77,7 @@ enum ArticleExtractorButtonState {
let images = [image1, image2, image1] let images = [image1, image2, image1]
animatedLayer = CALayer() animatedLayer = CALayer()
let imageSize = AppAsset.ArticleExtractor.off.size let imageSize = AppAsset.articleExtractorOffImage.size
animatedLayer!.bounds = CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height) animatedLayer!.bounds = CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height)
animatedLayer!.position = CGPoint(x: bounds.midX, y: bounds.midY) animatedLayer!.position = CGPoint(x: bounds.midX, y: bounds.midY)

View File

@ -40,7 +40,7 @@ final class ArticleViewController: UIViewController {
private var articleExtractorButton: ArticleExtractorButton = { private var articleExtractorButton: ArticleExtractorButton = {
let button = ArticleExtractorButton(type: .system) let button = ArticleExtractorButton(type: .system)
button.frame = CGRect(x: 0, y: 0, width: 44.0, height: 44.0) button.frame = CGRect(x: 0, y: 0, width: 44.0, height: 44.0)
button.setImage(AppAsset.ArticleExtractor.off, for: .normal) button.setImage(AppAsset.articleExtractorOffImage, for: .normal)
return button return button
}() }()

View File

@ -860,7 +860,7 @@ private extension WebViewController {
func toggleArticleExtractorAction() -> UIAction { func toggleArticleExtractorAction() -> UIAction {
let extracted = articleExtractorButtonState == .on let extracted = articleExtractorButtonState == .on
let title = extracted ? NSLocalizedString("Show Feed Article", comment: "Show Feed Article") : NSLocalizedString("Show Reader View", comment: "Show Reader View") let title = extracted ? NSLocalizedString("Show Feed Article", comment: "Show Feed Article") : NSLocalizedString("Show Reader View", comment: "Show Reader View")
let extractorImage = extracted ? AppAsset.ArticleExtractor.offSF : AppAsset.ArticleExtractor.onSF let extractorImage = extracted ? AppAsset.articleExtractorOffSFImage : AppAsset.articleExtractorOnSFImage
return UIAction(title: title, image: extractorImage) { [weak self] action in return UIAction(title: title, image: extractorImage) { [weak self] action in
self?.toggleArticleExtractor() self?.toggleArticleExtractor()
} }
@ -868,7 +868,7 @@ private extension WebViewController {
func shareAction() -> UIAction { func shareAction() -> UIAction {
let title = NSLocalizedString("Share", comment: "Share") let title = NSLocalizedString("Share", comment: "Share")
return UIAction(title: title, image: AppAsset.share) { [weak self] action in return UIAction(title: title, image: AppAsset.shareImage) { [weak self] action in
self?.showActivityDialog() self?.showActivityDialog()
} }
} }

View File

@ -705,12 +705,12 @@ private extension SidebarViewController {
} }
func setFilterButtonToActive() { func setFilterButtonToActive() {
filterButton?.image = AppAsset.filterActive filterButton?.image = AppAsset.filterActiveImage
filterButton?.accLabelText = NSLocalizedString("Selected - Filter Read Feeds", comment: "Selected - Filter Read Feeds") filterButton?.accLabelText = NSLocalizedString("Selected - Filter Read Feeds", comment: "Selected - Filter Read Feeds")
} }
func setFilterButtonToInactive() { func setFilterButtonToInactive() {
filterButton?.image = AppAsset.filterInactive filterButton?.image = AppAsset.filterInactiveImage
filterButton?.accLabelText = NSLocalizedString("Filter Read Feeds", comment: "Filter Read Feeds") filterButton?.accLabelText = NSLocalizedString("Filter Read Feeds", comment: "Filter Read Feeds")
} }
@ -1101,7 +1101,7 @@ private extension SidebarViewController {
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command") let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String
let action = UIAction(title: title, image: AppAsset.markAllAsRead) { [weak self] action in let action = UIAction(title: title, image: AppAsset.markAllAsReadImage) { [weak self] action in
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
Task { @MainActor in Task { @MainActor in
@ -1122,7 +1122,7 @@ private extension SidebarViewController {
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command") let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, account.nameForDisplay) as String let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, account.nameForDisplay) as String
let action = UIAction(title: title, image: AppAsset.markAllAsRead) { [weak self] action in let action = UIAction(title: title, image: AppAsset.markAllAsReadImage) { [weak self] action in
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
// If you don't have this delay the screen flashes when it executes this code // If you don't have this delay the screen flashes when it executes this code
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {

View File

@ -33,7 +33,7 @@ final class IconView: UIView {
private var isDiscernable = true private var isDiscernable = true
private let imageView: UIImageView = { private let imageView: UIImageView = {
let imageView = NonIntrinsicImageView(image: AppAsset.faviconTemplate) let imageView = NonIntrinsicImageView(image: AppAsset.faviconTemplateImage)
imageView.contentMode = .scaleAspectFit imageView.contentMode = .scaleAspectFit
imageView.clipsToBounds = true imageView.clipsToBounds = true
imageView.layer.cornerRadius = 2.0 imageView.layer.cornerRadius = 2.0

View File

@ -154,7 +154,7 @@ extension AccountInspectorViewController {
if section == 0 { if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAsset.Account.image(for: account.accountType) headerView.imageView.image = AppAsset.accountImage(for: account.accountType)
return headerView return headerView
} else { } else {
return super.tableView(tableView, viewForHeaderInSection: section) return super.tableView(tableView, viewForHeaderInSection: section)

View File

@ -133,17 +133,17 @@ final class AddAccountViewController: UITableViewController, AddAccountDismissDe
switch indexPath.section { switch indexPath.section {
case AddAccountSections.local.rawValue: case AddAccountSections.local.rawValue:
cell.comboNameLabel?.text = AddAccountSections.local.sectionContent[indexPath.row].localizedAccountName() cell.comboNameLabel?.text = AddAccountSections.local.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAsset.Account.image(for: .onMyMac) cell.comboImage?.image = AppAsset.accountImage(for: .onMyMac)
case AddAccountSections.icloud.rawValue: case AddAccountSections.icloud.rawValue:
cell.comboNameLabel?.text = AddAccountSections.icloud.sectionContent[indexPath.row].localizedAccountName() cell.comboNameLabel?.text = AddAccountSections.icloud.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAsset.Account.image(for: AddAccountSections.icloud.sectionContent[indexPath.row]) cell.comboImage?.image = AppAsset.accountImage(for: AddAccountSections.icloud.sectionContent[indexPath.row])
if AppDefaults.shared.isDeveloperBuild || AccountManager.shared.accounts.contains(where: { $0.accountType == .cloudKit }) { if AppDefaults.shared.isDeveloperBuild || AccountManager.shared.accounts.contains(where: { $0.accountType == .cloudKit }) {
cell.isUserInteractionEnabled = false cell.isUserInteractionEnabled = false
cell.comboNameLabel?.isEnabled = false cell.comboNameLabel?.isEnabled = false
} }
case AddAccountSections.web.rawValue: case AddAccountSections.web.rawValue:
cell.comboNameLabel?.text = AddAccountSections.web.sectionContent[indexPath.row].localizedAccountName() cell.comboNameLabel?.text = AddAccountSections.web.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAsset.Account.image(for: AddAccountSections.web.sectionContent[indexPath.row]) cell.comboImage?.image = AppAsset.accountImage(for: AddAccountSections.web.sectionContent[indexPath.row])
let type = AddAccountSections.web.sectionContent[indexPath.row] let type = AddAccountSections.web.sectionContent[indexPath.row]
if (type == .feedly || type == .inoreader) && AppDefaults.shared.isDeveloperBuild { if (type == .feedly || type == .inoreader) && AppDefaults.shared.isDeveloperBuild {
cell.isUserInteractionEnabled = false cell.isUserInteractionEnabled = false
@ -151,7 +151,7 @@ final class AddAccountViewController: UITableViewController, AddAccountDismissDe
} }
case AddAccountSections.selfhosted.rawValue: case AddAccountSections.selfhosted.rawValue:
cell.comboNameLabel?.text = AddAccountSections.selfhosted.sectionContent[indexPath.row].localizedAccountName() cell.comboNameLabel?.text = AddAccountSections.selfhosted.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAsset.Account.image(for: AddAccountSections.selfhosted.sectionContent[indexPath.row]) cell.comboImage?.image = AppAsset.accountImage(for: AddAccountSections.selfhosted.sectionContent[indexPath.row])
default: default:
return cell return cell

View File

@ -146,7 +146,7 @@ final class SettingsViewController: UITableViewController {
let acctCell = tableView.dequeueReusableCell(withIdentifier: "SettingsComboTableViewCell", for: indexPath) as! SettingsComboTableViewCell let acctCell = tableView.dequeueReusableCell(withIdentifier: "SettingsComboTableViewCell", for: indexPath) as! SettingsComboTableViewCell
acctCell.applyThemeProperties() acctCell.applyThemeProperties()
let account = sortedAccounts[indexPath.row] let account = sortedAccounts[indexPath.row]
acctCell.comboImage?.image = AppAsset.Account.image(for: account.accountType) acctCell.comboImage?.image = AppAsset.accountImage(for: account.accountType)
acctCell.comboNameLabel?.text = account.nameForDisplay acctCell.comboNameLabel?.text = account.nameForDisplay
cell = acctCell cell = acctCell
} }

View File

@ -70,7 +70,7 @@ private extension TimelinePreviewTableViewController {
let status = ArticleStatus(articleID: prototypeID, read: false, starred: false, dateArrived: Date()) let status = ArticleStatus(articleID: prototypeID, read: false, starred: false, dateArrived: Date())
let prototypeArticle = Article(accountID: prototypeID, articleID: prototypeID, feedID: prototypeID, uniqueID: prototypeID, title: longTitle, contentHTML: nil, contentText: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, datePublished: nil, dateModified: nil, authors: nil, status: status) let prototypeArticle = Article(accountID: prototypeID, articleID: prototypeID, feedID: prototypeID, uniqueID: prototypeID, title: longTitle, contentHTML: nil, contentText: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, datePublished: nil, dateModified: nil, authors: nil, status: status)
let iconImage = IconImage(AppAsset.faviconTemplate.withTintColor(AppAssets.secondaryAccentColor)) let iconImage = IconImage(AppAsset.faviconTemplateImage.withTintColor(AppAssets.secondaryAccentColor))
return TimelineCellData(article: prototypeArticle, showFeedName: .feed, feedName: "Feed Name", byline: nil, iconImage: iconImage, showIcon: true, featuredImage: nil, numberOfLines: AppDefaults.shared.timelineNumberOfLines, iconSize: AppDefaults.shared.timelineIconSize) return TimelineCellData(article: prototypeArticle, showFeedName: .feed, feedName: "Feed Name", byline: nil, iconImage: iconImage, showIcon: true, featuredImage: nil, numberOfLines: AppDefaults.shared.timelineNumberOfLines, iconSize: AppDefaults.shared.timelineIconSize)
} }

View File

@ -47,9 +47,9 @@ class ShareFolderPickerController: UITableViewController {
}() }()
if let account = container as? ExtensionAccount { if let account = container as? ExtensionAccount {
cell.icon.image = AppAsset.Account.image(for: account.type) cell.icon.image = AppAsset.accountImage(for: account.type)
} else { } else {
cell.icon.image = AppAsset.folder.image cell.icon.image = AppAsset.folderIcon.image
} }
cell.label?.text = container?.name ?? "" cell.label?.text = container?.name ?? ""

View File

@ -63,7 +63,7 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
// Initialize Programmatic Buttons // Initialize Programmatic Buttons
filterButton = UIBarButtonItem(image: AppAsset.filterInactive, style: .plain, target: self, action: #selector(toggleFilter(_:))) filterButton = UIBarButtonItem(image: AppAsset.filterInactiveImage, style: .plain, target: self, action: #selector(toggleFilter(_:)))
firstUnreadButton = UIBarButtonItem(image: AppAssets.nextUnreadArticleImage, style: .plain, target: self, action: #selector(firstUnread(_:))) firstUnreadButton = UIBarButtonItem(image: AppAssets.nextUnreadArticleImage, style: .plain, target: self, action: #selector(firstUnread(_:)))
// Setup the Search Controller // Setup the Search Controller
@ -656,10 +656,10 @@ private extension TimelineViewController {
} }
if coordinator.isReadArticlesFiltered { if coordinator.isReadArticlesFiltered {
filterButton?.image = AppAsset.filterActive filterButton?.image = AppAsset.filterActiveImage
filterButton?.accLabelText = NSLocalizedString("Selected - Filter Read Articles", comment: "Selected - Filter Read Articles") filterButton?.accLabelText = NSLocalizedString("Selected - Filter Read Articles", comment: "Selected - Filter Read Articles")
} else { } else {
filterButton?.image = AppAsset.filterInactive filterButton?.image = AppAsset.filterInactiveImage
filterButton?.accLabelText = NSLocalizedString("Filter Read Articles", comment: "Filter Read Articles") filterButton?.accLabelText = NSLocalizedString("Filter Read Articles", comment: "Filter Read Articles")
} }
@ -886,7 +886,7 @@ private extension TimelineViewController {
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command") let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String
let action = UIAction(title: title, image: AppAsset.markAllAsRead) { [weak self] action in let action = UIAction(title: title, image: AppAsset.markAllAsReadImage) { [weak self] action in
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
Task { @MainActor in Task { @MainActor in
@ -984,7 +984,7 @@ private extension TimelineViewController {
func shareAction(_ article: Article, indexPath: IndexPath) -> UIAction? { func shareAction(_ article: Article, indexPath: IndexPath) -> UIAction? {
guard let url = article.preferredURL else { return nil } guard let url = article.preferredURL else { return nil }
let title = NSLocalizedString("Share", comment: "Share") let title = NSLocalizedString("Share", comment: "Share")
let action = UIAction(title: title, image: AppAsset.share) { [weak self] action in let action = UIAction(title: title, image: AppAsset.shareImage) { [weak self] action in
self?.shareDialogForTableCell(indexPath: indexPath, url: url, title: article.title) self?.shareDialogForTableCell(indexPath: indexPath, url: url, title: article.title)
} }
return action return action