WIP
This commit is contained in:
@@ -47,6 +47,9 @@
|
||||
1CC092F72C1FAFD50004E1E6 /* AllMusclesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092F62C1FAFD50004E1E6 /* AllMusclesView.swift */; };
|
||||
1CC092F92C1FB1420004E1E6 /* AllExerciseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092F82C1FB1420004E1E6 /* AllExerciseView.swift */; };
|
||||
1CC092FB2C1FB3320004E1E6 /* AllEquipmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092FA2C1FB3320004E1E6 /* AllEquipmentView.swift */; };
|
||||
1CC092FD2C20B0A30004E1E6 /* ExtCountdownView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092FC2C20B0A30004E1E6 /* ExtCountdownView.swift */; };
|
||||
1CC092FF2C20B0C80004E1E6 /* ExtExerciseList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092FE2C20B0C80004E1E6 /* ExtExerciseList.swift */; };
|
||||
1CC093012C20B0E90004E1E6 /* TitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC093002C20B0E90004E1E6 /* TitleView.swift */; };
|
||||
1CD0C6632A5AF62900970E52 /* WorkoutOverviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD0C6622A5AF62900970E52 /* WorkoutOverviewView.swift */; };
|
||||
1CD0C6672A5CA19600970E52 /* BaseURLs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD0C6662A5CA19600970E52 /* BaseURLs.swift */; };
|
||||
1CD0C6682A5CA1A200970E52 /* BaseURLs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD0C6662A5CA19600970E52 /* BaseURLs.swift */; };
|
||||
@@ -174,6 +177,9 @@
|
||||
1CC092F62C1FAFD50004E1E6 /* AllMusclesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllMusclesView.swift; sourceTree = "<group>"; };
|
||||
1CC092F82C1FB1420004E1E6 /* AllExerciseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllExerciseView.swift; sourceTree = "<group>"; };
|
||||
1CC092FA2C1FB3320004E1E6 /* AllEquipmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllEquipmentView.swift; sourceTree = "<group>"; };
|
||||
1CC092FC2C20B0A30004E1E6 /* ExtCountdownView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtCountdownView.swift; sourceTree = "<group>"; };
|
||||
1CC092FE2C20B0C80004E1E6 /* ExtExerciseList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtExerciseList.swift; sourceTree = "<group>"; };
|
||||
1CC093002C20B0E90004E1E6 /* TitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleView.swift; sourceTree = "<group>"; };
|
||||
1CD0C6622A5AF62900970E52 /* WorkoutOverviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutOverviewView.swift; sourceTree = "<group>"; };
|
||||
1CD0C6662A5CA19600970E52 /* BaseURLs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseURLs.swift; sourceTree = "<group>"; };
|
||||
1CD0C66B2A5E4EA100970E52 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
@@ -284,6 +290,9 @@
|
||||
1C5190C52A589CC100885849 /* ActionsView.swift */,
|
||||
1C5190C32A589CAC00885849 /* InfoView.swift */,
|
||||
1C5190CB2A589D0000885849 /* CountdownView.swift */,
|
||||
1CC092FC2C20B0A30004E1E6 /* ExtCountdownView.swift */,
|
||||
1CC092FE2C20B0C80004E1E6 /* ExtExerciseList.swift */,
|
||||
1CC093002C20B0E90004E1E6 /* TitleView.swift */,
|
||||
);
|
||||
path = subview;
|
||||
sourceTree = "<group>";
|
||||
@@ -627,8 +636,10 @@
|
||||
1CC092EF2C1FACFC0004E1E6 /* NameView.swift in Sources */,
|
||||
1CF65A4E2A39FF200042FFBD /* WorkoutDetailViewModel.swift in Sources */,
|
||||
1CC092FB2C1FB3320004E1E6 /* AllEquipmentView.swift in Sources */,
|
||||
1CC092FD2C20B0A30004E1E6 /* ExtCountdownView.swift in Sources */,
|
||||
1CF65A472A39FB6C0042FFBD /* RegisteredUser.swift in Sources */,
|
||||
1CF65AB32A452F360042FFBD /* WatchPackageModel.swift in Sources */,
|
||||
1CC092FF2C20B0C80004E1E6 /* ExtExerciseList.swift in Sources */,
|
||||
1CD0C6672A5CA19600970E52 /* BaseURLs.swift in Sources */,
|
||||
1CF65A522A3A90A00042FFBD /* PreviewData.swift in Sources */,
|
||||
1C5190CE2A589D4100885849 /* AllWorkoutPickerView.swift in Sources */,
|
||||
@@ -670,6 +681,7 @@
|
||||
1C4AFF152A60F25F0027710B /* ThotStyle.swift in Sources */,
|
||||
1C5190C82A589CDA00885849 /* CurrentWorkoutElapsedTimeView.swift in Sources */,
|
||||
1CC092F92C1FB1420004E1E6 /* AllExerciseView.swift in Sources */,
|
||||
1CC093012C20B0E90004E1E6 /* TitleView.swift in Sources */,
|
||||
1CF65A452A39FB550042FFBD /* Exercise.swift in Sources */,
|
||||
1CF65A612A3BF6020042FFBD /* AddExerciseView.swift in Sources */,
|
||||
1C485C872A4915C400A6F896 /* CreateWorkoutItemPickerView.swift in Sources */,
|
||||
|
||||
@@ -44,7 +44,6 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
@Published var previewWorkout: Workout?
|
||||
|
||||
@Published var currentExerciseTimeLeft: Int = 0
|
||||
var currentExercisePositionString: String?
|
||||
|
||||
private var isWatchConnected = false
|
||||
// workoutEndDate fills out WatchPackageModel.workoutEndDate which
|
||||
|
||||
@@ -33,38 +33,25 @@ struct ExternalWorkoutDetailView: View {
|
||||
VStack {
|
||||
ExtExerciseList(workout: workout,
|
||||
allSupersetExecerciseIndex: bridgeModule.currentExerciseInfo.allSupersetExecerciseIndex)
|
||||
|
||||
// if let currentExercisePositionString = bridgeModule.currentExercisePositionString {
|
||||
// Text(currentExercisePositionString)
|
||||
// .font(Font.system(size: 75))
|
||||
// .scaledToFit()
|
||||
// .minimumScaleFactor(0.01)
|
||||
// .lineLimit(1)
|
||||
// .padding()
|
||||
// }
|
||||
}
|
||||
.frame(width: metrics.size.width * 0.4, height: metrics.size.height * 0.8)
|
||||
.padding([.top, .bottom], 20)
|
||||
}
|
||||
|
||||
HStack {
|
||||
ExtCountdownView()
|
||||
.padding(.leading, 50)
|
||||
.padding(.bottom, 20)
|
||||
if extShowNextVideo && extThotStyle != .off {
|
||||
ExtCountdownView()
|
||||
.frame(width: metrics.size.width * 0.8, height: metrics.size.height * 0.2)
|
||||
.padding(.leading, 50)
|
||||
.padding(.trailing, 5)
|
||||
|
||||
PlayerView(player: $smallAVPlayer)
|
||||
.frame(width: metrics.size.width * 0.2, height: metrics.size.height * 0.2)
|
||||
.padding(.trailing, 50)
|
||||
.frame(width: metrics.size.width * 0.2,
|
||||
height: metrics.size.height * 0.2)
|
||||
.onAppear{
|
||||
avPlayer.play()
|
||||
}
|
||||
} else {
|
||||
ExtCountdownView()
|
||||
.frame(width: metrics.size.width-50, height: metrics.size.height * 0.2)
|
||||
.padding([.leading, .trailing], 50)
|
||||
}
|
||||
}
|
||||
.background(Color(uiColor: .tertiarySystemGroupedBackground))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -115,161 +102,6 @@ struct ExternalWorkoutDetailView: View {
|
||||
}
|
||||
}
|
||||
|
||||
struct TitleView: View {
|
||||
@ObservedObject var bridgeModule = BridgeModule.shared
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
if let workout = bridgeModule.currentExerciseInfo.workout {
|
||||
Text(workout.name)
|
||||
.font(Font.system(size: 100))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||
Text("\(bridgeModule.currentWorkoutRunTimeInSeconds)")
|
||||
.font(Font.system(size: 100))
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ExtExerciseList: View {
|
||||
var workout: Workout
|
||||
var allSupersetExecerciseIndex: Int
|
||||
|
||||
var body: some View {
|
||||
if let allSupersetExecercise = workout.allSupersetExecercise {
|
||||
ZStack {
|
||||
ScrollViewReader { proxy in
|
||||
List() {
|
||||
ForEach(allSupersetExecercise.indices, id: \.self) { supersetExecerciseIdx in
|
||||
let supersetExecercise = allSupersetExecercise[supersetExecerciseIdx]
|
||||
HStack {
|
||||
if supersetExecerciseIdx == allSupersetExecerciseIndex {
|
||||
Image(systemName: "checkmark")
|
||||
.foregroundColor(.green)
|
||||
.font(Font.system(size: 55))
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.foregroundColor(.green)
|
||||
}
|
||||
|
||||
Text(supersetExecercise.exercise.name)
|
||||
.font(Font.system(size: 55))
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(3)
|
||||
.padding()
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.id(supersetExecerciseIdx)
|
||||
}
|
||||
}
|
||||
.onChange(of: allSupersetExecerciseIndex, perform: { newValue in
|
||||
withAnimation {
|
||||
proxy.scrollTo(allSupersetExecerciseIndex, anchor: .top)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
VStack {
|
||||
Text("\(allSupersetExecerciseIndex+1)/\(workout.allSupersetExecercise?.count ?? 0)")
|
||||
.font(Font.system(size: 55))
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding()
|
||||
.bold()
|
||||
.foregroundColor(.white)
|
||||
.background(
|
||||
Capsule()
|
||||
.strokeBorder(Color.black, lineWidth: 0.8)
|
||||
.background(Color(uiColor: UIColor(red: 148/255,
|
||||
green: 0,
|
||||
blue: 211/255,
|
||||
alpha: 0.5)))
|
||||
.clipped()
|
||||
)
|
||||
.clipShape(Capsule())
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ExtCountdownView: View {
|
||||
@StateObject var bridgeModule = BridgeModule.shared
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { metrics in
|
||||
VStack {
|
||||
if let currenExercise = bridgeModule.currentExerciseInfo.currentExercise {
|
||||
HStack {
|
||||
Text(currenExercise.exercise.extName)
|
||||
.font(.system(size: 200))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||
Text("\(Double(bridgeModule.currentWorkoutRunTimeInSeconds).asString(style: .positional))")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
}
|
||||
.frame(height: metrics.size.height * 0.5)
|
||||
|
||||
HStack {
|
||||
if let duration = currenExercise.duration,
|
||||
duration > 0 {
|
||||
ProgressView(value: Float(bridgeModule.currentExerciseTimeLeft), total: Float(duration))
|
||||
.scaleEffect(x: 1, y: 6, anchor: .center)
|
||||
Text("\(bridgeModule.currentExerciseTimeLeft)")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding(.leading)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
|
||||
if let reps = currenExercise.reps,
|
||||
reps > 0 {
|
||||
Text(" X \(reps)")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if let weight = currenExercise.weight,
|
||||
weight > 0 {
|
||||
Text(" @ \(weight)")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding(.trailing, 100)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
.frame(height: metrics.size.height * 0.5)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct ExternalWorkoutDetailView_Previews: PreviewProvider {
|
||||
// static var bridge = BridgeModule.shared
|
||||
//
|
||||
|
||||
@@ -44,7 +44,7 @@ struct ExerciseListView: View {
|
||||
if bridgeModule.isInWorkout &&
|
||||
supersetIndex == bridgeModule.currentExerciseInfo.supersetIndex &&
|
||||
exerciseIndex == bridgeModule.currentExerciseInfo.exerciseIndex {
|
||||
Image(systemName: "checkmark")
|
||||
Image(systemName: "figure.run")
|
||||
.foregroundColor(.green)
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ struct WorkoutDetailView: View {
|
||||
}
|
||||
|
||||
ExerciseListView(workout: workout, showExecersizeInfo: $showExecersizeInfo)
|
||||
.padding([.top, .bottom], 10)
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
|
||||
ActionsView(completedWorkout: {
|
||||
bridgeModule.completeWorkout()
|
||||
|
||||
81
Werkout_ios/subview/ExtCountdownView.swift
Normal file
81
Werkout_ios/subview/ExtCountdownView.swift
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ExtCountdownView.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 6/17/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ExtCountdownView: View {
|
||||
@StateObject var bridgeModule = BridgeModule.shared
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { metrics in
|
||||
VStack {
|
||||
if let currenExercise = bridgeModule.currentExerciseInfo.currentExercise {
|
||||
HStack {
|
||||
Text(currenExercise.exercise.extName)
|
||||
.font(.system(size: 200))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||
Text("\(Double(bridgeModule.currentWorkoutRunTimeInSeconds).asString(style: .positional))")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
}
|
||||
.frame(height: metrics.size.height * 0.5)
|
||||
|
||||
HStack {
|
||||
if let duration = currenExercise.duration,
|
||||
duration > 0 {
|
||||
ProgressView(value: Float(bridgeModule.currentExerciseTimeLeft), total: Float(duration))
|
||||
.scaleEffect(x: 1, y: 6, anchor: .center)
|
||||
Text("\(bridgeModule.currentExerciseTimeLeft)")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding(.leading)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
|
||||
if let reps = currenExercise.reps,
|
||||
reps > 0 {
|
||||
Text(" X \(reps)")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if let weight = currenExercise.weight,
|
||||
weight > 0 {
|
||||
Text(" @ \(weight)")
|
||||
.font(Font.system(size: 100))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding(.trailing, 100)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
.frame(height: metrics.size.height * 0.5)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ExtCountdownView()
|
||||
}
|
||||
77
Werkout_ios/subview/ExtExerciseList.swift
Normal file
77
Werkout_ios/subview/ExtExerciseList.swift
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ExtExerciseList.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 6/17/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ExtExerciseList: View {
|
||||
var workout: Workout
|
||||
var allSupersetExecerciseIndex: Int
|
||||
|
||||
var body: some View {
|
||||
if let allSupersetExecercise = workout.allSupersetExecercise {
|
||||
ZStack {
|
||||
ScrollViewReader { proxy in
|
||||
List() {
|
||||
ForEach(allSupersetExecercise.indices, id: \.self) { supersetExecerciseIdx in
|
||||
let supersetExecercise = allSupersetExecercise[supersetExecerciseIdx]
|
||||
HStack {
|
||||
if supersetExecerciseIdx == allSupersetExecerciseIndex {
|
||||
Image(systemName: "figure.run")
|
||||
.foregroundColor(.green)
|
||||
.font(Font.system(size: 55))
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.foregroundColor(.green)
|
||||
}
|
||||
|
||||
Text(supersetExecercise.exercise.name)
|
||||
.font(Font.system(size: 55))
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(3)
|
||||
.padding()
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.id(supersetExecerciseIdx)
|
||||
}
|
||||
}
|
||||
.onChange(of: allSupersetExecerciseIndex, perform: { newValue in
|
||||
withAnimation {
|
||||
proxy.scrollTo(allSupersetExecerciseIndex, anchor: .top)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
VStack {
|
||||
Text("\(allSupersetExecerciseIndex+1)/\(workout.allSupersetExecercise?.count ?? 0)")
|
||||
.font(Font.system(size: 55))
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding()
|
||||
.bold()
|
||||
.foregroundColor(.white)
|
||||
.background(
|
||||
Capsule()
|
||||
.strokeBorder(Color.black, lineWidth: 0.8)
|
||||
.background(Color(uiColor: UIColor(red: 148/255,
|
||||
green: 0,
|
||||
blue: 211/255,
|
||||
alpha: 0.5)))
|
||||
.clipped()
|
||||
)
|
||||
.clipShape(Capsule())
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#Preview {
|
||||
// ExtExerciseList()
|
||||
//}
|
||||
33
Werkout_ios/subview/TitleView.swift
Normal file
33
Werkout_ios/subview/TitleView.swift
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// TitleView.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 6/17/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct TitleView: View {
|
||||
@ObservedObject var bridgeModule = BridgeModule.shared
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
if let workout = bridgeModule.currentExerciseInfo.workout {
|
||||
Text(workout.name)
|
||||
.font(Font.system(size: 100))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||
Text("\(bridgeModule.currentWorkoutRunTimeInSeconds)")
|
||||
.font(Font.system(size: 100))
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
TitleView()
|
||||
}
|
||||
Reference in New Issue
Block a user