add details to phone workout view
This commit is contained in:
@@ -12,6 +12,6 @@ enum BaseURLs: String {
|
|||||||
case dev = "https://dev.werkout.fitness"
|
case dev = "https://dev.werkout.fitness"
|
||||||
|
|
||||||
static var currentBaseURL: String {
|
static var currentBaseURL: String {
|
||||||
return BaseURLs.dev.rawValue
|
return BaseURLs.local.rawValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class BridgeModule: NSObject, ObservableObject {
|
|||||||
// tells the watch app to stop the workout
|
// tells the watch app to stop the workout
|
||||||
public private(set) var workoutEndDate: Date?
|
public private(set) var workoutEndDate: Date?
|
||||||
@Published public private(set) var healthKitUUID: UUID?
|
@Published public private(set) var healthKitUUID: UUID?
|
||||||
|
@Published var isPaused = false
|
||||||
|
|
||||||
var audioPlayer: AVAudioPlayer?
|
var audioPlayer: AVAudioPlayer?
|
||||||
var avPlayer: AVPlayer?
|
var avPlayer: AVPlayer?
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ class BridgeModule: NSObject, ObservableObject {
|
|||||||
currentWorkoutRunTimeInSeconds = 0
|
currentWorkoutRunTimeInSeconds = 0
|
||||||
currentWorkoutRunTimer?.invalidate()
|
currentWorkoutRunTimer?.invalidate()
|
||||||
currentWorkoutRunTimer = nil
|
currentWorkoutRunTimer = nil
|
||||||
|
isPaused = false
|
||||||
|
|
||||||
if let superetExercise = currentExerciseInfo.currentExercise {
|
if let superetExercise = currentExerciseInfo.currentExercise {
|
||||||
updateCurrent(exercise: superetExercise)
|
updateCurrent(exercise: superetExercise)
|
||||||
@@ -161,7 +163,9 @@ class BridgeModule: NSObject, ObservableObject {
|
|||||||
if let _ = currentExerciseTimer {
|
if let _ = currentExerciseTimer {
|
||||||
currentExerciseTimer?.invalidate()
|
currentExerciseTimer?.invalidate()
|
||||||
currentExerciseTimer = nil
|
currentExerciseTimer = nil
|
||||||
|
isPaused = true
|
||||||
} else {
|
} else {
|
||||||
|
isPaused = false
|
||||||
startExerciseTimerWith(duration: currentExerciseTimeLeft)
|
startExerciseTimerWith(duration: currentExerciseTimeLeft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,22 @@ class CurrentWorkoutInfo {
|
|||||||
return workout?.supersets?.sorted(by: { $0.order < $1.order }) ?? [Superset]()
|
return workout?.supersets?.sorted(by: { $0.order < $1.order }) ?? [Superset]()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var numberOfRoundsInCurrentSuperSet: Int {
|
||||||
|
guard let workout = workout else { return -1 }
|
||||||
|
guard let supersets = workout.supersets else { return -1 }
|
||||||
|
|
||||||
|
if supersetIndex >= supersets.count {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
let currentSuperSet = supersets[supersetIndex]
|
||||||
|
|
||||||
|
if exerciseIndex >= currentSuperSet.exercises.count {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentSuperSet.rounds
|
||||||
|
}
|
||||||
|
|
||||||
var currentExercise: SupersetExercise? {
|
var currentExercise: SupersetExercise? {
|
||||||
guard let supersets = workout?.supersets else { return nil }
|
guard let supersets = workout?.supersets else { return nil }
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ struct ExternalWorkoutDetailView: View {
|
|||||||
ExtExerciseList(workout: workout,
|
ExtExerciseList(workout: workout,
|
||||||
allSupersetExecerciseIndex: bridgeModule.currentExerciseInfo.allSupersetExecerciseIndex)
|
allSupersetExecerciseIndex: bridgeModule.currentExerciseInfo.allSupersetExecerciseIndex)
|
||||||
|
|
||||||
if let currentExercisePositionString = bridgeModule.currentExercisePositionString {
|
// if let currentExercisePositionString = bridgeModule.currentExercisePositionString {
|
||||||
Text(currentExercisePositionString)
|
// Text(currentExercisePositionString)
|
||||||
.font(Font.system(size: 75))
|
// .font(Font.system(size: 75))
|
||||||
.scaledToFit()
|
// .scaledToFit()
|
||||||
.minimumScaleFactor(0.01)
|
// .minimumScaleFactor(0.01)
|
||||||
.lineLimit(1)
|
// .lineLimit(1)
|
||||||
.padding()
|
// .padding()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
.frame(width: metrics.size.width * 0.4, height: metrics.size.height * 0.8)
|
.frame(width: metrics.size.width * 0.4, height: metrics.size.height * 0.8)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,12 +70,17 @@ struct ActionsView: View {
|
|||||||
Button(action: {
|
Button(action: {
|
||||||
bridgeModule.pauseWorkout()
|
bridgeModule.pauseWorkout()
|
||||||
}, label: {
|
}, label: {
|
||||||
Image(systemName: "pause.circle.fill")
|
bridgeModule.isPaused ?
|
||||||
.font(.title)
|
Image(systemName: "play.circle.fill")
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.font(.title)
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
|
:
|
||||||
|
Image(systemName: "pause.circle.fill")
|
||||||
|
.font(.title)
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
})
|
})
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.background(.yellow)
|
.background(bridgeModule.isPaused ? .mint : .yellow)
|
||||||
.foregroundColor(.white)
|
.foregroundColor(.white)
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
|
|||||||
@@ -89,6 +89,23 @@ struct WorkoutDetailView: View {
|
|||||||
InfoView(workout: workout)
|
InfoView(workout: workout)
|
||||||
.padding(.bottom)
|
.padding(.bottom)
|
||||||
|
|
||||||
|
if bridgeModule.isInWorkout {
|
||||||
|
Divider()
|
||||||
|
HStack {
|
||||||
|
Text("Round \(bridgeModule.currentExerciseInfo.currentRound) of \(bridgeModule.currentExerciseInfo.numberOfRoundsInCurrentSuperSet)")
|
||||||
|
.font(.title3)
|
||||||
|
.lineLimit(1)
|
||||||
|
.padding()
|
||||||
|
.bold()
|
||||||
|
|
||||||
|
Text("Current: \(bridgeModule.currentExerciseInfo.allSupersetExecerciseIndex+1) of \(bridgeModule.currentExerciseInfo.workout?.allSupersetExecercise?.count ?? -99)")
|
||||||
|
.font(.title3)
|
||||||
|
.lineLimit(1)
|
||||||
|
.padding()
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExerciseListView(workout: workout, showExecersizeInfo: $showExecersizeInfo)
|
ExerciseListView(workout: workout, showExecersizeInfo: $showExecersizeInfo)
|
||||||
|
|
||||||
ActionsView(completedWorkout: {
|
ActionsView(completedWorkout: {
|
||||||
|
|||||||
Reference in New Issue
Block a user