|
|
|
|
@ -63,14 +63,14 @@ enum Preset: Int, Identifiable, CaseIterable { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var intervalGroup: CountdownIntervalGroup? { |
|
|
|
|
var intervalGroup: CountdownIntervalGroup { |
|
|
|
|
switch self { |
|
|
|
|
case .runningSplits: |
|
|
|
|
let runInterval = CountdownInterval(duration: 30.0, sound: Sound.sbArpeggio_Loop_River) |
|
|
|
|
let breakInterval = CountdownInterval(duration: 30.0, sound: Sound.sbLoop_ToneSD_Boavista) |
|
|
|
|
return CountdownIntervalGroup(repeatCount: 8, intervals: [runInterval, breakInterval]) |
|
|
|
|
default: |
|
|
|
|
return nil |
|
|
|
|
return CountdownIntervalGroup(repeatCount: 0, intervals: [CountdownInterval(duration: self.duration)]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -86,13 +86,17 @@ enum Preset: Int, Identifiable, CaseIterable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var formattedDuration: String { |
|
|
|
|
if let group = self.intervalGroup { |
|
|
|
|
let count = group.repeatCount.formatted() |
|
|
|
|
let durations = group.intervals.map { $0.duration.formatted() } |
|
|
|
|
let formattedIntervals = durations.joined(separator: "/") |
|
|
|
|
let group = self.intervalGroup |
|
|
|
|
let count = group.repeatCount.formatted() |
|
|
|
|
let durations = group.intervals.map { $0.duration.minuteSecond } |
|
|
|
|
let formattedIntervals = durations.joined(separator: "/") |
|
|
|
|
|
|
|
|
|
if group.repeatCount > 1 { |
|
|
|
|
return "\(count) * [\(formattedIntervals)]" |
|
|
|
|
} else if durations.count > 1 { |
|
|
|
|
return "[\(formattedIntervals)]" |
|
|
|
|
} else { |
|
|
|
|
return self.duration.minuteSecond |
|
|
|
|
return formattedIntervals |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
@ -137,7 +141,7 @@ struct PresetsView: View { |
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
|
|
|
|
|
VStack { |
|
|
|
|
ScrollView { |
|
|
|
|
|
|
|
|
|
Text("You can edit the duration, sound and label before adding") |
|
|
|
|
.padding() |
|
|
|
|
@ -197,7 +201,7 @@ struct TimerItemView: View { |
|
|
|
|
Text(sound.uppercased()).foregroundColor(Color(white: 0.7)) |
|
|
|
|
}.padding() |
|
|
|
|
Spacer() |
|
|
|
|
}.background(Color(white: 0.15)) |
|
|
|
|
}.background(Color(white: 0.1)) |
|
|
|
|
.cornerRadius(16.0) |
|
|
|
|
.monospaced() |
|
|
|
|
.font(Font.system(size: 16.0, weight: .semibold)) |
|
|
|
|
|