mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Complete switch on Mac from AppAssets to AppAsset.
This commit is contained in:
86
Shared/AppAsset-Mac.swift
Normal file
86
Shared/AppAsset-Mac.swift
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// AppAsset-Mac.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 10/30/24.
|
||||
// Copyright © 2024 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Core
|
||||
import Images
|
||||
|
||||
extension AppAsset {
|
||||
|
||||
static let iconLightBackgroundColor = NSColor(named: "iconLightBackgroundColor")!
|
||||
static let iconDarkBackgroundColor = NSColor(named: "iconDarkBackgroundColor")!
|
||||
|
||||
// MARK: - Mac Share Menu
|
||||
|
||||
static let marsEditImage = RSImage.appImage("MarsEditIcon")
|
||||
static let microblogImage = RSImage.appImage("MicroblogIcon")
|
||||
|
||||
// MARK: - Mac Toolbar
|
||||
|
||||
static let toolbarAddNewSidebarItemImage = RSImage.systemImage("plus")
|
||||
static let toolbarRefreshImage = RSImage.systemImage("arrow.clockwise")
|
||||
static let toolbarArticleThemeImage = RSImage.systemImage("doc.richtext")
|
||||
static let toolbarCleanUpImage = RSImage.systemImage("wind")
|
||||
static let toolbarNextUnreadImage = RSImage.systemImage("chevron.down.circle")
|
||||
static let toolbarOpenInBrowserImage = RSImage.systemImage("safari")
|
||||
static let toolbarReadClosedImage = RSImage.systemImage("largecircle.fill.circle")
|
||||
static let toolbarReadOpenImage = RSImage.systemImage("circle")
|
||||
static let toolbarShareImage = AppAsset.shareImage
|
||||
|
||||
// MARK: - Mac Preferences Toolbar
|
||||
|
||||
static let preferencesToolbarAccountsImage = RSImage.systemImage("at")
|
||||
static let preferencesToolbarGeneralImage = RSImage.systemImage("gearshape")
|
||||
static let preferencesToolbarAdvancedImage = RSImage.systemImage("gearshape.2")
|
||||
|
||||
// MARK: - Timeline
|
||||
|
||||
static let timelineSwipeMarkRead = NSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")!
|
||||
.withSymbolConfiguration(.init(scale: .large))
|
||||
static let timelineSwipeMarkUnread = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")!
|
||||
.withSymbolConfiguration(.init(scale: .large))
|
||||
static let timelineSwipeMarkStarred = NSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")!
|
||||
.withSymbolConfiguration(.init(scale: .large))
|
||||
static let timelineSwipeMarkUnstarred = NSImage(systemSymbolName: "star", accessibilityDescription: "Unstar")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
static let timelineStarSelected = RSImage.appImage("timelineStar").tinted(with: .white)
|
||||
static let timelineStarUnselected = RSImage.appImage("timelineStar").tinted(with: AppAsset.starColor)
|
||||
static let timelineSeparatorColor = NSColor(named: "timelineSeparatorColor")!
|
||||
|
||||
static let searchFeedImage: IconImage = {
|
||||
IconImage(NSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSupressed: true)
|
||||
}()
|
||||
|
||||
static let folderIcon: IconImage = {
|
||||
let image = RSImage.systemImage("folder")
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static let unreadFeedImage: IconImage = {
|
||||
let image = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static let starredFeedImage: IconImage = {
|
||||
let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = AppAsset.starColor
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static let todayFeedImage: IconImage = {
|
||||
let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor.orange
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
}
|
||||
39
Shared/AppAsset-iOS.swift
Normal file
39
Shared/AppAsset-iOS.swift
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// AppAsset-iOS.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Brent Simmons on 10/30/24.
|
||||
// Copyright © 2024 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension AppAsset {
|
||||
|
||||
static let starClosedImage = UIImage(systemName: "star.fill")!
|
||||
|
||||
static let searchFeedImage: IconImage = {
|
||||
IconImage(UIImage(systemName: "magnifyingglass")!, isSymbol: true)
|
||||
}()
|
||||
|
||||
static let unreadFeedImage: IconImage = {
|
||||
let image = UIImage(systemName: "largecircle.fill.circle")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSupressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
|
||||
}()
|
||||
|
||||
static let todayFeedImage: IconImage = {
|
||||
let image = UIImage(systemName: "sun.max.fill")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSupressed: true, preferredColor: UIColor.systemOrange.cgColor)
|
||||
}()
|
||||
|
||||
static let starredFeedImage: IconImage = {
|
||||
let image = UIImage(systemName: "star.fill")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSupressed: true, preferredColor: AppAsset.starColor.cgColor)
|
||||
}()
|
||||
|
||||
static let folderIcon: IconImage = {
|
||||
let image = RSImage.systemImage("folder.fill")
|
||||
let preferredColor = AppAssets.secondaryAccentColor
|
||||
return IconImage(image, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import Core
|
||||
import Account
|
||||
import Images
|
||||
|
||||
final class AppAsset {
|
||||
@MainActor final class AppAsset {
|
||||
|
||||
static let markAllAsReadImage = RSImage.appImage("markAllAsRead")
|
||||
static let faviconTemplateImage = RSImage.appImage("faviconTemplateImage")
|
||||
@@ -24,28 +24,8 @@ final class AppAsset {
|
||||
|
||||
static let starColor = RSColor(named: "starColor")!
|
||||
|
||||
@MainActor static let folderIcon: IconImage = {
|
||||
|
||||
#if os(macOS)
|
||||
let image = RSImage.systemImage("folder")
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
#else
|
||||
let image = RSImage.systemImage("folder.fill")
|
||||
let preferredColor = AppAssets.secondaryAccentColor
|
||||
return IconImage(image, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
#endif
|
||||
}()
|
||||
|
||||
@MainActor static let searchFeedImage: IconImage = {
|
||||
|
||||
#if os(macOS)
|
||||
IconImage(NSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSupressed: true)
|
||||
#else
|
||||
IconImage(UIImage(systemName: "magnifyingglass")!, isSymbol: true)
|
||||
#endif
|
||||
}()
|
||||
static let starOpenImage = RSImage.systemImage("star")
|
||||
static let starClosedImage = RSImage.systemImage("star.fill")
|
||||
|
||||
// MARK: - ArticleExtractor
|
||||
|
||||
@@ -59,11 +39,8 @@ final class AppAsset {
|
||||
|
||||
static let filterActiveImage = RSImage.systemImage("line.horizontal.3.decrease.circle.fill")
|
||||
static let filterInactiveImage = RSImage.systemImage("line.horizontal.3.decrease.circle")
|
||||
}
|
||||
|
||||
// MARK: - Account
|
||||
|
||||
extension AppAsset {
|
||||
// MARK: - Account
|
||||
|
||||
static let bazQuxImage = RSImage.appImage("accountBazQux")
|
||||
static let cloudKitImage = RSImage.appImage("accountCloudKit")
|
||||
@@ -77,7 +54,7 @@ extension AppAsset {
|
||||
static let newsBlurImage = RSImage.appImage("accountNewsBlur")
|
||||
static let theOldReaderImage = RSImage.appImage("accountTheOldReader")
|
||||
|
||||
@MainActor static func accountImage(for accountType: AccountType) -> RSImage {
|
||||
static func accountImage(for accountType: AccountType) -> RSImage {
|
||||
|
||||
switch accountType {
|
||||
case .onMyMac:
|
||||
@@ -111,39 +88,3 @@ extension AppAsset {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
// MARK: - Mac
|
||||
|
||||
extension AppAsset {
|
||||
|
||||
static let iconLightBackgroundColor = NSColor(named: "iconLightBackgroundColor")!
|
||||
static let iconDarkBackgroundColor = NSColor(named: "iconDarkBackgroundColor")!
|
||||
|
||||
// MARK: - Mac Share Menu
|
||||
|
||||
static let marsEditImage = RSImage.appImage("MarsEditIcon")
|
||||
static let microblogImage = RSImage.appImage("MicroblogIcon")
|
||||
|
||||
// MARK: - Mac Toolbar
|
||||
|
||||
static let toolbarAddNewSidebarItemImage = RSImage.systemImage("plus")
|
||||
static let toolbarRefreshImage = RSImage.systemImage("arrow.clockwise")
|
||||
static let toolbarArticleThemeImage = RSImage.systemImage("doc.richtext")
|
||||
static let toolbarCleanUpImage = RSImage.systemImage("wind")
|
||||
static let toolbarNextUnreadImage = RSImage.systemImage("chevron.down.circle")
|
||||
static let toolbarOpenInBrowserImage = RSImage.systemImage("safari")
|
||||
static let toolbarReadClosedImage = RSImage.systemImage("largecircle.fill.circle")
|
||||
static let toolbarReadOpenImage = RSImage.systemImage("circle")
|
||||
static let toolbarShareImage = AppAsset.shareImage
|
||||
|
||||
// MARK: - Mac Preferences Toolbar
|
||||
|
||||
static let preferencesToolbarAccountsImage = RSImage.systemImage("at")
|
||||
static let preferencesToolbarGeneralImage = RSImage.systemImage("gearshape")
|
||||
static let preferencesToolbarAdvancedImage = RSImage.systemImage("gearshape.2")
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import Images
|
||||
let nameForDisplayPrefix = NSLocalizedString("Search: ", comment: "Search smart feed title prefix")
|
||||
let searchString: String
|
||||
let fetchType: FetchType
|
||||
var smallIcon: IconImage? = AppAssets.searchFeedImage
|
||||
var smallIcon: IconImage? = AppAsset.searchFeedImage
|
||||
|
||||
init(searchString: String) {
|
||||
self.searchString = searchString
|
||||
|
||||
@@ -24,7 +24,7 @@ import Images
|
||||
let nameForDisplayPrefix = NSLocalizedString("Search: ", comment: "Search smart feed title prefix")
|
||||
let searchString: String
|
||||
let fetchType: FetchType
|
||||
var smallIcon: IconImage? = AppAssets.searchFeedImage
|
||||
var smallIcon: IconImage? = AppAsset.searchFeedImage
|
||||
|
||||
init(searchString: String, articleIDs: Set<String>) {
|
||||
self.searchString = searchString
|
||||
|
||||
@@ -20,7 +20,7 @@ import Images
|
||||
let nameForDisplay = NSLocalizedString("Starred", comment: "Starred pseudo-feed title")
|
||||
let fetchType: FetchType = .starred(nil)
|
||||
var smallIcon: IconImage? {
|
||||
return AppAssets.starredFeedImage
|
||||
return AppAsset.starredFeedImage
|
||||
}
|
||||
|
||||
func unreadCount(account: Account) async -> Int {
|
||||
|
||||
@@ -20,7 +20,7 @@ import Images
|
||||
let nameForDisplay = NSLocalizedString("Today", comment: "Today pseudo-feed title")
|
||||
let fetchType = FetchType.today(nil)
|
||||
var smallIcon: IconImage? {
|
||||
return AppAssets.todayFeedImage
|
||||
return AppAsset.todayFeedImage
|
||||
}
|
||||
|
||||
func unreadCount(account: Account) async -> Int {
|
||||
|
||||
@@ -41,7 +41,7 @@ final class UnreadFeed: PseudoFeed {
|
||||
}
|
||||
|
||||
var smallIcon: IconImage? {
|
||||
return AppAssets.unreadFeedImage
|
||||
return AppAsset.unreadFeedImage
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
Reference in New Issue
Block a user