try to fix watch stuff
This commit is contained in:
@@ -13,6 +13,7 @@ extension BridgeModule {
|
||||
currentWorkoutRunTimer = nil
|
||||
currentWorkoutRunTimer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: { timer in
|
||||
self.currentWorkoutRunTimeInSeconds += 1
|
||||
self.sendCurrentExerciseToWatch()
|
||||
})
|
||||
currentWorkoutRunTimer?.fire()
|
||||
}
|
||||
@@ -50,7 +51,6 @@ extension BridgeModule {
|
||||
}
|
||||
}
|
||||
}
|
||||
sendCurrentExerciseToWatch()
|
||||
} else {
|
||||
nextExercise()
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ extension BridgeModule {
|
||||
if let duration = exercise.duration, duration > 0 {
|
||||
self.startExerciseTimerWith(duration: duration)
|
||||
}
|
||||
self.sendCurrentExerciseToWatch()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +103,9 @@ extension BridgeModule {
|
||||
|
||||
func resetCurrentWorkout() {
|
||||
DispatchQueue.main.async {
|
||||
if self.isInWorkout {
|
||||
self.sendWorkoutCompleteToWatch()
|
||||
}
|
||||
self.currentWorkoutRunTimeInSeconds = 0
|
||||
self.currentWorkoutRunTimer?.invalidate()
|
||||
self.currentWorkoutRunTimer = nil
|
||||
|
||||
@@ -42,6 +42,7 @@ struct ExternalWorkoutDetailView: View {
|
||||
ExtCountdownView()
|
||||
.padding(.leading, 50)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
if extShowNextVideo && extThotStyle != .off {
|
||||
PlayerView(player: $smallAVPlayer)
|
||||
.frame(width: metrics.size.width * 0.2,
|
||||
@@ -60,6 +61,34 @@ struct ExternalWorkoutDetailView: View {
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.scaledToFill()
|
||||
}
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||
Text(" \(Double(bridgeModule.currentWorkoutRunTimeInSeconds).asString(style: .positional)) ")
|
||||
.font(Font.system(size: 120))
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding()
|
||||
.bold()
|
||||
.foregroundColor(.white)
|
||||
.background(
|
||||
Capsule()
|
||||
.strokeBorder(Color.black, lineWidth: 0.8)
|
||||
.background(Color(uiColor: UIColor(red: 148/255,
|
||||
green: 0,
|
||||
blue: 211/255,
|
||||
alpha: 0.5)))
|
||||
.clipped()
|
||||
)
|
||||
.clipShape(Capsule())
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading, 50)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
}
|
||||
.onChange(of: bridgeModule.isInWorkout, perform: { _ in
|
||||
playVideos()
|
||||
|
||||
@@ -176,9 +176,8 @@ struct WorkoutDetailView: View {
|
||||
bridgeModule.completedWorkout = {
|
||||
if let workoutData = createWorkoutData() {
|
||||
workoutComplete = .completedWorkout(workoutData)
|
||||
} else {
|
||||
bridgeModule.resetCurrentWorkout()
|
||||
}
|
||||
bridgeModule.resetCurrentWorkout()
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(
|
||||
|
||||
@@ -21,16 +21,6 @@ struct ExtCountdownView: View {
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||
Text("\(Double(bridgeModule.currentWorkoutRunTimeInSeconds).asString(style: .positional))")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
}
|
||||
.frame(height: metrics.size.height * 0.5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user