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

@ -55,33 +55,33 @@ struct AppAssets {
return NSImage(systemSymbolName: "plus", accessibilityDescription: nil)!
}()
static var articleExtractorError: RSImage = {
return RSImage(named: "articleExtractorError")!
}()
// static var articleExtractorError: RSImage = {
// return RSImage(named: "articleExtractorError")!
// }()
//
// static var articleExtractorOff: RSImage = {
// return RSImage(named: "articleExtractorOff")!
// }()
//
// static var articleExtractorOn: RSImage = {
// return RSImage(named: "articleExtractorOn")!
// }()
static var articleExtractorOff: RSImage = {
return RSImage(named: "articleExtractorOff")!
}()
// static var articleTheme: RSImage = {
// return NSImage(systemSymbolName: "doc.richtext", accessibilityDescription: nil)!
// }()
static var articleExtractorOn: RSImage = {
return RSImage(named: "articleExtractorOn")!
}()
// static var cleanUpImage: RSImage = {
// return NSImage(systemSymbolName: "wind", accessibilityDescription: nil)!
// }()
static var articleTheme: RSImage = {
return NSImage(systemSymbolName: "doc.richtext", accessibilityDescription: nil)!
}()
static var cleanUpImage: RSImage = {
return NSImage(systemSymbolName: "wind", accessibilityDescription: nil)!
}()
static var marsEditIcon: RSImage = {
return RSImage(named: "MarsEditIcon")!
}()
static var microblogIcon: RSImage = {
return RSImage(named: "MicroblogIcon")!
}()
// static var marsEditIcon: RSImage = {
// return RSImage(named: "MarsEditIcon")!
// }()
//
// static var microblogIcon: RSImage = {
// return RSImage(named: "MicroblogIcon")!
// }()
static var faviconTemplateImage: RSImage = {
return RSImage(named: "faviconTemplateImage")!
@ -103,37 +103,37 @@ struct AppAssets {
return NSColor(named: NSColor.Name("iconDarkBackgroundColor"))!
}()
static var legacyArticleExtractor: RSImage! = {
return RSImage(named: "legacyArticleExtractor")
}()
static var legacyArticleExtractorError: RSImage! = {
return RSImage(named: "legacyArticleExtractorError")
}()
static var legacyArticleExtractorInactiveDark: RSImage! = {
return RSImage(named: "legacyArticleExtractorInactiveDark")
}()
static var legacyArticleExtractorInactiveLight: RSImage! = {
return RSImage(named: "legacyArticleExtractorInactiveLight")
}()
static var legacyArticleExtractorProgress1: RSImage! = {
return RSImage(named: "legacyArticleExtractorProgress1")
}()
static var legacyArticleExtractorProgress2: RSImage! = {
return RSImage(named: "legacyArticleExtractorProgress2")
}()
static var legacyArticleExtractorProgress3: RSImage! = {
return RSImage(named: "legacyArticleExtractorProgress3")
}()
static var legacyArticleExtractorProgress4: RSImage! = {
return RSImage(named: "legacyArticleExtractorProgress4")
}()
// static var legacyArticleExtractor: RSImage! = {
// return RSImage(named: "legacyArticleExtractor")
// }()
//
// static var legacyArticleExtractorError: RSImage! = {
// return RSImage(named: "legacyArticleExtractorError")
// }()
//
// static var legacyArticleExtractorInactiveDark: RSImage! = {
// return RSImage(named: "legacyArticleExtractorInactiveDark")
// }()
//
// static var legacyArticleExtractorInactiveLight: RSImage! = {
// return RSImage(named: "legacyArticleExtractorInactiveLight")
// }()
//
// static var legacyArticleExtractorProgress1: RSImage! = {
// return RSImage(named: "legacyArticleExtractorProgress1")
// }()
//
// static var legacyArticleExtractorProgress2: RSImage! = {
// return RSImage(named: "legacyArticleExtractorProgress2")
// }()
//
// static var legacyArticleExtractorProgress3: RSImage! = {
// return RSImage(named: "legacyArticleExtractorProgress3")
// }()
//
// static var legacyArticleExtractorProgress4: RSImage! = {
// return RSImage(named: "legacyArticleExtractorProgress4")
// }()
static var folderImage: IconImage {
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
@ -142,9 +142,9 @@ struct AppAssets {
return IconImage(coloredImage, isSymbol: true, isBackgroundSuppressed: true, preferredColor: preferredColor.cgColor)
}
static var markAllAsReadImage: RSImage = {
return RSImage(named: "markAllAsRead")!
}()
// static var markAllAsReadImage: RSImage = {
// return RSImage(named: "markAllAsRead")!
// }()
static var nextUnreadImage: RSImage = {
return NSImage(systemSymbolName: "chevron.down.circle", accessibilityDescription: nil)!

View File

@ -25,16 +25,16 @@ final class ArticleExtractorButton: NSButton {
switch buttonState {
case .error:
stripAnimatedSublayer()
image = AppAssets.articleExtractorError
image = AppImage.articleExtractorError
case .animated:
image = nil
needsLayout = true
case .on:
stripAnimatedSublayer()
image = AppAssets.articleExtractorOn
image = AppImage.articleExtractorOn
case .off:
stripAnimatedSublayer()
image = AppAssets.articleExtractorOff
image = AppImage.articleExtractorOff
}
}
}
@ -66,7 +66,7 @@ final class ArticleExtractorButton: NSButton {
private func commonInit() {
wantsLayer = true
bezelStyle = .texturedRounded
image = AppAssets.articleExtractorOff
image = AppImage.articleExtractorOff
imageScaling = .scaleProportionallyDown
widthAnchor.constraint(equalTo: heightAnchor).isActive = true
}
@ -85,12 +85,12 @@ final class ArticleExtractorButton: NSButton {
}
private func addAnimatedSublayer(to hostedLayer: CALayer) {
let image1 = AppAssets.articleExtractorOff.tinted(with: NSColor.controlTextColor)
let image2 = AppAssets.articleExtractorOn.tinted(with: NSColor.controlTextColor)
let image1 = AppImage.articleExtractorOff.tinted(with: NSColor.controlTextColor)
let image2 = AppImage.articleExtractorOn.tinted(with: NSColor.controlTextColor)
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

@ -1,111 +0,0 @@
//
// ArticleExtractorButton.swift
// NetNewsWire
//
// Created by Maurice Parker on 9/18/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import Foundation
final class LegacyArticleExtractorButton: NSButton {
var isError = false {
didSet {
if isError != oldValue {
needsDisplay = true
}
}
}
var isInProgress = false {
didSet {
if isInProgress != oldValue {
needsDisplay = true
}
}
}
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
wantsLayer = true
}
required init?(coder: NSCoder) {
super.init(coder: coder)
wantsLayer = true
}
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
guard let hostedLayer = self.layer else {
return
}
if let imageLayer = hostedLayer.sublayers?[0] {
if needsToDraw(imageLayer.bounds) {
imageLayer.removeFromSuperlayer()
} else {
return
}
}
let opacity: Float = isEnabled ? 1.0 : 0.5
switch true {
case isError:
addImageSublayer(to: hostedLayer, image: AppAssets.legacyArticleExtractorError, opacity: opacity)
case isInProgress:
addAnimatedSublayer(to: hostedLayer)
default:
if NSApplication.shared.isActive {
addImageSublayer(to: hostedLayer, image: AppAssets.legacyArticleExtractor, opacity: opacity)
} else {
if NSApplication.shared.effectiveAppearance.isDarkMode {
addImageSublayer(to: hostedLayer, image: AppAssets.legacyArticleExtractorInactiveDark, opacity: opacity)
} else {
addImageSublayer(to: hostedLayer, image: AppAssets.legacyArticleExtractorInactiveLight, opacity: opacity)
}
}
}
}
private func makeLayerForImage(_ image: NSImage) -> CALayer {
let imageLayer = CALayer()
imageLayer.bounds = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)
imageLayer.position = CGPoint(x: bounds.midX, y: floor(bounds.midY))
return imageLayer
}
private func addImageSublayer(to hostedLayer: CALayer, image: NSImage, opacity: Float = 1.0) {
let imageLayer = makeLayerForImage(image)
imageLayer.contents = image
imageLayer.opacity = opacity
hostedLayer.addSublayer(imageLayer)
}
private func addAnimatedSublayer(to hostedLayer: CALayer) {
let imageProgress1 = AppAssets.legacyArticleExtractorProgress1
let imageProgress2 = AppAssets.legacyArticleExtractorProgress2
let imageProgress3 = AppAssets.legacyArticleExtractorProgress3
let imageProgress4 = AppAssets.legacyArticleExtractorProgress4
let images = [imageProgress1, imageProgress2, imageProgress3, imageProgress4, imageProgress3, imageProgress2, imageProgress1]
let imageLayer = CALayer()
imageLayer.bounds = CGRect(x: 0, y: 0, width: imageProgress1?.size.width ?? 0, height: imageProgress1?.size.height ?? 0)
imageLayer.position = CGPoint(x: bounds.midX, y: floor(bounds.midY))
hostedLayer.addSublayer(imageLayer)
let animation = CAKeyframeAnimation(keyPath: "contents")
animation.calculationMode = CAAnimationCalculationMode.linear
animation.keyTimes = [0, 0.16, 0.32, 0.50, 0.66, 0.82, 1]
animation.duration = 2
animation.values = images as [Any]
animation.repeatCount = HUGE
imageLayer.add(animation, forKey: "contents")
}
}

View File

@ -766,7 +766,7 @@ extension MainWindowController: NSToolbarDelegate {
case .markAllAsRead:
let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
return buildToolbarButton(.markAllAsRead, title, AppAssets.markAllAsReadImage, "markAllAsRead:")
return buildToolbarButton(.markAllAsRead, title, AppImage.markAllAsRead, "markAllAsRead:")
case .toggleReadArticlesFilter:
let title = NSLocalizedString("Read Articles Filter", comment: "Read Articles Filter")
@ -807,7 +807,7 @@ extension MainWindowController: NSToolbarDelegate {
return buildToolbarButton(.openInBrowser, title, AppAssets.openInBrowserImage, "openArticleInBrowser:")
case .articleThemeMenu:
articleThemeMenuToolbarItem.image = AppAssets.articleTheme
articleThemeMenuToolbarItem.image = AppImage.articleTheme
let description = NSLocalizedString("Article Theme", comment: "Article Theme")
articleThemeMenuToolbarItem.toolTip = description
articleThemeMenuToolbarItem.label = description
@ -822,7 +822,7 @@ extension MainWindowController: NSToolbarDelegate {
case .cleanUp:
let title = NSLocalizedString("Clean Up", comment: "Clean Up")
return buildToolbarButton(.cleanUp, title, AppAssets.cleanUpImage, "cleanUp:")
return buildToolbarButton(.cleanUp, title, AppImage.cleanUp, "cleanUp:")
default:
break

View File

@ -39,8 +39,7 @@ import RSCore
return nil
}
let image = sendToCommand.image ?? NSImage()
return NSSharingService(title: sendToCommand.title, image: image, alternateImage: nil) {
return NSSharingService(title: sendToCommand.title, image: sendToCommand.image, alternateImage: nil) {
sendToCommand.sendObject(object, selectedText: nil)
}
}

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"filename" : "ArticleExtractor.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ArticleExtractor@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,12 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ArticleExtractorError.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"filename" : "ArticleExtractorInactiveDark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ArticleExtractorInactiveDark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"filename" : "ArticleExtractorInactiveLight.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ArticleExtractorInactiveLight@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"filename" : "ArticleExtractorProgress1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ArticleExtractorProgress1@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"filename" : "ArticleExtractorProgress2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ArticleExtractorProgress2@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"filename" : "ArticleExtractorProgress3.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ArticleExtractorProgress3@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"filename" : "ArticleExtractorProgress4.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ArticleExtractorProgress4@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -29,7 +29,7 @@ public protocol SendToCommand {
/// The image for the command.
///
/// Often the icon of the target application.
var image: RSImage? { get }
var image: RSImage { get }
/// Determine whether an object can be sent to the target application.
///

View File

@ -421,7 +421,7 @@
84C1ECED2CDFE49100C7456A /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
AppAsset.swift,
AppImage.swift,
Defaults/AppDefaults.swift,
Defaults/ArticleTextSize.swift,
Defaults/FontSize.swift,

View File

@ -1,80 +0,0 @@
//
// AppAsset.swift
// NetNewsWire
//
// Created by Brent Simmons on 1/26/25.
// Copyright © 2025 Ranchero Software. All rights reserved.
//
#if os(macOS)
import AppKit
#elseif os(iOS)
import UIKit
#endif
import RSCore
import Account
struct AppAsset {
// MARK: - Account images
static func image(accountType: AccountType) -> RSImage? {
switch accountType {
case .onMyMac:
AppAsset.accountLocalImage
case .cloudKit:
AppAsset.accountCloudKitImage
case .feedbin:
AppAsset.accountFeedbinImage
case .feedly:
AppAsset.accountFeedlyImage
case .freshRSS:
AppAsset.accountFreshRSSImage
case .newsBlur:
AppAsset.accountNewsBlurImage
case .inoreader:
AppAsset.accountInoreaderImage
case .bazQux:
AppAsset.accountBazQuxImage
case .theOldReader:
AppAsset.accountTheOldReaderImage
}
}
// MARK: - Misc.
static let nnwFeedIcon = RSImage(named: "nnwFeedIcon")!
}
private extension AppAsset {
static var accountBazQuxImage = RSImage(named: "accountBazQux")!
static var accountCloudKitImage = RSImage(named: "accountCloudKit")!
static var accountFeedbinImage = RSImage(named: "accountFeedbin")!
static var accountFeedlyImage = RSImage(named: "accountFeedly")!
static var accountFreshRSSImage = RSImage(named: "accountFreshRSS")!
static var accountInoreaderImage = RSImage(named: "accountInoreader")!
static var accountNewsBlurImage = RSImage(named: "accountNewsBlur")!
static var accountTheOldReaderImage = RSImage(named: "accountTheOldReader")!
#if os(macOS)
static var accountLocalMacImage = RSImage(named: "accountLocal")!
#elseif os(iOS)
static var accountLocalPadImage = UIImage(named: "accountLocalPad")!
static var accountLocalPhoneImage = UIImage(named: "accountLocalPhone")!
#endif
static var accountLocalImage: RSImage = {
#if os(macOS)
accountLocalMacImage
#elseif os(iOS)
if UIDevice.current.userInterfaceIdiom == .pad {
return accountLocalPadImage
} else {
return accountLocalPhoneImage
}
#endif
}()
}

103
Shared/AppImage.swift Normal file
View File

@ -0,0 +1,103 @@
//
// AppImage.swift
// NetNewsWire
//
// Created by Brent Simmons on 1/26/25.
// Copyright © 2025 Ranchero Software. All rights reserved.
//
#if os(macOS)
import AppKit
#elseif os(iOS)
import UIKit
#endif
import RSCore
import Account
struct AppImage {
// MARK: - Account
static func accountImage(_ accountType: AccountType) -> RSImage? {
switch accountType {
case .onMyMac:
AppImage.accountLocal
case .cloudKit:
AppImage.accountCloudKit
case .feedbin:
AppImage.accountFeedbin
case .feedly:
AppImage.accountFeedly
case .freshRSS:
AppImage.accountFreshRSS
case .newsBlur:
AppImage.accountNewsBlur
case .inoreader:
AppImage.accountInoreader
case .bazQux:
AppImage.accountBazQux
case .theOldReader:
AppImage.accountTheOldReader
}
}
// MARK: - Article Extractor
static var articleExtractorError = RSImage(named: "articleExtractorError")!
static var articleExtractorOff = RSImage(named: "articleExtractorOff")!
static var articleExtractorOn = RSImage(named: "articleExtractorOn")!
#if os(iOS)
static var articleExtractorOffSF = UIImage(systemName: "doc.plaintext")!
static var articleExtractorOnSF = UIImage(named: "articleExtractorOnSF")!
static var articleExtractorOffTinted = articleExtractorOff.tinted(color: AppAssets.primaryAccentColor)!
static var articleExtractorOnTinted = articleExtractorOn.tinted(color: AppAssets.primaryAccentColor)!
#endif
// MARK: - Actions
static var markAllAsRead = RSImage(named: "markAllAsRead")!
// MARK: - Misc.
static let nnwFeedIcon = RSImage(named: "nnwFeedIcon")!
#if os(macOS)
// MARK: - Mac-only images
static var articleTheme = NSImage(systemSymbolName: "doc.richtext", accessibilityDescription: nil)!
static var cleanUp = NSImage(systemSymbolName: "wind", accessibilityDescription: nil)!
static var marsEditIcon = RSImage(named: "MarsEditIcon")!
static var microblogIcon = RSImage(named: "MicroblogIcon")!
#endif
#if os(iOS)
// MARK: - iOS-only images
#endif
}
// MARK: - Private
private extension AppImage {
static var accountBazQux = RSImage(named: "accountBazQux")!
static var accountCloudKit = RSImage(named: "accountCloudKit")!
static var accountFeedbin = RSImage(named: "accountFeedbin")!
static var accountFeedly = RSImage(named: "accountFeedly")!
static var accountFreshRSS = RSImage(named: "accountFreshRSS")!
static var accountInoreader = RSImage(named: "accountInoreader")!
static var accountNewsBlur = RSImage(named: "accountNewsBlur")!
static var accountTheOldReader = RSImage(named: "accountTheOldReader")!
#if os(macOS)
static var accountLocal = RSImage(named: "accountLocal")!
#elseif os(iOS)
static var accountLocalPad = UIImage(named: "accountLocalPad")!
static var accountLocalPhone = UIImage(named: "accountLocalPhone")!
static var accountLocal = UIDevice.current.userInterfaceIdiom == .pad ? accountLocalPad : accountLocalPhone
#endif
}

View File

@ -13,7 +13,7 @@ import Articles
final class SendToMarsEditCommand: SendToCommand {
let title = "MarsEdit"
let image: RSImage? = AppAssets.marsEditIcon
let image = AppImage.marsEditIcon
private let marsEditApps = [UserApp(bundleID: "com.red-sweater.marsedit5"), UserApp(bundleID: "com.red-sweater.marsedit4"), UserApp(bundleID: "com.red-sweater.marsedit")]

View File

@ -15,7 +15,7 @@ import RSCore
final class SendToMicroBlogCommand: SendToCommand {
let title = "Micro.blog"
let image: RSImage? = AppAssets.microblogIcon
let image = AppImage.microblogIcon
private let microBlogApp = UserApp(bundleID: "blog.micro.mac")

View File

@ -34,5 +34,5 @@ extension IconImage {
return nil
}()
static let nnwFeedIcon = IconImage(AppAsset.nnwFeedIcon)
static let nnwFeedIcon = IconImage(AppImage.nnwFeedIcon)
}

View File

@ -18,7 +18,7 @@ protocol SmallIconProvider {
extension Account: SmallIconProvider {
var smallIcon: IconImage? {
if let image = AppAsset.image(accountType: type) {
if let image = AppImage.accountImage(type) {
return IconImage(image)
}
return nil

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
}