mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Make mark-as-starred menu item work; make it validate; change its name as needed.
This commit is contained in:
22
Commands/MarkCommandValidationStatus.swift
Normal file
22
Commands/MarkCommandValidationStatus.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// MarkCommandValidationStatus.swift
|
||||
// Evergreen
|
||||
//
|
||||
// Created by Brent Simmons on 2/17/18.
|
||||
// Copyright © 2018 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum MarkCommandValidationStatus {
|
||||
|
||||
case canMark, canUnmark, canDoNothing
|
||||
|
||||
static func statusFor(_ articles: ArticleArray, _ canMarkTest: ((ArticleArray) -> Bool)) -> MarkCommandValidationStatus {
|
||||
|
||||
if articles.isEmpty {
|
||||
return .canDoNothing
|
||||
}
|
||||
return canMarkTest(articles) ? .canMark : .canUnmark
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user