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.

This commit is contained in:
Isaac Greene 2022-06-16 23:37:45 -04:00
parent 7aa899ca7d
commit af513b8c05
4 changed files with 155 additions and 118 deletions

View file

@ -10,137 +10,153 @@ import SwiftUI
struct June2022: View { struct June2022: View {
var body: some View { var body: some View {
ScrollView { ScrollView {
//2022-06-15 //2022-06-16
HStack { HStack {
VStack (alignment: .leading) { VStack (alignment: .leading) {
Text("2022-06-15") Text("2022-06-16")
.font(.title2) .font(.title2)
Text("Version Prerelease Build LVSXT10a.3\n") Text("Version Release Candidate 3\n")
.font(.footnote) .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() Spacer()
} }
.padding(30) .padding(30)
//2022-06-14 // has ten days of logs
HStack { VStack {
VStack (alignment: .leading) { //2022-06-15
Text("2022-06-14") HStack {
.font(.title2) VStack (alignment: .leading) {
Text("Version Prerelease Build LVSXT10a.3\n") Text("2022-06-15")
.font(.footnote) .font(.title2)
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") 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)
}
.padding(30) //2022-06-14
HStack {
//2022-06-11 VStack (alignment: .leading) {
// LVSXT10a.2 Text("2022-06-14")
HStack { .font(.title2)
VStack (alignment: .leading) { Text("Version Prerelease Build LVSXT10a.3\n")
Text("2022-06-11") .font(.footnote)
.font(.title2) 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")
Text("Version Release Candidate 2\n") }
.font(.footnote) Spacer()
Text("\u{2022} Added biometrics to sign in along with option for username/password")
} }
Spacer() .padding(30)
}
.padding(30) //2022-06-11
// LVSXT10a.2
//2022-06-10 HStack {
// LVSXT10a VStack (alignment: .leading) {
HStack { Text("2022-06-11")
VStack (alignment: .leading) { .font(.title2)
Text("2022-06-10") Text("Version Release Candidate 2\n")
.font(.title2) .font(.footnote)
Text("Version Release Candidate\n") Text("\u{2022} Added biometrics to sign in along with option for username/password")
.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)
}
.padding(30) //2022-06-10
// LVSXT10a
//2022-06-09 HStack {
HStack { VStack (alignment: .leading) {
VStack (alignment: .leading) { Text("2022-06-10")
Text("2022-06-09") .font(.title2)
.font(.title2) Text("Version Release Candidate\n")
Text("Version Prerelease Build LVSXT10c.2\n") .font(.footnote)
.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")
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)
}
.padding(30) //2022-06-09
HStack {
//2022-06-08 VStack (alignment: .leading) {
HStack { Text("2022-06-09")
VStack (alignment: .leading) { .font(.title2)
Text("2022-06-08") Text("Version Prerelease Build LVSXT10c.2\n")
.font(.title2) .font(.footnote)
Text("Version Prerelease Build LVSXT10c\n") Text("\u{2022} Worked on a simple login page to view contact info\n\t\u{2022} Spent *way* too long on it")
.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()
} }
Spacer() .padding(30)
}
.padding(30) //2022-06-08
HStack {
//2022-06-05 VStack (alignment: .leading) {
HStack { Text("2022-06-08")
VStack (alignment: .leading) { .font(.title2)
Text("2022-06-05") Text("Version Prerelease Build LVSXT10c\n")
.font(.title2) .font(.footnote)
Text("Version Prerelease Build LVSXT10d.3\n") 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")
.font(.footnote) }
Text("\u{2022} Started work on converting the pace to a more understandable format") Spacer()
} }
} .padding(30)
.padding(30)
//2022-06-05
//2022-06-04 HStack {
HStack { VStack (alignment: .leading) {
VStack (alignment: .leading) { Text("2022-06-05")
Text("2022-06-04") .font(.title2)
.font(.title2) Text("Version Prerelease Build LVSXT10d.3\n")
Text("Version Prerelease Build LVSXT10d.2\n") .font(.footnote)
.font(.footnote) Text("\u{2022} Started work on converting the pace to a more understandable format")
Text("\u{2022} Reformatted some tabs, and added the Recently Resolved issues tab\n\u{2022} Moved the Help tab into Docs") }
} }
Spacer() .padding(30)
}
.padding(30) //2022-06-04
HStack {
//2022-06-03 VStack (alignment: .leading) {
HStack { Text("2022-06-04")
VStack (alignment: .leading) { .font(.title2)
Text("2022-06-03") Text("Version Prerelease Build LVSXT10d.2\n")
.font(.title2) .font(.footnote)
Text("Version Prerelease Build LVSXT10d\n") Text("\u{2022} Reformatted some tabs, and added the Recently Resolved issues tab\n\u{2022} Moved the Help tab into Docs")
.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)
}
.padding(30) //2022-06-03
HStack {
//2022-06-01 VStack (alignment: .leading) {
//gay Text("2022-06-03")
HStack { .font(.title2)
VStack (alignment: .leading) { Text("Version Prerelease Build LVSXT10d\n")
Text("2022-06-01") .font(.footnote)
.font(.title2) 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.")
Text("Version Prerelease Build LVSXT10g.3\n") }
.font(.footnote) Spacer()
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)
//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") .navigationTitle("June 2022 Log")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)

View file

@ -43,6 +43,13 @@ struct ContentView: View {
Button("Done") { Button("Done") {
nameIsFocused = false nameIsFocused = false
} }
Button("Clear") {
distance = ""
timeHours = ""
timeMinutes = ""
timeSeconds = ""
}
Spacer()
Button("Next") { Button("Next") {
if focusedField == .distance { if focusedField == .distance {
focusedField = .hours focusedField = .hours
@ -117,7 +124,7 @@ struct PaceResults: View {
@Binding var distance: String @Binding var distance: String
var body: some View { 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, // because of some conversions I have to do,
// this constant is a double just to make things easier. // this constant is a double just to make things easier.
// this has to be one because the pace is calculated // this has to be one because the pace is calculated
@ -210,7 +217,7 @@ struct PaceResults: View {
HStack { HStack {
VStack (alignment: .leading) { VStack (alignment: .leading) {
Text("\(distance)\(selectedSystem)") Text("\(roundString(Double(removeLeadingZeros(distance: &distance)) ?? 0))\(selectedSystem)")
Text("\(convertedDistanceString)\(notSelectedSystem)") Text("\(convertedDistanceString)\(notSelectedSystem)")
} }
.frame(minWidth: 100) .frame(minWidth: 100)
@ -230,6 +237,15 @@ struct PaceResults: View {
} }
return distance 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 { struct ContentView_Previews: PreviewProvider {

View file

@ -62,8 +62,8 @@ struct DocsView: View {
} }
Section(header: Text("App Information")) { Section(header: Text("App Information")) {
NavigationLink("Software License", destination: LicenseView()) NavigationLink("Software License", destination: LicenseView())
Text("Version: Prerelease Build LVSXT10a.3") Text("Version: Release Candidate 3")
Text("Release date: 2022-06-15") Text("Release date: 2022-06-16")
Text("Start date: 2022-03-25") Text("Start date: 2022-03-25")
Link("Built with SwiftUI \(Image(systemName: "swift"))", destination: URL(string: "https://developer.apple.com/xcode/swiftui")!) Link("Built with SwiftUI \(Image(systemName: "swift"))", destination: URL(string: "https://developer.apple.com/xcode/swiftui")!)
} }

View file

@ -13,7 +13,7 @@ struct RecentlyResolved: View {
var body: some View { var body: some View {
ScrollView { ScrollView {
VStack(alignment: .leading) { 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) .padding(30)
} }
@ -25,9 +25,13 @@ struct HighPriority: View {
var body: some View { var body: some View {
ScrollView { ScrollView {
VStack { 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) .padding(30)
.frame(maxWidth: .infinity)
} }
.navigationTitle("High Priority") .navigationTitle("High Priority")
} }
@ -43,6 +47,7 @@ struct MediumPriority: View {
.frame(width: 70) .frame(width: 70)
} }
.padding(30) .padding(30)
.frame(maxWidth: .infinity)
} }
.navigationTitle("Medium Priority") .navigationTitle("Medium Priority")
} }