WIP
This commit is contained in:
@@ -243,9 +243,25 @@ struct CurrentWorkoutElapsedTimeView: View {
|
||||
}
|
||||
|
||||
struct ExerciseListView: View {
|
||||
@AppStorage("showNSFWVideos") private var showNSFWVideos = false
|
||||
@ObservedObject var bridgeModule = BridgeModule.shared
|
||||
var workout: Workout
|
||||
|
||||
@State var avPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4")!)
|
||||
@State var videoExercise: ExerciseExercise? {
|
||||
didSet {
|
||||
if showNSFWVideos {
|
||||
if let viddd = self.videoExercise?.nsfwVideoURL,
|
||||
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
|
||||
avPlayer = AVPlayer(url: url)
|
||||
}
|
||||
} else {
|
||||
if let viddd = self.videoExercise?.videoURL,
|
||||
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
|
||||
avPlayer = AVPlayer(url: url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
List() {
|
||||
@@ -259,12 +275,17 @@ struct ExerciseListView: View {
|
||||
}
|
||||
|
||||
Text(obj.exercise.name)
|
||||
.onTapGesture {
|
||||
bridgeModule.goToExerciseAt(index: i)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
if bridgeModule.isInWorkout {
|
||||
bridgeModule.goToExerciseAt(index: i)
|
||||
} else {
|
||||
videoExercise = obj.exercise
|
||||
}
|
||||
}
|
||||
|
||||
if i == bridgeModule.currentExerciseIdx {
|
||||
HStack {
|
||||
if obj.exercise.isReps {
|
||||
@@ -284,6 +305,9 @@ struct ExerciseListView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.sheet(item: $videoExercise) { exercise in
|
||||
VideoPlayerView(avPlayer: $avPlayer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user