Feature: Media Panel Disable in standard mode

This commit is contained in:
Hariharan Mudaliar 2026-01-28 03:03:25 +05:30
commit f425b38a81
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
8 changed files with 240 additions and 6 deletions

View file

@ -383,6 +383,7 @@ struct NotchHomeView: View {
@ObservedObject var batteryModel = BatteryStatusViewModel.shared
@ObservedObject var coordinator = DynamicIslandViewCoordinator.shared
@ObservedObject private var extensionNotchExperienceManager = ExtensionNotchExperienceManager.shared
@Default(.showStandardMediaControls) private var showStandardMediaControls
let albumArtNamespace: Namespace.ID
var body: some View {
@ -407,8 +408,10 @@ struct NotchHomeView: View {
}
} else {
// Normal mode: Show full music player with optional calendar and webcam
MusicPlayerView(albumArtNamespace: albumArtNamespace)
.frame(maxWidth: .infinity, alignment: .leading)
if showStandardMediaControls {
MusicPlayerView(albumArtNamespace: albumArtNamespace)
.frame(maxWidth: .infinity, alignment: .leading)
}
if Defaults[.showCalendar] {
CalendarView()

View file

@ -1964,11 +1964,16 @@ struct Media: View {
@Default(.lockScreenGlassStyle) private var lockScreenGlassStyle
@Default(.lockScreenGlassCustomizationMode) private var lockScreenGlassCustomizationMode
@Default(.lockScreenMusicAlbumParallaxEnabled) private var lockScreenMusicAlbumParallaxEnabled
@Default(.showStandardMediaControls) private var showStandardMediaControls
private func highlightID(_ title: String) -> String {
SettingsTab.media.highlightID(for: title)
}
private var standardControlsSuppressed: Bool {
!showStandardMediaControls && !enableMinimalisticUI
}
var body: some View {
Form {
Section {
@ -2002,6 +2007,23 @@ struct Media: View {
.font(.caption)
}
}
Section {
Defaults.Toggle("Show media controls in Dynamic Island", key: .showStandardMediaControls)
.disabled(enableMinimalisticUI)
.settingsHighlight(id: highlightID("Show media controls in Dynamic Island"))
if enableMinimalisticUI {
Text("Disable Minimalistic UI to configure the standard notch media controls.")
.font(.caption)
.foregroundStyle(.secondary)
} else if standardControlsSuppressed {
Text("Standard notch media controls are hidden. Re-enable the toggle above to restore them.")
.font(.caption)
.foregroundStyle(.secondary)
}
} header: {
Text("Dynamic Island Visibility")
}
Section {
Defaults.Toggle(key: .showShuffleAndRepeat) {
HStack {
@ -2053,11 +2075,13 @@ struct Media: View {
"Enable music live activity",
isOn: $coordinator.musicLiveActivityEnabled.animation()
)
.disabled(standardControlsSuppressed)
.help(standardControlsSuppressed ? "Standard notch media controls are hidden while this toggle is off." : "")
Defaults.Toggle(
"Show floating media controls",
key: .musicControlWindowEnabled
)
.disabled(!coordinator.musicLiveActivityEnabled)
.disabled(!coordinator.musicLiveActivityEnabled || standardControlsSuppressed)
.help("Displays play/pause and skip buttons beside the notch while music is active. Disabled by default.")
Toggle("Enable sneak peek", isOn: $enableSneakPeek)
Toggle("Show sneak peek on playback changes", isOn: $showSneakPeekOnTrackChange)
@ -2124,6 +2148,8 @@ struct Media: View {
} footer: {
Text("These controls mirror the Lock Screen tab so you can tune the media overlay while focusing on playback settings.")
}
.disabled(!showStandardMediaControls)
.opacity(showStandardMediaControls ? 1 : 0.5)
Picker(selection: $hideNotchOption, label:
HStack {
@ -3301,6 +3327,7 @@ struct LockScreenSettings: View {
@Default(.lockScreenWeatherShowsAQI) private var lockScreenWeatherShowsAQI
@Default(.lockScreenWeatherShowsSunrise) private var lockScreenWeatherShowsSunrise
@Default(.lockScreenWeatherAQIScale) private var lockScreenWeatherAQIScale
@Default(.showStandardMediaControls) private var showStandardMediaControls
private func highlightID(_ title: String) -> String {
SettingsTab.lockScreen.highlightID(for: title)
@ -3422,11 +3449,20 @@ struct LockScreenSettings: View {
.opacity(enableLockScreenMediaWidget ? 1 : 0.5)
.settingsHighlight(id: highlightID("Enable media panel blur"))
}
if !showStandardMediaControls {
Text("Enable Dynamic Island media controls to manage the lock screen panel.")
.font(.caption)
.foregroundStyle(.secondary)
.frame(maxWidth: .infinity, alignment: .leading)
}
} header: {
Text("Media Panel")
} footer: {
Text("Enable and style the media controls that appear above the system clock when the screen is locked.")
}
.disabled(!showStandardMediaControls)
.opacity(showStandardMediaControls ? 1 : 0.5)
Section {
Defaults.Toggle("Show lock screen timer", key: .enableLockScreenTimerWidget)

View file

@ -36,12 +36,18 @@ struct TabSelectionView: View {
@Default(.enableThirdPartyExtensions) private var enableThirdPartyExtensions
@Default(.enableExtensionNotchExperiences) private var enableExtensionNotchExperiences
@Default(.enableExtensionNotchTabs) private var enableExtensionNotchTabs
@Default(.showCalendar) private var showCalendar
@Default(.showMirror) private var showMirror
@Default(.showStandardMediaControls) private var showStandardMediaControls
@Default(.enableMinimalisticUI) private var enableMinimalisticUI
@Namespace var animation
private var tabs: [TabModel] {
var tabsArray: [TabModel] = []
tabsArray.append(TabModel(label: "Home", icon: "house.fill", view: .home))
if homeTabVisible {
tabsArray.append(TabModel(label: "Home", icon: "house.fill", view: .home))
}
if Defaults[.dynamicShelf] {
tabsArray.append(TabModel(label: "Shelf", icon: "tray.fill", view: .shelf))
@ -77,7 +83,9 @@ struct TabSelectionView: View {
)
}
}
DispatchQueue.main.async {
ensureValidSelection(with: tabsArray)
}
return tabsArray
}
var body: some View {
@ -121,6 +129,13 @@ struct TabSelectionView: View {
extensionNotchExperienceManager.activeExperiences.filter { $0.descriptor.tab != nil }
}
private var homeTabVisible: Bool {
if enableMinimalisticUI {
return true
}
return showStandardMediaControls || showCalendar || showMirror
}
private func isSelected(_ tab: TabModel) -> Bool {
if tab.view == .extensionExperience {
return coordinator.currentView == .extensionExperience
@ -128,6 +143,20 @@ struct TabSelectionView: View {
}
return coordinator.currentView == tab.view
}
private func ensureValidSelection(with tabs: [TabModel]) {
guard !tabs.isEmpty else { return }
if tabs.contains(where: { isSelected($0) }) {
return
}
guard let first = tabs.first else { return }
if first.view == .extensionExperience {
coordinator.selectedExtensionExperienceID = first.experienceID
} else {
coordinator.selectedExtensionExperienceID = nil
}
coordinator.currentView = first.view
}
}
#Preview {