Make mark-as-starred menu item work; make it validate; change its name as needed.

This commit is contained in:
Brent Simmons
2018-02-17 12:01:14 -08:00
parent ce5b60cfe8
commit 21f262e953
5 changed files with 40 additions and 17 deletions

View 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
}
}