Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions AudioPriorityBar/Services/PriorityManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,21 @@ class PriorityManager {
}

func unhideDevice(_ device: AudioDevice) {
let key = hiddenKey(for: device)
var hidden = defaults.array(forKey: key) as? [String] ?? []
hidden.removeAll { $0 == device.uid }
defaults.set(hidden, forKey: key)
// For outputs, remove from BOTH hidden category lists so the device
// becomes visible regardless of which mode the user is currently in.
// Otherwise clicking "unhide" in the ignored popover can silently
// land the device in a category whose section is not currently shown.
let keys: [String]
if device.type == .input {
keys = [hiddenMicsKey]
} else {
keys = [hiddenSpeakersKey, hiddenHeadphonesKey]
}
for key in keys {
var hidden = defaults.array(forKey: key) as? [String] ?? []
hidden.removeAll { $0 == device.uid }
defaults.set(hidden, forKey: key)
}
}

func unhideDevice(_ device: AudioDevice, fromCategory category: OutputCategory) {
Expand Down
2 changes: 1 addition & 1 deletion AudioPriorityBar/Views/DeviceListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct DeviceListView: View {

var body: some View {
VStack(spacing: 4) {
ForEach(Array(devices.enumerated()), id: \.element.id) { index, device in
ForEach(Array(devices.enumerated()), id: \.element) { index, device in
DraggableDeviceRow(
device: device,
index: index,
Expand Down
2 changes: 1 addition & 1 deletion AudioPriorityBar/Views/MenuBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ struct HiddenDevicesToggleView: View {
.buttonStyle(.plain)
.popover(isPresented: $isExpanded, arrowEdge: .bottom) {
VStack(alignment: .leading, spacing: 4) {
ForEach(allHiddenDevices, id: \.id) { device in
ForEach(allHiddenDevices, id: \.self) { device in
HiddenDeviceRow(device: device)
}
}
Expand Down