This commit is contained in:
Trey t
2024-06-17 12:04:49 -07:00
parent d9ec548357
commit addeca4ead
2 changed files with 62 additions and 55 deletions

View File

@@ -48,50 +48,55 @@ struct WorkoutDetailView: View {
.onAppear{
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)
.padding(.bottom)
if !bridgeModule.isInWorkout {
InfoView(workout: workout)
.padding(.bottom)
}
if bridgeModule.isInWorkout {
Divider()
.background(Color(uiColor: .secondaryLabel))
HStack {
Text("\(bridgeModule.currentExerciseInfo.currentRound) of \(bridgeModule.currentExerciseInfo.numberOfRoundsInCurrentSuperSet)")
.font(.title3)
@@ -109,11 +114,15 @@ struct WorkoutDetailView: View {
.padding(.trailing, 10)
}
.padding([.top, .bottom])
.background(Color(uiColor: .tertiarySystemBackground))
}
Divider()
.background(Color(uiColor: .secondaryLabel))
ExerciseListView(workout: workout, showExecersizeInfo: $showExecersizeInfo)
.padding([.top, .bottom], 10)
.background(Color(uiColor: .secondarySystemBackground))
.background(Color(uiColor: .systemGroupedBackground))
ActionsView(completedWorkout: {
bridgeModule.completeWorkout()

View File

@@ -13,25 +13,23 @@ struct InfoView: View {
var body: some View {
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)
.font(.title3)
.padding()
if let desc = workout.description {
Text(desc)
.frame(maxWidth: .infinity, alignment: .leading)
.font(.body)
.padding([.leading, .trailing])
}
if let estimatedTime = workout.estimatedTime {
Text(estimatedTime.asString(style: .abbreviated))
.frame(maxWidth: .infinity, alignment: .leading)
.font(.body)
.padding([.leading, .trailing])
}
.font(.body)
.padding([.leading, .trailing])
}
if let estimatedTime = workout.estimatedTime {
Text(estimatedTime.asString(style: .abbreviated))
.frame(maxWidth: .infinity, alignment: .leading)
.font(.body)
.padding([.leading, .trailing])
}
}
}