mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Convert AppAssets to shared Assets.
This commit is contained in:
1 parent
33cf97a59b
commit
beeeabba24
42 files changed
+288
-316
No files matched your search
@@ -1,79 +0,0 @@
|
||||
//
|
||||
// AppAssets.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 2/17/18.
|
||||
// Copyright © 2018 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
import RSCore
|
||||
import Account
|
||||
|
||||
struct AppAssets {
|
||||
static let addNewSidebarItemImage = NSImage(systemSymbolName: "plus", accessibilityDescription: nil)!
|
||||
static let articleTheme = NSImage(systemSymbolName: "doc.richtext", accessibilityDescription: nil)!
|
||||
static let cleanUpImage = NSImage(systemSymbolName: "bubbles.and.sparkles", accessibilityDescription: nil)!
|
||||
static let deleteImage = NSImage(systemSymbolName: "xmark.bin", accessibilityDescription: nil)!
|
||||
static let marsEditIcon = RSImage(named: "MarsEditIcon")!
|
||||
static let microblogIcon = RSImage(named: "MicroblogIcon")!
|
||||
static let faviconTemplateImage = RSImage(named: "faviconTemplateImage")!
|
||||
static let filterActive = NSImage(systemSymbolName: "line.horizontal.3.decrease.circle.fill", accessibilityDescription: nil)!
|
||||
static let filterInactive = NSImage(systemSymbolName: "line.horizontal.3.decrease.circle", accessibilityDescription: nil)!
|
||||
static let iconLightBackgroundColor = NSColor(named: NSColor.Name("iconLightBackgroundColor"))!
|
||||
static let iconDarkBackgroundColor = NSColor(named: NSColor.Name("iconDarkBackgroundColor"))!
|
||||
|
||||
static let mainFolderImage: IconImage = {
|
||||
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
|
||||
static let markAllAsReadMenuImage = RSImage(named: "markAllAsRead")!
|
||||
static let markAllAsReadImage = RSImage(named: "markAllAsRead")!
|
||||
static let markBelowAsReadImage = RSImage(named: "markBelowAsRead")!
|
||||
static let markAboveAsReadImage = RSImage(named: "markAboveAsRead")!
|
||||
|
||||
static let nextUnreadImage = NSImage(systemSymbolName: "chevron.down.circle", accessibilityDescription: nil)!
|
||||
static let notificationImage = NSImage(systemSymbolName: "bell.badge", 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)!
|
||||
static let refreshImage = NSImage(systemSymbolName: "arrow.clockwise", accessibilityDescription: nil)!
|
||||
static let renameImage = NSImage(systemSymbolName: "pencil", accessibilityDescription: nil)!
|
||||
static let searchFeedImage = IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSuppressed: true)
|
||||
static let shareImage = NSImage(systemSymbolName: "square.and.arrow.up", accessibilityDescription: nil)!
|
||||
static let sidebarToggleImage = NSImage(systemSymbolName: "sidebar.left", accessibilityDescription: nil)!
|
||||
|
||||
static let starredFeedImage: IconImage = {
|
||||
let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "StarColor")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static let timelineStarSelected = RSImage(named: "timelineStar")?.tinted(with: .white)
|
||||
static let timelineStarUnselected = RSImage(named: "timelineStar")?.tinted(with: starColor)
|
||||
|
||||
static let todayFeedImage: IconImage = {
|
||||
let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor.orange
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static let unreadFeedImage: IconImage = {
|
||||
let image = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static let swipeMarkReadImage = RSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")!
|
||||
static let swipeMarkUnreadImage = RSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")!
|
||||
static let swipeMarkStarredImage = RSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")!
|
||||
static let swipeMarkUnstarredImage = RSImage(systemSymbolName: "star", accessibilityDescription: "Unstar")!
|
||||
static let starColor = NSColor(named: NSColor.Name("StarColor"))!
|
||||
}
|
||||
@@ -56,8 +56,8 @@ final class IconView: NSView {
|
||||
return imageView.frame.size.height < bounds.size.height
|
||||
}
|
||||
|
||||
private static var lightBackgroundColor = AppAssets.iconLightBackgroundColor
|
||||
private static var darkBackgroundColor = AppAssets.iconDarkBackgroundColor
|
||||
private static var lightBackgroundColor = Assets.Colors.iconLightBackground
|
||||
private static var darkBackgroundColor = Assets.Colors.iconDarkBackground
|
||||
|
||||
override init(frame frameRect: NSRect) {
|
||||
super.init(frame: frameRect)
|
||||
|
||||
@@ -781,11 +781,11 @@ extension MainWindowController: NSToolbarDelegate {
|
||||
|
||||
case .refresh:
|
||||
let title = NSLocalizedString("Refresh", comment: "Refresh")
|
||||
return buildToolbarButton(.refresh, title, AppAssets.refreshImage, "refreshAll:")
|
||||
return buildToolbarButton(.refresh, title, Assets.Images.refresh, "refreshAll:")
|
||||
|
||||
case .newSidebarItemMenu:
|
||||
let toolbarItem = NSMenuToolbarItem(itemIdentifier: .newSidebarItemMenu)
|
||||
toolbarItem.image = AppAssets.addNewSidebarItemImage
|
||||
toolbarItem.image = Assets.Images.addNewSidebarItem
|
||||
let description = NSLocalizedString("Add Item", comment: "Add Item")
|
||||
toolbarItem.toolTip = description
|
||||
toolbarItem.label = description
|
||||
@@ -794,18 +794,18 @@ 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, Assets.Images.markAllAsRead, "markAllAsRead:")
|
||||
|
||||
case .toggleReadArticlesFilter:
|
||||
let title = NSLocalizedString("Read Articles Filter", comment: "Read Articles Filter")
|
||||
return buildToolbarButton(.toggleReadArticlesFilter, title, AppAssets.filterInactive, "toggleReadArticlesFilter:")
|
||||
return buildToolbarButton(.toggleReadArticlesFilter, title, Assets.Images.filterInactive, "toggleReadArticlesFilter:")
|
||||
|
||||
case .timelineTrackingSeparator:
|
||||
return NSTrackingSeparatorToolbarItem(identifier: .timelineTrackingSeparator, splitView: splitViewController!.splitView, dividerIndex: 1)
|
||||
|
||||
case .markRead:
|
||||
let title = NSLocalizedString("Mark Read", comment: "Mark Read")
|
||||
return buildToolbarButton(.markRead, title, AppAssets.readClosedImage, "toggleRead:")
|
||||
return buildToolbarButton(.markRead, title, Assets.Images.readClosed, "toggleRead:")
|
||||
|
||||
case .markStar:
|
||||
let title = NSLocalizedString("Star", comment: "Star")
|
||||
@@ -813,7 +813,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, Assets.Images.nextUnread, "nextUnread:")
|
||||
|
||||
case .readerView:
|
||||
let toolbarItem = RSToolbarItem(itemIdentifier: .readerView)
|
||||
@@ -828,14 +828,14 @@ extension MainWindowController: NSToolbarDelegate {
|
||||
|
||||
case .share:
|
||||
let title = NSLocalizedString("Share", comment: "Share")
|
||||
return buildToolbarButton(.share, title, AppAssets.shareImage, "toolbarShowShareMenu:")
|
||||
return buildToolbarButton(.share, title, Assets.Images.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, Assets.Images.openInBrowser, "openArticleInBrowser:")
|
||||
|
||||
case .articleThemeMenu:
|
||||
articleThemeMenuToolbarItem.image = AppAssets.articleTheme
|
||||
articleThemeMenuToolbarItem.image = Assets.Images.articleTheme
|
||||
let description = NSLocalizedString("Article Theme", comment: "Article Theme")
|
||||
articleThemeMenuToolbarItem.toolTip = description
|
||||
articleThemeMenuToolbarItem.label = description
|
||||
@@ -850,7 +850,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, Assets.Images.cleanUp, "cleanUp:")
|
||||
|
||||
default:
|
||||
break
|
||||
@@ -1112,7 +1112,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 ? Assets.Images.readClosed : Assets.Images.readOpen
|
||||
}
|
||||
|
||||
return result
|
||||
@@ -1223,7 +1223,7 @@ private extension MainWindowController {
|
||||
(item as? NSMenuItem)?.title = hideCommand
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
toolbarItem.toolTip = hideCommand
|
||||
button.image = AppAssets.filterInactive
|
||||
button.image = Assets.Images.filterInactive
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1232,13 +1232,13 @@ private extension MainWindowController {
|
||||
(item as? NSMenuItem)?.title = showCommand
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
toolbarItem.toolTip = showCommand
|
||||
button.image = AppAssets.filterActive
|
||||
button.image = Assets.Images.filterActive
|
||||
}
|
||||
} else {
|
||||
(item as? NSMenuItem)?.title = hideCommand
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
toolbarItem.toolTip = hideCommand
|
||||
button.image = AppAssets.filterInactive
|
||||
button.image = Assets.Images.filterInactive
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ private extension SidebarViewController {
|
||||
}
|
||||
|
||||
if let homePageURL = feed.homePageURL, let _ = URL(string: homePageURL) {
|
||||
let item = menuItem(NSLocalizedString("Open Home Page", comment: "Command"), #selector(openHomePageFromContextualMenu(_:)), homePageURL, image: AppAssets.openInBrowserImage)
|
||||
let item = menuItem(NSLocalizedString("Open Home Page", comment: "Command"), #selector(openHomePageFromContextualMenu(_:)), homePageURL, image: Assets.Images.openInBrowser)
|
||||
menu.addItem(item)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
}
|
||||
@@ -232,7 +232,7 @@ private extension SidebarViewController {
|
||||
|
||||
let notificationText = feed.notificationDisplayName.capitalized
|
||||
|
||||
let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), feed, image: AppAssets.notificationImage)
|
||||
let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), feed, image: Assets.Images.notification)
|
||||
if feed.isNotifyAboutNewArticles == nil || feed.isNotifyAboutNewArticles! == false {
|
||||
notificationMenuItem.state = .off
|
||||
} else {
|
||||
@@ -301,17 +301,17 @@ private extension SidebarViewController {
|
||||
|
||||
func markAllReadMenuItem(_ objects: [Any]) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Mark All as Read", comment: "Command"), #selector(markObjectsReadFromContextualMenu(_:)), objects, image: AppAssets.markAllAsReadMenuImage)
|
||||
return menuItem(NSLocalizedString("Mark All as Read", comment: "Command"), #selector(markObjectsReadFromContextualMenu(_:)), objects, image: Assets.Images.markAllAsReadMenu)
|
||||
}
|
||||
|
||||
func deleteMenuItem(_ objects: [Any]) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Delete", comment: "Command"), #selector(deleteFromContextualMenu(_:)), objects, image: AppAssets.deleteImage)
|
||||
return menuItem(NSLocalizedString("Delete", comment: "Command"), #selector(deleteFromContextualMenu(_:)), objects, image: Assets.Images.delete)
|
||||
}
|
||||
|
||||
func renameMenuItem(_ object: Any) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Rename", comment: "Command"), #selector(renameFromContextualMenu(_:)), object, image: AppAssets.renameImage)
|
||||
return menuItem(NSLocalizedString("Rename", comment: "Command"), #selector(renameFromContextualMenu(_:)), object, image: Assets.Images.rename)
|
||||
}
|
||||
|
||||
func anyObjectInArrayHasNonZeroUnreadCount(_ objects: [Any]) -> Bool {
|
||||
|
||||
@@ -20,7 +20,7 @@ final class TimelineTableCellView: NSTableCellView {
|
||||
|
||||
private lazy var iconView = IconView()
|
||||
|
||||
private var starView = TimelineTableCellView.imageView(with: AppAssets.timelineStarUnselected, scaling: .scaleNone)
|
||||
private var starView = TimelineTableCellView.imageView(with: Assets.Images.timelineStarUnselected, scaling: .scaleNone)
|
||||
|
||||
private lazy var textFields = {
|
||||
return [self.dateView, self.feedNameView, self.titleView, self.summaryView, self.textView]
|
||||
@@ -259,9 +259,9 @@ private extension TimelineTableCellView {
|
||||
|
||||
func updateStarView() {
|
||||
if isSelected && isEmphasized {
|
||||
starView.image = AppAssets.timelineStarSelected
|
||||
starView.image = Assets.Images.timelineStarSelected
|
||||
} else {
|
||||
starView.image = AppAssets.timelineStarUnselected
|
||||
starView.image = Assets.Images.timelineStarUnselected
|
||||
}
|
||||
showOrHideView(starView, !cellData.starred)
|
||||
}
|
||||
|
||||
@@ -223,9 +223,9 @@ private extension TimelineContainerViewController {
|
||||
readFilteredButton.isHidden = false
|
||||
|
||||
if isReadFiltered {
|
||||
readFilteredButton.image = AppAssets.filterActive
|
||||
readFilteredButton.image = Assets.Images.filterActive
|
||||
} else {
|
||||
readFilteredButton.image = AppAssets.filterInactive
|
||||
readFilteredButton.image = Assets.Images.filterInactive
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,30 +230,30 @@ private extension TimelineViewController {
|
||||
|
||||
func markReadMenuItem(_ articles: [Article]) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Mark as Read", comment: "Command"), #selector(markArticlesReadFromContextualMenu(_:)), articles, image: AppAssets.swipeMarkReadImage)
|
||||
return menuItem(NSLocalizedString("Mark as Read", comment: "Command"), #selector(markArticlesReadFromContextualMenu(_:)), articles, image: Assets.Images.swipeMarkRead)
|
||||
}
|
||||
|
||||
func markUnreadMenuItem(_ articles: [Article]) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Mark as Unread", comment: "Command"), #selector(markArticlesUnreadFromContextualMenu(_:)), articles, image: AppAssets.swipeMarkUnreadImage)
|
||||
return menuItem(NSLocalizedString("Mark as Unread", comment: "Command"), #selector(markArticlesUnreadFromContextualMenu(_:)), articles, image: Assets.Images.swipeMarkUnread)
|
||||
}
|
||||
|
||||
func markStarredMenuItem(_ articles: [Article]) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Mark as Starred", comment: "Command"), #selector(markArticlesStarredFromContextualMenu(_:)), articles, image: AppAssets.swipeMarkStarredImage)
|
||||
return menuItem(NSLocalizedString("Mark as Starred", comment: "Command"), #selector(markArticlesStarredFromContextualMenu(_:)), articles, image: Assets.Images.swipeMarkStarred)
|
||||
}
|
||||
|
||||
func markUnstarredMenuItem(_ articles: [Article]) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Mark as Unstarred", comment: "Command"), #selector(markArticlesUnstarredFromContextualMenu(_:)), articles, image: AppAssets.swipeMarkUnstarredImage)
|
||||
return menuItem(NSLocalizedString("Mark as Unstarred", comment: "Command"), #selector(markArticlesUnstarredFromContextualMenu(_:)), articles, image: Assets.Images.swipeMarkUnstarred)
|
||||
}
|
||||
|
||||
func markAboveReadMenuItem(_ articles: [Article]) -> NSMenuItem {
|
||||
return menuItem(NSLocalizedString("Mark Above as Read", comment: "Command"), #selector(markAboveArticlesReadFromContextualMenu(_:)), articles, image: AppAssets.markAboveAsReadImage)
|
||||
return menuItem(NSLocalizedString("Mark Above as Read", comment: "Command"), #selector(markAboveArticlesReadFromContextualMenu(_:)), articles, image: Assets.Images.markAboveAsRead)
|
||||
}
|
||||
|
||||
func markBelowReadMenuItem(_ articles: [Article]) -> NSMenuItem {
|
||||
return menuItem(NSLocalizedString("Mark Below as Read", comment: "Command"), #selector(markBelowArticlesReadFromContextualMenu(_:)), articles, image: AppAssets.markBelowAsReadImage)
|
||||
return menuItem(NSLocalizedString("Mark Below as Read", comment: "Command"), #selector(markBelowArticlesReadFromContextualMenu(_:)), articles, image: Assets.Images.markBelowAsRead)
|
||||
}
|
||||
|
||||
func selectFeedInSidebarMenuItem(_ feed: Feed) -> NSMenuItem {
|
||||
@@ -270,12 +270,12 @@ private extension TimelineViewController {
|
||||
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
|
||||
let menuText = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String
|
||||
|
||||
return menuItem(menuText, #selector(markAllInFeedAsRead(_:)), feed, image: AppAssets.markAllAsReadImage)
|
||||
return menuItem(menuText, #selector(markAllInFeedAsRead(_:)), feed, image: Assets.Images.markAllAsRead)
|
||||
}
|
||||
|
||||
func openInBrowserMenuItem(_ urlString: String) -> NSMenuItem {
|
||||
|
||||
return menuItem(NSLocalizedString("Open in Browser", comment: "Command"), #selector(openInBrowserFromContextualMenu(_:)), urlString, image: AppAssets.openInBrowserImage)
|
||||
return menuItem(NSLocalizedString("Open in Browser", comment: "Command"), #selector(openInBrowserFromContextualMenu(_:)), urlString, image: Assets.Images.openInBrowser)
|
||||
}
|
||||
|
||||
func copyArticleURLMenuItem(_ urlString: String) -> NSMenuItem {
|
||||
|
||||
@@ -969,7 +969,7 @@ extension TimelineViewController: NSTableViewDelegate {
|
||||
self.toggleArticleRead(article);
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
action.image = article.status.read ? AppAssets.swipeMarkUnreadImage : AppAssets.swipeMarkReadImage
|
||||
action.image = article.status.read ? Assets.Images.swipeMarkUnread : Assets.Images.swipeMarkRead
|
||||
return [action]
|
||||
|
||||
case .trailing:
|
||||
@@ -977,8 +977,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 = Assets.Colors.star
|
||||
action.image = article.status.starred ? Assets.Images.swipeMarkUnstarred : Assets.Images.swipeMarkStarred
|
||||
return [action]
|
||||
|
||||
@unknown default:
|
||||
|
||||
@@ -35,13 +35,13 @@ final class PreferencesWindowController : NSWindowController, NSToolbarDelegate
|
||||
var specs = [PreferencesToolbarItemSpec]()
|
||||
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.General,
|
||||
name: NSLocalizedString("General", comment: "Preferences"),
|
||||
image: AppAssets.preferencesToolbarGeneralImage)]
|
||||
image: Assets.Images.preferencesToolbarGeneral)]
|
||||
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Accounts,
|
||||
name: NSLocalizedString("Accounts", comment: "Preferences"),
|
||||
image: AppAssets.preferencesToolbarAccountsImage)]
|
||||
image: Assets.Images.preferencesToolbarAccounts)]
|
||||
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Advanced,
|
||||
name: NSLocalizedString("Advanced", comment: "Preferences"),
|
||||
image: AppAssets.preferencesToolbarAdvancedImage)]
|
||||
image: Assets.Images.preferencesToolbarAdvanced)]
|
||||
return specs
|
||||
}()
|
||||
|
||||
|
||||
@@ -380,7 +380,6 @@
|
||||
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||
membershipExceptions = (
|
||||
/Localized/ShareExtension/MainInterface.storyboard,
|
||||
AppAssets.swift,
|
||||
AppDefaults.swift,
|
||||
Resources/Assets.xcassets,
|
||||
ShareExtension/ShareFolderPickerAccountCell.xib,
|
||||
|
||||
+160
-12
@@ -15,6 +15,11 @@ import UIKit
|
||||
import RSCore
|
||||
import Account
|
||||
|
||||
#if os(macOS)
|
||||
typealias RSColor = NSColor
|
||||
#else
|
||||
typealias RSColor = UIColor
|
||||
#endif
|
||||
|
||||
struct Assets {
|
||||
struct Images {
|
||||
@@ -30,35 +35,165 @@ struct Assets {
|
||||
static var starOpen: RSImage { RSImage(symbol: "star")! }
|
||||
static var starClosed: RSImage { RSImage(symbol: "star.fill")! }
|
||||
static var copy: RSImage { RSImage(symbol: "document.on.document")! }
|
||||
static var markAllAsRead: RSImage { RSImage(named: "markAllAsRead")! }
|
||||
static var nextUnread: RSImage { RSImage(symbol: "chevron.down.circle")! }
|
||||
|
||||
static var nnwFeedIcon: RSImage { RSImage(named: "nnwFeedIcon")! }
|
||||
static var faviconTemplate: RSImage { RSImage(named: "faviconTemplateImage")! }
|
||||
|
||||
static var articleExtractorError: RSImage { RSImage(named: "articleExtractorError")! }
|
||||
static var articleExtractorOn: RSImage { RSImage(named: "articleExtractorOn")! }
|
||||
static var articleExtractorOff: RSImage { RSImage(named: "articleExtractorOff")! }
|
||||
static var share: RSImage { RSImage(symbol: "square.and.arrow.up")! }
|
||||
static var folder: RSImage { RSImage(symbol: "folder")! }
|
||||
static var starredFeed: IconImage {
|
||||
IconImage(starClosed,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: Assets.Colors.star.cgColor)
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
#if os(macOS)
|
||||
static var accountLocal: RSImage { RSImage(named: "accountLocal")! }
|
||||
#else // iOS
|
||||
static var addNewSidebarItem: RSImage { RSImage(symbol: "plus")! }
|
||||
static var articleTheme: RSImage { RSImage(symbol: "doc.richtext")! }
|
||||
static var cleanUp: RSImage { RSImage(symbol: "bubbles.and.sparkles")! }
|
||||
static var delete: RSImage { RSImage(symbol: "xmark.bin")! }
|
||||
static var marsEdit: RSImage { RSImage(named: "MarsEditIcon")! }
|
||||
static var microblog: RSImage { RSImage(named: "MicroblogIcon")! }
|
||||
static var filterActive: RSImage { RSImage(symbol: "line.horizontal.3.decrease.circle.fill")! }
|
||||
static var filterInactive: RSImage { RSImage(symbol: "line.horizontal.3.decrease.circle")! }
|
||||
static var markAllAsReadMenu: RSImage { RSImage(named: "markAllAsRead")! }
|
||||
static var notification: RSImage { RSImage(symbol: "bell.badge")! }
|
||||
static var openInBrowser: RSImage { RSImage(symbol: "safari")! }
|
||||
static var preferencesToolbarAccounts: RSImage { RSImage(symbol: "at")! }
|
||||
static var preferencesToolbarGeneral: RSImage { RSImage(symbol: "gearshape")! }
|
||||
static var preferencesToolbarAdvanced: RSImage { RSImage(symbol: "gearshape.2")! }
|
||||
static var readClosed: RSImage { RSImage(symbol: "largecircle.fill.circle")! }
|
||||
static var readOpen: RSImage { RSImage(symbol: "circle")! }
|
||||
static var refresh: RSImage { RSImage(symbol: "arrow.clockwise")! }
|
||||
static var rename: RSImage { RSImage(symbol: "pencil")! }
|
||||
static var swipeMarkUnstarred: RSImage { RSImage(symbol: "star")! }
|
||||
static var timelineStarSelected: RSImage { RSImage(named: "timelineStar")!.tinted(with: .white) }
|
||||
static var timelineStarUnselected: RSImage { RSImage(named: "timelineStar")!.tinted(with: Assets.Colors.star) }
|
||||
static var markBelowAsRead: RSImage { RSImage(named: "markBelowAsRead")! }
|
||||
static var markAboveAsRead: RSImage { RSImage(named: "markAboveAsRead")! }
|
||||
static var searchFeed: IconImage {
|
||||
IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSuppressed: true)
|
||||
}
|
||||
static var swipeMarkStarred: RSImage {
|
||||
RSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")!
|
||||
}
|
||||
static var swipeMarkRead: RSImage {
|
||||
RSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")!
|
||||
}
|
||||
static var swipeMarkUnread: RSImage {
|
||||
RSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")!
|
||||
}
|
||||
static var mainFolder: IconImage {
|
||||
IconImage(folder,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: Assets.Colors.primaryAccent.cgColor)
|
||||
}
|
||||
static var todayFeed: IconImage {
|
||||
let image = RSImage(symbol: "sun.max.fill")!
|
||||
return IconImage(image,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: NSColor.orange.cgColor)
|
||||
}
|
||||
static var unreadFeed: IconImage {
|
||||
let image = RSImage(symbol: "largecircle.fill.circle")!
|
||||
return IconImage(image,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: Assets.Colors.primaryAccent.cgColor)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else // iOS
|
||||
static var accountLocalPadImage: RSImage { RSImage(named: "accountLocalPad")! }
|
||||
static var accountLocalPhoneImage: RSImage { RSImage(named: "accountLocalPhone")! }
|
||||
|
||||
static var articleExtractorOnSF: RSImage { RSImage(named: "articleExtractorOnSF")! }
|
||||
static var articleExtractorOffSF: RSImage { RSImage(symbol: "doc.plaintext")! }
|
||||
@MainActor static var articleExtractorOnTinted: RSImage {
|
||||
articleExtractorOn.tinted(color: Assets.Colors.primaryAccent)!
|
||||
}
|
||||
@MainActor static var articleExtractorOffTinted: RSImage {
|
||||
articleExtractorOff.tinted(color: Assets.Colors.primaryAccent)!
|
||||
}
|
||||
|
||||
static var circleClosed: RSImage { RSImage(symbol: "largecircle.fill.circle")! }
|
||||
#endif
|
||||
static var markBelowAsRead: RSImage { RSImage(symbol: "arrowtriangle.down.circle")! }
|
||||
static var markAboveAsRead: RSImage { RSImage(named: "arrowtriangle.up.circle")! }
|
||||
static var more: RSImage { RSImage(symbol: "ellipsis.circle")! }
|
||||
static var nextArticle: RSImage { RSImage(symbol: "chevron.down")! }
|
||||
static var circleOpen: RSImage { RSImage(symbol: "circle")! }
|
||||
static var disclosure: RSImage { RSImage(named: "disclosure")! }
|
||||
static var deactivate: RSImage { RSImage(symbol: "minus.circle")! }
|
||||
static var edit: RSImage { RSImage(symbol: "square.and.pencil")! }
|
||||
static var filter: RSImage { RSImage(symbol: "line.3.horizontal.decrease")! }
|
||||
static var folderOutlinePlus: RSImage { RSImage(symbol: "folder.badge.plus")! }
|
||||
static var info: RSImage { RSImage(symbol: "info.circle")! }
|
||||
static var plus: RSImage { RSImage(symbol: "plus")! }
|
||||
static var prevArticle: RSImage { RSImage(symbol: "chevron.up")! }
|
||||
static var openInSidebar: RSImage { RSImage(symbol: "arrow.turn.down.left")! }
|
||||
static var safari: RSImage { RSImage(symbol: "safari")! }
|
||||
static var smartFeed: RSImage { RSImage(symbol: "gear")! }
|
||||
static var trash: RSImage { RSImage(symbol: "trash")! }
|
||||
|
||||
static var searchFeed: IconImage {
|
||||
IconImage(RSImage(symbol: "magnifyingglass")!, isSymbol: true)
|
||||
}
|
||||
static var mainFolder: IconImage {
|
||||
IconImage(folder,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: Assets.Colors.secondaryAccent.cgColor)
|
||||
}
|
||||
static var todayFeed: IconImage {
|
||||
let image = RSImage(symbol: "sun.max.fill")!
|
||||
return IconImage(image,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: UIColor.systemOrange.cgColor)
|
||||
}
|
||||
static var unreadFeed: IconImage {
|
||||
let image = RSImage(symbol: "largecircle.fill.circle")!
|
||||
return IconImage(image,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: Assets.Colors.secondaryAccent.cgColor)
|
||||
}
|
||||
static var timelineStar: RSImage {
|
||||
let image = RSImage(symbol: "star.fill")!
|
||||
return image.withTintColor(Assets.Colors.star, renderingMode: .alwaysOriginal)
|
||||
}
|
||||
static var unreadCellIndicator: IconImage {
|
||||
let image = RSImage(symbol: "circle.fill")!
|
||||
return IconImage(image,
|
||||
isSymbol: true,
|
||||
isBackgroundSuppressed: true,
|
||||
preferredColor: Assets.Colors.secondaryAccent.cgColor)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@MainActor static func accountImage(_ accountType: AccountType) -> RSImage {
|
||||
switch accountType {
|
||||
case .onMyMac:
|
||||
#if os(macOS)
|
||||
#if os(macOS)
|
||||
return Assets.Images.accountLocal
|
||||
#else // iOS
|
||||
#else // iOS
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
return Assets.Images.accountLocalPadImage
|
||||
} else {
|
||||
return Assets.Images.accountLocalPhoneImage
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
case .cloudKit:
|
||||
return Assets.Images.accountCloudKit
|
||||
case .bazQux:
|
||||
@@ -79,19 +214,32 @@ struct Assets {
|
||||
}
|
||||
|
||||
struct Colors {
|
||||
#if os(macOS)
|
||||
static var timelineSeparator: NSColor { NSColor(named: "timelineSeparatorColor")! }
|
||||
#endif
|
||||
#if os(macOS)
|
||||
static var primaryAccent: RSColor { RSColor(named: "AccentColor")! }
|
||||
static var timelineSeparator: RSColor { NSColor(named: "timelineSeparatorColor")! }
|
||||
static var iconLightBackground: RSColor { NSColor(named: "iconLightBackgroundColor")! }
|
||||
static var iconDarkBackground: RSColor { NSColor(named: "iconDarkBackgroundColor")! }
|
||||
static var star: RSColor { RSColor(named: "StarColor")! }
|
||||
#else // iOS
|
||||
static var primaryAccent: RSColor { RSColor(named: "primaryAccentColor")! }
|
||||
static var secondaryAccent: RSColor { RSColor(named: "secondaryAccentColor")! }
|
||||
static var star: RSColor { RSColor(named: "starColor")! }
|
||||
static var vibrantText: RSColor { RSColor(named: "vibrantTextColor")! }
|
||||
static var controlBackground: RSColor { RSColor(named: "controlBackgroundColor")! }
|
||||
static var iconBackground: RSColor { RSColor(named: "iconBackgroundColor")! }
|
||||
static var fullScreenBackground: RSColor { RSColor(named: "fullScreenBackgroundColor")! }
|
||||
static var sectionHeader: RSColor { RSColor(named: "sectionHeaderColor")! }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
extension RSImage {
|
||||
|
||||
convenience init?(symbol: String) {
|
||||
#if os(macOS)
|
||||
#if os(macOS)
|
||||
self.init(systemSymbolName: symbol, accessibilityDescription: nil)
|
||||
#else // iOS
|
||||
#else // iOS
|
||||
self.init(systemName: symbol)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import Articles
|
||||
@MainActor final class SendToMarsEditCommand: SendToCommand {
|
||||
|
||||
let title = "MarsEdit"
|
||||
let image: RSImage? = AppAssets.marsEditIcon
|
||||
let image: RSImage? = Assets.Images.marsEdit
|
||||
|
||||
private let marsEditApps = [UserApp(bundleID: "com.red-sweater.marsedit5"), UserApp(bundleID: "com.red-sweater.marsedit4"), UserApp(bundleID: "com.red-sweater.marsedit")]
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import RSCore
|
||||
@MainActor final class SendToMicroBlogCommand: SendToCommand {
|
||||
|
||||
let title = "Micro.blog"
|
||||
let image: RSImage? = AppAssets.microblogIcon
|
||||
let image: RSImage? = Assets.Images.microblog
|
||||
|
||||
private let microBlogApp = UserApp(bundleID: "blog.micro.mac")
|
||||
|
||||
|
||||
@@ -15,27 +15,20 @@ import UIKit
|
||||
import RSCore
|
||||
|
||||
final class IconImage: @unchecked Sendable {
|
||||
|
||||
lazy var isDark: Bool = {
|
||||
return image.isDark()
|
||||
}()
|
||||
|
||||
lazy var isBright: Bool = {
|
||||
return image.isBright()
|
||||
}()
|
||||
|
||||
let image: RSImage
|
||||
let isSymbol: Bool
|
||||
let isBackgroundSuppressed: Bool
|
||||
let preferredColor: CGColor?
|
||||
|
||||
lazy var isDark = image.isDark()
|
||||
lazy var isBright = image.isBright()
|
||||
|
||||
init(_ image: RSImage, isSymbol: Bool = false, isBackgroundSuppressed: Bool = false, preferredColor: CGColor? = nil) {
|
||||
self.image = image
|
||||
self.isSymbol = isSymbol
|
||||
self.preferredColor = preferredColor
|
||||
self.isBackgroundSuppressed = isBackgroundSuppressed
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
@@ -64,7 +57,7 @@ fileprivate enum ImageLuminanceType {
|
||||
case regular, bright, dark
|
||||
}
|
||||
|
||||
extension CGImage {
|
||||
private extension CGImage {
|
||||
|
||||
func isBright() -> Bool {
|
||||
guard let luminanceType = getLuminanceType() else {
|
||||
@@ -80,8 +73,7 @@ extension CGImage {
|
||||
return luminanceType == .dark
|
||||
}
|
||||
|
||||
fileprivate func getLuminanceType() -> ImageLuminanceType? {
|
||||
|
||||
func getLuminanceType() -> ImageLuminanceType? {
|
||||
// This has been rewritten with information from https://christianselig.com/2021/04/efficient-average-color/
|
||||
|
||||
// First, resize the image. We do this for two reasons, 1) less pixels to deal with means faster
|
||||
@@ -147,22 +139,21 @@ extension CGImage {
|
||||
}
|
||||
}
|
||||
|
||||
private func red(for pixelData: UInt32) -> UInt8 {
|
||||
func red(for pixelData: UInt32) -> UInt8 {
|
||||
return UInt8((pixelData >> 16) & 255)
|
||||
}
|
||||
|
||||
private func green(for pixelData: UInt32) -> UInt8 {
|
||||
func green(for pixelData: UInt32) -> UInt8 {
|
||||
return UInt8((pixelData >> 8) & 255)
|
||||
}
|
||||
|
||||
private func blue(for pixelData: UInt32) -> UInt8 {
|
||||
func blue(for pixelData: UInt32) -> UInt8 {
|
||||
return UInt8((pixelData >> 0) & 255)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
enum IconSize: Int, CaseIterable {
|
||||
enum IconSize: Int, CaseIterable, Sendable {
|
||||
case small = 1
|
||||
case medium = 2
|
||||
case large = 3
|
||||
@@ -181,5 +172,4 @@ enum IconSize: Int, CaseIterable {
|
||||
return CGSize(width: IconSize.largeDimension, height: IconSize.largeDimension)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,6 @@ protocol SmallIconProvider {
|
||||
|
||||
@MainActor extension Folder: SmallIconProvider {
|
||||
var smallIcon: IconImage? {
|
||||
AppAssets.mainFolderImage
|
||||
Assets.Images.mainFolder
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,12 @@ import Account
|
||||
}
|
||||
|
||||
let colorHash = ColorHash(feed.url)
|
||||
if let favicon = AppAssets.faviconTemplateImage.maskWithColor(color: colorHash.color.cgColor) {
|
||||
if let favicon = Assets.Images.faviconTemplate.maskWithColor(color: colorHash.color.cgColor) {
|
||||
let iconImage = IconImage(favicon, isBackgroundSuppressed: true)
|
||||
FaviconGenerator.faviconGeneratorCache[feed.url] = iconImage
|
||||
return iconImage
|
||||
} else {
|
||||
return IconImage(AppAssets.faviconTemplateImage, isBackgroundSuppressed: true)
|
||||
return IconImage(Assets.Images.faviconTemplate, isBackgroundSuppressed: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ struct SearchFeedDelegate: SmartFeedDelegate {
|
||||
let nameForDisplayPrefix = NSLocalizedString("Search: ", comment: "Search smart feed title prefix")
|
||||
let searchString: String
|
||||
let fetchType: FetchType
|
||||
var smallIcon: IconImage? = AppAssets.searchFeedImage
|
||||
var smallIcon: IconImage? = Assets.Images.searchFeed
|
||||
|
||||
init(searchString: String) {
|
||||
self.searchString = searchString
|
||||
|
||||
@@ -25,7 +25,7 @@ struct SearchTimelineFeedDelegate: SmartFeedDelegate {
|
||||
let nameForDisplayPrefix = NSLocalizedString("Search: ", comment: "Search smart feed title prefix")
|
||||
let searchString: String
|
||||
let fetchType: FetchType
|
||||
var smallIcon: IconImage? = AppAssets.searchFeedImage
|
||||
var smallIcon: IconImage? = Assets.Images.searchFeed
|
||||
|
||||
init(searchString: String, articleIDs: Set<String>) {
|
||||
self.searchString = searchString
|
||||
|
||||
@@ -21,7 +21,7 @@ import Account
|
||||
let nameForDisplay = NSLocalizedString("Starred", comment: "Starred pseudo-feed title")
|
||||
let fetchType: FetchType = .starred(nil)
|
||||
var smallIcon: IconImage? {
|
||||
return AppAssets.starredFeedImage
|
||||
Assets.Images.starredFeed
|
||||
}
|
||||
func fetchUnreadCount(account: Account) async throws -> Int? {
|
||||
try await account.fetchUnreadCountForStarredArticlesAsync()
|
||||
|
||||
@@ -20,7 +20,7 @@ struct TodayFeedDelegate: SmartFeedDelegate {
|
||||
let nameForDisplay = NSLocalizedString("Today", comment: "Today pseudo-feed title")
|
||||
let fetchType = FetchType.today(nil)
|
||||
var smallIcon: IconImage? {
|
||||
return AppAssets.todayFeedImage
|
||||
Assets.Images.todayFeed
|
||||
}
|
||||
|
||||
func fetchUnreadCount(account: Account) async throws -> Int? {
|
||||
|
||||
@@ -42,7 +42,7 @@ import ArticlesDatabase
|
||||
}
|
||||
|
||||
var smallIcon: IconImage? {
|
||||
return AppAssets.unreadFeedImage
|
||||
Assets.Images.unreadFeed
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
@@ -16,7 +16,7 @@ final class AddComboTableViewCell: VibrantTableViewCell {
|
||||
override func updateVibrancy(animated: Bool) {
|
||||
super.updateVibrancy(animated: animated)
|
||||
|
||||
let iconTintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : AppAssets.secondaryAccentColor
|
||||
let iconTintColor = isHighlighted || isSelected ? Assets.Colors.vibrantText : Assets.Colors.secondaryAccent
|
||||
if animated {
|
||||
UIView.animate(withDuration: Self.duration) {
|
||||
self.icon.tintColor = iconTintColor
|
||||
|
||||
@@ -16,7 +16,7 @@ final class SelectComboTableViewCell: VibrantTableViewCell {
|
||||
override func updateVibrancy(animated: Bool) {
|
||||
super.updateVibrancy(animated: animated)
|
||||
|
||||
let iconTintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
|
||||
let iconTintColor = isHighlighted || isSelected ? Assets.Colors.vibrantText : UIColor.label
|
||||
if animated {
|
||||
UIView.animate(withDuration: Self.duration) {
|
||||
self.icon.tintColor = iconTintColor
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
//
|
||||
// AppAssets.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Maurice Parker on 4/8/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
import UIKit
|
||||
import RSCore
|
||||
import Account
|
||||
|
||||
struct AppAssets {
|
||||
@MainActor static let articleExtractorOffTinted: UIImage = {
|
||||
let image = UIImage(named: "articleExtractorOff")!
|
||||
return image.tinted(color: AppAssets.primaryAccentColor)!
|
||||
}()
|
||||
|
||||
static let articleExtractorOnSF = RSImage(named: "articleExtractorOnSF")!
|
||||
|
||||
@MainActor static let articleExtractorOnTinted: UIImage = {
|
||||
let image = UIImage(named: "articleExtractorOn")!
|
||||
return image.tinted(color: AppAssets.primaryAccentColor)!
|
||||
}()
|
||||
|
||||
static let iconBackgroundColor = UIColor(named: "iconBackgroundColor")!
|
||||
|
||||
static let circleOpenImage = RSImage(systemName: "circle")!
|
||||
static let disclosureImage = RSImage(named: "disclosure")!
|
||||
static let deactivateImage = RSImage(systemName: "minus.circle")!
|
||||
static let editImage = RSImage(systemName: "square.and.pencil")!
|
||||
static let faviconTemplateImage = RSImage(named: "faviconTemplateImage")!
|
||||
static let filterImage = RSImage(systemName: "line.3.horizontal.decrease")!
|
||||
static let folderOutlinePlus = RSImage(systemName: "folder.badge.plus")!
|
||||
static let fullScreenBackgroundColor = UIColor(named: "fullScreenBackgroundColor")!
|
||||
static let infoImage = RSImage(systemName: "info.circle")!
|
||||
static let markAllAsReadImage = RSImage(named: "markAllAsRead")!
|
||||
static let markBelowAsReadImage = RSImage(systemName: "arrowtriangle.down.circle")!
|
||||
static let markAboveAsReadImage = RSImage(systemName: "arrowtriangle.up.circle")!
|
||||
|
||||
static let mainFolderImage = IconImage(RSImage(systemName: "folder")!, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
|
||||
|
||||
static let mainFolderImageNonIcon = RSImage(systemName: "folder")!.withRenderingMode(.alwaysOriginal).withTintColor(.secondaryLabel)
|
||||
static let moreImage = RSImage(systemName: "ellipsis.circle")!
|
||||
static let nextArticleImage = RSImage(systemName: "chevron.down")!
|
||||
static let nextUnreadArticleImage = RSImage(systemName: "chevron.down.circle")!
|
||||
static let plus = RSImage(systemName: "plus")!
|
||||
static let prevArticleImage = RSImage(systemName: "chevron.up")!
|
||||
static let openInSidebarImage = RSImage(systemName: "arrow.turn.down.left")!
|
||||
static let primaryAccentColor = UIColor(named: "primaryAccentColor")!
|
||||
static let safariImage = RSImage(systemName: "safari")!
|
||||
static let searchFeedImage = IconImage(UIImage(systemName: "magnifyingglass")!, isSymbol: true)
|
||||
static let secondaryAccentColor = UIColor(named: "secondaryAccentColor")!
|
||||
static let sectionHeaderColor = UIColor(named: "sectionHeaderColor")!
|
||||
static let shareImage = RSImage(systemName: "square.and.arrow.up")!
|
||||
static let smartFeedImage = RSImage(systemName: "gear")!
|
||||
static let starColor = UIColor(named: "starColor")!
|
||||
|
||||
static let starredFeedImage: IconImage = {
|
||||
let image = UIImage(systemName: "star.fill")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.starColor.cgColor)
|
||||
}()
|
||||
|
||||
static let timelineStarImage: UIImage = {
|
||||
let image = UIImage(systemName: "star.fill")!
|
||||
return image.withTintColor(AppAssets.starColor, renderingMode: .alwaysOriginal)
|
||||
}()
|
||||
|
||||
static let todayFeedImage: IconImage = {
|
||||
let image = UIImage(systemName: "sun.max.fill")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: UIColor.systemOrange.cgColor)
|
||||
}()
|
||||
|
||||
static let trashImage = RSImage(systemName: "trash")!
|
||||
static let unreadCellIndicatorImage: IconImage = {
|
||||
let image = UIImage(systemName: "circle.fill")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
|
||||
}()
|
||||
|
||||
static let unreadFeedImage: IconImage = {
|
||||
let image = UIImage(systemName: "largecircle.fill.circle")!
|
||||
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
|
||||
}()
|
||||
|
||||
static let vibrantTextColor = UIColor(named: "vibrantTextColor")!
|
||||
static let controlBackgroundColor = UIColor(named: "controlBackgroundColor")!
|
||||
}
|
||||
@@ -72,8 +72,8 @@ final class ArticleExtractorButton: UIButton {
|
||||
}
|
||||
|
||||
private func addAnimatedSublayer(to hostedLayer: CALayer) {
|
||||
let image1 = AppAssets.articleExtractorOffTinted.cgImage!
|
||||
let image2 = AppAssets.articleExtractorOnTinted.cgImage!
|
||||
let image1 = Assets.Images.articleExtractorOffTinted.cgImage!
|
||||
let image2 = Assets.Images.articleExtractorOnTinted.cgImage!
|
||||
let images = [image1, image2, image1]
|
||||
|
||||
animatedLayer = CALayer()
|
||||
|
||||
@@ -224,7 +224,7 @@ final class ArticleViewController: UIViewController {
|
||||
actionBarButtonItem.isEnabled = permalinkPresent
|
||||
|
||||
if article.status.read {
|
||||
readBarButtonItem.image = AppAssets.circleOpenImage
|
||||
readBarButtonItem.image = Assets.Images.circleOpen
|
||||
readBarButtonItem.isEnabled = article.isAvailableToMarkUnread
|
||||
readBarButtonItem.accLabelText = NSLocalizedString("Mark Article Unread", comment: "Mark Article Unread")
|
||||
} else {
|
||||
|
||||
@@ -41,7 +41,7 @@ final class ImageTransition: NSObject, UIViewControllerAnimatedTransitioning {
|
||||
let fromView = transitionContext.view(forKey: .from)!
|
||||
fromView.removeFromSuperview()
|
||||
|
||||
transitionContext.containerView.backgroundColor = AppAssets.fullScreenBackgroundColor
|
||||
transitionContext.containerView.backgroundColor = Assets.Colors.fullScreenBackground
|
||||
transitionContext.containerView.addSubview(imageView)
|
||||
|
||||
webViewController?.hideClickedImage()
|
||||
|
||||
@@ -742,7 +742,7 @@ private extension WebViewController {
|
||||
func prevArticleAction() -> UIAction? {
|
||||
guard coordinator.isPrevArticleAvailable else { return nil }
|
||||
let title = NSLocalizedString("Previous Article", comment: "Previous Article")
|
||||
return UIAction(title: title, image: AppAssets.prevArticleImage) { [weak self] action in
|
||||
return UIAction(title: title, image: Assets.Images.prevArticle) { [weak self] action in
|
||||
self?.coordinator.selectPrevArticle()
|
||||
}
|
||||
}
|
||||
@@ -750,7 +750,7 @@ private extension WebViewController {
|
||||
func nextArticleAction() -> UIAction? {
|
||||
guard coordinator.isNextArticleAvailable else { return nil }
|
||||
let title = NSLocalizedString("Next Article", comment: "Next Article")
|
||||
return UIAction(title: title, image: AppAssets.nextArticleImage) { [weak self] action in
|
||||
return UIAction(title: title, image: Assets.Images.nextArticle) { [weak self] action in
|
||||
self?.coordinator.selectNextArticle()
|
||||
}
|
||||
}
|
||||
@@ -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 ? Assets.Images.circleClosed : AppAssets.circleOpenImage
|
||||
let readImage = article.status.read ? Assets.Images.circleClosed : Assets.Images.circleOpen
|
||||
return UIAction(title: title, image: readImage) { [weak self] action in
|
||||
self?.coordinator.toggleReadForCurrentArticle()
|
||||
}
|
||||
@@ -777,7 +777,7 @@ private extension WebViewController {
|
||||
func nextUnreadArticleAction() -> UIAction? {
|
||||
guard coordinator.isAnyUnreadAvailable else { return nil }
|
||||
let title = NSLocalizedString("Next Unread Article", comment: "Next Unread Article")
|
||||
return UIAction(title: title, image: AppAssets.nextUnreadArticleImage) { [weak self] action in
|
||||
return UIAction(title: title, image: Assets.Images.nextUnread) { [weak self] action in
|
||||
self?.coordinator.selectNextUnread()
|
||||
}
|
||||
}
|
||||
@@ -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 ? Assets.Images.articleExtractorOffSF : AppAssets.articleExtractorOnSF
|
||||
let extractorImage = extracted ? Assets.Images.articleExtractorOffSF : Assets.Images.articleExtractorOnSF
|
||||
return UIAction(title: title, image: extractorImage) { [weak self] action in
|
||||
self?.toggleArticleExtractor()
|
||||
}
|
||||
@@ -793,7 +793,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: Assets.Images.share) { [weak self] action in
|
||||
self?.showActivityDialog()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ final class IconView: UIView {
|
||||
private var isDiscernable = true
|
||||
|
||||
private let imageView: UIImageView = {
|
||||
let imageView = NonIntrinsicImageView(image: AppAssets.faviconTemplateImage)
|
||||
let imageView = NonIntrinsicImageView(image: Assets.Images.faviconTemplate)
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
imageView.clipsToBounds = true
|
||||
imageView.layer.cornerRadius = 2.0
|
||||
@@ -115,7 +115,7 @@ private extension IconView {
|
||||
|
||||
private func updateBackgroundColor() {
|
||||
if !isBackgroundSuppressed && ((iconImage != nil && isVerticalBackgroundExposed) || !isDiscernable) {
|
||||
backgroundColor = AppAssets.iconBackgroundColor
|
||||
backgroundColor = Assets.Colors.iconBackground
|
||||
} else {
|
||||
backgroundColor = nil
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class MainFeedCollectionViewCell: UICollectionViewCell {
|
||||
if let preferredColor = iconImage?.preferredColor {
|
||||
faviconView.tintColor = UIColor(cgColor: preferredColor)
|
||||
} else {
|
||||
faviconView.tintColor = AppAssets.secondaryAccentColor
|
||||
faviconView.tintColor = Assets.Colors.secondaryAccent
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,12 +88,12 @@ class MainFeedCollectionViewCell: UICollectionViewCell {
|
||||
switch (state.isHighlighted || state.isSelected || state.isFocused, traitCollection.userInterfaceIdiom) {
|
||||
case (true, .pad):
|
||||
backgroundConfig.backgroundColor = .tertiarySystemFill
|
||||
feedTitle.textColor = AppAssets.primaryAccentColor
|
||||
feedTitle.textColor = Assets.Colors.primaryAccent
|
||||
feedTitle.font = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize,
|
||||
weight: .semibold)
|
||||
unreadCountLabel.font = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .semibold)
|
||||
case (true, .phone):
|
||||
backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
|
||||
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
|
||||
feedTitle.textColor = .white
|
||||
unreadCountLabel.textColor = .secondaryLabel
|
||||
if feedTitle.text == "All Unread" {
|
||||
@@ -109,7 +109,7 @@ class MainFeedCollectionViewCell: UICollectionViewCell {
|
||||
if let preferredColor = iconImage?.preferredColor {
|
||||
faviconView.tintColor = UIColor(cgColor: preferredColor)
|
||||
} else {
|
||||
faviconView.tintColor = AppAssets.secondaryAccentColor
|
||||
faviconView.tintColor = Assets.Colors.secondaryAccent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell {
|
||||
if let preferredColor = iconImage?.preferredColor {
|
||||
faviconView.tintColor = UIColor(cgColor: preferredColor)
|
||||
} else {
|
||||
faviconView.tintColor = AppAssets.secondaryAccentColor
|
||||
faviconView.tintColor = Assets.Colors.secondaryAccent
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,17 +117,17 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell {
|
||||
switch (state.isHighlighted || state.isSelected || state.isFocused, traitCollection.userInterfaceIdiom) {
|
||||
case (true, .pad):
|
||||
backgroundConfig.backgroundColor = .tertiarySystemFill
|
||||
folderTitle.textColor = AppAssets.primaryAccentColor
|
||||
folderTitle.textColor = Assets.Colors.primaryAccent
|
||||
folderTitle.font = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .semibold)
|
||||
unreadCountLabel.font = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .semibold)
|
||||
case (true, .phone):
|
||||
backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
|
||||
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
|
||||
folderTitle.textColor = .white
|
||||
unreadCountLabel.textColor = .secondaryLabel
|
||||
faviconView.tintColor = .white
|
||||
default:
|
||||
folderTitle.textColor = .label
|
||||
faviconView.tintColor = AppAssets.primaryAccentColor
|
||||
faviconView.tintColor = Assets.Colors.primaryAccent
|
||||
folderTitle.font = UIFont.preferredFont(forTextStyle: .body)
|
||||
unreadCountLabel.font = UIFont.preferredFont(forTextStyle: .body)
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
|
||||
}
|
||||
|
||||
func setFilterButtonToActive() {
|
||||
filterButton.tintColor = AppAssets.primaryAccentColor
|
||||
filterButton.tintColor = Assets.Colors.primaryAccent
|
||||
filterButton?.accLabelText = NSLocalizedString("Selected - Filter Read Feeds", comment: "Selected - Filter Read Feeds")
|
||||
}
|
||||
|
||||
@@ -688,13 +688,13 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
|
||||
var menuItems: [UIAction] = []
|
||||
|
||||
let addFeedActionTitle = NSLocalizedString("Add Feed", comment: "Add Feed")
|
||||
let addFeedAction = UIAction(title: addFeedActionTitle, image: AppAssets.plus) { _ in
|
||||
let addFeedAction = UIAction(title: addFeedActionTitle, image: Assets.Images.plus) { _ in
|
||||
self.coordinator.showAddFeed()
|
||||
}
|
||||
menuItems.append(addFeedAction)
|
||||
|
||||
let addFolderActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
let addFolderAction = UIAction(title: addFolderActionTitle, image: AppAssets.folderOutlinePlus) { _ in
|
||||
let addFolderAction = UIAction(title: addFolderActionTitle, image: Assets.Images.folderOutlinePlus) { _ in
|
||||
self.coordinator.showAddFolder()
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ extension MainFeedCollectionViewController {
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Open Home Page", comment: "Open Home Page")
|
||||
let action = UIAction(title: title, image: AppAssets.safariImage) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.safari) { [weak self] action in
|
||||
self?.coordinator.showBrowserForFeed(indexPath)
|
||||
}
|
||||
return action
|
||||
@@ -1026,7 +1026,7 @@ extension MainFeedCollectionViewController {
|
||||
func deleteAction(indexPath: IndexPath) -> UIAction {
|
||||
let title = NSLocalizedString("Delete", comment: "Delete")
|
||||
|
||||
let action = UIAction(title: title, image: AppAssets.trashImage, attributes: .destructive) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.trash, attributes: .destructive) { [weak self] action in
|
||||
self?.delete(indexPath: indexPath)
|
||||
}
|
||||
return action
|
||||
@@ -1034,7 +1034,7 @@ extension MainFeedCollectionViewController {
|
||||
|
||||
func renameAction(indexPath: IndexPath) -> UIAction {
|
||||
let title = NSLocalizedString("Rename", comment: "Rename")
|
||||
let action = UIAction(title: title, image: AppAssets.editImage) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.edit) { [weak self] action in
|
||||
self?.rename(indexPath: indexPath)
|
||||
}
|
||||
return action
|
||||
@@ -1046,7 +1046,7 @@ extension MainFeedCollectionViewController {
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Get Info", comment: "Get Info")
|
||||
let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.info) { [weak self] action in
|
||||
self?.coordinator.showFeedInspector(for: feed)
|
||||
}
|
||||
return action
|
||||
@@ -1054,7 +1054,7 @@ extension MainFeedCollectionViewController {
|
||||
|
||||
func getAccountInfoAction(account: Account) -> UIAction {
|
||||
let title = NSLocalizedString("Get Info", comment: "Get Info")
|
||||
let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.info) { [weak self] action in
|
||||
self?.coordinator.showAccountInspector(for: account)
|
||||
}
|
||||
return action
|
||||
@@ -1062,7 +1062,7 @@ extension MainFeedCollectionViewController {
|
||||
|
||||
func deactivateAccountAction(account: Account) -> UIAction {
|
||||
let title = NSLocalizedString("Deactivate", comment: "Deactivate")
|
||||
let action = UIAction(title: title, image: AppAssets.deactivateImage) { action in
|
||||
let action = UIAction(title: title, image: Assets.Images.deactivate) { action in
|
||||
account.isActive = false
|
||||
}
|
||||
return action
|
||||
@@ -1090,7 +1090,7 @@ extension MainFeedCollectionViewController {
|
||||
|
||||
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
|
||||
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, sidebarItem.nameForDisplay) as String
|
||||
let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.markAllAsRead) { [weak self] action in
|
||||
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
|
||||
if let articles = try? sidebarItem.fetchUnreadArticles() {
|
||||
self?.coordinator.markAllAsRead(Array(articles))
|
||||
@@ -1108,7 +1108,7 @@ extension MainFeedCollectionViewController {
|
||||
|
||||
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] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.markAllAsRead) { [weak self] action 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) {
|
||||
|
||||
@@ -68,8 +68,8 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
indicatorView.alpha = 1.0
|
||||
}
|
||||
UIView.animate(withDuration: 0.25) {
|
||||
self.indicatorView.iconImage = AppAssets.unreadCellIndicatorImage
|
||||
self.indicatorView.tintColor = AppAssets.secondaryAccentColor
|
||||
self.indicatorView.iconImage = Assets.Images.unreadCellIndicator
|
||||
self.indicatorView.tintColor = Assets.Colors.secondaryAccent
|
||||
}
|
||||
return
|
||||
} else if cellData.starred {
|
||||
@@ -77,8 +77,8 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
indicatorView.alpha = 1.0
|
||||
}
|
||||
UIView.animate(withDuration: 0.25) {
|
||||
self.indicatorView.iconImage = AppAssets.starredFeedImage
|
||||
self.indicatorView.tintColor = AppAssets.starColor
|
||||
self.indicatorView.iconImage = Assets.Images.starredFeed
|
||||
self.indicatorView.tintColor = Assets.Colors.star
|
||||
}
|
||||
return
|
||||
} else if indicatorView.alpha == 1.0 {
|
||||
@@ -133,7 +133,7 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
}
|
||||
|
||||
if state.isSelected || state.isHighlighted || state.isFocused || state.isSwiped {
|
||||
backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
|
||||
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
|
||||
applyTitleTextWithAttributes(state)
|
||||
articleDate.textColor = .lightText
|
||||
authorByLine.textColor = .lightText
|
||||
|
||||
@@ -94,8 +94,8 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
indicatorView.alpha = 1.0
|
||||
}
|
||||
UIView.animate(withDuration: 0.25) {
|
||||
self.indicatorView.iconImage = AppAssets.unreadCellIndicatorImage
|
||||
self.indicatorView.tintColor = AppAssets.secondaryAccentColor
|
||||
self.indicatorView.iconImage = Assets.Images.unreadCellIndicator
|
||||
self.indicatorView.tintColor = Assets.Colors.secondaryAccent
|
||||
}
|
||||
return
|
||||
} else if cellData.starred {
|
||||
@@ -103,8 +103,8 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
indicatorView.alpha = 1.0
|
||||
}
|
||||
UIView.animate(withDuration: 0.25) {
|
||||
self.indicatorView.iconImage = AppAssets.starredFeedImage
|
||||
self.indicatorView.tintColor = AppAssets.starColor
|
||||
self.indicatorView.iconImage = Assets.Images.starredFeed
|
||||
self.indicatorView.tintColor = Assets.Colors.star
|
||||
}
|
||||
return
|
||||
} else if indicatorView.alpha == 1.0 {
|
||||
@@ -162,7 +162,7 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
}
|
||||
|
||||
if state.isSelected || state.isHighlighted || state.isFocused || state.isSwiped {
|
||||
backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
|
||||
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
|
||||
applyTitleTextWithAttributes(state)
|
||||
articleDate.textColor = .lightText
|
||||
authorByLine.textColor = .lightText
|
||||
|
||||
@@ -23,8 +23,8 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu
|
||||
|
||||
@IBOutlet var markAllAsReadButton: UIBarButtonItem?
|
||||
|
||||
private lazy var filterButton = UIBarButtonItem(image: AppAssets.filterImage, style: .plain, target: self, action: #selector(toggleFilter(_:)))
|
||||
private lazy var firstUnreadButton = UIBarButtonItem(image: AppAssets.nextUnreadArticleImage, style: .plain, target: self, action: #selector(firstUnread(_:)))
|
||||
private lazy var filterButton = UIBarButtonItem(image: Assets.Images.filter, style: .plain, target: self, action: #selector(toggleFilter(_:)))
|
||||
private lazy var firstUnreadButton = UIBarButtonItem(image: Assets.Images.nextUnread, style: .plain, target: self, action: #selector(firstUnread(_:)))
|
||||
|
||||
private lazy var dataSource = makeDataSource()
|
||||
private let searchController = UISearchController(searchResultsController: nil)
|
||||
@@ -407,8 +407,8 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu
|
||||
completion(true)
|
||||
}
|
||||
|
||||
readAction.image = article.status.read ? Assets.Images.circleClosed : AppAssets.circleOpenImage
|
||||
readAction.backgroundColor = AppAssets.primaryAccentColor
|
||||
readAction.image = article.status.read ? Assets.Images.circleClosed : Assets.Images.circleOpen
|
||||
readAction.backgroundColor = Assets.Colors.primaryAccent
|
||||
|
||||
return UISwipeActionsConfiguration(actions: [readAction])
|
||||
}
|
||||
@@ -428,7 +428,7 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu
|
||||
}
|
||||
|
||||
starAction.image = article.status.starred ? Assets.Images.starOpen : Assets.Images.starClosed
|
||||
starAction.backgroundColor = AppAssets.starColor
|
||||
starAction.backgroundColor = Assets.Colors.star
|
||||
|
||||
// Set up the read action
|
||||
let moreTitle = NSLocalizedString("More", comment: "More")
|
||||
@@ -477,7 +477,7 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu
|
||||
|
||||
}
|
||||
|
||||
moreAction.image = AppAssets.moreImage
|
||||
moreAction.image = Assets.Images.more
|
||||
moreAction.backgroundColor = UIColor.systemGray
|
||||
|
||||
return UISwipeActionsConfiguration(actions: [starAction, moreAction])
|
||||
@@ -757,7 +757,7 @@ private extension MainTimelineViewController {
|
||||
|
||||
if isReadArticlesFiltered {
|
||||
filterButton.style = .prominent
|
||||
filterButton.tintColor = AppAssets.primaryAccentColor
|
||||
filterButton.tintColor = Assets.Colors.primaryAccent
|
||||
filterButton.accLabelText = NSLocalizedString("Selected - Filter Read Articles", comment: "Selected - Filter Read Articles")
|
||||
} else {
|
||||
filterButton.style = .plain
|
||||
@@ -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 ? Assets.Images.circleClosed : AppAssets.circleOpenImage
|
||||
let image = article.status.read ? Assets.Images.circleClosed : Assets.Images.circleOpen
|
||||
|
||||
let action = UIAction(title: title, image: image) { [weak self] action in
|
||||
self?.toggleRead(article)
|
||||
@@ -902,7 +902,7 @@ private extension MainTimelineViewController {
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Mark Above as Read", comment: "Mark Above as Read")
|
||||
let image = AppAssets.markAboveAsReadImage
|
||||
let image = Assets.Images.markAboveAsRead
|
||||
let action = UIAction(title: title, image: image) { [weak self] action in
|
||||
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
|
||||
self?.markAboveAsRead(article)
|
||||
@@ -927,7 +927,7 @@ private extension MainTimelineViewController {
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Mark Below as Read", comment: "Mark Below as Read")
|
||||
let image = AppAssets.markBelowAsReadImage
|
||||
let image = Assets.Images.markBelowAsRead
|
||||
let action = UIAction(title: title, image: image) { [weak self] action in
|
||||
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
|
||||
self?.markBelowAsRead(article)
|
||||
@@ -989,7 +989,7 @@ private extension MainTimelineViewController {
|
||||
!timelineFeedIsEqualTo(feed) else { return nil }
|
||||
|
||||
let title = NSLocalizedString("Go to Feed", comment: "Go to Feed")
|
||||
let action = UIAction(title: title, image: AppAssets.openInSidebarImage) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.openInSidebar) { [weak self] action in
|
||||
self?.discloseFeed(feed, animations: [.scroll, .navigation])
|
||||
}
|
||||
return action
|
||||
@@ -1027,7 +1027,7 @@ private extension MainTimelineViewController {
|
||||
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] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.markAllAsRead) { [weak self] action in
|
||||
MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
|
||||
self?.markAllAsRead(articles)
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ private extension MainTimelineViewController {
|
||||
func openInBrowserAction(_ article: Article) -> UIAction? {
|
||||
guard let _ = article.preferredURL else { return nil }
|
||||
let title = NSLocalizedString("Open in Browser", comment: "Open in Browser")
|
||||
let action = UIAction(title: title, image: AppAssets.safariImage) { [weak self] action in
|
||||
let action = UIAction(title: title, image: Assets.Images.safari) { [weak self] action in
|
||||
self?.showBrowserForArticle(article)
|
||||
}
|
||||
return action
|
||||
@@ -1118,7 +1118,7 @@ private extension MainTimelineViewController {
|
||||
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: Assets.Images.share) { [weak self] action in
|
||||
self?.shareDialogForTableCell(indexPath: indexPath, url: url, title: article.title)
|
||||
}
|
||||
return action
|
||||
|
||||
@@ -19,7 +19,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
|
||||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||
|
||||
window!.tintColor = AppAssets.primaryAccentColor
|
||||
window!.tintColor = Assets.Colors.primaryAccent
|
||||
|
||||
let rootViewController = window!.rootViewController as! RootSplitViewController
|
||||
rootViewController.presentsWithGesture = true
|
||||
|
||||
@@ -104,7 +104,7 @@ final class ArticleThemesTableViewController: UITableViewController {
|
||||
self?.present(alertController, animated: true)
|
||||
}
|
||||
|
||||
deleteAction.image = AppAssets.trashImage
|
||||
deleteAction.image = Assets.Images.trash
|
||||
deleteAction.backgroundColor = UIColor.systemRed
|
||||
|
||||
return UISwipeActionsConfiguration(actions: [deleteAction])
|
||||
|
||||
@@ -17,7 +17,7 @@ final class SettingsComboTableViewCell: VibrantTableViewCell {
|
||||
super.updateVibrancy(animated: animated)
|
||||
updateLabelVibrancy(comboNameLabel, color: labelColor, animated: animated)
|
||||
|
||||
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
|
||||
let tintColor = isHighlighted || isSelected ? Assets.Colors.vibrantText : UIColor.label
|
||||
if animated {
|
||||
UIView.animate(withDuration: Self.duration) {
|
||||
self.comboImage?.tintColor = tintColor
|
||||
|
||||
@@ -48,7 +48,7 @@ final class ShareFolderPickerController: UITableViewController {
|
||||
if let account = container as? ExtensionAccount {
|
||||
cell.icon.image = Assets.accountImage(account.type)
|
||||
} else {
|
||||
cell.icon.image = AppAssets.mainFolderImage.image
|
||||
cell.icon.image = Assets.Images.mainFolder.image
|
||||
}
|
||||
|
||||
cell.label?.text = container?.name ?? ""
|
||||
|
||||
@@ -10,7 +10,7 @@ import UIKit
|
||||
|
||||
final class VibrantButton: UIButton {
|
||||
|
||||
@IBInspectable var backgroundHighlightColor: UIColor = AppAssets.secondaryAccentColor
|
||||
@IBInspectable var backgroundHighlightColor: UIColor = Assets.Colors.secondaryAccent
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
@@ -22,8 +22,8 @@ final class VibrantButton: UIButton {
|
||||
}
|
||||
|
||||
private func commonInit() {
|
||||
setTitleColor(AppAssets.vibrantTextColor, for: .highlighted)
|
||||
let disabledColor = AppAssets.secondaryAccentColor.withAlphaComponent(0.5)
|
||||
setTitleColor(Assets.Colors.vibrantText, for: .highlighted)
|
||||
let disabledColor = Assets.Colors.secondaryAccent.withAlphaComponent(0.5)
|
||||
setTitleColor(disabledColor, for: .disabled)
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ final class VibrantLabel: UILabel {
|
||||
}
|
||||
|
||||
private func commonInit() {
|
||||
highlightedTextColor = AppAssets.vibrantTextColor
|
||||
highlightedTextColor = Assets.Colors.vibrantText
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,11 +13,11 @@ class VibrantTableViewCell: UITableViewCell {
|
||||
static let duration: TimeInterval = 0.6
|
||||
|
||||
var labelColor: UIColor {
|
||||
return isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
|
||||
return isHighlighted || isSelected ? Assets.Colors.vibrantText : UIColor.label
|
||||
}
|
||||
|
||||
var secondaryLabelColor: UIColor {
|
||||
return isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.secondaryLabel
|
||||
return isHighlighted || isSelected ? Assets.Colors.vibrantText : UIColor.secondaryLabel
|
||||
}
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
@@ -47,7 +47,7 @@ class VibrantTableViewCell: UITableViewCell {
|
||||
/// Subclass overrides should call super
|
||||
func applyThemeProperties() {
|
||||
let selectedBackgroundView = UIView(frame: .zero)
|
||||
selectedBackgroundView.backgroundColor = AppAssets.secondaryAccentColor
|
||||
selectedBackgroundView.backgroundColor = Assets.Colors.secondaryAccent
|
||||
self.selectedBackgroundView = selectedBackgroundView
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class VibrantBasicTableViewCell: VibrantTableViewCell {
|
||||
@IBInspectable var imageSelected: UIImage?
|
||||
|
||||
var iconTint: UIColor {
|
||||
return isHighlighted || isSelected ? labelColor : AppAssets.primaryAccentColor
|
||||
return isHighlighted || isSelected ? labelColor : Assets.Colors.primaryAccent
|
||||
}
|
||||
|
||||
var iconImage: UIImage? {
|
||||
|
||||
Reference in new issue
Block a user