@@ -104,8 +104,6 @@ struct ContentView: View {
104104 @EnvironmentObject var settingsModel : SettingsModel
105105 @State private var animationProgress : CGFloat = 0
106106 @State private var breathingPhase : BreathingPhase = . inhale
107- @State private var overlayOpacity : Double = 0.1
108- @State private var showSettings = false
109107 @State private var cycleCount : Int = 0
110108 @State private var cachedMaxCircleScale : CGFloat = 1
111109 @State private var animationSessionIdentifier : Int = 0
@@ -203,18 +201,24 @@ struct ContentView: View {
203201 let blurRadius = useGradient ? borderUnit * 2 : 0 as CGFloat
204202
205203 Group {
206- ForEach ( [ true , false ] , id: \. self) { rightSide in
207- // Trail glow (fills behind the sweep front)
208- HalfPerimeterShape ( rightSide: rightSide)
209- . trim ( from: trailFrom, to: trailTo)
210- . stroke ( phaseColor, style: StrokeStyle ( lineWidth: strokeWidth, lineCap: . butt) )
211- . opacity ( 0.25 )
212- // Leading band (bright sweep at the front)
213- HalfPerimeterShape ( rightSide: rightSide)
214- . trim ( from: bandFrom, to: bandTo)
215- . stroke ( phaseColor, style: StrokeStyle ( lineWidth: strokeWidth, lineCap: . butt) )
216- . opacity ( 0.8 )
217- }
204+ // Trail glow (fills behind the sweep front)
205+ HalfPerimeterShape ( rightSide: true )
206+ . trim ( from: trailFrom, to: trailTo)
207+ . stroke ( phaseColor, style: StrokeStyle ( lineWidth: strokeWidth, lineCap: . butt) )
208+ . opacity ( 0.25 )
209+ HalfPerimeterShape ( rightSide: false )
210+ . trim ( from: trailFrom, to: trailTo)
211+ . stroke ( phaseColor, style: StrokeStyle ( lineWidth: strokeWidth, lineCap: . butt) )
212+ . opacity ( 0.25 )
213+ // Leading band (bright sweep at the front)
214+ HalfPerimeterShape ( rightSide: true )
215+ . trim ( from: bandFrom, to: bandTo)
216+ . stroke ( phaseColor, style: StrokeStyle ( lineWidth: strokeWidth, lineCap: . butt) )
217+ . opacity ( 0.8 )
218+ HalfPerimeterShape ( rightSide: false )
219+ . trim ( from: bandFrom, to: bandTo)
220+ . stroke ( phaseColor, style: StrokeStyle ( lineWidth: strokeWidth, lineCap: . butt) )
221+ . opacity ( 0.8 )
218222 }
219223 . blur ( radius: blurRadius)
220224 . opacity ( rippleOpacity)
@@ -223,38 +227,6 @@ struct ContentView: View {
223227 }
224228 }
225229
226- if showSettings {
227- SettingsView (
228- showSettings: $showSettings,
229- inhaleColor: $settingsModel. inhaleColor,
230- exhaleColor: $settingsModel. exhaleColor,
231- backgroundColor: $settingsModel. backgroundColor,
232- colorFillType: $settingsModel. colorFillGradient,
233- inhaleDuration: $settingsModel. inhaleDuration,
234- postInhaleHoldDuration: $settingsModel. postInhaleHoldDuration,
235- exhaleDuration: $settingsModel. exhaleDuration,
236- postExhaleHoldDuration: $settingsModel. postExhaleHoldDuration,
237- drift: $settingsModel. drift,
238- overlayOpacity: $overlayOpacity,
239- shape: Binding < AnimationShape > (
240- get: { self . settingsModel. shape } ,
241- set: { self . settingsModel. shape = $0 }
242- ) ,
243- animationMode: Binding < AnimationMode > (
244- get: { self . settingsModel. animationMode } ,
245- set: { self . settingsModel. animationMode = $0 }
246- ) ,
247- randomizedTimingInhale: $settingsModel. randomizedTimingInhale,
248- randomizedTimingPostInhaleHold: $settingsModel. randomizedTimingPostInhaleHold,
249- randomizedTimingExhale: $settingsModel. randomizedTimingExhale,
250- randomizedTimingPostExhaleHold: $settingsModel. randomizedTimingPostExhaleHold,
251- holdRippleMode: $settingsModel. holdRippleMode,
252- isAnimating: $settingsModel. isAnimating,
253- appVisibility: $settingsModel. appVisibility,
254- reminderIntervalMinutes: $settingsModel. reminderIntervalMinutes,
255- autoStopMinutes: $settingsModel. autoStopMinutes
256- )
257- }
258230 }
259231 . onAppear {
260232 cachedMaxCircleScale = Self . getMaxCircleScale ( )
@@ -276,11 +248,9 @@ struct ContentView: View {
276248 resumeBreathingCycle ( )
277249 }
278250 }
279- . onChange ( of: settingsModel. resetAnimation) { newValue in
280- if newValue {
281- resetAnimation ( )
282- startBreathingCycle ( )
283- }
251+ . onReceive ( settingsModel. resetAnimationSignal) { _ in
252+ resetAnimation ( )
253+ startBreathingCycle ( )
284254 }
285255 . onChange ( of: settingsModel. shape) { _ in
286256 guard settingsModel. isAnimating && !settingsModel. isPaused else { return }
0 commit comments