2018-02-17 21:01:14 +01:00
|
|
|
//
|
|
|
|
// MarkCommandValidationStatus.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2018-02-17 21:01:14 +01:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
}
|