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