Skip to content
Merged
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
48 changes: 27 additions & 21 deletions LoopFollow/Alarm/AlarmEditing/Components/AlarmAudioSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,39 @@ private struct TonePickerSheet: View {

var body: some View {
NavigationView {
List {
ForEach(SoundFile.allCases) { tone in
Button {
selected = tone
AlarmSound.setSoundFile(str: tone.rawValue)
AlarmSound.stop()
AlarmSound.playTest()
} label: {
HStack {
Text(tone.displayName)
if tone == selected {
Spacer()
Image(systemName: "checkmark")
.foregroundColor(.accentColor)
ScrollViewReader { proxy in
List {
ForEach(SoundFile.allCases) { tone in
Button {
selected = tone
AlarmSound.setSoundFile(str: tone.rawValue)
AlarmSound.stop()
AlarmSound.playTest()
} label: {
HStack {
Text(tone.displayName)
if tone == selected {
Spacer()
Image(systemName: "checkmark")
.foregroundColor(.accentColor)
}
}
}
.id(tone)
}
}
}
.navigationTitle("Choose Tone")
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Done") {
AlarmSound.stop()
dismiss()
.navigationTitle("Choose Tone")
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Done") {
AlarmSound.stop()
dismiss()
}
}
}
.onAppear {
proxy.scrollTo(selected, anchor: .center)
}
}
}
}
Expand Down