fix naming on variable
fix tapping on exercise not updating external correctly
This commit is contained in:
Trey t
2024-08-28 08:55:41 -05:00
parent bfb373c8af
commit 2d5d55c272
14 changed files with 51 additions and 55 deletions

View File

@@ -18,7 +18,7 @@ struct ExternalWorkoutDetailView: View {
var body: some View {
ZStack {
if let workout = bridgeModule.currentExerciseInfo.workout {
if let workout = bridgeModule.currentWorkoutInfo.workout {
GeometryReader { metrics in
VStack {
HStack {
@@ -32,7 +32,7 @@ struct ExternalWorkoutDetailView: View {
VStack {
ExtExerciseList(workout: workout,
allSupersetExecerciseIndex: bridgeModule.currentExerciseInfo.allSupersetExecerciseIndex)
allSupersetExecerciseIndex: bridgeModule.currentWorkoutInfo.allSupersetExecerciseIndex)
}
.frame(width: metrics.size.width * 0.4, height: metrics.size.height * 0.8)
.padding([.top, .bottom], 20)
@@ -93,11 +93,11 @@ struct ExternalWorkoutDetailView: View {
.onChange(of: bridgeModule.isInWorkout, perform: { _ in
playVideos()
})
.onChange(of: bridgeModule.currentExerciseInfo.allSupersetExecerciseIndex, perform: { _ in
.onChange(of: bridgeModule.currentWorkoutInfo.allSupersetExecerciseIndex, perform: { _ in
playVideos()
})
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(bridgeModule.currentExerciseInfo.workout == nil ? Color(red: 157/255, green: 138/255, blue: 255/255) : Color(uiColor: .systemBackground))
.background(bridgeModule.currentWorkoutInfo.workout == nil ? Color(red: 157/255, green: 138/255, blue: 255/255) : Color(uiColor: .systemBackground))
.onReceive(NotificationCenter.default.publisher(
for: UIScene.willEnterForegroundNotification)) { _ in
avPlayer.play()
@@ -106,13 +106,13 @@ struct ExternalWorkoutDetailView: View {
}
func playVideos() {
if let currentExtercise = bridgeModule.currentExerciseInfo.currentExercise {
if let currentExtercise = bridgeModule.currentWorkoutInfo.currentExercise {
if let videoURL = VideoURLCreator.videoURL(
thotStyle: extThotStyle,
gender: thotGenderOption,
defaultVideoURLStr: currentExtercise.exercise.videoURL,
exerciseName: currentExtercise.exercise.name,
workout: bridgeModule.currentExerciseInfo.workout) {
workout: bridgeModule.currentWorkoutInfo.workout) {
avPlayer = AVPlayer(url: videoURL)
avPlayer.play()
}
@@ -120,9 +120,9 @@ struct ExternalWorkoutDetailView: View {
if let smallVideoURL = VideoURLCreator.videoURL(
thotStyle: .never,
gender: thotGenderOption,
defaultVideoURLStr: BridgeModule.shared.currentExerciseInfo.nextExerciseInfo?.exercise.videoURL,
exerciseName: BridgeModule.shared.currentExerciseInfo.nextExerciseInfo?.exercise.name,
workout: bridgeModule.currentExerciseInfo.workout),
defaultVideoURLStr: BridgeModule.shared.currentWorkoutInfo.nextExerciseInfo?.exercise.videoURL,
exerciseName: BridgeModule.shared.currentWorkoutInfo.nextExerciseInfo?.exercise.name,
workout: bridgeModule.currentWorkoutInfo.workout),
extShowNextVideo {
smallAVPlayer = AVPlayer(url: smallVideoURL)
smallAVPlayer.play()