|
|
|
|
@ -54,6 +54,8 @@ enum Preset: Int, Identifiable, CaseIterable { |
|
|
|
|
case nap |
|
|
|
|
case runningSplits |
|
|
|
|
case toothbrushing |
|
|
|
|
case blackTea |
|
|
|
|
case greenTea |
|
|
|
|
|
|
|
|
|
var localizedName: String { |
|
|
|
|
switch self { |
|
|
|
|
@ -64,6 +66,8 @@ enum Preset: Int, Identifiable, CaseIterable { |
|
|
|
|
case .nap: return NSLocalizedString("Nap", comment: "") |
|
|
|
|
case .runningSplits: return NSLocalizedString("Running splits", comment: "") |
|
|
|
|
case .toothbrushing: return NSLocalizedString("Tooth brushing", comment: "") |
|
|
|
|
case .blackTea: return NSLocalizedString("Black tea", comment: "") |
|
|
|
|
case .greenTea: return NSLocalizedString("Green tea", comment: "") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -87,6 +91,22 @@ enum Preset: Int, Identifiable, CaseIterable { |
|
|
|
|
case .nap: return 20 * 60 |
|
|
|
|
case .runningSplits: return 0.0 |
|
|
|
|
case .toothbrushing: return 2 * 60.0 |
|
|
|
|
case .greenTea: return 3 * 60.0 |
|
|
|
|
case .blackTea: return 4 * 60.0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var sound: Set<Sound> { |
|
|
|
|
switch self { |
|
|
|
|
case .softBoiled: return [] |
|
|
|
|
case .mediumBoiledEggs: return [] |
|
|
|
|
case .hardBoiledEggs: return [] |
|
|
|
|
case .meditation: return [] |
|
|
|
|
case .nap: return [] |
|
|
|
|
case .runningSplits: return [] |
|
|
|
|
case .toothbrushing: return [] |
|
|
|
|
case .blackTea: return [] |
|
|
|
|
case .greenTea: return [] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -106,18 +126,6 @@ enum Preset: Int, Identifiable, CaseIterable { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var sound: Set<Sound> { |
|
|
|
|
switch self { |
|
|
|
|
case .softBoiled: return [] |
|
|
|
|
case .mediumBoiledEggs: return [] |
|
|
|
|
case .hardBoiledEggs: return [] |
|
|
|
|
case .meditation: return [] |
|
|
|
|
case .nap: return [] |
|
|
|
|
case .runningSplits: return [] |
|
|
|
|
case .toothbrushing: return [] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var soundTitle: String { |
|
|
|
|
return "Great sound" |
|
|
|
|
} |
|
|
|
|
@ -183,7 +191,6 @@ struct PresetsView: View { |
|
|
|
|
|
|
|
|
|
Spacer() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.sheet(isPresented: $isPresented, content: { |
|
|
|
|
CountdownEditView(isPresented: $isPresented, preset: self.model.selectedPreset, tabSelection: self.tabSelection) |
|
|
|
|
.environment(\.managedObjectContext, viewContext) |
|
|
|
|
@ -224,6 +231,9 @@ struct PresetsView_Previews: PreviewProvider { |
|
|
|
|
|
|
|
|
|
struct TimerItemView_Previews: PreviewProvider { |
|
|
|
|
static var previews: some View { |
|
|
|
|
TimerItemView(name: "Hard boiled eggs", duration: "10:00", sound: "Stephan Bodzin").frame(width: UIScreen.main.bounds.width / 2.0) |
|
|
|
|
TimerItemView(name: "Hard boiled eggs", |
|
|
|
|
duration: "10:00", |
|
|
|
|
sound: "Stephan Bodzin") |
|
|
|
|
.frame(width: UIScreen.main.bounds.width / 2.0) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|