WIP
This commit is contained in:
@@ -48,50 +48,55 @@ struct WorkoutDetailView: View {
|
|||||||
.onAppear{
|
.onAppear{
|
||||||
avPlayer.play()
|
avPlayer.play()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button(action: {
|
||||||
|
if let assetURL = ((avPlayer.currentItem?.asset) as? AVURLAsset)?.url,
|
||||||
|
let currentExtercise = bridgeModule.currentExerciseInfo.currentExercise,
|
||||||
|
let otherVideoURL = VideoURLCreator.videoURL(
|
||||||
|
thotStyle: VideoURLCreator.otherVideoType(forVideoURL: assetURL),
|
||||||
|
gender: thotGenderOption,
|
||||||
|
defaultVideoURLStr: currentExtercise.exercise.videoURL,
|
||||||
|
exerciseName: currentExtercise.exercise.name,
|
||||||
|
workout: bridgeModule.currentExerciseInfo.workout) {
|
||||||
|
avPlayer = AVPlayer(url: otherVideoURL)
|
||||||
|
avPlayer.play()
|
||||||
|
}
|
||||||
|
}, label: {
|
||||||
|
Image(systemName: "arrow.triangle.2.circlepath.camera.fill")
|
||||||
|
.frame(width: 44, height: 44)
|
||||||
|
.foregroundColor(Color("appColor"))
|
||||||
|
})
|
||||||
|
.foregroundColor(.blue)
|
||||||
|
.cornerRadius(4)
|
||||||
|
.frame(width: 160, height: 120)
|
||||||
|
.position(x: metrics.size.width - 22, y: metrics.size.height - 30)
|
||||||
|
|
||||||
|
Button(action: {
|
||||||
|
showExecersizeInfo.toggle()
|
||||||
|
}, label: {
|
||||||
|
Image(systemName: "info.circle.fill")
|
||||||
|
.frame(width: 44, height: 44)
|
||||||
|
.foregroundColor(Color("appColor"))
|
||||||
|
})
|
||||||
|
.foregroundColor(.blue)
|
||||||
|
.cornerRadius(4)
|
||||||
|
.frame(width: 120, height: 120)
|
||||||
|
.position(x: 22, y: metrics.size.height - 30)
|
||||||
}
|
}
|
||||||
|
|
||||||
Button(action: {
|
|
||||||
if let assetURL = ((avPlayer.currentItem?.asset) as? AVURLAsset)?.url,
|
|
||||||
let currentExtercise = bridgeModule.currentExerciseInfo.currentExercise,
|
|
||||||
let otherVideoURL = VideoURLCreator.videoURL(
|
|
||||||
thotStyle: VideoURLCreator.otherVideoType(forVideoURL: assetURL),
|
|
||||||
gender: thotGenderOption,
|
|
||||||
defaultVideoURLStr: currentExtercise.exercise.videoURL,
|
|
||||||
exerciseName: currentExtercise.exercise.name,
|
|
||||||
workout: bridgeModule.currentExerciseInfo.workout) {
|
|
||||||
avPlayer = AVPlayer(url: otherVideoURL)
|
|
||||||
avPlayer.play()
|
|
||||||
}
|
|
||||||
}, label: {
|
|
||||||
Image(systemName: "arrow.triangle.2.circlepath.camera.fill")
|
|
||||||
.frame(width: 44, height: 44)
|
|
||||||
.foregroundColor(Color("appColor"))
|
|
||||||
})
|
|
||||||
.foregroundColor(.blue)
|
|
||||||
.cornerRadius(4)
|
|
||||||
.frame(width: 160, height: 120)
|
|
||||||
.position(x: metrics.size.width - 22, y: metrics.size.height - 30)
|
|
||||||
|
|
||||||
Button(action: {
|
|
||||||
showExecersizeInfo.toggle()
|
|
||||||
}, label: {
|
|
||||||
Image(systemName: "info.circle.fill")
|
|
||||||
.frame(width: 44, height: 44)
|
|
||||||
.foregroundColor(Color("appColor"))
|
|
||||||
})
|
|
||||||
.foregroundColor(.blue)
|
|
||||||
.cornerRadius(4)
|
|
||||||
.frame(width: 120, height: 120)
|
|
||||||
.position(x: 22, y: metrics.size.height - 30)
|
|
||||||
}
|
}
|
||||||
|
.padding([.top, .bottom])
|
||||||
|
.background(Color(uiColor: .tertiarySystemBackground))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoView(workout: workout)
|
if !bridgeModule.isInWorkout {
|
||||||
.padding(.bottom)
|
InfoView(workout: workout)
|
||||||
|
.padding(.bottom)
|
||||||
|
}
|
||||||
|
|
||||||
if bridgeModule.isInWorkout {
|
if bridgeModule.isInWorkout {
|
||||||
Divider()
|
Divider()
|
||||||
|
.background(Color(uiColor: .secondaryLabel))
|
||||||
HStack {
|
HStack {
|
||||||
Text("\(bridgeModule.currentExerciseInfo.currentRound) of \(bridgeModule.currentExerciseInfo.numberOfRoundsInCurrentSuperSet)")
|
Text("\(bridgeModule.currentExerciseInfo.currentRound) of \(bridgeModule.currentExerciseInfo.numberOfRoundsInCurrentSuperSet)")
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
@@ -109,11 +114,15 @@ struct WorkoutDetailView: View {
|
|||||||
.padding(.trailing, 10)
|
.padding(.trailing, 10)
|
||||||
}
|
}
|
||||||
.padding([.top, .bottom])
|
.padding([.top, .bottom])
|
||||||
|
.background(Color(uiColor: .tertiarySystemBackground))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
.background(Color(uiColor: .secondaryLabel))
|
||||||
|
|
||||||
ExerciseListView(workout: workout, showExecersizeInfo: $showExecersizeInfo)
|
ExerciseListView(workout: workout, showExecersizeInfo: $showExecersizeInfo)
|
||||||
.padding([.top, .bottom], 10)
|
.padding([.top, .bottom], 10)
|
||||||
.background(Color(uiColor: .secondarySystemBackground))
|
.background(Color(uiColor: .systemGroupedBackground))
|
||||||
|
|
||||||
ActionsView(completedWorkout: {
|
ActionsView(completedWorkout: {
|
||||||
bridgeModule.completeWorkout()
|
bridgeModule.completeWorkout()
|
||||||
|
|||||||
@@ -13,25 +13,23 @@ struct InfoView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
if bridgeModule.isInWorkout == false {
|
Text(workout.name)
|
||||||
Text(workout.name)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.font(.title3)
|
||||||
|
.padding()
|
||||||
|
|
||||||
|
if let desc = workout.description {
|
||||||
|
Text(desc)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.font(.title3)
|
.font(.body)
|
||||||
.padding()
|
.padding([.leading, .trailing])
|
||||||
|
}
|
||||||
|
|
||||||
if let desc = workout.description {
|
if let estimatedTime = workout.estimatedTime {
|
||||||
Text(desc)
|
Text(estimatedTime.asString(style: .abbreviated))
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.padding([.leading, .trailing])
|
.padding([.leading, .trailing])
|
||||||
}
|
|
||||||
|
|
||||||
if let estimatedTime = workout.estimatedTime {
|
|
||||||
Text(estimatedTime.asString(style: .abbreviated))
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
.font(.body)
|
|
||||||
.padding([.leading, .trailing])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user