WIP
This commit is contained in:
@@ -93,15 +93,17 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
}
|
||||
|
||||
private func startTimerWith(duration: Int) {
|
||||
timer?.invalidate()
|
||||
timer = nil
|
||||
timeLeft = duration
|
||||
timer = Timer.scheduledTimer(timeInterval: 1,
|
||||
target: self,
|
||||
selector: #selector(updateCounter),
|
||||
userInfo: nil,
|
||||
repeats: true)
|
||||
timer?.fire()
|
||||
DispatchQueue.main.async {
|
||||
self.timer?.invalidate()
|
||||
self.timer = nil
|
||||
self.timeLeft = duration
|
||||
self.timer = Timer.scheduledTimer(timeInterval: 1,
|
||||
target: self,
|
||||
selector: #selector(self.updateCounter),
|
||||
userInfo: nil,
|
||||
repeats: true)
|
||||
self.timer?.fire()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func updateCounter() {
|
||||
@@ -137,10 +139,12 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
}
|
||||
|
||||
func updateCurrent(exercise: ExerciseElement) {
|
||||
self.currentExercise = exercise
|
||||
|
||||
if let duration = exercise.duration {
|
||||
startTimerWith(duration: duration)
|
||||
DispatchQueue.main.async {
|
||||
self.currentExercise = exercise
|
||||
|
||||
if let duration = exercise.duration {
|
||||
self.startTimerWith(duration: duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ struct AllWorkoutsView: View {
|
||||
fatalError("shit broke")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
fatalError("shit broke")
|
||||
}
|
||||
} else {
|
||||
showLoginView = true
|
||||
|
||||
Reference in New Issue
Block a user