Prepare for open-sourcing: scrub the prior-art attribution from the spec, agent guide, and code comments so the project documents its own behavior. - Reword RULES_FEATURE_SPEC.md to describe OpenAppLock's rules feature directly (drop the screen-recording source line and "as observed"/ "not demoed"/"as shown" framing) - Replace "the reference app/UI/style/defaults" comments and test names with direct descriptions of the behavior - No behavior change; comments, docs, and @Test display names only Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
65 lines
1.6 KiB
Swift
65 lines
1.6 KiB
Swift
//
|
|
// RuleKind.swift
|
|
// OpenAppLock
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// The three kinds of blocking rules offered on the "New Rule" sheet.
|
|
enum RuleKind: String, Codable, CaseIterable, Sendable {
|
|
/// Block selected apps during a recurring time window.
|
|
case schedule
|
|
/// Block selected apps after a daily usage budget is spent.
|
|
case timeLimit
|
|
/// Block selected apps after a number of opens per day.
|
|
case openLimit
|
|
|
|
var displayName: String {
|
|
switch self {
|
|
case .schedule: "Schedule"
|
|
case .timeLimit: "Time Limit"
|
|
case .openLimit: "Open Limit"
|
|
}
|
|
}
|
|
|
|
var exampleText: String {
|
|
switch self {
|
|
case .schedule: "e.g. 9-5, Daily"
|
|
case .timeLimit: "e.g. 45m/day"
|
|
case .openLimit: "e.g. 5 opens/day"
|
|
}
|
|
}
|
|
|
|
var symbolName: String {
|
|
switch self {
|
|
case .schedule: "calendar"
|
|
case .timeLimit: "hourglass"
|
|
case .openLimit: "lock.fill"
|
|
}
|
|
}
|
|
|
|
/// Default name given to a brand-new rule of this kind (e.g. "In the Zone", "Time Keeper").
|
|
var defaultRuleName: String {
|
|
switch self {
|
|
case .schedule: "In the Zone"
|
|
case .timeLimit: "Time Keeper"
|
|
case .openLimit: "Gate Keeper"
|
|
}
|
|
}
|
|
}
|
|
|
|
/// How the rule's app selection is interpreted.
|
|
enum SelectionMode: String, Codable, CaseIterable, Sendable {
|
|
/// Block the selected apps; everything else stays available.
|
|
case block
|
|
/// Block everything except the selected apps.
|
|
case allowOnly
|
|
|
|
var displayName: String {
|
|
switch self {
|
|
case .block: "Block"
|
|
case .allowOnly: "Allow Only"
|
|
}
|
|
}
|
|
}
|