Rename AppAsset to AppImage.

This commit is contained in:
Brent Simmons
2025-01-26 22:07:13 -08:00
parent 69ae436ea4
commit b116c7b6e5
52 changed files with 240 additions and 495 deletions

View File

@@ -57,7 +57,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 = AppAsset.image(accountType: .cloudKit)
headerView.imageView.image = AppImage.accountImage(.cloudKit)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)

View File

@@ -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 = AppAsset.image(accountType: .feedbin)
headerView.imageView.image = AppImage.accountImage(.feedbin)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)

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 = AppAsset.image(accountType: .onMyMac)
headerView.imageView.image = AppImage.accountImage(.onMyMac)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)

View File

@@ -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 = AppAsset.image(accountType: .newsBlur)
headerView.imageView.image = AppImage.accountImage(.newsBlur)
return headerView
} else {
return super.tableView(tableView, viewForHeaderInSection: section)

View File

@@ -210,13 +210,13 @@ final class ReaderAPIAccountViewController: UITableViewController {
if let accountType = accountType {
switch accountType {
case .bazQux:
return AppAsset.image(accountType: .bazQux)
return AppImage.accountImage(.bazQux)
case .inoreader:
return AppAsset.image(accountType: .inoreader)
return AppImage.accountImage(.inoreader)
case .theOldReader:
return AppAsset.image(accountType: .theOldReader)
return AppImage.accountImage(.theOldReader)
case .freshRSS:
return AppAsset.image(accountType: .freshRSS)
return AppImage.accountImage(.freshRSS)
default:
return nil
}

View File

@@ -53,35 +53,35 @@ struct AppAssets {
// 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 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")!
@@ -135,9 +135,9 @@ struct AppAssets {
UIImage(systemName: "info.circle")!
}()
static var markAllAsReadImage: UIImage = {
return UIImage(named: "markAllAsRead")!
}()
// static var markAllAsReadImage: UIImage = {
// return UIImage(named: "markAllAsRead")!
// }()
static var markBelowAsReadImage: UIImage = {
return UIImage(systemName: "arrowtriangle.down.circle")!

View File

@@ -25,16 +25,16 @@ final class ArticleExtractorButton: UIButton {
switch buttonState {
case .error:
stripAnimatedSublayer()
setImage(AppAssets.articleExtractorError, for: .normal)
setImage(AppImage.articleExtractorError, for: .normal)
case .animated:
setImage(nil, for: .normal)
setNeedsLayout()
case .on:
stripAnimatedSublayer()
setImage(AppAssets.articleExtractorOn, for: .normal)
setImage(AppImage.articleExtractorOn, for: .normal)
case .off:
stripAnimatedSublayer()
setImage(AppAssets.articleExtractorOff, for: .normal)
setImage(AppImage.articleExtractorOff, for: .normal)
}
}
}
@@ -72,12 +72,12 @@ final class ArticleExtractorButton: UIButton {
}
private func addAnimatedSublayer(to hostedLayer: CALayer) {
let image1 = AppAssets.articleExtractorOffTinted.cgImage!
let image2 = AppAssets.articleExtractorOnTinted.cgImage!
let image1 = AppImage.articleExtractorOffTinted.cgImage!
let image2 = AppImage.articleExtractorOnTinted.cgImage!
let images = [image1, image2, image1]
animatedLayer = CALayer()
let imageSize = AppAssets.articleExtractorOff.size
let imageSize = AppImage.articleExtractorOff.size
animatedLayer!.bounds = CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height)
animatedLayer!.position = CGPoint(x: bounds.midX, y: bounds.midY)

View File

@@ -41,7 +41,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(AppImage.articleExtractorOff, for: .normal)
return button
}()

View File

@@ -768,7 +768,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 ? AppImage.articleExtractorOffSF : AppImage.articleExtractorOnSF
return UIAction(title: title, image: extractorImage) { [weak self] _ in
self?.toggleArticleExtractor()
}

View File

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

View File

@@ -1145,7 +1145,7 @@ private extension MainFeedViewController {
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String
let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] _ in
let action = UIAction(title: title, image: AppImage.markAllAsRead) { [weak self] _ in
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
if let articles = try? feed.fetchUnreadArticles() {
self?.coordinator.markAllAsRead(Array(articles))
@@ -1163,7 +1163,7 @@ private extension MainFeedViewController {
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, account.nameForDisplay) as String
let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] _ in
let action = UIAction(title: title, image: AppImage.markAllAsRead) { [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
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {

View File

@@ -919,7 +919,7 @@ private extension TimelineViewController {
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String
let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] _ in
let action = UIAction(title: title, image: AppImage.markAllAsRead) { [weak self] _ in
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
self?.coordinator.markAllAsRead(articles)
}

View File

@@ -127,17 +127,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 = AppAsset.image(accountType: .onMyMac)
cell.comboImage?.image = AppImage.accountImage(.onMyMac)
case AddAccountSections.icloud.rawValue:
cell.comboNameLabel?.text = AddAccountSections.icloud.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAsset.image(accountType: AddAccountSections.icloud.sectionContent[indexPath.row])
cell.comboImage?.image = AppImage.accountImage(AddAccountSections.icloud.sectionContent[indexPath.row])
if AppDefaults.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 = AppAsset.image(accountType: AddAccountSections.web.sectionContent[indexPath.row])
cell.comboImage?.image = AppImage.accountImage(AddAccountSections.web.sectionContent[indexPath.row])
let type = AddAccountSections.web.sectionContent[indexPath.row]
if (type == .feedly || type == .inoreader) && AppDefaults.isDeveloperBuild {
cell.isUserInteractionEnabled = false
@@ -145,7 +145,7 @@ final class AddAccountViewController: UITableViewController, AddAccountDismissDe
}
case AddAccountSections.selfhosted.rawValue:
cell.comboNameLabel?.text = AddAccountSections.selfhosted.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAsset.image(accountType: AddAccountSections.selfhosted.sectionContent[indexPath.row])
cell.comboImage?.image = AppImage.accountImage(AddAccountSections.selfhosted.sectionContent[indexPath.row])
default:
return cell

View File

@@ -121,7 +121,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 = AppAsset.image(accountType: account.type)
acctCell.comboImage?.image = AppImage.accountImage(account.type)
acctCell.comboNameLabel?.text = account.nameForDisplay
cell = acctCell
}

View File

@@ -46,7 +46,7 @@ final class ShareFolderPickerController: UITableViewController {
}()
if let account = container as? ExtensionAccount {
cell.icon.image = AppAsset.image(accountType: account.type)
cell.icon.image = AppImage.accountImage(account.type)
} else {
cell.icon.image = AppAssets.folderImage.image
}