remove images

splits
Laurent 2 years ago
parent d5ee77128c
commit 63f4327e8c
  1. 24
      LeCountdown/Views/Countdown/CountdownFormView.swift
  2. 4
      LeCountdown/Views/Countdown/NewCountdownView.swift
  3. 14
      LeCountdown/Views/Reusable/SoundFormView.swift
  4. 8
      LeCountdown/Views/Stopwatch/NewStopwatchView.swift
  5. 3
      LeCountdown/Views/Stopwatch/StopwatchFormView.swift

@ -24,7 +24,6 @@ struct CountdownFormView : View {
var nameBinding: Binding<String> var nameBinding: Binding<String>
var durationBinding: Binding<TimeInterval> var durationBinding: Binding<TimeInterval>
var imageBinding: Binding<CoolPic>
var hasRanges: Bool var hasRanges: Bool
@ -56,15 +55,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)
}
}
Section { Section {
Button { Button {
self._addInterval() self._addInterval()
@ -76,6 +66,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)
}
}
} else { } else {
Section(header: Text("Name")) { Section(header: Text("Name")) {
@ -95,9 +94,7 @@ struct CountdownFormView : View {
} }
SoundFormView( SoundFormView(model: self.model)
model: self.model,
imageBinding: self.imageBinding)
} }
.sheet(item: self.$selectedRange) { item in .sheet(item: self.$selectedRange) { item in
RangeFormView(timeRange: item, RangeFormView(timeRange: item,
@ -122,7 +119,6 @@ struct CountdownFormView_Previews: PreviewProvider {
CountdownFormView( CountdownFormView(
nameBinding: .constant(""), nameBinding: .constant(""),
durationBinding: .constant(0.0), durationBinding: .constant(0.0),
imageBinding: .constant(.pic3),
hasRanges: true) hasRanges: true)
.environmentObject(TimerModel()) .environmentObject(TimerModel())
} }

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

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

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

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

Loading…
Cancel
Save