Skip to content

Commit e3ba7f7

Browse files
committed
fix count error
1 parent 79cca25 commit e3ba7f7

File tree

19 files changed

+126
-62
lines changed

19 files changed

+126
-62
lines changed

FitCount.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FitCount/Assets.xcassets/QuickPose-Logo.imageset/Contents.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

FitCount/ContentView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import SwiftUI
99

1010
struct ContentView: View {
1111
@StateObject var viewModel = ViewModel()
12+
@StateObject var sessionConfig: SessionConfig = SessionConfig()
1213

1314

1415
var body: some View {
@@ -25,7 +26,7 @@ struct ContentView: View {
2526
.padding()
2627
.cornerRadius(8) // Add corner radius for a rounded look
2728
}.navigationDestination(for: Exercise.self) { exercise in
28-
ExerciseDetailsView(exercise: exercise).environmentObject(viewModel)
29+
ExerciseDetailsView(exercise: exercise).environmentObject(viewModel).environmentObject(sessionConfig)
2930
}
3031
}
3132
.background(.white)

FitCount/History/HistoryView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct HistoryView: View {
1919
VStack {
2020
if let sessionDataArray = sessionDataArray {
2121
ScrollView {
22-
ForEach(sessionDataArray, id: \.self) { sessionData in
22+
ForEach(sessionDataArray.reversed(), id: \.self) { sessionData in
2323
Text(sessionData.exercise)
2424
Text("\(sessionData.count) reps")
2525
Text("\(sessionData.seconds) sec")

FitCount/Workout/ExerciseDetailsView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ struct TitleNavBarItem: View {
2222
}
2323

2424
class SessionConfig: ObservableObject {
25-
@Published var nReps : Int = 0
25+
@Published var nReps : Int = 1
2626
@Published var nMinutes : Int = 0
27-
@Published var nSeconds : Int = 0
27+
@Published var nSeconds : Int = 1
2828

2929
@Published var useReps: Bool = true
3030
}
3131

3232

3333
struct ExerciseDetailsView: View {
3434
@EnvironmentObject var viewModel: ViewModel
35-
@StateObject var sessionConfig: SessionConfig = SessionConfig()
35+
@EnvironmentObject var sessionConfig: SessionConfig
3636

3737
let exercise: Exercise
3838

FitCount/Workout/QuickPoseBasicView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct QuickPoseBasicView: View {
8989
.padding(16)
9090
.scaleEffect(countScale)
9191

92-
Text(String(seconds) + (!sessionConfig.useReps ? " \\ " + String(sessionConfig.nSeconds) : "") + " sec")
92+
Text(String(seconds) + (!sessionConfig.useReps ? " \\ " + String(sessionConfig.nSeconds + sessionConfig.nMinutes * 60) : "") + " sec")
9393
.font(.system(size: 30, weight: .semibold))
9494
.padding(16)
9595
}

FitCount/Workout/WorkoutResultsView.swift

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,38 @@ struct WorkoutResultsView: View {
1212
@EnvironmentObject var viewModel: ViewModel
1313

1414
var body: some View {
15-
VStack{
16-
17-
Text("Count: " + String(sessionData.count))
18-
Text("Time: " + String(sessionData.seconds))
19-
20-
Button {
21-
viewModel.path.removeLast(viewModel.path.count)
22-
} label: {
23-
Text("Finish workout")
24-
.foregroundColor(.white)
25-
.padding()
26-
.background(.indigo) // Set background color to the main color
27-
.cornerRadius(8) // Add corner radius for a rounded look
28-
}.padding()
15+
NavigationView{
16+
VStack() {
17+
Text("Number of reps: \(sessionData.count)")
18+
.font(.title)
19+
.padding(.top, 50)
20+
.padding(.bottom, 20)
21+
22+
Text("Time: \(sessionData.seconds) Seconds")
23+
.font(.title2)
24+
.padding(.bottom, 40)
25+
26+
Button(action: {
27+
viewModel.path.removeLast(viewModel.path.count)
28+
}) {
29+
Text("Finish Workout")
30+
.foregroundColor(.white)
31+
.font(.title2)
32+
.padding()
33+
.frame(maxWidth: .infinity)
34+
.background(Color.indigo)
35+
.cornerRadius(8)
36+
}
37+
.padding()
38+
.buttonStyle(PlainButtonStyle()) // Remove button style highlighting
39+
40+
Spacer()
41+
}
42+
.navigationBarTitle("Results")
43+
.navigationBarBackButtonHidden(true)
44+
.padding()
45+
.background(Color.white) // Set the background color of the entire view
46+
// .padding([.leading, .trailing], 24)
2947
}
30-
.navigationBarBackButtonHidden(true)
3148
}
3249
}

FitCount/Workout/WorkoutView.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ struct WorkoutView: View {
1414

1515
@State var cameraPermissionGranted = false
1616
var exercise: Exercise
17-
// var nReps: Int?
18-
// var nSeconds: Int?
19-
2017

2118
var body: some View {
2219
GeometryReader { geometry in

FitCount.xcodeproj/project.pbxproj renamed to FitCounter by QuickPose.ai.xcodeproj/project.pbxproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
927261A32A24EF0B00C3B390 /* HistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryView.swift; sourceTree = "<group>"; };
6060
92C702F82A1BC705002ECC0B /* QuickPoseBasicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickPoseBasicView.swift; sourceTree = "<group>"; };
6161
92C703032A1D049E002ECC0B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
62-
92CACFCD2A1B7DD100DA2B40 /* FitCount.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FitCount.app; sourceTree = BUILT_PRODUCTS_DIR; };
62+
92CACFCD2A1B7DD100DA2B40 /* FitCounter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FitCounter.app; sourceTree = BUILT_PRODUCTS_DIR; };
6363
92CACFD02A1B7DD100DA2B40 /* FitCountApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FitCountApp.swift; sourceTree = "<group>"; };
6464
92CACFD22A1B7DD100DA2B40 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
6565
92CACFD42A1B7DD100DA2B40 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -146,7 +146,7 @@
146146
92CACFCE2A1B7DD100DA2B40 /* Products */ = {
147147
isa = PBXGroup;
148148
children = (
149-
92CACFCD2A1B7DD100DA2B40 /* FitCount.app */,
149+
92CACFCD2A1B7DD100DA2B40 /* FitCounter.app */,
150150
92CACFDD2A1B7DD200DA2B40 /* FitCountTests.xctest */,
151151
92CACFE72A1B7DD200DA2B40 /* FitCountUITests.xctest */,
152152
);
@@ -199,9 +199,9 @@
199199
/* End PBXGroup section */
200200

201201
/* Begin PBXNativeTarget section */
202-
92CACFCC2A1B7DD100DA2B40 /* FitCount */ = {
202+
92CACFCC2A1B7DD100DA2B40 /* FitCounter */ = {
203203
isa = PBXNativeTarget;
204-
buildConfigurationList = 92CACFF12A1B7DD200DA2B40 /* Build configuration list for PBXNativeTarget "FitCount" */;
204+
buildConfigurationList = 92CACFF12A1B7DD200DA2B40 /* Build configuration list for PBXNativeTarget "FitCounter" */;
205205
buildPhases = (
206206
92CACFC92A1B7DD100DA2B40 /* Sources */,
207207
92CACFCA2A1B7DD100DA2B40 /* Frameworks */,
@@ -211,7 +211,7 @@
211211
);
212212
dependencies = (
213213
);
214-
name = FitCount;
214+
name = FitCounter;
215215
packageProductDependencies = (
216216
92C702FB2A1BC74A002ECC0B /* QuickPoseCamera */,
217217
92C702FD2A1BC74A002ECC0B /* QuickPoseCore */,
@@ -220,7 +220,7 @@
220220
920A3EF52A20B14100EC6FC9 /* PagerTabStripView */,
221221
);
222222
productName = FitCount;
223-
productReference = 92CACFCD2A1B7DD100DA2B40 /* FitCount.app */;
223+
productReference = 92CACFCD2A1B7DD100DA2B40 /* FitCounter.app */;
224224
productType = "com.apple.product-type.application";
225225
};
226226
92CACFDC2A1B7DD200DA2B40 /* FitCountTests */ = {
@@ -282,7 +282,7 @@
282282
};
283283
};
284284
};
285-
buildConfigurationList = 92CACFC82A1B7DD000DA2B40 /* Build configuration list for PBXProject "FitCount" */;
285+
buildConfigurationList = 92CACFC82A1B7DD000DA2B40 /* Build configuration list for PBXProject "FitCounter by QuickPose.ai" */;
286286
compatibilityVersion = "Xcode 14.0";
287287
developmentRegion = en;
288288
hasScannedForEncodings = 0;
@@ -299,7 +299,7 @@
299299
projectDirPath = "";
300300
projectRoot = "";
301301
targets = (
302-
92CACFCC2A1B7DD100DA2B40 /* FitCount */,
302+
92CACFCC2A1B7DD100DA2B40 /* FitCounter */,
303303
92CACFDC2A1B7DD200DA2B40 /* FitCountTests */,
304304
92CACFE62A1B7DD200DA2B40 /* FitCountUITests */,
305305
);
@@ -375,12 +375,12 @@
375375
/* Begin PBXTargetDependency section */
376376
92CACFDF2A1B7DD200DA2B40 /* PBXTargetDependency */ = {
377377
isa = PBXTargetDependency;
378-
target = 92CACFCC2A1B7DD100DA2B40 /* FitCount */;
378+
target = 92CACFCC2A1B7DD100DA2B40 /* FitCounter */;
379379
targetProxy = 92CACFDE2A1B7DD200DA2B40 /* PBXContainerItemProxy */;
380380
};
381381
92CACFE92A1B7DD200DA2B40 /* PBXTargetDependency */ = {
382382
isa = PBXTargetDependency;
383-
target = 92CACFCC2A1B7DD100DA2B40 /* FitCount */;
383+
target = 92CACFCC2A1B7DD100DA2B40 /* FitCounter */;
384384
targetProxy = 92CACFE82A1B7DD200DA2B40 /* PBXContainerItemProxy */;
385385
};
386386
/* End PBXTargetDependency section */
@@ -523,7 +523,7 @@
523523
"$(inherited)",
524524
"@executable_path/Frameworks",
525525
);
526-
MARKETING_VERSION = 0.2;
526+
MARKETING_VERSION = 0.3;
527527
PRODUCT_BUNDLE_IDENTIFIER = ai.quickpose.FitCount;
528528
PRODUCT_NAME = "$(TARGET_NAME)";
529529
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -555,7 +555,7 @@
555555
"$(inherited)",
556556
"@executable_path/Frameworks",
557557
);
558-
MARKETING_VERSION = 0.2;
558+
MARKETING_VERSION = 0.3;
559559
PRODUCT_BUNDLE_IDENTIFIER = ai.quickpose.FitCount;
560560
PRODUCT_NAME = "$(TARGET_NAME)";
561561
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -643,7 +643,7 @@
643643
/* End XCBuildConfiguration section */
644644

645645
/* Begin XCConfigurationList section */
646-
92CACFC82A1B7DD000DA2B40 /* Build configuration list for PBXProject "FitCount" */ = {
646+
92CACFC82A1B7DD000DA2B40 /* Build configuration list for PBXProject "FitCounter by QuickPose.ai" */ = {
647647
isa = XCConfigurationList;
648648
buildConfigurations = (
649649
92CACFEF2A1B7DD200DA2B40 /* Debug */,
@@ -652,7 +652,7 @@
652652
defaultConfigurationIsVisible = 0;
653653
defaultConfigurationName = Release;
654654
};
655-
92CACFF12A1B7DD200DA2B40 /* Build configuration list for PBXNativeTarget "FitCount" */ = {
655+
92CACFF12A1B7DD200DA2B40 /* Build configuration list for PBXNativeTarget "FitCounter" */ = {
656656
isa = XCConfigurationList;
657657
buildConfigurations = (
658658
92CACFF22A1B7DD200DA2B40 /* Debug */,

FitCounter by QuickPose.ai.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)