Convert AccountStats over to xib. Add localization.

This commit is contained in:
Brent Simmons committed 2026-06-02 21:56:11 -07:00
1 parent 3d260089a8
commit 503a205115
7 files changed
+994 -610

No files matched your search

@@ -1,138 +0,0 @@
//
// AccountStatsFooterView.swift
// NetNewsWire
//
// Created by Brent Simmons on 4/7/26.
//
import AppKit
final class AccountStatsFooterView: NSView {
private static let vacuumButtonTitle = NSLocalizedString("Vacuum Databases", comment: "Vacuum Databases button title")
private let refreshButton: NSButton
private let vacuumButton: NSButton
private let vacuumSpinner = NSProgressIndicator()
private let helpButton: NSButton
private let explanationLabel: NSTextField
init() {
refreshButton = NSButton()
refreshButton.bezelStyle = .rounded
refreshButton.title = NSLocalizedString("Refresh", comment: "Refresh button title")
refreshButton.translatesAutoresizingMaskIntoConstraints = false
refreshButton.target = nil
refreshButton.action = #selector(AccountStatsViewController.refresh(_:))
vacuumButton = NSButton()
vacuumButton.bezelStyle = .rounded
vacuumButton.title = Self.vacuumButtonTitle
vacuumButton.translatesAutoresizingMaskIntoConstraints = false
vacuumButton.target = nil
vacuumButton.action = #selector(AccountStatsViewController.vacuum(_:))
helpButton = NSButton()
helpButton.bezelStyle = .helpButton
helpButton.title = ""
helpButton.translatesAutoresizingMaskIntoConstraints = false
helpButton.setAccessibilityLabel(NSLocalizedString("Help — opens in browser", comment: "Help button accessibility label"))
helpButton.target = nil
helpButton.action = #selector(AccountStatsViewController.showHelp(_:))
explanationLabel = NSTextField(wrappingLabelWithString: NSLocalizedString("Vacuuming may make databases faster.", comment: "Vacuum explanation text"))
explanationLabel.translatesAutoresizingMaskIntoConstraints = false
explanationLabel.font = NSFont.systemFont(ofSize: AccountStatsLayout.bottomBarFontSize)
explanationLabel.textColor = .secondaryLabelColor
explanationLabel.alignment = .natural
super.init(frame: .zero)
translatesAutoresizingMaskIntoConstraints = false
vacuumSpinner.translatesAutoresizingMaskIntoConstraints = false
vacuumSpinner.style = .spinning
vacuumSpinner.controlSize = .small
vacuumSpinner.isHidden = true
vacuumSpinner.isIndeterminate = true
// Spinner is centered inside the button so it visually replaces the title during vacuum.
vacuumButton.addSubview(vacuumSpinner)
let divider = NSBox()
divider.boxType = .separator
divider.translatesAutoresizingMaskIntoConstraints = false
let background = NSVisualEffectView()
background.translatesAutoresizingMaskIntoConstraints = false
background.blendingMode = .withinWindow
background.material = .titlebar
// Empty view between the helper text and the Refresh button — absorbs slack
// so the helper text stays next to the Vacuum Databases button on the left
// and the Refresh button stays pinned to the trailing edge.
let spacer = NSView()
spacer.translatesAutoresizingMaskIntoConstraints = false
let row = NSStackView(views: [vacuumButton, explanationLabel, spacer, refreshButton, helpButton])
row.translatesAutoresizingMaskIntoConstraints = false
row.orientation = .horizontal
row.alignment = .centerY
row.spacing = 8
row.distribution = .fill
spacer.setContentHuggingPriority(.defaultLow, for: .horizontal)
spacer.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
// Helper text sizes to its content so it sits next to the Vacuum button.
explanationLabel.setContentHuggingPriority(.required, for: .horizontal)
explanationLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
refreshButton.setContentHuggingPriority(.required, for: .horizontal)
vacuumButton.setContentHuggingPriority(.required, for: .horizontal)
helpButton.setContentHuggingPriority(.required, for: .horizontal)
addSubview(divider)
addSubview(background)
addSubview(row)
let padding = AccountStatsLayout.horizontalPadding
let spacing = AccountStatsLayout.verticalSpacing
NSLayoutConstraint.activate([
divider.topAnchor.constraint(equalTo: topAnchor),
divider.leadingAnchor.constraint(equalTo: leadingAnchor),
divider.trailingAnchor.constraint(equalTo: trailingAnchor),
background.topAnchor.constraint(equalTo: divider.bottomAnchor),
background.leadingAnchor.constraint(equalTo: leadingAnchor),
background.trailingAnchor.constraint(equalTo: trailingAnchor),
background.bottomAnchor.constraint(equalTo: bottomAnchor),
row.topAnchor.constraint(equalTo: divider.bottomAnchor, constant: spacing),
row.leadingAnchor.constraint(equalTo: leadingAnchor, constant: padding),
row.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -padding),
row.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -spacing),
vacuumButton.widthAnchor.constraint(equalToConstant: AccountStatsLayout.buttonWidth),
refreshButton.widthAnchor.constraint(equalTo: vacuumButton.widthAnchor),
vacuumSpinner.centerXAnchor.constraint(equalTo: vacuumButton.centerXAnchor),
vacuumSpinner.centerYAnchor.constraint(equalTo: vacuumButton.centerYAnchor)
])
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) is not supported")
}
func updateVacuumState(_ isVacuuming: Bool) {
vacuumButton.isEnabled = !isVacuuming
vacuumButton.title = isVacuuming ? "" : Self.vacuumButtonTitle
vacuumSpinner.isHidden = !isVacuuming
if isVacuuming {
vacuumSpinner.startAnimation(nil)
} else {
vacuumSpinner.stopAnimation(nil)
}
}
}
-31
View File
@@ -1,31 +0,0 @@
//
// AccountStatsLayout.swift
// NetNewsWire
//
// Created by Brent Simmons on 4/7/26.
//
import AppKit
enum AccountStatsLayout {
static let windowDefaultWidth: CGFloat = 800
// Wide enough to fit all NSTableView columns at their initial widths plus inset-style
// chrome, intercell spacing, vertical scroller, and header padding. Clamps any prior
// narrow autosaved frame on next open.
static let windowMinWidth: CGFloat = 740
static let windowMinHeight: CGFloat = 260
static let windowDefaultHeight: CGFloat = 460
static let horizontalPadding: CGFloat = 16
static let verticalSpacing: CGFloat = 12
static let buttonWidth: CGFloat = 160
static let bottomBarFontSize: CGFloat = 16 // matches Activity Log / Error Log warning labels
static func formattedNumber(_ value: Int) -> String {
NumberFormatter.localizedString(from: NSNumber(value: value), number: .decimal)
}
static func formattedSize(_ bytes: Int) -> String {
Int64(bytes).formatted(.byteCount(style: .file))
}
}
@@ -1,334 +0,0 @@
//
// AccountStatsViewController.swift
// NetNewsWire
//
// Created by Brent Simmons on 4/7/26.
//
import AppKit
import RSWeb
final class AccountStatsViewController: NSViewController {
private let model = AccountStatsViewModel()
private let scrollView = NSScrollView()
private let tableView = AccountStatsTableView()
private let footerView = AccountStatsFooterView()
override func loadView() {
let containerView = NSView()
containerView.translatesAutoresizingMaskIntoConstraints = false
configureScrollView()
configureTableView()
containerView.addSubview(scrollView)
containerView.addSubview(footerView)
NSLayoutConstraint.activate([
scrollView.topAnchor.constraint(equalTo: containerView.topAnchor),
scrollView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
scrollView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
scrollView.bottomAnchor.constraint(equalTo: footerView.topAnchor),
footerView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
footerView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
footerView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor)
])
self.view = containerView
}
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(handleAccountStatsDidChange(_:)), name: .AccountStatsDidChange, object: model)
}
override func viewDidAppear() {
super.viewDidAppear()
model.refresh()
}
@objc func handleAccountStatsDidChange(_ notification: Notification) {
updateUI()
}
@objc func refresh(_ sender: Any?) {
model.refresh()
}
@objc func vacuum(_ sender: Any?) {
model.vacuum()
}
@objc func showHelp(_ sender: Any?) {
if let url = URL(string: "https://netnewswire.com/help/account-stats.html") {
MacWebBrowser.openURL(url)
}
}
}
// MARK: - NSTableViewDataSource
extension AccountStatsViewController: NSTableViewDataSource {
func numberOfRows(in tableView: NSTableView) -> Int {
model.accountStats.count + (showsTotalsRow ? 1 : 0)
}
}
// MARK: - NSTableViewDelegate
extension AccountStatsViewController: NSTableViewDelegate {
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
guard let tableColumn else {
return nil
}
let identifier = tableColumn.identifier
let columnKind = columnKind(for: identifier)
let cell: NSTableCellView
if let recycled = tableView.makeView(withIdentifier: identifier, owner: self) as? NSTableCellView {
cell = recycled
} else {
cell = Self.makeCell(identifier: identifier, alignment: columnKind.alignment)
}
let textField = cell.textField!
if row == totalsRowIndex {
let font = columnKind.usesMonospacedDigits
? NSFont.monospacedDigitSystemFont(ofSize: NSFont.systemFontSize, weight: .bold)
: NSFont.boldSystemFont(ofSize: NSFont.systemFontSize)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = columnKind.alignment
textField.font = font
textField.textColor = .labelColor
textField.attributedStringValue = NSAttributedString(
string: totalsText(for: columnKind),
attributes: [
.font: font,
.foregroundColor: NSColor.labelColor,
.paragraphStyle: paragraphStyle
]
)
return cell
}
guard row < model.accountStats.count else {
return nil
}
let stats = model.accountStats[row]
textField.stringValue = text(for: columnKind, stats: stats)
textField.textColor = stats.isActive ? .labelColor : .secondaryLabelColor
textField.font = columnKind.usesMonospacedDigits
? NSFont.monospacedDigitSystemFont(ofSize: NSFont.systemFontSize, weight: .regular)
: NSFont.systemFont(ofSize: NSFont.systemFontSize)
return cell
}
}
// MARK: - Private
private extension AccountStatsViewController {
enum ColumnKind: String, CaseIterable {
case account, dbSize, feeds, folders, articles, statuses, unread, starred
var identifier: NSUserInterfaceItemIdentifier {
NSUserInterfaceItemIdentifier(rawValue)
}
var title: String {
switch self {
case .account:
return NSLocalizedString("Account", comment: "Account column header")
case .feeds:
return NSLocalizedString("Feeds", comment: "Feeds column header")
case .folders:
return NSLocalizedString("Folders", comment: "Folders column header")
case .articles:
return NSLocalizedString("Articles", comment: "Articles column header")
case .statuses:
return NSLocalizedString("Statuses", comment: "Statuses column header")
case .unread:
return NSLocalizedString("Unread", comment: "Unread column header")
case .starred:
return NSLocalizedString("Starred", comment: "Starred column header")
case .dbSize:
return NSLocalizedString("Databases", comment: "Databases size column header")
}
}
var width: CGFloat {
switch self {
case .account:
return 130
case .dbSize:
return 80
case .articles, .statuses:
return 70
case .feeds, .folders, .unread, .starred:
return 55
}
}
var alignment: NSTextAlignment {
switch self {
case .account:
return .left
default:
return .right
}
}
var usesMonospacedDigits: Bool {
alignment == .right
}
var flexes: Bool {
self == .account
}
}
func configureScrollView() {
scrollView.translatesAutoresizingMaskIntoConstraints = false
scrollView.hasVerticalScroller = true
scrollView.hasHorizontalScroller = false
scrollView.drawsBackground = true
scrollView.documentView = tableView
}
func configureTableView() {
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.usesAlternatingRowBackgroundColors = true
tableView.rowSizeStyle = .default
tableView.allowsColumnReordering = false
tableView.allowsColumnSelection = false
tableView.allowsEmptySelection = true
tableView.allowsMultipleSelection = false
tableView.style = .inset
tableView.delegate = self
tableView.dataSource = self
for kind in ColumnKind.allCases {
let column = NSTableColumn(identifier: kind.identifier)
column.title = kind.title
column.width = kind.width
column.minWidth = kind.width
column.headerCell.alignment = kind.alignment
column.resizingMask = kind.flexes ? [.userResizingMask, .autoresizingMask] : [.userResizingMask]
tableView.addTableColumn(column)
}
}
func updateUI() {
tableView.reloadData()
footerView.updateVacuumState(model.isVacuuming)
}
var showsTotalsRow: Bool {
model.accountStats.count > 1
}
var totalsRowIndex: Int? {
showsTotalsRow ? model.accountStats.count : nil
}
func columnKind(for identifier: NSUserInterfaceItemIdentifier) -> ColumnKind {
ColumnKind(rawValue: identifier.rawValue) ?? .account
}
func totalsText(for kind: ColumnKind) -> String {
switch kind {
case .account:
return NSLocalizedString("Totals", comment: "Totals row label")
case .feeds:
return AccountStatsLayout.formattedNumber(model.totalFeedCount)
case .folders:
return AccountStatsLayout.formattedNumber(model.totalFolderCount)
case .articles:
return AccountStatsLayout.formattedNumber(model.totalArticleCount)
case .statuses:
return AccountStatsLayout.formattedNumber(model.totalStatusesCount)
case .unread:
return AccountStatsLayout.formattedNumber(model.totalUnreadCount)
case .starred:
return AccountStatsLayout.formattedNumber(model.totalStarredCount)
case .dbSize:
return AccountStatsLayout.formattedSize(model.totalDatabaseSizeBytes)
}
}
func text(for kind: ColumnKind, stats: AccountStatsData) -> String {
switch kind {
case .account:
if stats.name == stats.typeName {
return stats.name
}
return "\(stats.name) (\(stats.typeName))"
case .feeds:
return AccountStatsLayout.formattedNumber(stats.feedCount)
case .folders:
return AccountStatsLayout.formattedNumber(stats.folderCount)
case .articles:
return stats.totalArticleCount.map { AccountStatsLayout.formattedNumber($0) } ?? "—"
case .statuses:
return stats.statusesCount.map { AccountStatsLayout.formattedNumber($0) } ?? "—"
case .unread:
return stats.unreadCount.map { AccountStatsLayout.formattedNumber($0) } ?? "—"
case .starred:
return stats.starredCount.map { AccountStatsLayout.formattedNumber($0) } ?? "—"
case .dbSize:
return AccountStatsLayout.formattedSize(stats.databaseSizeBytes)
}
}
static func makeCell(identifier: NSUserInterfaceItemIdentifier, alignment: NSTextAlignment) -> NSTableCellView {
let cell = NSTableCellView()
cell.identifier = identifier
let textField = NSTextField(labelWithString: "")
textField.translatesAutoresizingMaskIntoConstraints = false
textField.alignment = alignment
textField.lineBreakMode = .byTruncatingTail
cell.addSubview(textField)
cell.textField = textField
NSLayoutConstraint.activate([
textField.leadingAnchor.constraint(equalTo: cell.leadingAnchor, constant: 2),
textField.trailingAnchor.constraint(equalTo: cell.trailingAnchor, constant: -2),
textField.centerYAnchor.constraint(equalTo: cell.centerYAnchor)
])
return cell
}
}
// MARK: - AccountStatsTableView
/// NSTableView that doesn't extend its alternating-row stripes below the last row.
final class AccountStatsTableView: NSTableView {
override func drawBackground(inClipRect clipRect: NSRect) {
super.drawBackground(inClipRect: clipRect)
guard numberOfRows > 0 else {
return
}
let belowLastRowY = rect(ofRow: numberOfRows - 1).maxY
guard belowLastRowY < clipRect.maxY else {
return
}
let coverRect = NSRect(
x: clipRect.minX,
y: belowLastRowY,
width: clipRect.width,
height: clipRect.maxY - belowLastRowY
)
(backgroundColor).setFill()
coverRect.fill()
}
}
+78 -93
View File
@@ -9,11 +9,7 @@ import Foundation
import Account
import ArticlesDatabase
extension Notification.Name {
static let AccountStatsDidChange = Notification.Name("AccountStatsDidChange")
}
struct AccountStatsData {
struct AccountStatsRowData {
let accountID: String
let name: String
@@ -30,87 +26,86 @@ struct AccountStatsData {
@MainActor final class AccountStatsViewModel {
var accountStats = [AccountStatsData]()
var isVacuuming = false
var accountStats = [String: AccountStatsRowData]()
private(set) var sortedAccountStats = [AccountStatsRowData]()
var sortDescriptor: NSSortDescriptor?
private var refreshGeneration = 0
private var pendingAccountIDs = Set<String>()
// Async-derived totals stay stable through a refresh — they only update once every account has reported.
private var cachedTotalArticleCount = 0
private var cachedTotalUnreadCount = 0
private var cachedTotalStarredCount = 0
private var cachedTotalStatusesCount = 0
init() {
NotificationCenter.default.addObserver(self, selector: #selector(handleUserDidAddAccount(_:)), name: .UserDidAddAccount, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleUserDidDeleteAccount(_:)), name: .UserDidDeleteAccount, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleAccountStateDidChange(_:)), name: .AccountStateDidChange, object: nil)
}
@objc func handleUserDidAddAccount(_ notification: Notification) {
refresh()
}
@objc func handleUserDidDeleteAccount(_ notification: Notification) {
refresh()
}
@objc func handleAccountStateDidChange(_ notification: Notification) {
refresh()
}
func refresh() {
refreshGeneration += 1
let generation = refreshGeneration
func refresh() async {
let accounts = AccountManager.shared.sortedAccounts
let previousByID = Dictionary(uniqueKeysWithValues: accountStats.map { ($0.accountID, $0) })
let previous = accountStats
// Preserve previous async-loaded counts while the new fetches are in flight — cells stay
// at their old values instead of flickering to "—".
accountStats = accounts.map { account in
let previous = previousByID[account.accountID]
return AccountStatsData(
// Preserve previous async-loaded counts so cells keep their values until the new fetches return.
var newStats = [String: AccountStatsRowData]()
for account in accounts {
let previousData = previous[account.accountID]
newStats[account.accountID] = AccountStatsRowData(
accountID: account.accountID,
name: account.nameForDisplay,
typeName: account.type.displayName,
isActive: account.isActive,
feedCount: account.flattenedFeeds().count,
folderCount: account.folders?.count ?? 0,
totalArticleCount: previous?.totalArticleCount,
statusesCount: previous?.statusesCount,
unreadCount: previous?.unreadCount,
starredCount: previous?.starredCount,
totalArticleCount: previousData?.totalArticleCount,
statusesCount: previousData?.statusesCount,
unreadCount: previousData?.unreadCount,
starredCount: previousData?.starredCount,
databaseSizeBytes: databaseSize(for: account)
)
}
pendingAccountIDs = Set(accounts.map { $0.accountID })
NotificationCenter.default.post(name: .AccountStatsDidChange, object: self)
accountStats = newStats
for account in accounts {
loadCounts(for: account, generation: generation)
guard let counts = try? await account.fetchArticleCountsAsync(), var stats = accountStats[account.accountID] else {
continue
}
stats.totalArticleCount = counts.totalCount
stats.unreadCount = counts.unreadCount
stats.starredCount = counts.starredCount
stats.statusesCount = counts.statusesCount
accountStats[account.accountID] = stats
}
recomputeCachedTotals()
applySort()
}
func vacuum() {
isVacuuming = true
NotificationCenter.default.post(name: .AccountStatsDidChange, object: self)
Task {
await appDelegate.vacuumAllDatabases()
isVacuuming = false
refresh()
func applySort() {
let unsorted = Array(accountStats.values)
let ascending = sortDescriptor?.ascending ?? true
let key = sortDescriptor?.key ?? "account"
switch key {
case "account":
sortedAccountStats = unsorted.sorted { Self.compareStrings($0.name, $1.name, ascending: ascending) }
case "dbSize":
sortedAccountStats = unsorted.sorted { Self.compareInts($0.databaseSizeBytes, $1.databaseSizeBytes, ascending: ascending) }
case "feeds":
sortedAccountStats = unsorted.sorted { Self.compareInts($0.feedCount, $1.feedCount, ascending: ascending) }
case "folders":
sortedAccountStats = unsorted.sorted { Self.compareInts($0.folderCount, $1.folderCount, ascending: ascending) }
case "articles":
sortedAccountStats = unsorted.sorted { Self.compareOptionalInts($0.totalArticleCount, $1.totalArticleCount, ascending: ascending) }
case "statuses":
sortedAccountStats = unsorted.sorted { Self.compareOptionalInts($0.statusesCount, $1.statusesCount, ascending: ascending) }
case "unread":
sortedAccountStats = unsorted.sorted { Self.compareOptionalInts($0.unreadCount, $1.unreadCount, ascending: ascending) }
case "starred":
sortedAccountStats = unsorted.sorted { Self.compareOptionalInts($0.starredCount, $1.starredCount, ascending: ascending) }
default:
sortedAccountStats = unsorted
}
}
var totalFeedCount: Int {
accountStats.reduce(0) { $0 + $1.feedCount }
accountStats.values.reduce(0) { $0 + $1.feedCount }
}
var totalFolderCount: Int {
accountStats.reduce(0) { $0 + $1.folderCount }
accountStats.values.reduce(0) { $0 + $1.folderCount }
}
var totalArticleCount: Int {
@@ -130,58 +125,48 @@ struct AccountStatsData {
}
var totalDatabaseSizeBytes: Int {
accountStats.reduce(0) { $0 + $1.databaseSizeBytes }
accountStats.values.reduce(0) { $0 + $1.databaseSizeBytes }
}
}
private extension AccountStatsViewModel {
func loadCounts(for account: Account, generation: Int) {
let accountID = account.accountID
Task { @MainActor in
let counts = try? await account.fetchArticleCountsAsync()
guard generation == refreshGeneration else {
return
}
guard let counts else {
// Fetch failed (database suspended, etc.) — leave previous values in place.
pendingAccountIDs.remove(accountID)
if pendingAccountIDs.isEmpty {
recomputeCachedTotals()
NotificationCenter.default.post(name: .AccountStatsDidChange, object: self)
}
return
}
guard let index = accountStats.firstIndex(where: { $0.accountID == accountID }) else {
return
}
accountStats[index].totalArticleCount = counts.totalCount
accountStats[index].unreadCount = counts.unreadCount
accountStats[index].starredCount = counts.starredCount
accountStats[index].statusesCount = counts.statusesCount
static func compareStrings(_ lhs: String, _ rhs: String, ascending: Bool) -> Bool {
let result = lhs.localizedCaseInsensitiveCompare(rhs)
return ascending ? result == .orderedAscending : result == .orderedDescending
}
pendingAccountIDs.remove(accountID)
if pendingAccountIDs.isEmpty {
recomputeCachedTotals()
}
NotificationCenter.default.post(name: .AccountStatsDidChange, object: self)
static func compareInts(_ lhs: Int, _ rhs: Int, ascending: Bool) -> Bool {
ascending ? lhs < rhs : lhs > rhs
}
static func compareOptionalInts(_ lhs: Int?, _ rhs: Int?, ascending: Bool) -> Bool {
switch (lhs, rhs) {
case (nil, nil):
return false
case (nil, _):
return ascending
case (_, nil):
return !ascending
case let (l?, r?):
return ascending ? l < r : l > r
}
}
func recomputeCachedTotals() {
cachedTotalArticleCount = accountStats.reduce(0) { $0 + ($1.totalArticleCount ?? 0) }
cachedTotalUnreadCount = accountStats.reduce(0) { $0 + ($1.unreadCount ?? 0) }
cachedTotalStarredCount = accountStats.reduce(0) { $0 + ($1.starredCount ?? 0) }
cachedTotalStatusesCount = accountStats.reduce(0) { $0 + ($1.statusesCount ?? 0) }
cachedTotalArticleCount = accountStats.values.reduce(0) { $0 + ($1.totalArticleCount ?? 0) }
cachedTotalUnreadCount = accountStats.values.reduce(0) { $0 + ($1.unreadCount ?? 0) }
cachedTotalStarredCount = accountStats.values.reduce(0) { $0 + ($1.starredCount ?? 0) }
cachedTotalStatusesCount = accountStats.values.reduce(0) { $0 + ($1.statusesCount ?? 0) }
}
func databaseSize(for account: Account) -> Int {
let dataFolder = account.dataFolder as NSString
let baseNames = ["DB.sqlite3", "FeedSettings.db", "Sync.sqlite3"]
let databaseNames = ["DB.sqlite3", "FeedSettings.db", "Sync.sqlite3"]
var totalSize = 0
for baseName in baseNames {
let path = dataFolder.appendingPathComponent(baseName)
for databaseName in databaseNames {
let path = dataFolder.appendingPathComponent(databaseName)
if let attributes = try? FileManager.default.attributesOfItem(atPath: path),
let size = attributes[FileAttributeKey.size] as? Int {
totalSize += size
@@ -6,6 +6,9 @@
//
import AppKit
import Account
import RSCore
import RSWeb
final class AccountStatsWindowController: NSWindowController {
@@ -20,23 +23,28 @@ final class AccountStatsWindowController: NSWindowController {
}
}
@IBOutlet private var tableView: UtilityTableView?
@IBOutlet private var vacuumButton: NSButton?
@IBOutlet private var vacuumSpinner: NSProgressIndicator?
private let model = AccountStatsViewModel()
private var hasBeenShown = false
init() {
let size = NSSize(width: AccountStatsLayout.windowDefaultWidth, height: AccountStatsLayout.windowDefaultHeight)
let window = NSWindow(contentRect: NSRect(origin: .zero, size: size), styleMask: [.titled, .closable, .resizable, .miniaturizable], backing: .buffered, defer: true)
window.title = NSLocalizedString("Account Stats", comment: "Account Stats window title")
window.isReleasedWhenClosed = false
window.minSize = NSSize(width: AccountStatsLayout.windowMinWidth, height: AccountStatsLayout.windowMinHeight)
window.contentViewController = AccountStatsViewController()
window.setFrameAutosaveName("AccountStatsWindow")
super.init(window: window)
private var hasFittedColumns = false
private var isVacuuming = false {
didSet {
updateVacuumUI()
}
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) is not supported")
convenience init() {
self.init(windowNibName: "AccountStatsWindow")
}
override func windowDidLoad() {
super.windowDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(handleUserDidAddAccount(_:)), name: .UserDidAddAccount, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleUserDidDeleteAccount(_:)), name: .UserDidDeleteAccount, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleAccountStateDidChange(_:)), name: .AccountStateDidChange, object: nil)
}
override func showWindow(_ sender: Any?) {
@@ -44,10 +52,273 @@ final class AccountStatsWindowController: NSWindowController {
hasBeenShown = true
window?.center()
}
if !hasFittedColumns {
fitColumnsToLocalizedHeaders()
hasFittedColumns = true
}
super.showWindow(sender)
refreshModel()
}
func saveState() {
Self.shouldOpenAtStartup = window?.isVisible ?? false
}
@objc func handleUserDidAddAccount(_ notification: Notification) {
refreshModel()
}
@objc func handleUserDidDeleteAccount(_ notification: Notification) {
refreshModel()
}
@objc func handleAccountStateDidChange(_ notification: Notification) {
refreshModel()
}
@objc func refresh(_ sender: Any?) {
refreshModel()
}
@objc func vacuum(_ sender: Any?) {
guard !isVacuuming else {
return
}
isVacuuming = true
Task {
await appDelegate.vacuumAllDatabases()
isVacuuming = false
refreshModel()
}
}
@objc func showHelp(_ sender: Any?) {
if let url = URL(string: "https://netnewswire.com/help/account-stats.html") {
MacWebBrowser.openURL(url)
}
}
}
// MARK: - NSTableViewDataSource
extension AccountStatsWindowController: NSTableViewDataSource {
func numberOfRows(in tableView: NSTableView) -> Int {
model.sortedAccountStats.count + (showsTotalsRow ? 1 : 0)
}
func tableView(_ tableView: NSTableView, sortDescriptorsDidChange oldDescriptors: [NSSortDescriptor]) {
model.sortDescriptor = tableView.sortDescriptors.first
model.applySort()
reloadData()
}
}
// MARK: - NSTableViewDelegate
extension AccountStatsWindowController: NSTableViewDelegate {
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
guard let tableColumn else {
return nil
}
let identifier = tableColumn.identifier
let columnKind = columnKind(for: identifier)
guard let cell = tableView.makeView(withIdentifier: identifier, owner: self) as? NSTableCellView else {
return nil
}
guard let textField = cell.textField else {
return cell
}
let pointSize = textField.font?.pointSize ?? NSFont.systemFontSize
if row == totalsRowIndex {
let font = columnKind.usesMonospacedDigits
? NSFont.monospacedDigitSystemFont(ofSize: pointSize, weight: .bold)
: NSFont.boldSystemFont(ofSize: pointSize)
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = columnKind.alignment
textField.alignment = columnKind.alignment
textField.attributedStringValue = NSAttributedString(
string: totalsText(for: columnKind),
attributes: [
.font: font,
.foregroundColor: NSColor.labelColor,
.paragraphStyle: paragraph
]
)
return cell
}
guard row < model.sortedAccountStats.count else {
return nil
}
let accountData = model.sortedAccountStats[row]
textField.stringValue = text(for: columnKind, stats: accountData)
textField.textColor = accountData.isActive ? .labelColor : .secondaryLabelColor
textField.alignment = columnKind.alignment
textField.font = columnKind.usesMonospacedDigits
? NSFont.monospacedDigitSystemFont(ofSize: pointSize, weight: .regular)
: NSFont.systemFont(ofSize: pointSize)
return cell
}
}
// MARK: - Private
private extension AccountStatsWindowController {
enum ColumnKind: String {
case account, dbSize, feeds, folders, articles, statuses, unread, starred
var alignment: NSTextAlignment {
switch self {
case .account:
return .left
default:
return .right
}
}
var usesMonospacedDigits: Bool {
self != .account
}
}
func refreshModel() {
Task {
await model.refresh()
reloadData()
}
}
func reloadData() {
tableView?.reloadData()
updateUI()
}
func updateUI() {
updateVacuumUI()
}
func updateVacuumUI() {
vacuumButton?.isEnabled = !isVacuuming
vacuumSpinner?.isHidden = !isVacuuming
if isVacuuming {
vacuumSpinner?.startAnimation(nil)
} else {
vacuumSpinner?.stopAnimation(nil)
}
}
func fitColumnsToLocalizedHeaders() {
guard let tableView else {
return
}
// Cell-side padding (~6pt each side) + sort-indicator triangle (~12pt) + breathing.
let headerPadding: CGFloat = 28
// Extra width above the minimum so the user has room to drag a column narrower.
let shrinkSlack: CGFloat = 28
let headerFont = NSFont.systemFont(ofSize: NSFont.smallSystemFontSize)
var totalColumnWidth: CGFloat = 0
for column in tableView.tableColumns {
let title = column.headerCell.stringValue
let titleWidth = (title as NSString).size(withAttributes: [.font: headerFont]).width
let required = ceil(titleWidth) + headerPadding
if required > column.minWidth {
column.minWidth = required
}
if required > column.width {
column.width = required + shrinkSlack
}
totalColumnWidth += column.width
}
// The XIB's contentMinSize was sized for English. Widen it if the localized
// columns plus chrome can't fit, otherwise the table view squeezes columns
// below their minWidth and they clip.
guard let window else {
return
}
let intercellSpacing = tableView.intercellSpacing.width * CGFloat(tableView.tableColumns.count - 1)
let chrome: CGFloat = 24 // vertical scroller + a little slack
let requiredContentWidth = ceil(totalColumnWidth + intercellSpacing + chrome)
if requiredContentWidth > window.contentMinSize.width {
window.contentMinSize = NSSize(width: requiredContentWidth, height: window.contentMinSize.height)
}
if requiredContentWidth > window.frame.size.width {
var frame = window.frame
frame.size.width = requiredContentWidth
window.setFrame(frame, display: true)
}
}
var showsTotalsRow: Bool {
model.sortedAccountStats.count > 1
}
var totalsRowIndex: Int? {
showsTotalsRow ? model.sortedAccountStats.count : nil
}
func columnKind(for identifier: NSUserInterfaceItemIdentifier) -> ColumnKind {
ColumnKind(rawValue: identifier.rawValue) ?? .account
}
func totalsText(for kind: ColumnKind) -> String {
switch kind {
case .account:
return NSLocalizedString("Totals", comment: "Totals row label")
case .feeds:
return Self.formattedNumber(model.totalFeedCount)
case .folders:
return Self.formattedNumber(model.totalFolderCount)
case .articles:
return Self.formattedNumber(model.totalArticleCount)
case .statuses:
return Self.formattedNumber(model.totalStatusesCount)
case .unread:
return Self.formattedNumber(model.totalUnreadCount)
case .starred:
return Self.formattedNumber(model.totalStarredCount)
case .dbSize:
return Self.formattedSize(model.totalDatabaseSizeBytes)
}
}
func text(for kind: ColumnKind, stats: AccountStatsRowData) -> String {
switch kind {
case .account:
if stats.name == stats.typeName {
return stats.name
}
return "\(stats.name) (\(stats.typeName))"
case .feeds:
return Self.formattedNumber(stats.feedCount)
case .folders:
return Self.formattedNumber(stats.folderCount)
case .articles:
return stats.totalArticleCount.map { Self.formattedNumber($0) } ?? "—"
case .statuses:
return stats.statusesCount.map { Self.formattedNumber($0) } ?? "—"
case .unread:
return stats.unreadCount.map { Self.formattedNumber($0) } ?? "—"
case .starred:
return stats.starredCount.map { Self.formattedNumber($0) } ?? "—"
case .dbSize:
return Self.formattedSize(stats.databaseSizeBytes)
}
}
static func formattedNumber(_ value: Int) -> String {
NumberFormatter.localizedString(from: NSNumber(value: value), number: .decimal)
}
static func formattedSize(_ bytes: Int) -> String {
Int64(bytes).formatted(.byteCount(style: .file))
}
}
@@ -0,0 +1,409 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24765" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24765"/>
<capability name="System colors introduced in macOS 10.14" minToolsVersion="10.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AccountStatsWindowController" customModule="NetNewsWire" customModuleProvider="target">
<connections>
<outlet property="tableView" destination="JP4-Kx-0oU" id="fO-02-tvw"/>
<outlet property="vacuumButton" destination="Vpw-Lo-UEL" id="sw6-gL-F5L"/>
<outlet property="vacuumSpinner" destination="RbZ-Ko-8zv" id="Wkt-Gj-zz5"/>
<outlet property="window" destination="QvC-M9-y7g" id="gQ2-hz-NmK"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Account Stats" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="880" y="965" width="700" height="256"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1410"/>
<value key="minSize" type="size" width="700" height="256"/>
<value key="maxSize" type="size" width="1440" height="1440"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="700" height="256"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="Lnf-gd-W5z">
<rect key="frame" x="0.0" y="64" width="700" height="192"/>
<clipView key="contentView" id="aS7-wc-rRc">
<rect key="frame" x="0.0" y="0.0" width="700" height="192"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" tableStyle="inset" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveName="AccountStatsTable" rowHeight="24" rowSizeStyle="medium" headerView="88L-NM-yhV" viewBased="YES" id="JP4-Kx-0oU" customClass="UtilityTableView" customModule="RSCore">
<rect key="frame" x="0.0" y="0.0" width="700" height="164"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="17" height="0.0"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="separatorColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="account" editable="NO" width="85" minWidth="40" maxWidth="1000" id="JLZ-2v-hkU">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Account">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" id="Y52-mO-gL7">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="localizedCaseInsensitiveCompare:" sortKey="account"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="1g0-JI-K6r">
<rect key="frame" x="18" y="0.0" width="83" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rCU-G8-JdG">
<rect key="frame" x="0.0" y="4" width="83" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" allowsEditingTextAttributes="YES" id="UVc-PJ-R0k">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="rCU-G8-JdG" id="fIj-uh-xQp"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="dbSize" editable="NO" width="80" minWidth="40" maxWidth="1000" id="el9-XU-UyQ">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Databases">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" id="Xxh-OL-fYt">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="dbSize"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="Cwb-t8-NbO">
<rect key="frame" x="118" y="0.0" width="80" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u7n-zh-ctE">
<rect key="frame" x="0.0" y="4" width="80" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" id="zhx-Ov-duc">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="u7n-zh-ctE" id="eeJ-Kf-Jhh"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="feeds" editable="NO" width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="5F9-ka-Ic8">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Feeds">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" id="pY3-MD-6wW">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="feeds"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="x0W-dN-J6p">
<rect key="frame" x="215" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qjn-QR-def">
<rect key="frame" x="0.0" y="1" width="64" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" allowsEditingTextAttributes="YES" id="kA5-wz-jmt">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="qjn-QR-def" id="PYs-Z1-Dya"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="folders" editable="NO" width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="Jvt-nt-V8z">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Folders">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" id="gzc-rr-Jyp">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="folders"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="gp5-TA-hiz">
<rect key="frame" x="296" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="H1q-vB-zLL">
<rect key="frame" x="0.0" y="1" width="64" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" allowsEditingTextAttributes="YES" id="Twm-50-2Qw">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="H1q-vB-zLL" id="Gkk-DC-8LR"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="articles" editable="NO" width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="A8s-1h-rFK">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Articles">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" id="XAz-kL-2Hy">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="articles"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="0ny-MW-BMu">
<rect key="frame" x="377" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gza-2p-4tl">
<rect key="frame" x="0.0" y="1" width="64" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" allowsEditingTextAttributes="YES" id="IQU-K9-vWm">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="gza-2p-4tl" id="Di2-tW-5mS"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="statuses" editable="NO" width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="JJX-19-V6q">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Statuses">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" id="73Q-aL-Y94">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="statuses"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="Phr-Hu-ueS">
<rect key="frame" x="458" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="obt-ci-1KR">
<rect key="frame" x="0.0" y="1" width="64" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" allowsEditingTextAttributes="YES" id="aRB-Xy-tHl">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="obt-ci-1KR" id="x1n-dD-eZe"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="unread" editable="NO" width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="RQ5-kB-Icw">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Unread">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" id="5OS-P9-EB2">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="unread"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="WGz-cH-QvS">
<rect key="frame" x="539" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1In-II-j1C">
<rect key="frame" x="0.0" y="1" width="64" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" allowsEditingTextAttributes="YES" id="Tqy-wY-UOm">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="1In-II-j1C" id="g1R-fH-2sp"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="starred" editable="NO" width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="0cO-dq-wRh">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Starred">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" id="sDl-Le-Pgf">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="starred"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="dcS-hq-fQd">
<rect key="frame" x="620" y="0.0" width="61" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Mfx-Pp-H53">
<rect key="frame" x="0.0" y="1" width="61" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" allowsEditingTextAttributes="YES" id="afu-hA-bCZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="Mfx-Pp-H53" id="fKn-MP-gOq"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="-2" id="tv-01-ds0"/>
<outlet property="delegate" destination="-2" id="tv-02-dl0"/>
</connections>
</tableView>
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Cme-wD-9iT">
<rect key="frame" x="-100" y="-100" width="640" height="17"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="Bck-8a-Pa1">
<rect key="frame" x="224" y="17" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" wantsLayer="YES" id="88L-NM-yhV">
<rect key="frame" x="0.0" y="0.0" width="700" height="28"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
<visualEffectView wantsLayer="YES" blendingMode="withinWindow" material="titlebar" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="3Ct-jP-dkh">
<rect key="frame" x="0.0" y="0.0" width="700" height="64"/>
<subviews>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="CCY-aO-S6G">
<rect key="frame" x="0.0" y="61" width="700" height="5"/>
</box>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Vpw-Lo-UEL">
<rect key="frame" x="20" y="20" width="141" height="24"/>
<buttonCell key="cell" type="push" title="Vacuum Databases" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="KiW-Nc-bVK">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="vacuum:" target="-2" id="bn-vac-act"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5xO-up-t4V">
<rect key="frame" x="167" y="24" width="244" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Vacuuming may make databases faster." id="xwg-oc-6B1">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<progressIndicator wantsLayer="YES" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" maxValue="100" displayedWhenStopped="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="RbZ-Ko-8zv">
<rect key="frame" x="417" y="24" width="16" height="16"/>
</progressIndicator>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="N0p-CD-tr7">
<rect key="frame" x="504" y="20" width="140" height="24"/>
<buttonCell key="cell" type="push" title="Refresh" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="1Nz-s2-tlh">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="vacuum:" target="-2" id="tP0-LG-SUR"/>
</connections>
</button>
<button horizontalHuggingPriority="1000" verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="a3Q-Bq-vCh">
<rect key="frame" x="656" y="20" width="24" height="24"/>
<buttonCell key="cell" type="help" bezelStyle="helpButton" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="d7a-Y9-drR">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="showHelp:" target="-2" id="bn-hlp-act"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="Vpw-Lo-UEL" firstAttribute="leading" secondItem="3Ct-jP-dkh" secondAttribute="leading" constant="20" symbolic="YES" id="26q-33-E6k"/>
<constraint firstAttribute="trailing" secondItem="a3Q-Bq-vCh" secondAttribute="trailing" constant="20" symbolic="YES" id="3NL-hn-osY"/>
<constraint firstItem="RbZ-Ko-8zv" firstAttribute="leading" secondItem="5xO-up-t4V" secondAttribute="trailing" constant="8" symbolic="YES" id="3yz-i2-1eP"/>
<constraint firstItem="CCY-aO-S6G" firstAttribute="top" secondItem="3Ct-jP-dkh" secondAttribute="top" id="4jT-du-UCY"/>
<constraint firstAttribute="bottom" secondItem="a3Q-Bq-vCh" secondAttribute="bottom" constant="20" symbolic="YES" id="5dl-Hi-dkf"/>
<constraint firstItem="Vpw-Lo-UEL" firstAttribute="top" secondItem="3Ct-jP-dkh" secondAttribute="top" constant="20" symbolic="YES" id="DlI-jz-BTc"/>
<constraint firstItem="5xO-up-t4V" firstAttribute="leading" secondItem="Vpw-Lo-UEL" secondAttribute="trailing" constant="8" symbolic="YES" id="Gas-rG-sQ0"/>
<constraint firstItem="CCY-aO-S6G" firstAttribute="leading" secondItem="3Ct-jP-dkh" secondAttribute="leading" id="N0y-xe-yEK"/>
<constraint firstItem="N0p-CD-tr7" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="RbZ-Ko-8zv" secondAttribute="trailing" constant="8" symbolic="YES" id="YPb-D4-rYl"/>
<constraint firstItem="5xO-up-t4V" firstAttribute="firstBaseline" secondItem="Vpw-Lo-UEL" secondAttribute="firstBaseline" id="dW6-4x-rvJ"/>
<constraint firstItem="RbZ-Ko-8zv" firstAttribute="centerY" secondItem="3Ct-jP-dkh" secondAttribute="centerY" id="dYd-Jh-TeT"/>
<constraint firstAttribute="bottom" secondItem="Vpw-Lo-UEL" secondAttribute="bottom" constant="20" symbolic="YES" id="ivQ-6G-EpO"/>
<constraint firstItem="a3Q-Bq-vCh" firstAttribute="leading" secondItem="N0p-CD-tr7" secondAttribute="trailing" constant="12" symbolic="YES" id="njx-pJ-4RF"/>
<constraint firstAttribute="trailing" secondItem="CCY-aO-S6G" secondAttribute="trailing" id="qyl-sa-fMa"/>
<constraint firstItem="N0p-CD-tr7" firstAttribute="firstBaseline" secondItem="Vpw-Lo-UEL" secondAttribute="firstBaseline" id="s7K-jR-lor"/>
<constraint firstItem="N0p-CD-tr7" firstAttribute="width" secondItem="Vpw-Lo-UEL" secondAttribute="width" id="vgD-kQ-FB8"/>
<constraint firstItem="a3Q-Bq-vCh" firstAttribute="top" secondItem="3Ct-jP-dkh" secondAttribute="top" constant="20" symbolic="YES" id="yeO-rS-dVm"/>
</constraints>
</visualEffectView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="3Ct-jP-dkh" secondAttribute="bottom" id="72i-Bk-hET"/>
<constraint firstItem="Lnf-gd-W5z" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="CIb-md-NMC"/>
<constraint firstAttribute="trailing" secondItem="Lnf-gd-W5z" secondAttribute="trailing" id="Gd4-22-FY8"/>
<constraint firstItem="Lnf-gd-W5z" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="Jcp-L2-1Fz"/>
<constraint firstAttribute="trailing" secondItem="3Ct-jP-dkh" secondAttribute="trailing" id="ZlT-lk-0Hf"/>
<constraint firstItem="3Ct-jP-dkh" firstAttribute="top" secondItem="Lnf-gd-W5z" secondAttribute="bottom" id="fNw-OO-znN"/>
<constraint firstItem="3Ct-jP-dkh" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="jZ4-9V-gnm"/>
</constraints>
</view>
<point key="canvasLocation" x="-127" y="236"/>
</window>
</objects>
</document>
@@ -0,0 +1,222 @@
{
"sourceLanguage" : "en",
"strings" : {
"0cO-dq-wRh.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Starred\"; ObjectID = \"0cO-dq-wRh\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Starred"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Destacados"
}
}
}
},
"1Nz-s2-tlh.title" : {
"comment" : "Class = \"NSButtonCell\"; title = \"Refresh\"; ObjectID = \"1Nz-s2-tlh\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Refresh"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Actualizar"
}
}
}
},
"5F9-ka-Ic8.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Feeds\"; ObjectID = \"5F9-ka-Ic8\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Feeds"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Fuentes"
}
}
}
},
"A8s-1h-rFK.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Articles\"; ObjectID = \"A8s-1h-rFK\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Articles"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Artículos"
}
}
}
},
"el9-XU-UyQ.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Databases\"; ObjectID = \"el9-XU-UyQ\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Databases"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bases de datos"
}
}
}
},
"JJX-19-V6q.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Statuses\"; ObjectID = \"JJX-19-V6q\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Statuses"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Estados"
}
}
}
},
"JLZ-2v-hkU.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Account\"; ObjectID = \"JLZ-2v-hkU\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Account"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Cuenta"
}
}
}
},
"Jvt-nt-V8z.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Folders\"; ObjectID = \"Jvt-nt-V8z\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Folders"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Carpetas"
}
}
}
},
"KiW-Nc-bVK.title" : {
"comment" : "Class = \"NSButtonCell\"; title = \"Vacuum Databases\"; ObjectID = \"KiW-Nc-bVK\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Vacuum Databases"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Compactar bases de datos"
}
}
}
},
"QvC-M9-y7g.title" : {
"comment" : "Class = \"NSWindow\"; title = \"Account Stats\"; ObjectID = \"QvC-M9-y7g\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Account Stats"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Estadísticas de cuentas"
}
}
}
},
"RQ5-kB-Icw.headerCell.title" : {
"comment" : "Class = \"NSTableColumn\"; headerCell.title = \"Unread\"; ObjectID = \"RQ5-kB-Icw\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Unread"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "No leídos"
}
}
}
},
"xwg-oc-6B1.title" : {
"comment" : "Class = \"NSTextFieldCell\"; title = \"Vacuuming may make databases faster.\"; ObjectID = \"xwg-oc-6B1\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Vacuuming may make databases faster."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Compactar puede acelerar las bases de datos."
}
}
}
}
},
"version" : "1.2"
}