Continue conversion from AppAssets to shared Assets.

This commit is contained in:
Brent Simmons committed 2025-11-18 22:08:33 -08:00
1 parent 35be01c220
commit 39ffd38461
24 files changed
+78 -74

No files matched your search

@@ -49,7 +49,7 @@ final class CloudKitAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAssets.image(for: .cloudKit)
headerView.imageView.image = Assets.accountImage(.cloudKit)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)
@@ -59,7 +59,7 @@ final class FeedbinAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAssets.image(for: .feedbin)
headerView.imageView.image = Assets.accountImage(.feedbin)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)
+1 -1
View File
@@ -46,7 +46,7 @@ final class LocalAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAssets.image(for: .onMyMac)
headerView.imageView.image = Assets.accountImage(.onMyMac)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)
@@ -58,7 +58,7 @@ final class NewsBlurAccountViewController: UITableViewController {
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAssets.image(for: .newsBlur)
headerView.imageView.image = Assets.accountImage(.newsBlur)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)
@@ -207,18 +207,18 @@ final class ReaderAPIAccountViewController: UITableViewController {
}
private func headerViewImage() -> UIImage? {
if let accountType = accountType {
if let accountType {
switch accountType {
case .bazQux:
return AppAssets.accountBazQuxImage
case .inoreader:
return AppAssets.accountInoreaderImage
case .theOldReader:
return AppAssets.accountTheOldReaderImage
case .freshRSS:
return AppAssets.accountFreshRSSImage
default:
return nil
case .bazQux:
return Assets.Images.accountBazQux
case .inoreader:
return Assets.Images.accountInoreader
case .theOldReader:
return Assets.Images.accountTheOldReader
case .freshRSS:
return Assets.Images.accountFreshRSS
default:
return nil
}
}
return nil
-8
View File
@@ -10,17 +10,11 @@ import RSCore
import Account
struct AppAssets {
static let nnwFeedIcon = RSImage(named: "nnwFeedIcon")!
static let articleExtractorError = RSImage(named: "articleExtractorError")!
static let articleExtractorOff = RSImage(named: "articleExtractorOff")!
static let articleExtractorOffSF = RSImage(systemName: "doc.plaintext")!
@MainActor static let articleExtractorOffTinted: UIImage = {
let image = UIImage(named: "articleExtractorOff")!
return image.tinted(color: AppAssets.primaryAccentColor)!
}()
static let articleExtractorOn = RSImage(named: "articleExtractorOn")!
static let articleExtractorOnSF = RSImage(named: "articleExtractorOnSF")!
@MainActor static let articleExtractorOnTinted: UIImage = {
@@ -30,10 +24,8 @@ struct AppAssets {
static let iconBackgroundColor = UIColor(named: "iconBackgroundColor")!
static let circleClosedImage = RSImage(systemName: "largecircle.fill.circle")!
static let circleOpenImage = RSImage(systemName: "circle")!
static let disclosureImage = RSImage(named: "disclosure")!
static let copyImage = RSImage(systemName: "doc.on.doc")!
static let deactivateImage = RSImage(systemName: "minus.circle")!
static let editImage = RSImage(systemName: "square.and.pencil")!
static let faviconTemplateImage = RSImage(named: "faviconTemplateImage")!
+4 -4
View File
@@ -25,16 +25,16 @@ final class ArticleExtractorButton: UIButton {
switch buttonState {
case .error:
stripAnimatedSublayer()
setImage(AppAssets.articleExtractorError, for: .normal)
setImage(Assets.Images.articleExtractorError, for: .normal)
case .animated:
setImage(nil, for: .normal)
setNeedsLayout()
case .on:
stripAnimatedSublayer()
setImage(AppAssets.articleExtractorOn, for: .normal)
setImage(Assets.Images.articleExtractorOn, for: .normal)
case .off:
stripAnimatedSublayer()
setImage(AppAssets.articleExtractorOff, for: .normal)
setImage(Assets.Images.articleExtractorOff, for: .normal)
}
}
}
@@ -77,7 +77,7 @@ final class ArticleExtractorButton: UIButton {
let images = [image1, image2, image1]
animatedLayer = CALayer()
let imageSize = AppAssets.articleExtractorOff.size
let imageSize = Assets.Images.articleExtractorOff.size
animatedLayer!.bounds = CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height)
animatedLayer!.position = CGPoint(x: bounds.midX, y: bounds.midY)
+4 -4
View File
@@ -39,7 +39,7 @@ final class ArticleViewController: UIViewController {
private var articleExtractorButton: ArticleExtractorButton = {
let button = ArticleExtractorButton(type: .system)
button.frame = CGRect(x: 0, y: 0, width: 44.0, height: 44.0)
button.setImage(AppAssets.articleExtractorOff, for: .normal)
button.setImage(Assets.Images.articleExtractorOff, for: .normal)
return button
}()
@@ -228,16 +228,16 @@ final class ArticleViewController: UIViewController {
readBarButtonItem.isEnabled = article.isAvailableToMarkUnread
readBarButtonItem.accLabelText = NSLocalizedString("Mark Article Unread", comment: "Mark Article Unread")
} else {
readBarButtonItem.image = AppAssets.circleClosedImage
readBarButtonItem.image = Assets.Images.circleClosed
readBarButtonItem.isEnabled = true
readBarButtonItem.accLabelText = NSLocalizedString("Selected - Mark Article Unread", comment: "Selected - Mark Article Unread")
}
if article.status.starred {
starBarButtonItem.image = AppAssets.starClosedImage
starBarButtonItem.image = Assets.Images.starClosed
starBarButtonItem.accLabelText = NSLocalizedString("Selected - Star Article", comment: "Selected - Star Article")
} else {
starBarButtonItem.image = AppAssets.starOpenImage
starBarButtonItem.image = Assets.Images.starOpen
starBarButtonItem.accLabelText = NSLocalizedString("Star Article", comment: "Star Article")
}
}
+3 -3
View File
@@ -759,7 +759,7 @@ private extension WebViewController {
guard let article = article, !article.status.read || article.isAvailableToMarkUnread else { return nil }
let title = article.status.read ? NSLocalizedString("Mark as Unread", comment: "Mark as Unread") : NSLocalizedString("Mark as Read", comment: "Mark as Read")
let readImage = article.status.read ? AppAssets.circleClosedImage : AppAssets.circleOpenImage
let readImage = article.status.read ? Assets.Images.circleClosed : AppAssets.circleOpenImage
return UIAction(title: title, image: readImage) { [weak self] action in
self?.coordinator.toggleReadForCurrentArticle()
}
@@ -768,7 +768,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 ? Assets.Images.starOpen : Assets.Images.starClosed
return UIAction(title: title, image: starredImage) { [weak self] action in
self?.coordinator.toggleStarredForCurrentArticle()
}
@@ -785,7 +785,7 @@ private extension WebViewController {
func toggleArticleExtractorAction() -> UIAction {
let extracted = articleExtractorButtonState == .on
let title = extracted ? NSLocalizedString("Show Feed Article", comment: "Show Feed Article") : NSLocalizedString("Show Reader View", comment: "Show Reader View")
let extractorImage = extracted ? AppAssets.articleExtractorOffSF : AppAssets.articleExtractorOnSF
let extractorImage = extracted ? Assets.Images.articleExtractorOffSF : AppAssets.articleExtractorOnSF
return UIAction(title: title, image: extractorImage) { [weak self] action in
self?.toggleArticleExtractor()
}
@@ -166,7 +166,7 @@ extension AccountInspectorViewController {
if section == 0 {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
headerView.imageView.image = AppAssets.image(for: account.type)
headerView.imageView.image = Assets.accountImage(account.type)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)
@@ -951,7 +951,7 @@ extension MainFeedCollectionViewController {
}
let title = NSLocalizedString("Copy Feed URL", comment: "Copy Feed URL")
let action = UIAction(title: title, image: AppAssets.copyImage) { action in
let action = UIAction(title: title, image: Assets.Images.copy) { action in
UIPasteboard.general.url = url
}
return action
@@ -979,7 +979,7 @@ extension MainFeedCollectionViewController {
}
let title = NSLocalizedString("Copy Home Page URL", comment: "Copy Home Page URL")
let action = UIAction(title: title, image: AppAssets.copyImage) { action in
let action = UIAction(title: title, image: Assets.Images.copy) { action in
UIPasteboard.general.url = url
}
return action
@@ -407,7 +407,7 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu
completion(true)
}
readAction.image = article.status.read ? AppAssets.circleClosedImage : AppAssets.circleOpenImage
readAction.image = article.status.read ? Assets.Images.circleClosed : AppAssets.circleOpenImage
readAction.backgroundColor = AppAssets.primaryAccentColor
return UISwipeActionsConfiguration(actions: [readAction])
@@ -427,7 +427,7 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu
completion(true)
}
starAction.image = article.status.starred ? AppAssets.starOpenImage : AppAssets.starClosedImage
starAction.image = article.status.starred ? Assets.Images.starOpen : Assets.Images.starClosed
starAction.backgroundColor = AppAssets.starColor
// Set up the read action
@@ -858,7 +858,7 @@ private extension MainTimelineViewController {
let title = article.status.read ?
NSLocalizedString("Mark as Unread", comment: "Mark as Unread") :
NSLocalizedString("Mark as Read", comment: "Mark as Read")
let image = article.status.read ? AppAssets.circleClosedImage : AppAssets.circleOpenImage
let image = article.status.read ? Assets.Images.circleClosed : AppAssets.circleOpenImage
let action = UIAction(title: title, image: image) { [weak self] action in
self?.toggleRead(article)
@@ -877,7 +877,7 @@ private extension MainTimelineViewController {
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 ? Assets.Images.starOpen : Assets.Images.starClosed
let action = UIAction(title: title, image: image) { [weak self] action in
self?.toggleStar(article)
@@ -1064,7 +1064,7 @@ private extension MainTimelineViewController {
func copyArticleURLAction(_ article: Article) -> UIAction? {
guard let url = article.preferredURL else { return nil }
let title = NSLocalizedString("Copy Article URL", comment: "Copy Article URL")
let action = UIAction(title: title, image: AppAssets.copyImage) { action in
let action = UIAction(title: title, image: Assets.Images.copy) { action in
UIPasteboard.general.url = url
}
return action
@@ -1073,7 +1073,7 @@ private extension MainTimelineViewController {
func copyExternalURLAction(_ article: Article) -> UIAction? {
guard let externalLink = article.externalLink, externalLink != article.preferredLink, let url = URL(string: externalLink) else { return nil }
let title = NSLocalizedString("Copy External URL", comment: "Copy External URL")
let action = UIAction(title: title, image: AppAssets.copyImage) { action in
let action = UIAction(title: title, image: Assets.Images.copy) { action in
UIPasteboard.general.url = url
}
return action
+4 -4
View File
@@ -130,17 +130,17 @@ final class AddAccountViewController: UITableViewController, AddAccountDismissDe
switch indexPath.section {
case AddAccountSections.local.rawValue:
cell.comboNameLabel?.text = AddAccountSections.local.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: .onMyMac)
cell.comboImage?.image = Assets.accountImage(.onMyMac)
case AddAccountSections.icloud.rawValue:
cell.comboNameLabel?.text = AddAccountSections.icloud.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.icloud.sectionContent[indexPath.row])
cell.comboImage?.image = Assets.accountImage(AddAccountSections.icloud.sectionContent[indexPath.row])
if AppDefaults.shared.isDeveloperBuild || AccountManager.shared.accounts.contains(where: { $0.type == .cloudKit }) {
cell.isUserInteractionEnabled = false
cell.comboNameLabel?.isEnabled = false
}
case AddAccountSections.web.rawValue:
cell.comboNameLabel?.text = AddAccountSections.web.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.web.sectionContent[indexPath.row])
cell.comboImage?.image = Assets.accountImage(AddAccountSections.web.sectionContent[indexPath.row])
let type = AddAccountSections.web.sectionContent[indexPath.row]
if (type == .feedly || type == .inoreader) && AppDefaults.shared.isDeveloperBuild {
cell.isUserInteractionEnabled = false
@@ -148,7 +148,7 @@ final class AddAccountViewController: UITableViewController, AddAccountDismissDe
}
case AddAccountSections.selfhosted.rawValue:
cell.comboNameLabel?.text = AddAccountSections.selfhosted.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.selfhosted.sectionContent[indexPath.row])
cell.comboImage?.image = Assets.accountImage(AddAccountSections.selfhosted.sectionContent[indexPath.row])
default:
return cell
@@ -95,7 +95,7 @@ class ModernTimelineCustomizerTableViewController: UITableViewController {
showFeedName: .byline,
feedName: "The Great Gatsby",
byline: "F. Scott Fitzgerald",
iconImage: IconImage(UIImage(named: "nnwFeedIcon")!),
iconImage: IconImage(Assets.Images.nnwFeedIcon),
showIcon: true,
numberOfLines: AppDefaults.shared.timelineNumberOfLines,
iconSize: AppDefaults.shared.timelineIconSize)
+1 -1
View File
@@ -152,7 +152,7 @@ final class SettingsViewController: UITableViewController {
let acctCell = tableView.dequeueReusableCell(withIdentifier: "SettingsComboTableViewCell", for: indexPath) as! SettingsComboTableViewCell
acctCell.applyThemeProperties()
let account = sortedAccounts[indexPath.row]
acctCell.comboImage?.image = AppAssets.image(for: account.type)
acctCell.comboImage?.image = Assets.accountImage(account.type)
acctCell.comboNameLabel?.text = account.nameForDisplay
cell = acctCell
}
@@ -46,7 +46,7 @@ final class ShareFolderPickerController: UITableViewController {
}()
if let account = container as? ExtensionAccount {
cell.icon.image = AppAssets.image(for: account.type)
cell.icon.image = Assets.accountImage(account.type)
} else {
cell.icon.image = AppAssets.mainFolderImage.image
}