This commit is contained in:
Trey t
2023-07-10 15:35:48 -05:00
parent a2098943a8
commit 93cab684b9
10 changed files with 220 additions and 100 deletions

View File

@@ -30,6 +30,7 @@ struct WorkoutOverviewView: View {
}
}
}
if let muscles = workout.muscles,
muscles.joined(separator: ", ").count > 0{
Divider()
@@ -54,6 +55,6 @@ struct WorkoutOverviewView: View {
struct WorkoutOverviewView_Previews: PreviewProvider {
static var previews: some View {
WorkoutOverviewView(workout: PreviewData.allWorkouts()[0])
WorkoutOverviewView(workout: PreviewData.allWorkouts()[2])
}
}

View File

@@ -65,20 +65,8 @@ struct ExternalWorkoutDetailView: View {
}
}
.onChange(of: bridgeModule.currentExercise, perform: { newValue in
var _url: URL?
if showNSFWVideos {
if let viddd = newValue?.exercise.nsfwVideoURL,
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
} else {
if let viddd = newValue?.exercise.videoURL,
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
}
if let __url = _url {
avPlayer = AVPlayer(url: __url)
if let videoURL = newValue?.videoURL(nsfw: showNSFWVideos) {
avPlayer = AVPlayer(url: videoURL)
avPlayer.play()
}
})

View File

@@ -13,18 +13,12 @@ struct ExerciseListView: View {
@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)
}
if let videoURL = self.videoExercise?.videoURL(nsfw: showNSFWVideos) {
avPlayer = AVPlayer(url: videoURL)
avPlayer.play()
}
}
}

View File

@@ -80,41 +80,15 @@ struct WorkoutDetailView: View {
}
}
.onChange(of: bridgeModule.currentExercise, perform: { newValue in
var _url: URL?
if showNSFWVideos {
if let viddd = newValue?.exercise.nsfwVideoURL,
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
} else {
if let viddd = newValue?.exercise.videoURL,
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
}
if let __url = _url {
avPlayer = AVPlayer(url: __url)
if let videoURL = newValue?.videoURL(nsfw: showNSFWVideos) {
avPlayer = AVPlayer(url: videoURL)
avPlayer.play()
}
})
.onAppear{
var _url: URL?
if let currentExercise = bridgeModule.currentExercise {
if showNSFWVideos {
let viddd = currentExercise.exercise.nsfwVideoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
} else {
let viddd = currentExercise.exercise.videoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
}
if let __url = _url {
avPlayer = AVPlayer(url: __url)
avPlayer.play()
}
if let videoURL = bridgeModule.currentExercise?.videoURL(nsfw: showNSFWVideos) {
avPlayer = AVPlayer(url: videoURL)
avPlayer.play()
}
bridgeModule.completedWorkout = {
if let workoutData = createWorkoutData() {