From 63f4327e8c63fd4d757deab498285408c0733f46 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 29 Nov 2023 10:32:03 +0100 Subject: [PATCH] remove images --- .../Views/Countdown/CountdownFormView.swift | 24 ++++++++----------- .../Views/Countdown/NewCountdownView.swift | 4 ---- .../Views/Reusable/SoundFormView.swift | 14 +++++------ .../Views/Stopwatch/NewStopwatchView.swift | 10 +------- .../Views/Stopwatch/StopwatchFormView.swift | 3 --- 5 files changed, 17 insertions(+), 38 deletions(-) diff --git a/LeCountdown/Views/Countdown/CountdownFormView.swift b/LeCountdown/Views/Countdown/CountdownFormView.swift index 8acaf28..a0da34e 100644 --- a/LeCountdown/Views/Countdown/CountdownFormView.swift +++ b/LeCountdown/Views/Countdown/CountdownFormView.swift @@ -24,7 +24,6 @@ struct CountdownFormView : View { var nameBinding: Binding var durationBinding: Binding - var imageBinding: Binding 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 { Button { 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 { Section(header: Text("Name")) { @@ -95,9 +94,7 @@ struct CountdownFormView : View { } - SoundFormView( - model: self.model, - imageBinding: self.imageBinding) + SoundFormView(model: self.model) } .sheet(item: self.$selectedRange) { item in RangeFormView(timeRange: item, @@ -122,7 +119,6 @@ struct CountdownFormView_Previews: PreviewProvider { CountdownFormView( nameBinding: .constant(""), durationBinding: .constant(0.0), - imageBinding: .constant(.pic3), hasRanges: true) .environmentObject(TimerModel()) } diff --git a/LeCountdown/Views/Countdown/NewCountdownView.swift b/LeCountdown/Views/Countdown/NewCountdownView.swift index c1158ff..ec8ada1 100644 --- a/LeCountdown/Views/Countdown/NewCountdownView.swift +++ b/LeCountdown/Views/Countdown/NewCountdownView.swift @@ -56,7 +56,6 @@ 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 @@ -106,7 +105,6 @@ struct CountdownEditView : View { focusedField: _focusedField, nameBinding: $nameString, durationBinding: $duration, - imageBinding: $image, hasRanges: self.hasRanges) .environmentObject(self.model) @@ -223,7 +221,6 @@ struct CountdownEditView : View { if let image = countdown.image, let coolpic = CoolPic(rawValue: image) { - self.image = coolpic } } @@ -260,7 +257,6 @@ 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 diff --git a/LeCountdown/Views/Reusable/SoundFormView.swift b/LeCountdown/Views/Reusable/SoundFormView.swift index 34ce72f..a1fe059 100644 --- a/LeCountdown/Views/Reusable/SoundFormView.swift +++ b/LeCountdown/Views/Reusable/SoundFormView.swift @@ -11,12 +11,10 @@ struct SoundFormView : View { var model: TimerModel - var imageBinding: Binding - // var repeatCountBinding: Binding? = nil var optionalSound: Binding? = nil - @State var imageSelectionSheetShown: Bool = false +// @State var imageSelectionSheetShown: Bool = false var body: some View { @@ -41,10 +39,11 @@ 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) +// } } } @@ -72,8 +71,7 @@ struct SoundImageFormView_Previews: PreviewProvider { static var previews: some View { Form { - SoundFormView(model: TimerModel(), - imageBinding: .constant(.pic1)) + SoundFormView(model: TimerModel()) } } } diff --git a/LeCountdown/Views/Stopwatch/NewStopwatchView.swift b/LeCountdown/Views/Stopwatch/NewStopwatchView.swift index b7cd764..5f0a86b 100644 --- a/LeCountdown/Views/Stopwatch/NewStopwatchView.swift +++ b/LeCountdown/Views/Stopwatch/NewStopwatchView.swift @@ -45,8 +45,6 @@ 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 @@ -77,7 +75,6 @@ struct StopwatchEditView: View { } } StopwatchFormView(nameBinding: self.$nameString, - imageBinding: self.$image, playSoundBinding: self.$playSound).environmentObject(self.model) .onAppear { self._onAppear() @@ -149,11 +146,7 @@ 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 } @@ -185,7 +178,6 @@ struct StopwatchEditView: View { sw.playableIds = self.model.soundModel.playableIds sw.confirmationSoundList = self.model.confirmationSoundModel.playableIds - sw.image = self.image.rawValue if !self.nameString.isEmpty { diff --git a/LeCountdown/Views/Stopwatch/StopwatchFormView.swift b/LeCountdown/Views/Stopwatch/StopwatchFormView.swift index d51e431..8c27a39 100644 --- a/LeCountdown/Views/Stopwatch/StopwatchFormView.swift +++ b/LeCountdown/Views/Stopwatch/StopwatchFormView.swift @@ -16,7 +16,6 @@ struct StopwatchFormView: View { @FocusState private var focusedField: StopwatchField? var nameBinding: Binding - var imageBinding: Binding var playSoundBinding: Binding @EnvironmentObject var model: TimerModel @@ -34,7 +33,6 @@ struct StopwatchFormView: View { } SoundFormView(model: self.model, - imageBinding: imageBinding, optionalSound: playSoundBinding) }.toolbar { @@ -57,7 +55,6 @@ struct StopwatchFormView_Previews: PreviewProvider { static var previews: some View { StopwatchFormView( nameBinding: .constant(""), - imageBinding: .constant(.pic1), playSoundBinding: .constant(true)) .environmentObject(TimerModel()) }