From 4e0659d4ccb6d78db1aaac0431fd4d513e1b8bb8 Mon Sep 17 00:00:00 2001 From: Hariharan Mudaliar Date: Mon, 1 Dec 2025 20:14:50 +0530 Subject: [PATCH] Add alpha tags --- DynamicIsland/Localizable.xcstrings | 23 +++++++ .../components/Settings/SettingsView.swift | 67 ++++++++++++++++--- DynamicIsland/models/Constants.swift | 1 + 3 files changed, 83 insertions(+), 8 deletions(-) diff --git a/DynamicIsland/Localizable.xcstrings b/DynamicIsland/Localizable.xcstrings index f76b7e6..cfe724f 100644 --- a/DynamicIsland/Localizable.xcstrings +++ b/DynamicIsland/Localizable.xcstrings @@ -2813,6 +2813,14 @@ } } }, + "ALPHA" : { + "comment" : "A label indicating a feature that is still in development.", + "isCommentAutoGenerated" : true + }, + "Alpha Feature Warning" : { + "comment" : "The title of an alert that warns users about an alpha feature.", + "isCommentAutoGenerated" : true + }, "Always hide in fullscreen" : { "localizations" : { "ar" : { @@ -6246,6 +6254,13 @@ "Custom OSD" : { "comment" : "The title of the settings screen for customizing the OSD.", "isCommentAutoGenerated" : true + }, + "Custom OSD feature requires macOS 15 or later." : { + "comment" : "A description of the Custom OSD feature, visible only on macOS 15 or later.", + "isCommentAutoGenerated" : true + }, + "Custom OSD is an experimental alpha feature and may contain bugs or unexpected behavior.\n\nThis feature requires macOS 15 or later and is still under active development. It's recommended to keep it disabled unless you want to help test it." : { + }, "Custom OSD is disabled because HUDs are enabled. Disable HUDs in the HUDs tab to use Custom OSD." : { "comment" : "A message displayed below the toggle to inform the user that they cannot enable Custom OSD if HUDs are enabled.", @@ -7613,6 +7628,10 @@ "comment" : "A description of the media panel settings in the lock screen settings view.", "isCommentAutoGenerated" : true }, + "Enable Anyway" : { + "comment" : "A button that enables the Custom OSD feature despite the warning.", + "isCommentAutoGenerated" : true + }, "Enable Built-in System HUD" : { "extractionState" : "stale", "localizations" : { @@ -11154,6 +11173,10 @@ "Mac battery at %d percent" : { "comment" : "Mac battery gauge accessibility label" }, + "macOS 15 or later required" : { + "comment" : "A message displayed when the Custom OSD feature is unavailable on this version of macOS.", + "isCommentAutoGenerated" : true + }, "Made with ❤️ by Ebullioscopic" : { "comment" : "A footer text that credits the developer of the app.", "isCommentAutoGenerated" : true diff --git a/DynamicIsland/components/Settings/SettingsView.swift b/DynamicIsland/components/Settings/SettingsView.swift index d11961f..69d261e 100644 --- a/DynamicIsland/components/Settings/SettingsView.swift +++ b/DynamicIsland/components/Settings/SettingsView.swift @@ -261,6 +261,18 @@ struct SettingsView: View { sidebarIcon(for: tab) Text(tab.title) .foregroundStyle(Color.primary) + if tab == .osd { + Spacer() + Text("ALPHA") + .font(.system(size: 9, weight: .bold)) + .foregroundStyle(.white) + .padding(.horizontal, 6) + .padding(.vertical, 2) + .background( + Capsule() + .fill(Color.orange) + ) + } } .padding(.vertical, 4) } @@ -728,7 +740,25 @@ struct SettingsView: View { } case .osd: SettingsForm(tab: .osd) { - CustomOSDSettings() + if #available(macOS 15.0, *) { + CustomOSDSettings() + } else { + VStack(spacing: 16) { + Image(systemName: "exclamationmark.triangle.fill") + .font(.system(size: 48)) + .foregroundStyle(.orange) + + Text("macOS 15 or later required") + .font(.headline) + + Text("Custom OSD feature requires macOS 15 or later.") + .font(.subheadline) + .foregroundStyle(.secondary) + .multilineTextAlignment(.center) + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + .padding() + } } case .battery: SettingsForm(tab: .battery) { @@ -4362,6 +4392,7 @@ struct ColorPickerSettings: View { struct CustomOSDSettings: View { @Default(.enableCustomOSD) var enableCustomOSD + @Default(.hasSeenOSDAlphaWarning) var hasSeenOSDAlphaWarning @Default(.enableOSDVolume) var enableOSDVolume @Default(.enableOSDBrightness) var enableOSDBrightness @Default(.enableOSDKeyboardBacklight) var enableOSDKeyboardBacklight @@ -4369,6 +4400,7 @@ struct CustomOSDSettings: View { @Default(.osdIconColorStyle) var osdIconColorStyle @Default(.enableSystemHUD) var enableSystemHUD + @State private var showAlphaWarning = false @State private var previewValue: CGFloat = 0.65 @State private var previewType: SneakContentType = .volume @@ -4379,15 +4411,22 @@ struct CustomOSDSettings: View { var body: some View { Form { Section { - Toggle("Enable Custom OSD", isOn: $enableCustomOSD) - .settingsHighlight(id: highlightID("Enable Custom OSD")) - .disabled(enableSystemHUD) - .onChange(of: enableCustomOSD) { _, enabled in - if enabled { - // Disable System HUD when OSD is enabled - enableSystemHUD = false + Toggle("Enable Custom OSD", isOn: Binding( + get: { enableCustomOSD }, + set: { newValue in + if newValue && !hasSeenOSDAlphaWarning { + showAlphaWarning = true + } else { + enableCustomOSD = newValue + if newValue { + // Disable System HUD when OSD is enabled + enableSystemHUD = false + } } } + )) + .settingsHighlight(id: highlightID("Enable Custom OSD")) + .disabled(enableSystemHUD) } header: { Text("General") } footer: { @@ -4501,6 +4540,18 @@ struct CustomOSDSettings: View { } } } + .alert("Alpha Feature Warning", isPresented: $showAlphaWarning) { + Button("Cancel", role: .cancel) { + enableCustomOSD = false + } + Button("Enable Anyway") { + hasSeenOSDAlphaWarning = true + enableCustomOSD = true + enableSystemHUD = false + } + } message: { + Text("Custom OSD is an experimental alpha feature and may contain bugs or unexpected behavior.\n\nThis feature requires macOS 15 or later and is still under active development. It's recommended to keep it disabled unless you want to help test it.") + } .navigationTitle("Custom OSD") } } diff --git a/DynamicIsland/models/Constants.swift b/DynamicIsland/models/Constants.swift index 65a6e8d..59eaff6 100644 --- a/DynamicIsland/models/Constants.swift +++ b/DynamicIsland/models/Constants.swift @@ -589,6 +589,7 @@ extension Defaults.Keys { // MARK: Custom OSD Window Feature static let enableCustomOSD = Key("enableCustomOSD", default: false) + static let hasSeenOSDAlphaWarning = Key("hasSeenOSDAlphaWarning", default: false) static let enableOSDVolume = Key("enableOSDVolume", default: true) static let enableOSDBrightness = Key("enableOSDBrightness", default: true) static let enableOSDKeyboardBacklight = Key("enableOSDKeyboardBacklight", default: true)