Skip to content

Commit 2d3d048

Browse files
committed
reduce: vestigial pre-Minimal-Mode settings enums
WorkspaceTitlebarSettings and WorkspaceButtonFadeSettings predate WorkspacePresentationModeSettings (Minimal Mode), which replaced them. WorkspaceButtonFadeSettings.initializeStoredModeIfNeeded() and isEnabled() have no call sites; WorkspaceTitlebarSettings.isVisible() was only called from that uncalled migration path. No UI surfaces either enum. Their orphaned localization keys (settings.app.fadeButtons.*, settings.app.showWorkspaceTitlebar.*) went in the previous commit; the resetAllSettings() lines that scrubbed their legacy UserDefaults keys go here.
1 parent c097307 commit 2d3d048

1 file changed

Lines changed: 0 additions & 65 deletions

File tree

Sources/ProgramaApp.swift

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@ import Darwin
44
import Bonsplit
55
import UniformTypeIdentifiers
66

7-
enum WorkspaceTitlebarSettings {
8-
static let showTitlebarKey = "workspaceTitlebarVisible"
9-
static let defaultShowTitlebar = true
10-
11-
static func isVisible(defaults: UserDefaults = .standard) -> Bool {
12-
if defaults.object(forKey: showTitlebarKey) == nil {
13-
return defaultShowTitlebar
14-
}
15-
return defaults.bool(forKey: showTitlebarKey)
16-
}
17-
}
18-
197
enum WorkspacePresentationModeSettings {
208
static let modeKey = "workspacePresentationMode"
219

@@ -39,54 +27,6 @@ enum WorkspacePresentationModeSettings {
3927
}
4028
}
4129

42-
enum WorkspaceButtonFadeSettings {
43-
static let modeKey = "workspaceButtonsFadeMode"
44-
static let legacyTitlebarControlsVisibilityModeKey = "titlebarControlsVisibilityMode"
45-
static let legacyPaneTabBarControlsVisibilityModeKey = "paneTabBarControlsVisibilityMode"
46-
47-
enum Mode: String {
48-
case enabled
49-
case disabled
50-
}
51-
52-
static let defaultMode: Mode = .disabled
53-
54-
static func mode(for rawValue: String?) -> Mode {
55-
Mode(rawValue: rawValue ?? "") ?? defaultMode
56-
}
57-
58-
static func isEnabled(defaults: UserDefaults = .standard) -> Bool {
59-
mode(for: defaults.string(forKey: modeKey)) == .enabled
60-
}
61-
62-
static func initializeStoredModeIfNeeded(defaults: UserDefaults = .standard) {
63-
guard defaults.string(forKey: modeKey) == nil else { return }
64-
65-
if let migratedMode = migratedLegacyMode(defaults: defaults) {
66-
defaults.set(migratedMode.rawValue, forKey: modeKey)
67-
return
68-
}
69-
70-
let initialMode: Mode = WorkspaceTitlebarSettings.isVisible(defaults: defaults) ? .disabled : .enabled
71-
defaults.set(initialMode.rawValue, forKey: modeKey)
72-
}
73-
74-
private static func migratedLegacyMode(defaults: UserDefaults) -> Mode? {
75-
let legacyValues = [
76-
defaults.string(forKey: legacyTitlebarControlsVisibilityModeKey),
77-
defaults.string(forKey: legacyPaneTabBarControlsVisibilityModeKey),
78-
]
79-
80-
if legacyValues.contains(where: { $0 == "onHover" || $0 == "hover" || $0 == "enabled" }) {
81-
return .enabled
82-
}
83-
if legacyValues.contains(where: { $0 == "always" || $0 == "disabled" }) {
84-
return .disabled
85-
}
86-
return nil
87-
}
88-
}
89-
9030
enum PaneFirstClickFocusSettings {
9131
static let enabledKey = "paneFirstClickFocus.enabled"
9232
static let defaultEnabled = false
@@ -6018,11 +5958,6 @@ struct SettingsView: View {
60185958
alwaysShowShortcutHints = ShortcutHintDebugSettings.defaultAlwaysShowHints
60195959
newWorkspacePlacement = WorkspacePlacementSettings.defaultPlacement.rawValue
60205960
workspacePresentationMode = WorkspacePresentationModeSettings.defaultMode.rawValue
6021-
let defaults = UserDefaults.standard
6022-
defaults.removeObject(forKey: WorkspaceTitlebarSettings.showTitlebarKey)
6023-
defaults.removeObject(forKey: WorkspaceButtonFadeSettings.modeKey)
6024-
defaults.removeObject(forKey: WorkspaceButtonFadeSettings.legacyTitlebarControlsVisibilityModeKey)
6025-
defaults.removeObject(forKey: WorkspaceButtonFadeSettings.legacyPaneTabBarControlsVisibilityModeKey)
60265961
closeWorkspaceOnLastSurfaceShortcut = LastSurfaceCloseShortcutSettings.defaultValue
60275962
paneFirstClickFocusEnabled = PaneFirstClickFocusSettings.defaultEnabled
60285963
workspaceAutoReorder = WorkspaceAutoReorderSettings.defaultValue

0 commit comments

Comments
 (0)