show next up video
This commit is contained in:
@@ -85,6 +85,10 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
var nextExerciseObject: SupersetExercise? {
|
||||
currentExerciseInfo.nextExercise
|
||||
}
|
||||
|
||||
func resetCurrentWorkout() {
|
||||
DispatchQueue.main.async {
|
||||
self.currentWorkoutRunTimeInSeconds = 0
|
||||
|
||||
@@ -38,6 +38,34 @@ class CurrentWorkoutInfo {
|
||||
return obj
|
||||
}
|
||||
|
||||
var nextExerciseInfo: SupersetExercise? {
|
||||
guard let workout = workout else { return nil }
|
||||
guard let supersets = workout.supersets else { return nil }
|
||||
|
||||
var _exerciseIndex = exerciseIndex + 1
|
||||
var _supersetIndex = supersetIndex
|
||||
let currentSuperSet = supersets[_supersetIndex]
|
||||
|
||||
if _exerciseIndex >= currentSuperSet.exercises.count {
|
||||
var _currentRound = currentRound + 1
|
||||
|
||||
if currentRound > currentSuperSet.rounds {
|
||||
_supersetIndex = _supersetIndex + 1
|
||||
_currentRound = 1
|
||||
|
||||
if supersetIndex >= supersets.count {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
_exerciseIndex = 0
|
||||
}
|
||||
|
||||
let superset = supersets[_supersetIndex]
|
||||
let exercise = superset.exercises[_exerciseIndex]
|
||||
return exercise
|
||||
}
|
||||
|
||||
var nextExercise: SupersetExercise? {
|
||||
guard let workout = workout else { return nil }
|
||||
guard let supersets = workout.supersets else { return nil }
|
||||
|
||||
@@ -14,7 +14,7 @@ struct AccountView: View {
|
||||
@State var showCompletedWorkouts: Bool = false
|
||||
@AppStorage(Constants.phoneThotStyle) private var phoneThotStyle: ThotStyle = .never
|
||||
@AppStorage(Constants.extThotStyle) private var extThotStyle: ThotStyle = .never
|
||||
@AppStorage(Constants.extShowBothVideos) private var extShowBothVideos: Bool = false
|
||||
@AppStorage(Constants.extShowNextVideo) private var extShowNextVideo: Bool = false
|
||||
@AppStorage(Constants.thotGenderOption) private var thotGenderOption: String = "female"
|
||||
|
||||
var body: some View {
|
||||
@@ -105,8 +105,8 @@ struct AccountView: View {
|
||||
Group {
|
||||
Divider()
|
||||
|
||||
Toggle(isOn: $extShowBothVideos, label: {
|
||||
Text("Show both videos on external")
|
||||
Toggle(isOn: $extShowNextVideo, label: {
|
||||
Text("Show next up video")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ struct ExternalWorkoutDetailView: View {
|
||||
@State var avPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4")!)
|
||||
@State var smallAVPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4")!)
|
||||
@AppStorage(Constants.extThotStyle) private var extThotStyle: ThotStyle = .never
|
||||
@AppStorage(Constants.extShowBothVideos) private var extShowBothVideos: Bool = false
|
||||
@AppStorage(Constants.extShowNextVideo) private var extShowNextVideo: Bool = false
|
||||
@AppStorage(Constants.thotGenderOption) private var thotGenderOption: String = "female"
|
||||
|
||||
var body: some View {
|
||||
@@ -47,7 +47,7 @@ struct ExternalWorkoutDetailView: View {
|
||||
}
|
||||
|
||||
HStack {
|
||||
if extShowBothVideos && extThotStyle != .off {
|
||||
if extShowNextVideo && extThotStyle != .off {
|
||||
ExtCountdownView()
|
||||
.frame(width: metrics.size.width * 0.8, height: metrics.size.height * 0.2)
|
||||
.padding(.leading, 50)
|
||||
@@ -85,7 +85,7 @@ struct ExternalWorkoutDetailView: View {
|
||||
avPlayer = AVPlayer(url: videoURL)
|
||||
avPlayer.play()
|
||||
|
||||
if extShowBothVideos {
|
||||
if extShowNextVideo {
|
||||
if let smallVideoURL = VideoURLCreator.videoURL(
|
||||
thotStyle: VideoURLCreator.otherVideoType(forVideoURL: videoURL),
|
||||
gender: thotGenderOption,
|
||||
@@ -110,12 +110,12 @@ struct ExternalWorkoutDetailView: View {
|
||||
avPlayer = AVPlayer(url: videoURL)
|
||||
avPlayer.play()
|
||||
|
||||
if extShowBothVideos {
|
||||
if extShowNextVideo {
|
||||
if let smallVideoURL = VideoURLCreator.videoURL(
|
||||
thotStyle: VideoURLCreator.otherVideoType(forVideoURL: videoURL),
|
||||
thotStyle: .never,
|
||||
gender: thotGenderOption,
|
||||
defaultVideoURLStr: currentExtercise.exercise.videoURL,
|
||||
exerciseName: currentExtercise.exercise.name,
|
||||
defaultVideoURLStr: BridgeModule.shared.currentExerciseInfo.nextExerciseInfo?.exercise.videoURL,
|
||||
exerciseName: BridgeModule.shared.currentExerciseInfo.nextExerciseInfo?.exercise.name,
|
||||
workout: bridgeModule.currentExerciseInfo.workout) {
|
||||
smallAVPlayer = AVPlayer(url: smallVideoURL)
|
||||
smallAVPlayer.play()
|
||||
|
||||
@@ -13,7 +13,7 @@ import AVKit
|
||||
struct Constants {
|
||||
static let phoneThotStyle = "phoneThotStyle"
|
||||
static let extThotStyle = "extThotStyle"
|
||||
static let extShowBothVideos = "extShowBothVideos"
|
||||
static let extShowNextVideo = "extShowNextVideo"
|
||||
static let thotGenderOption = "thotGenderOption"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user