From 440a7fbefaf5e484c908c01cefed58a6c9e49491 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 25 Jul 2024 20:14:58 -0700 Subject: [PATCH] Continue moving to structured and shared AppAsset over separate AppAssets. --- Mac/AppAssets.swift | 96 ++++++------------ Mac/MainWindow/MainWindowController.swift | 10 +- .../Timeline/Cell/TimelineTableCellView.swift | 8 +- .../Timeline/TimelineTableRowView.swift | 2 +- .../Timeline/TimelineViewController.swift | 6 +- .../PreferencesWindowController.swift | 6 +- .../ArticleExtractor.png | Bin 206 -> 0 bytes .../ArticleExtractor@2x.png | Bin 253 -> 0 bytes .../Contents.json | 22 ---- .../ArticleExtractorError.pdf | Bin 3818 -> 0 bytes .../Contents.json | 12 --- .../ArticleExtractorInactiveDark.png | Bin 206 -> 0 bytes .../ArticleExtractorInactiveDark@2x.png | Bin 253 -> 0 bytes .../Contents.json | 22 ---- .../ArticleExtractorInactiveLight.png | Bin 206 -> 0 bytes .../ArticleExtractorInactiveLight@2x.png | Bin 253 -> 0 bytes .../Contents.json | 22 ---- .../ArticleExtractorProgress1.png | Bin 214 -> 0 bytes .../ArticleExtractorProgress1@2x.png | Bin 260 -> 0 bytes .../Contents.json | 22 ---- .../ArticleExtractorProgress2.png | Bin 216 -> 0 bytes .../ArticleExtractorProgress2@2x.png | Bin 262 -> 0 bytes .../Contents.json | 22 ---- .../ArticleExtractorProgress3.png | Bin 209 -> 0 bytes .../ArticleExtractorProgress3@2x.png | Bin 254 -> 0 bytes .../Contents.json | 22 ---- .../ArticleExtractorProgress4.png | Bin 217 -> 0 bytes .../ArticleExtractorProgress4@2x.png | Bin 263 -> 0 bytes .../Contents.json | 22 ---- Modules/Core/Sources/Core/RSColor.swift | 16 +++ Shared/AppAsset.swift | 33 +++++- Shared/Extensions/SmallIconProvider.swift | 2 +- iOS/AppAssets.swift | 10 +- iOS/Article/WebViewController.swift | 2 +- .../ShareFolderPickerController.swift | 2 +- iOS/Timeline/TimelineViewController.swift | 4 +- 36 files changed, 100 insertions(+), 263 deletions(-) delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractor.imageset/ArticleExtractor.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractor.imageset/ArticleExtractor@2x.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractor.imageset/Contents.json delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorError.imageset/ArticleExtractorError.pdf delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorError.imageset/Contents.json delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveDark.imageset/ArticleExtractorInactiveDark.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveDark.imageset/ArticleExtractorInactiveDark@2x.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveDark.imageset/Contents.json delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveLight.imageset/ArticleExtractorInactiveLight.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveLight.imageset/ArticleExtractorInactiveLight@2x.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveLight.imageset/Contents.json delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress1.imageset/ArticleExtractorProgress1.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress1.imageset/ArticleExtractorProgress1@2x.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress1.imageset/Contents.json delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/ArticleExtractorProgress2.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/ArticleExtractorProgress2@2x.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/Contents.json delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress3.imageset/ArticleExtractorProgress3.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress3.imageset/ArticleExtractorProgress3@2x.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress3.imageset/Contents.json delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/ArticleExtractorProgress4.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/ArticleExtractorProgress4@2x.png delete mode 100644 Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/Contents.json create mode 100644 Modules/Core/Sources/Core/RSColor.swift diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift index 286809c13..75cf57dc0 100644 --- a/Mac/AppAssets.swift +++ b/Mac/AppAssets.swift @@ -7,16 +7,16 @@ // import AppKit +import Core import Account import Images -import Core extension AppAsset { struct Mac { - static let iconLightBackgroundColor = NSColor(named: NSColor.Name("iconLightBackgroundColor"))! - static let iconDarkBackgroundColor = NSColor(named: NSColor.Name("iconDarkBackgroundColor"))! + static let iconLightBackgroundColor = NSColor(named: "iconLightBackgroundColor")! + static let iconDarkBackgroundColor = NSColor(named: "iconDarkBackgroundColor")! static let marsEditIcon = RSImage.appImage("MarsEditIcon") static let microblogIcon = RSImage.appImage("MicroblogIcon") @@ -27,6 +27,31 @@ extension AppAsset { static let refresh = RSImage.systemImage("arrow.clockwise") static let articleTheme = RSImage.systemImage("doc.richtext") static let cleanUpImage = RSImage.systemImage("wind") + static let nextUnread = RSImage.systemImage("chevron.down.circle") + static let openInBrowser = RSImage.systemImage("safari") + static let readClosed = RSImage.systemImage("largecircle.fill.circle") + static let readOpen = RSImage.systemImage("circle") + static let share = AppAsset.share + } + + struct PreferencesToolbar { + static let accounts = RSImage.systemImage("at") + static let general = RSImage.systemImage("gearshape") + static let advanced = RSImage.systemImage("gearshape.2") + } + + struct Timeline { + static let swipeMarkRead = NSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")! + .withSymbolConfiguration(.init(scale: .large)) + static let swipeMarkUnread = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")! + .withSymbolConfiguration(.init(scale: .large)) + static let swipeMarkStarred = NSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")! + .withSymbolConfiguration(.init(scale: .large)) + static let swipeMarkUnstarred = NSImage(systemSymbolName: "star", accessibilityDescription: "Unstar")! + .withSymbolConfiguration(.init(scale: .large))! + static let starSelected = RSImage.appImage("timelineStar").tinted(with: .white) + static let starUnselected = RSImage.appImage("timelineStar").tinted(with: AppAsset.starColor) + static let separatorColor = NSColor(named: "timelineSeparatorColor")! } } } @@ -34,54 +59,11 @@ extension AppAsset { struct AppAssets { - - - static let legacyArticleExtractor = NSImage(named: "legacyArticleExtractor")! - - static let legacyArticleExtractorError = NSImage(named: "legacyArticleExtractorError")! - - static let legacyArticleExtractorInactiveDark = NSImage(named: "legacyArticleExtractorInactiveDark")! - - static let legacyArticleExtractorInactiveLight = NSImage(named: "legacyArticleExtractorInactiveLight")! - - static let legacyArticleExtractorProgress1 = NSImage(named: "legacyArticleExtractorProgress1") - - static let legacyArticleExtractorProgress2 = NSImage(named: "legacyArticleExtractorProgress2") - - static let legacyArticleExtractorProgress3 = NSImage(named: "legacyArticleExtractorProgress3") - - static let legacyArticleExtractorProgress4 = NSImage(named: "legacyArticleExtractorProgress4") - - @MainActor - static let folderImage: IconImage = { - let image = NSImage(systemSymbolName: "folder", 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 nextUnreadImage = NSImage(systemSymbolName: "chevron.down.circle", accessibilityDescription: nil)! - - static let openInBrowserImage = NSImage(systemSymbolName: "safari", accessibilityDescription: nil)! - - static let preferencesToolbarAccountsImage = NSImage(systemSymbolName: "at", accessibilityDescription: nil)! - - static let preferencesToolbarGeneralImage = NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)! - - static let preferencesToolbarAdvancedImage = NSImage(systemSymbolName: "gearshape.2", accessibilityDescription: nil)! - - static let readClosedImage = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)! - - static let readOpenImage = NSImage(systemSymbolName: "circle", accessibilityDescription: nil)! - - @MainActor static let searchFeedImage: IconImage = { return IconImage(NSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSupressed: true) }() - static let shareImage = NSImage(systemSymbolName: "square.and.arrow.up", accessibilityDescription: nil)! - static let starClosedImage = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)! static let starOpenImage = NSImage(systemSymbolName: "star", accessibilityDescription: nil)! @@ -89,17 +71,11 @@ struct AppAssets { @MainActor static let starredFeedImage: IconImage = { let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)! - let preferredColor = NSColor(named: "StarColor")! + let preferredColor = AppAsset.starColor let coloredImage = image.tinted(with: preferredColor) return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor) }() - static let timelineSeparatorColor = NSColor(named: "timelineSeparatorColor")! - - static let timelineStarSelected = NSImage(named: "timelineStar")?.tinted(with: .white) - - static let timelineStarUnselected = NSImage(named: "timelineStar")?.tinted(with: starColor) - @MainActor static let todayFeedImage: IconImage = { let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)! @@ -115,18 +91,4 @@ struct AppAssets { let coloredImage = image.tinted(with: preferredColor) return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor) }() - - static let swipeMarkReadImage = NSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")! - .withSymbolConfiguration(.init(scale: .large)) - - static let swipeMarkUnreadImage = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")! - .withSymbolConfiguration(.init(scale: .large)) - - static let swipeMarkStarredImage = NSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")! - .withSymbolConfiguration(.init(scale: .large)) - - static let swipeMarkUnstarredImage = NSImage(systemSymbolName: "star", accessibilityDescription: "Unstar")! - .withSymbolConfiguration(.init(scale: .large))! - - static let starColor = NSColor(named: NSColor.Name("StarColor"))! } diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index 132ecdd0f..072b9e213 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -824,7 +824,7 @@ extension MainWindowController: NSToolbarDelegate { case .markRead: let title = NSLocalizedString("Mark Read", comment: "Mark Read") - return buildToolbarButton(.markRead, title, AppAssets.readClosedImage, "toggleRead:") + return buildToolbarButton(.markRead, title, AppAsset.Mac.Toolbar.readClosed, "toggleRead:") case .markStar: let title = NSLocalizedString("Star", comment: "Star") @@ -832,7 +832,7 @@ extension MainWindowController: NSToolbarDelegate { case .nextUnread: let title = NSLocalizedString("Next Unread", comment: "Next Unread") - return buildToolbarButton(.nextUnread, title, AppAssets.nextUnreadImage, "nextUnread:") + return buildToolbarButton(.nextUnread, title, AppAsset.Mac.Toolbar.nextUnread, "nextUnread:") case .readerView: let toolbarItem = RSToolbarItem(itemIdentifier: .readerView) @@ -847,11 +847,11 @@ extension MainWindowController: NSToolbarDelegate { case .share: let title = NSLocalizedString("Share", comment: "Share") - return buildToolbarButton(.share, title, AppAssets.shareImage, "toolbarShowShareMenu:") + return buildToolbarButton(.share, title, AppAsset.Mac.Toolbar.share, "toolbarShowShareMenu:") case .openInBrowser: let title = NSLocalizedString("Open in Browser", comment: "Open in Browser") - return buildToolbarButton(.openInBrowser, title, AppAssets.openInBrowserImage, "openArticleInBrowser:") + return buildToolbarButton(.openInBrowser, title, AppAsset.Mac.Toolbar.openInBrowser, "openArticleInBrowser:") case .articleThemeMenu: articleThemeMenuToolbarItem.image = AppAsset.Mac.Toolbar.articleTheme @@ -1079,7 +1079,7 @@ private extension MainWindowController { } if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton { - button.image = markingRead ? AppAssets.readClosedImage : AppAssets.readOpenImage + button.image = markingRead ? AppAsset.Mac.Toolbar.readClosed : AppAsset.Mac.Toolbar.readOpen } return result diff --git a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift index 4b8652d48..2fb854431 100644 --- a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift +++ b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift @@ -8,7 +8,7 @@ import AppKit -class TimelineTableCellView: NSTableCellView { +final class TimelineTableCellView: NSTableCellView { private let titleView = TimelineTableCellView.multiLineTextField() private let summaryView = TimelineTableCellView.multiLineTextField() @@ -19,7 +19,7 @@ class TimelineTableCellView: NSTableCellView { private lazy var iconView = IconView() - private var starView = TimelineTableCellView.imageView(with: AppAssets.timelineStarUnselected, scaling: .scaleNone) + private var starView = TimelineTableCellView.imageView(with: AppAsset.Mac.Timeline.starUnselected, scaling: .scaleNone) private lazy var textFields = { return [self.dateView, self.feedNameView, self.titleView, self.summaryView, self.textView] @@ -258,9 +258,9 @@ private extension TimelineTableCellView { func updateStarView() { if isSelected && isEmphasized { - starView.image = AppAssets.timelineStarSelected + starView.image = AppAsset.Mac.Timeline.starSelected } else { - starView.image = AppAssets.timelineStarUnselected + starView.image = AppAsset.Mac.Timeline.starUnselected } showOrHideView(starView, !cellData.starred) } diff --git a/Mac/MainWindow/Timeline/TimelineTableRowView.swift b/Mac/MainWindow/Timeline/TimelineTableRowView.swift index acf7d5e78..05ddf92c8 100644 --- a/Mac/MainWindow/Timeline/TimelineTableRowView.swift +++ b/Mac/MainWindow/Timeline/TimelineTableRowView.swift @@ -59,7 +59,7 @@ class TimelineTableRowView : NSTableRowView { separator = NSView() separator!.translatesAutoresizingMaskIntoConstraints = false separator!.wantsLayer = true - separator!.layer?.backgroundColor = AppAssets.timelineSeparatorColor.cgColor + separator!.layer?.backgroundColor = AppAsset.Mac.Timeline.separatorColor.cgColor addSubview(separator!) diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index f0e80e345..6a21545c6 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -938,7 +938,7 @@ extension TimelineViewController: NSTableViewDelegate { self.toggleArticleRead(article); tableView.rowActionsVisible = false } - action.image = article.status.read ? AppAssets.swipeMarkUnreadImage : AppAssets.swipeMarkReadImage + action.image = article.status.read ? AppAsset.Mac.Timeline.swipeMarkUnread : AppAsset.Mac.Timeline.swipeMarkRead return [action] case .trailing: @@ -946,8 +946,8 @@ extension TimelineViewController: NSTableViewDelegate { self.toggleArticleStarred(article); tableView.rowActionsVisible = false } - action.backgroundColor = AppAssets.starColor - action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage + action.backgroundColor = AppAsset.starColor + action.image = article.status.starred ? AppAsset.Mac.Timeline.swipeMarkUnstarred : AppAsset.Mac.Timeline.swipeMarkStarred return [action] @unknown default: diff --git a/Mac/Preferences/PreferencesWindowController.swift b/Mac/Preferences/PreferencesWindowController.swift index be7ef37c8..a318496ac 100644 --- a/Mac/Preferences/PreferencesWindowController.swift +++ b/Mac/Preferences/PreferencesWindowController.swift @@ -35,10 +35,10 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate { var specs = [PreferencesToolbarItemSpec]() specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.General, name: NSLocalizedString("General", comment: "Preferences"), - image: AppAssets.preferencesToolbarGeneralImage)] + image: AppAsset.Mac.PreferencesToolbar.general)] specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Accounts, name: NSLocalizedString("Accounts", comment: "Preferences"), - image: AppAssets.preferencesToolbarAccountsImage)] + image: AppAsset.Mac.PreferencesToolbar.accounts)] // Omit the Advanced Preferences for now because the Software Update related functionality is // forbidden/non-applicable, and we can rely upon Apple to some extent for crash reports. We @@ -47,7 +47,7 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate { #if !MAC_APP_STORE specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Advanced, name: NSLocalizedString("Advanced", comment: "Preferences"), - image: AppAssets.preferencesToolbarAdvancedImage)] + image: AppAsset.Mac.PreferencesToolbar.advanced)] #endif return specs }() diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractor.imageset/ArticleExtractor.png b/Mac/Resources/Assets.xcassets/legacyArticleExtractor.imageset/ArticleExtractor.png deleted file mode 100644 index 9af1d10d464d52fc82e97f1bc9278241dbf9ea33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uuz(rC1}QWNE&K$eEIeHtLo5W7 z6BY;<9LxXpalVl842_F67GECmG`H5t^eCtcaV>r*!*;~&VgWaE(qlOhJAgb6Mw<&;$Tp<0{Dj diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractor.imageset/ArticleExtractor@2x.png b/Mac/Resources/Assets.xcassets/legacyArticleExtractor.imageset/ArticleExtractor@2x.png deleted file mode 100644 index fa4f44b82c4ccc8ef8356580ea1d06b07c9c6be7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz07Sip>6gA}f5OZp6?(mh=qLn1hn z6C_?X7}j0x|IaMR;lrG1dE#9lJ5LEu&n^28iVj7V8!q%W3*NjrWt#Hhn*|4)87!^b zZz>zJc<8aOko94n$L%KT@K!_CH2*~_!?~h{TVL&TGA^8zJ=?}C$FyOE>K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J}_-_^#Ynli!J8L0vO|B@d+kPn43~)TYiK`&C7(JZ?DDS1^f5U7kuL4lxQ;NaKjA^sk}sooIA~j*q4<(ILyG% WUn|U9zce1?CI(MeKbLh*2~7ZR!!7&( diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveDark.imageset/ArticleExtractorInactiveDark@2x.png b/Mac/Resources/Assets.xcassets/legacyArticleExtractorInactiveDark.imageset/ArticleExtractorInactiveDark@2x.png deleted file mode 100644 index 2ae7def3fac08fed9f65ee430c53e72855936ec9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz07Sip>6gA}f5OZp6?(mh=qLn1hn z6C_?XY}~Nn!+!@hrppdde4DDTFfz+BFaE|~!!aR-@5}e^#!A++FBPSjNb^;2D7Zh@ zs7`5PIQf)eYjfs-;)5%gSI911{ET<6z=24r*!*;~&VgWaE(qlOhJA6gA}f5OZp6?(mh=qLn1hn z6C_?Xe0+4Y`#-ypzznuaMHB8W=973KA+fdofpf!?B8T|+`GPlZPMM~>_-4TYX9i0v z_nXSbEFOC7D`b6`=W)BqI=t18HO+s~%5biz;nr6>os0`-WzV)T%Q0Bpm&YsPY&8E8t_EA6gA}f5OZp6?@;qG}Ln1hn z6C_?X1S+Nd{NKpKvaE57Ov?8a%xqR{Zg1s(2qg5}|I)mqC}E*IyYi;Zo>%+Vh#!$V z+r})%^divclzgS4Ly@J!TLq~PF$S*~vfN*;sC3q6DVWB5W!?8g$L73u8D=sc1R7k= ao>FVdQ&MBb@0JG{cH2?qr diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/ArticleExtractorProgress2@2x.png b/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/ArticleExtractorProgress2@2x.png deleted file mode 100644 index f7883efeca1b4e29649ec4942de576d3ec2eddd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 262 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz07Sip>6gA}f5OZp6?3OrpLLn1hn z6C_?X7}j0x|IaMR;lrG1dE#9lJ5LEu&n^28iU%|VH_us8^x)_u54V)`$*bfe^*d~5 z@v_^nTv(hk#r~61!WLVD2R922$QpbK`n#h4qBBFf<%SFW%uDYr5Btw}_YUKE*2R1d d{=&-r{0v_>MBMkyoUsYy22WQ%mvv4FO#s8KNU{I` diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/Contents.json b/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/Contents.json deleted file mode 100644 index 21de8a7fd..000000000 --- a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress2.imageset/Contents.json +++ /dev/null @@ -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 - } -} diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress3.imageset/ArticleExtractorProgress3.png b/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress3.imageset/ArticleExtractorProgress3.png deleted file mode 100644 index ee2ef5db6c11acc8abaf9d23a9c43ca150f128e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uuz(rC1}QWNE&K$etUX;ELo5W7 z6BY;<9LxXpalVl842_F67GECmG`H5t^eCtcaV>r*z$RpP+Wj(PP@ICH ZW@PyKMZ|orHlH}iI8RqUmvv4FO#mY>E@}V( diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress3.imageset/ArticleExtractorProgress3@2x.png b/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress3.imageset/ArticleExtractorProgress3@2x.png deleted file mode 100644 index 0a809afc7380922237f42322d9c7d09dbf2d2ac9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 254 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz07Sip>6gA}f5OZp6?GCW-zLn1hn z6C_?X7}j0x|IaMR;lrG1dE#9lJ5LEu&n^28iVj7V8!q%W3*NjrWt#Hhn*|4)87!^b zZz>zJNT?=F>)*!CX7bMcbR#40zrfRuiVd4>9o|;Si`{wgjITmZqLe`=%T14$VaXK{ Ucm4zH)*!n*UHx3vIVCg!0Lr*!*;~&VgUzp=ZvQx_Iyb4RIzwB i@n}IStIyj5?Tie0eWI$yp4&mrWAJqKb6Mw<&;$S&5;Ri) diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/ArticleExtractorProgress4@2x.png b/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/ArticleExtractorProgress4@2x.png deleted file mode 100644 index 2c9bad220a9204bd4938413ab45eac734b4e64fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz07Sip>6gA}f5OZp6?3O!vMLn1hn z6C_?X7}j0x|IaMR;lrG1dE#9lJ5LEu&n^28iVj7V8!q%W3*NjrWt#Hhn*|4)87!^b zZz>zJc<8aOko94n$L%KT@K!_CH2*~_!(x{+MQi>xiF+#rzN(FRM*G{mehASE} ab*~t2@`#$gisUy2Il|M`&t;ucLK6USQ%52I diff --git a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/Contents.json b/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/Contents.json deleted file mode 100644 index 7f2137461..000000000 --- a/Mac/Resources/Assets.xcassets/legacyArticleExtractorProgress4.imageset/Contents.json +++ /dev/null @@ -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 - } -} diff --git a/Modules/Core/Sources/Core/RSColor.swift b/Modules/Core/Sources/Core/RSColor.swift new file mode 100644 index 000000000..2ea17abbb --- /dev/null +++ b/Modules/Core/Sources/Core/RSColor.swift @@ -0,0 +1,16 @@ +// +// RSColor.swift +// +// +// Created by Brent Simmons on 7/9/24. +// + +#if os(macOS) +import AppKit +public typealias RSColor = NSColor +#endif + +#if os(iOS) +import UIKit +public typealias RSColor = UIColor +#endif diff --git a/Shared/AppAsset.swift b/Shared/AppAsset.swift index f2441219c..793c8b457 100644 --- a/Shared/AppAsset.swift +++ b/Shared/AppAsset.swift @@ -14,12 +14,43 @@ import UIKit import Core import Account +import Images final class AppAsset { - static let markAllAsRead = RSImage.appImage("markAllAsRead") static let faviconTemplate = RSImage.appImage("faviconTemplateImage") + static let share = RSImage.systemImage("square.and.arrow.up") + + static let starColor = RSColor(named: "StarColor")! + + @MainActor static let folder: 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 + }() + struct Account { diff --git a/Shared/Extensions/SmallIconProvider.swift b/Shared/Extensions/SmallIconProvider.swift index 0ea228dbf..e76cca70b 100644 --- a/Shared/Extensions/SmallIconProvider.swift +++ b/Shared/Extensions/SmallIconProvider.swift @@ -35,6 +35,6 @@ extension Feed: SmallIconProvider { extension Folder: SmallIconProvider { var smallIcon: IconImage? { - AppAssets.folderImage + AppAsset.folder } } diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index e06df2362..8abf86938 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -47,8 +47,6 @@ struct AppAssets { static let markAboveAsReadImage = UIImage(systemName: "arrowtriangle.up.circle")! - @MainActor static let folderImage = IconImage(UIImage(systemName: "folder.fill")!, isSymbol: true, isBackgroundSupressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor) - static let folderImageNonIcon = UIImage(systemName: "folder.fill")!.withRenderingMode(.alwaysOriginal).withTintColor(.secondaryLabel) static let moreImage = UIImage(systemName: "ellipsis.circle")! @@ -73,26 +71,22 @@ struct AppAssets { static let sectionHeaderColor = UIColor(named: "sectionHeaderColor")! - static let shareImage = UIImage(systemName: "square.and.arrow.up")! - static let smartFeedImage = UIImage(systemName: "gear")! - static let starColor = UIColor(named: "starColor")! - static let starClosedImage = UIImage(systemName: "star.fill")! static let starOpenImage = UIImage(systemName: "star")! @MainActor static let starredFeedImage: IconImage = { let image = UIImage(systemName: "star.fill")! - return IconImage(image, isSymbol: true, isBackgroundSupressed: true, preferredColor: AppAssets.starColor.cgColor) + return IconImage(image, isSymbol: true, isBackgroundSupressed: true, preferredColor: AppAsset.starColor.cgColor) }() static let tickMarkColor = UIColor(named: "tickMarkColor")! static let timelineStarImage: UIImage = { let image = UIImage(systemName: "star.fill")! - return image.withTintColor(AppAssets.starColor, renderingMode: .alwaysOriginal) + return image.withTintColor(AppAsset.starColor, renderingMode: .alwaysOriginal) }() @MainActor static let todayFeedImage: IconImage = { diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index f5a87366e..715c29580 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -868,7 +868,7 @@ private extension WebViewController { func shareAction() -> UIAction { let title = NSLocalizedString("Share", comment: "Share") - return UIAction(title: title, image: AppAssets.shareImage) { [weak self] action in + return UIAction(title: title, image: AppAsset.share) { [weak self] action in self?.showActivityDialog() } } diff --git a/iOS/ShareExtension/ShareFolderPickerController.swift b/iOS/ShareExtension/ShareFolderPickerController.swift index edba1d4e0..0510b3bfc 100644 --- a/iOS/ShareExtension/ShareFolderPickerController.swift +++ b/iOS/ShareExtension/ShareFolderPickerController.swift @@ -49,7 +49,7 @@ class ShareFolderPickerController: UITableViewController { if let account = container as? ExtensionAccount { cell.icon.image = AppAsset.Account.image(for: account.type) } else { - cell.icon.image = AppAssets.folderImage.image + cell.icon.image = AppAsset.folder.image } cell.label?.text = container?.name ?? "" diff --git a/iOS/Timeline/TimelineViewController.swift b/iOS/Timeline/TimelineViewController.swift index 6e5b71a8a..9d0e92d3f 100644 --- a/iOS/Timeline/TimelineViewController.swift +++ b/iOS/Timeline/TimelineViewController.swift @@ -285,7 +285,7 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner { } starAction.image = article.status.starred ? AppAssets.starOpenImage : AppAssets.starClosedImage - starAction.backgroundColor = AppAssets.starColor + starAction.backgroundColor = AppAsset.starColor // Set up the read action let moreTitle = NSLocalizedString("More", comment: "More") @@ -984,7 +984,7 @@ private extension TimelineViewController { func shareAction(_ article: Article, indexPath: IndexPath) -> UIAction? { guard let url = article.preferredURL else { return nil } let title = NSLocalizedString("Share", comment: "Share") - let action = UIAction(title: title, image: AppAssets.shareImage) { [weak self] action in + let action = UIAction(title: title, image: AppAsset.share) { [weak self] action in self?.shareDialogForTableCell(indexPath: indexPath, url: url, title: article.title) } return action