Compare commits

..

No commits in common. '63f4327e8c63fd4d757deab498285408c0733f46' and '977c44eb05cf20da5a9fbcee90987dd5b0248cbf' have entirely different histories.

  1. 2
      LeCountdown/Sound/Sound.swift
  2. 24
      LeCountdown/Views/Countdown/CountdownFormView.swift
  3. 4
      LeCountdown/Views/Countdown/NewCountdownView.swift
  4. 14
      LeCountdown/Views/Reusable/SoundFormView.swift
  5. 10
      LeCountdown/Views/Stopwatch/NewStopwatchView.swift
  6. 3
      LeCountdown/Views/Stopwatch/StopwatchFormView.swift

@ -135,7 +135,7 @@ enum Sound: Int, CaseIterable, Identifiable, Localized {
case trancosoBowl
case natureOceanShore
static var `default`: Sound { .sbSEM_Synths_Loop4_Nothing_Like_You }
static var `default`: Sound { .ESM_Ambient_Game_Menu_Soft_Wood }
var localizedString: String {
switch self {

@ -24,6 +24,7 @@ struct CountdownFormView : View {
var nameBinding: Binding<String>
var durationBinding: Binding<TimeInterval>
var imageBinding: Binding<CoolPic>
var hasRanges: Bool
@ -55,6 +56,15 @@ struct CountdownFormView : View {
}
}
Section {
HStack {
Stepper("Repeat Count", value: self.$model.repeatCount, in: 1...100)
Spacer()
Text(self.model.repeatCount.formatted())
.frame(width: 24.0)
}
}
Section {
Button {
self._addInterval()
@ -66,15 +76,6 @@ struct CountdownFormView : View {
}
}
Section {
HStack {
Stepper("Repeat Count", value: self.$model.repeatCount, in: 1...100)
Spacer()
Text(self.model.repeatCount.formatted())
.frame(width: 24.0)
}
}
} else {
Section(header: Text("Name")) {
@ -94,7 +95,9 @@ struct CountdownFormView : View {
}
SoundFormView(model: self.model)
SoundFormView(
model: self.model,
imageBinding: self.imageBinding)
}
.sheet(item: self.$selectedRange) { item in
RangeFormView(timeRange: item,
@ -119,6 +122,7 @@ struct CountdownFormView_Previews: PreviewProvider {
CountdownFormView(
nameBinding: .constant(""),
durationBinding: .constant(0.0),
imageBinding: .constant(.pic3),
hasRanges: true)
.environmentObject(TimerModel())
}

@ -56,6 +56,7 @@ struct CountdownEditView : View {
@State var duration: TimeInterval = 0.0
// @State var soundRepeatCount: Int16 = 0
@State var image: CoolPic = .pic1
@State var deleteConfirmationShown: Bool = false
@State var activityNameConfirmationShown: Bool = false
@ -105,6 +106,7 @@ struct CountdownEditView : View {
focusedField: _focusedField,
nameBinding: $nameString,
durationBinding: $duration,
imageBinding: $image,
hasRanges: self.hasRanges)
.environmentObject(self.model)
@ -221,6 +223,7 @@ struct CountdownEditView : View {
if let image = countdown.image,
let coolpic = CoolPic(rawValue: image) {
self.image = coolpic
}
}
@ -257,6 +260,7 @@ struct CountdownEditView : View {
cd.order = max
}
cd.image = self.image.rawValue
cd.playableIds = self.model.soundModel.playableIds
cd.setConfirmationSounds(self.model.confirmationSoundModel.sounds)
cd.repeatCount = self.model.repeatCount

@ -11,10 +11,12 @@ struct SoundFormView : View {
var model: TimerModel
var imageBinding: Binding<CoolPic>
// var repeatCountBinding: Binding<Int16>? = nil
var optionalSound: Binding<Bool>? = nil
// @State var imageSelectionSheetShown: Bool = false
@State var imageSelectionSheetShown: Bool = false
var body: some View {
@ -39,11 +41,10 @@ struct SoundFormView : View {
catalog: .confirmation,
title: NSLocalizedString("Start Sound", comment: ""))
}.sheet(isPresented: self.$imageSelectionSheetShown) {
ImageSelectionView(showBinding: self.$imageSelectionSheetShown,
imageBinding: self.imageBinding)
}
// .sheet(isPresented: self.$imageSelectionSheetShown) {
// ImageSelectionView(showBinding: self.$imageSelectionSheetShown,
// imageBinding: self.imageBinding)
// }
}
}
@ -71,7 +72,8 @@ struct SoundImageFormView_Previews: PreviewProvider {
static var previews: some View {
Form {
SoundFormView(model: TimerModel())
SoundFormView(model: TimerModel(),
imageBinding: .constant(.pic1))
}
}
}

@ -45,6 +45,8 @@ struct StopwatchEditView: View {
@State var playSound: Bool = false
@State var image: CoolPic = .pic1
@State var deleteConfirmationShown: Bool = false
@State var activityNameConfirmationShown: Bool = false
@State fileprivate var _rename: Bool? = nil
@ -75,6 +77,7 @@ struct StopwatchEditView: View {
}
}
StopwatchFormView(nameBinding: self.$nameString,
imageBinding: self.$image,
playSoundBinding: self.$playSound).environmentObject(self.model)
.onAppear {
self._onAppear()
@ -146,7 +149,11 @@ struct StopwatchEditView: View {
self.model.soundModel.setPlayables(stopwatch.playables)
self.model.confirmationSoundModel.setPlayables(stopwatch.confirmationPlayables)
if let image = stopwatch.image, let coolpic = CoolPic(rawValue: image) {
self.image = coolpic
}
self._hasLoaded = true
}
@ -178,6 +185,7 @@ struct StopwatchEditView: View {
sw.playableIds = self.model.soundModel.playableIds
sw.confirmationSoundList = self.model.confirmationSoundModel.playableIds
sw.image = self.image.rawValue
if !self.nameString.isEmpty {

@ -16,6 +16,7 @@ struct StopwatchFormView: View {
@FocusState private var focusedField: StopwatchField?
var nameBinding: Binding<String>
var imageBinding: Binding<CoolPic>
var playSoundBinding: Binding<Bool>
@EnvironmentObject var model: TimerModel
@ -33,6 +34,7 @@ struct StopwatchFormView: View {
}
SoundFormView(model: self.model,
imageBinding: imageBinding,
optionalSound: playSoundBinding)
}.toolbar {
@ -55,6 +57,7 @@ struct StopwatchFormView_Previews: PreviewProvider {
static var previews: some View {
StopwatchFormView(
nameBinding: .constant(""),
imageBinding: .constant(.pic1),
playSoundBinding: .constant(true))
.environmentObject(TimerModel())
}

Loading…
Cancel
Save