Skip to content

Commit

Permalink
Resolved issue with intervals skipping repeats after the first
Browse files Browse the repository at this point in the history
  • Loading branch information
deb761 committed Nov 9, 2017
1 parent ae52f99 commit 41d12b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
22 changes: 11 additions & 11 deletions Trainer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSLocationAlwaysUsageDescription</key>
<string>Location is used to determine distance traveled</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Location is used to determine distance traveled</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is used to determine distance traveled</string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand All @@ -27,9 +17,19 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>4</string>
<string>5</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Location is used to determine distance traveled</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Location is used to determine distance traveled</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is used to determine distance traveled</string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
16 changes: 7 additions & 9 deletions Trainer/TrackWorkout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class TrackWorkout {
running = true
phaseNum = 0
currentPhase = phases[phaseNum]
time = 0.0

if let time = at {
startTime = time
Expand Down Expand Up @@ -167,32 +168,29 @@ class TrackWorkout {
timeStamp = now
currentPhase = phases[phaseNum]
var phaseChanged:Bool = false
while running {
//while running {
currentPhase!.addDistance(distance: distance)
if !currentPhase!.ended {
break
return
}
if phaseNum + 1 < phases.count {
phaseNum += 1
currentPhase = phases[phaseNum]
if let endTime = currentPhase!.endTime {
currentPhase!.start()
if endTime.timeIntervalSinceNow > 0.0 {
currentPhase!.startAt(Date())
updateEndTime()
updateEndTime()
}
}
else {
currentPhase!.start()
}
phaseChanged = true
}
else {
// workout is over
running = false
delegate.processComplete()
break
//break
}
}
//}
if phaseChanged {
delegate.processPhaseChange()
}
Expand Down

0 comments on commit 41d12b0

Please sign in to comment.