From af513b8c0569f98851036184983a790369dca8a4 Mon Sep 17 00:00:00 2001 From: Isaac Greene Date: Thu, 16 Jun 2022 23:37:45 -0400 Subject: [PATCH] Fixed issue where entering a distance of less than .1 crashed the app. Formatted the primary distance to three decimal paces. Added a "Clear" button which sets all text fields to "". Moved app back to Release Candidate. --- Splits/ChangeLogData.swift | 240 ++++++++++++++++++++----------------- Splits/ContentView.swift | 20 +++- Splits/DocsView.swift | 4 +- Splits/KnownIssues.swift | 9 +- 4 files changed, 155 insertions(+), 118 deletions(-) diff --git a/Splits/ChangeLogData.swift b/Splits/ChangeLogData.swift index 8a9ba50..e06a47f 100644 --- a/Splits/ChangeLogData.swift +++ b/Splits/ChangeLogData.swift @@ -10,137 +10,153 @@ import SwiftUI struct June2022: View { var body: some View { ScrollView { - //2022-06-15 + //2022-06-16 HStack { VStack (alignment: .leading) { - Text("2022-06-15") + Text("2022-06-16") .font(.title2) - Text("Version Prerelease Build LVSXT10a.3\n") + Text("Version Release Candidate 3\n") .font(.footnote) - Text("\u{2022} Fixed an issue where typing zero for the distance caused the app to crash\n\u{2022} Implemented a way to navigate between text fields and redid the Done button to make it fit better") + Text("\u{2022} You can now enter any distance you want without the app crashing\n\u{2022} Formatted the primary distance to three decimal places") } Spacer() } .padding(30) - //2022-06-14 - HStack { - VStack (alignment: .leading) { - Text("2022-06-14") - .font(.title2) - Text("Version Prerelease Build LVSXT10a.3\n") - .font(.footnote) - Text("\u{2022} Optimized some code to allow for future development\n\u{2022} Starting on fixing an issue where putting a zero as the first number in the Distance field causes the app to crash\n\u{2022} Started work on more robust app documentation") + // has ten days of logs + VStack { + //2022-06-15 + HStack { + VStack (alignment: .leading) { + Text("2022-06-15") + .font(.title2) + Text("Version Prerelease Build LVSXT10a.3\n") + .font(.footnote) + Text("\u{2022} Fixed an issue where typing zero for the distance caused the app to crash\n\u{2022} Implemented a way to navigate between text fields and redid the Done button to make it fit better") + } + Spacer() } - Spacer() - } - .padding(30) - - //2022-06-11 - // LVSXT10a.2 - HStack { - VStack (alignment: .leading) { - Text("2022-06-11") - .font(.title2) - Text("Version Release Candidate 2\n") - .font(.footnote) - Text("\u{2022} Added biometrics to sign in along with option for username/password") + .padding(30) + + //2022-06-14 + HStack { + VStack (alignment: .leading) { + Text("2022-06-14") + .font(.title2) + Text("Version Prerelease Build LVSXT10a.3\n") + .font(.footnote) + Text("\u{2022} Optimized some code to allow for future development\n\u{2022} Starting on fixing an issue where putting a zero as the first number in the Distance field causes the app to crash\n\u{2022} Started work on more robust app documentation") + } + Spacer() } - Spacer() - } - .padding(30) - - //2022-06-10 - // LVSXT10a - HStack { - VStack (alignment: .leading) { - Text("2022-06-10") - .font(.title2) - Text("Version Release Candidate\n") - .font(.footnote) - Text("\u{2022} Got the conversion of paces to work, so a 5:00/km pace will also show as 8:03/mi\n\u{2022} This app is now considered \"Finished\" and will transition to Version Numbers\n\u{2022} FINALLY MADE A WAY TO DISMISS THE KEYBOARD\n\t\u{2022} (as with most of the other solutions I've had to use for other problems in this app, the fix was remarkably easy)\n\u{2022} Made several small quality-of-life improvements") + .padding(30) + + //2022-06-11 + // LVSXT10a.2 + HStack { + VStack (alignment: .leading) { + Text("2022-06-11") + .font(.title2) + Text("Version Release Candidate 2\n") + .font(.footnote) + Text("\u{2022} Added biometrics to sign in along with option for username/password") + } + Spacer() } - Spacer() - } - .padding(30) - - //2022-06-09 - HStack { - VStack (alignment: .leading) { - Text("2022-06-09") - .font(.title2) - Text("Version Prerelease Build LVSXT10c.2\n") - .font(.footnote) - Text("\u{2022} Worked on a simple login page to view contact info\n\t\u{2022} Spent *way* too long on it") + .padding(30) + + //2022-06-10 + // LVSXT10a + HStack { + VStack (alignment: .leading) { + Text("2022-06-10") + .font(.title2) + Text("Version Release Candidate\n") + .font(.footnote) + Text("\u{2022} Got the conversion of paces to work, so a 5:00/km pace will also show as 8:03/mi\n\u{2022} This app is now considered \"Finished\" and will transition to Version Numbers\n\u{2022} FINALLY MADE A WAY TO DISMISS THE KEYBOARD\n\t\u{2022} (as with most of the other solutions I've had to use for other problems in this app, the fix was remarkably easy)\n\u{2022} Made several small quality-of-life improvements") + } + Spacer() } - Spacer() - } - .padding(30) - - //2022-06-08 - HStack { - VStack (alignment: .leading) { - Text("2022-06-08") - .font(.title2) - Text("Version Prerelease Build LVSXT10c\n") - .font(.footnote) - Text("\u{2022} Finished with a conversion of the pace to be a more readable format (i.e. 5:45 instead of 5.75)!\n\t\u{2022} This is probably one of the biggest things to increase readability in the app\n\u{2022} Installed a Software License") + .padding(30) + + //2022-06-09 + HStack { + VStack (alignment: .leading) { + Text("2022-06-09") + .font(.title2) + Text("Version Prerelease Build LVSXT10c.2\n") + .font(.footnote) + Text("\u{2022} Worked on a simple login page to view contact info\n\t\u{2022} Spent *way* too long on it") + } + Spacer() } - Spacer() - } - .padding(30) - - //2022-06-05 - HStack { - VStack (alignment: .leading) { - Text("2022-06-05") - .font(.title2) - Text("Version Prerelease Build LVSXT10d.3\n") - .font(.footnote) - Text("\u{2022} Started work on converting the pace to a more understandable format") + .padding(30) + + //2022-06-08 + HStack { + VStack (alignment: .leading) { + Text("2022-06-08") + .font(.title2) + Text("Version Prerelease Build LVSXT10c\n") + .font(.footnote) + Text("\u{2022} Finished with a conversion of the pace to be a more readable format (i.e. 5:45 instead of 5.75)!\n\t\u{2022} This is probably one of the biggest things to increase readability in the app\n\u{2022} Installed a Software License") + } + Spacer() } - } - .padding(30) - - //2022-06-04 - HStack { - VStack (alignment: .leading) { - Text("2022-06-04") - .font(.title2) - Text("Version Prerelease Build LVSXT10d.2\n") - .font(.footnote) - Text("\u{2022} Reformatted some tabs, and added the Recently Resolved issues tab\n\u{2022} Moved the Help tab into Docs") + .padding(30) + + //2022-06-05 + HStack { + VStack (alignment: .leading) { + Text("2022-06-05") + .font(.title2) + Text("Version Prerelease Build LVSXT10d.3\n") + .font(.footnote) + Text("\u{2022} Started work on converting the pace to a more understandable format") + } } - Spacer() - } - .padding(30) - - //2022-06-03 - HStack { - VStack (alignment: .leading) { - Text("2022-06-03") - .font(.title2) - Text("Version Prerelease Build LVSXT10d\n") - .font(.footnote) - Text("\u{2022} Finished hours input.\n\u{2022} Moved some things around and the \"Change log\" tab is now \"Docs\" which holds info on features, the change log, and known issues, with a few other things.") + .padding(30) + + //2022-06-04 + HStack { + VStack (alignment: .leading) { + Text("2022-06-04") + .font(.title2) + Text("Version Prerelease Build LVSXT10d.2\n") + .font(.footnote) + Text("\u{2022} Reformatted some tabs, and added the Recently Resolved issues tab\n\u{2022} Moved the Help tab into Docs") + } + Spacer() } - Spacer() - } - .padding(30) - - //2022-06-01 - //gay - HStack { - VStack (alignment: .leading) { - Text("2022-06-01") - .font(.title2) - Text("Version Prerelease Build LVSXT10g.3\n") - .font(.footnote) - Text("\u{2022} Partially implemented an easier way to input hours. Mostly working on formatting issues, but it shows up somewhat like it's supposed to.") + .padding(30) + + //2022-06-03 + HStack { + VStack (alignment: .leading) { + Text("2022-06-03") + .font(.title2) + Text("Version Prerelease Build LVSXT10d\n") + .font(.footnote) + Text("\u{2022} Finished hours input.\n\u{2022} Moved some things around and the \"Change log\" tab is now \"Docs\" which holds info on features, the change log, and known issues, with a few other things.") + } + Spacer() } - Spacer() + .padding(30) + + //2022-06-01 + //gay + HStack { + VStack (alignment: .leading) { + Text("2022-06-01") + .font(.title2) + Text("Version Prerelease Build LVSXT10g.3\n") + .font(.footnote) + Text("\u{2022} Partially implemented an easier way to input hours. Mostly working on formatting issues, but it shows up somewhat like it's supposed to.") + } + Spacer() + } + .padding(30) } - .padding(30) } .navigationTitle("June 2022 Log") .navigationBarTitleDisplayMode(.inline) diff --git a/Splits/ContentView.swift b/Splits/ContentView.swift index 3d73d11..c714a5e 100644 --- a/Splits/ContentView.swift +++ b/Splits/ContentView.swift @@ -43,6 +43,13 @@ struct ContentView: View { Button("Done") { nameIsFocused = false } + Button("Clear") { + distance = "" + timeHours = "" + timeMinutes = "" + timeSeconds = "" + } + Spacer() Button("Next") { if focusedField == .distance { focusedField = .hours @@ -117,7 +124,7 @@ struct PaceResults: View { @Binding var distance: String var body: some View { - let distanceDub:Double = Double(removeLeadingZeros(distance: &distance)) ?? 1.0 + let distanceDub:Double = ((Double(distance) != 0 ? Double(removeLeadingZeros(distance: &distance)) ?? 1.0 : 1.0)) // because of some conversions I have to do, // this constant is a double just to make things easier. // this has to be one because the pace is calculated @@ -210,7 +217,7 @@ struct PaceResults: View { HStack { VStack (alignment: .leading) { - Text("\(distance)\(selectedSystem)") + Text("\(roundString(Double(removeLeadingZeros(distance: &distance)) ?? 0))\(selectedSystem)") Text("\(convertedDistanceString)\(notSelectedSystem)") } .frame(minWidth: 100) @@ -230,6 +237,15 @@ struct PaceResults: View { } return distance } + + func roundString(_ variable: Double) -> String { + if distance.contains(".") { + let formattedString = String(format: "%.3f", variable) + return formattedString + } else { + return distance + } + } } struct ContentView_Previews: PreviewProvider { diff --git a/Splits/DocsView.swift b/Splits/DocsView.swift index c11aa65..e73e797 100644 --- a/Splits/DocsView.swift +++ b/Splits/DocsView.swift @@ -62,8 +62,8 @@ struct DocsView: View { } Section(header: Text("App Information")) { NavigationLink("Software License", destination: LicenseView()) - Text("Version: Prerelease Build LVSXT10a.3") - Text("Release date: 2022-06-15") + Text("Version: Release Candidate 3") + Text("Release date: 2022-06-16") Text("Start date: 2022-03-25") Link("Built with SwiftUI \(Image(systemName: "swift"))", destination: URL(string: "https://developer.apple.com/xcode/swiftui")!) } diff --git a/Splits/KnownIssues.swift b/Splits/KnownIssues.swift index df14f9d..472847e 100644 --- a/Splits/KnownIssues.swift +++ b/Splits/KnownIssues.swift @@ -13,7 +13,7 @@ struct RecentlyResolved: View { var body: some View { ScrollView { VStack(alignment: .leading) { - Text("\u{2022} Implemented an easy way to dismiss the keyboard in the main view of Calculator (it only took 2 1/2 months)\n\u{2022} Opening the contacts tab no longer causes the app to crash (RC 2)\n\u{2022} Typing zero as the first number for the distance no longer causes the app to crash") + Text("\u{2022} Opening the contacts tab no longer causes the app to crash\n\u{2022} Typing zero as the first number for the distance no longer causes the app to crash\n\u{2022} Having a distance of less than .1 no longer crashes the app") } .padding(30) } @@ -25,9 +25,13 @@ struct HighPriority: View { var body: some View { ScrollView { VStack { - Text("\u{2022} Entering a distance of less than 0.1 per unit causes the app to crash\n\t**Workaround:** RIP to you if this applies") + Image(systemName: "checkmark.shield.fill") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 70) } .padding(30) + .frame(maxWidth: .infinity) } .navigationTitle("High Priority") } @@ -43,6 +47,7 @@ struct MediumPriority: View { .frame(width: 70) } .padding(30) + .frame(maxWidth: .infinity) } .navigationTitle("Medium Priority") }