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