WIP
This commit is contained in:
@@ -104,3 +104,20 @@ extension Bundle {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension Double {
|
||||||
|
/*
|
||||||
|
10000.asString(style: .positional) // 2:46:40
|
||||||
|
10000.asString(style: .abbreviated) // 2h 46m 40s
|
||||||
|
10000.asString(style: .short) // 2 hr, 46 min, 40 sec
|
||||||
|
10000.asString(style: .full) // 2 hours, 46 minutes, 40 seconds
|
||||||
|
10000.asString(style: .spellOut) // two hours, forty-six minutes, forty seconds
|
||||||
|
10000.asString(style: .brief) // 2hr 46min 40sec
|
||||||
|
*/
|
||||||
|
func asString(style: DateComponentsFormatter.UnitsStyle) -> String {
|
||||||
|
let formatter = DateComponentsFormatter()
|
||||||
|
formatter.allowedUnits = [.hour, .minute, .second, .nanosecond]
|
||||||
|
formatter.unitsStyle = style
|
||||||
|
return formatter.string(from: self) ?? ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,12 +20,15 @@ struct ExternalWorkoutDetailView: View {
|
|||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
PlayerView(player: $avPlayer)
|
PlayerView(player: $avPlayer)
|
||||||
.frame(width: metrics.size.width * 0.6, height: metrics.size.height * 0.8)
|
.frame(width: metrics.size.width * 0.5, height: metrics.size.height * 0.8)
|
||||||
.onAppear{
|
.onAppear{
|
||||||
avPlayer.play()
|
avPlayer.play()
|
||||||
}
|
}
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
|
ExtExerciseList(workout: workout,
|
||||||
|
currentExerciseIdx: bridgeModule.currentExerciseIdx)
|
||||||
|
|
||||||
if let currentExercisePositionString = bridgeModule.currentExercisePositionString {
|
if let currentExercisePositionString = bridgeModule.currentExercisePositionString {
|
||||||
Text(currentExercisePositionString)
|
Text(currentExercisePositionString)
|
||||||
.font(Font.system(size: 75))
|
.font(Font.system(size: 75))
|
||||||
@@ -34,10 +37,8 @@ struct ExternalWorkoutDetailView: View {
|
|||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
ExtExerciseList(workout: workout,
|
|
||||||
currentExerciseIdx: bridgeModule.currentExerciseIdx)
|
|
||||||
}
|
}
|
||||||
.frame(width: metrics.size.width * 0.3, height: metrics.size.height * 0.8)
|
.frame(width: metrics.size.width * 0.4, height: metrics.size.height * 0.8)
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtCountdownView()
|
ExtCountdownView()
|
||||||
@@ -121,7 +122,6 @@ struct ExtExerciseList: View {
|
|||||||
if i == currentExerciseIdx {
|
if i == currentExerciseIdx {
|
||||||
Image(systemName: "checkmark")
|
Image(systemName: "checkmark")
|
||||||
.font(Font.system(size: 55))
|
.font(Font.system(size: 55))
|
||||||
.scaledToFit()
|
|
||||||
.minimumScaleFactor(0.01)
|
.minimumScaleFactor(0.01)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.foregroundColor(.green)
|
.foregroundColor(.green)
|
||||||
@@ -129,9 +129,8 @@ struct ExtExerciseList: View {
|
|||||||
|
|
||||||
Text(obj.exercise.name)
|
Text(obj.exercise.name)
|
||||||
.font(Font.system(size: 55))
|
.font(Font.system(size: 55))
|
||||||
.scaledToFit()
|
|
||||||
.minimumScaleFactor(0.01)
|
.minimumScaleFactor(0.01)
|
||||||
.lineLimit(1)
|
.lineLimit(3)
|
||||||
.padding()
|
.padding()
|
||||||
.id(i)
|
.id(i)
|
||||||
}
|
}
|
||||||
@@ -161,8 +160,17 @@ struct ExtCountdownView: View {
|
|||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
|
||||||
|
if currenExercise.exercise.side.count > 0 {
|
||||||
|
Text(" - " + currenExercise.exercise.side)
|
||||||
|
.font(.system(size: 200))
|
||||||
|
.scaledToFit()
|
||||||
|
.minimumScaleFactor(0.01)
|
||||||
|
.lineLimit(1)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
|
||||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||||
Text("\(bridgeModule.currentWorkoutRunTimeInSeconds)")
|
Text("\(Double(bridgeModule.currentWorkoutRunTimeInSeconds).asString(style: .positional))")
|
||||||
.font(Font.system(size: 100))
|
.font(Font.system(size: 100))
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.minimumScaleFactor(0.01)
|
.minimumScaleFactor(0.01)
|
||||||
@@ -175,25 +183,37 @@ struct ExtCountdownView: View {
|
|||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
if let duration = currenExercise.duration,
|
if let duration = currenExercise.duration,
|
||||||
duration > 0 {
|
duration > 0 {
|
||||||
ProgressView(value: Float(bridgeModule.currentExerciseTimeLeft), total: Float(duration))
|
ProgressView(value: Float(bridgeModule.currentExerciseTimeLeft), total: Float(duration))
|
||||||
.scaleEffect(x: 1, y: 6, anchor: .center)
|
.scaleEffect(x: 1, y: 6, anchor: .center)
|
||||||
Text("\(bridgeModule.currentExerciseTimeLeft)")
|
Text("\(bridgeModule.currentExerciseTimeLeft)")
|
||||||
.font(Font.system(size: 75))
|
.font(Font.system(size: 100))
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.minimumScaleFactor(0.01)
|
.minimumScaleFactor(0.01)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.padding(.leading)
|
.padding(.leading)
|
||||||
.padding(.trailing, 100)
|
.padding(.trailing, 100)
|
||||||
} else if let reps = currenExercise.reps,
|
}
|
||||||
reps > 0 {
|
|
||||||
Text("\(reps)")
|
if let reps = currenExercise.reps,
|
||||||
.font(Font.system(size: 150))
|
reps > 0 {
|
||||||
|
Text(" X \(reps)")
|
||||||
|
.font(Font.system(size: 100))
|
||||||
|
.scaledToFit()
|
||||||
|
.minimumScaleFactor(0.01)
|
||||||
|
.lineLimit(1)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let weight = currenExercise.weight,
|
||||||
|
weight > 0 {
|
||||||
|
Text(" @ \(weight)")
|
||||||
|
.font(Font.system(size: 100))
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.minimumScaleFactor(0.01)
|
.minimumScaleFactor(0.01)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.padding(.leading)
|
|
||||||
.padding(.trailing, 100)
|
.padding(.trailing, 100)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(height: metrics.size.height * 0.5)
|
.frame(height: metrics.size.height * 0.5)
|
||||||
|
|||||||
Reference in New Issue
Block a user