Skip to content

Commit

Permalink
Add dummy grades for app store screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
jevonmao committed Aug 2, 2021
1 parent 657599a commit 63d9e54
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/SMHSSchedule (iOS)/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1742</string>
<string>1751</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct CourseGradeItem: View {

Text(course.periodName)
.font(.title2)
.fontWeight(.medium)
.lineLimit(1)
.minimumScaleFactor(0.7)
.padding(.bottom, 1)
Expand Down
14 changes: 10 additions & 4 deletions Sources/Shared/Views/GradesView/GradesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import SwiftUIVisualEffects

struct GradesView: View {
@StateObject var gradesViewModel = GradesViewModel()
@EnvironmentObject var userSettings: UserSettings

var body: some View {
NavigationView {
if !gradesViewModel.gradesResponse.isEmpty {
ScrollView {
LazyVStack(spacing: 20) {
ForEach(gradesViewModel.gradesResponse.filter{!$0.isPrior}, id: \.self){
ForEach(getCoursesList(), id: \.self){
CourseGradeItem(course: $0)
}
ActionButton(label: "Log Out") {
Expand Down Expand Up @@ -50,12 +51,17 @@ struct GradesView: View {
isLoading: $gradesViewModel.isLoading,
shouldReload: .constant(false))
}


}
}


func getCoursesList() -> [CourseGrade] {
if userSettings.developerSettings.dummyGrades {
return CourseGrade.dummyGrades
}
else {
return gradesViewModel.gradesResponse.filter{!$0.isPrior}
}
}
}

struct GradesView_Previews: PreviewProvider {
Expand Down
33 changes: 32 additions & 1 deletion Sources/Shared/Views/GradesView/Model/GradesResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,36 @@ struct CourseGrade: Codable, Hashable {
var teacherName: String
var gradePercent: String
var currentMark: String
var isPrior: Bool
var isPrior: Bool = false

static let dummyGrades: [CourseGrade] = [.init(periodNum: 1,
periodName: "Precalculus H AI IB",
teacherName: "CookT",
gradePercent: "69.7",
currentMark: "D+"),
.init(periodNum: 2,
periodName: "Journalism 1 H",
teacherName: "AppleseedJ",
gradePercent: "98.8",
currentMark: "A+"),
.init(periodNum: 3,
periodName: "AP Physics C",
teacherName: "MuskE",
gradePercent: "90.5",
currentMark: "A-"),
.init(periodNum: 4,
periodName: "Religion 2",
teacherName: "RileyT",
gradePercent: "74.3",
currentMark: "C"),
.init(periodNum: 5,
periodName: "History MUN H",
teacherName: "WashingtonG",
gradePercent: "64.9",
currentMark: "F"),
.init(periodNum: 6,
periodName: "French 3",
teacherName: "TrumpD",
gradePercent: "100.5",
currentMark: "A+")]
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ extension GradesViewModel {
gradesResponse = []
}
}

extension GradesViewModel {

}
4 changes: 4 additions & 0 deletions Sources/Shared/Views/SettingsView/DeveloperSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ struct DeveloperSettingsView: View { //Developer-only settings for debug scheme
Text("Debug Networking Mode")
})

Toggle(isOn: $userSettings.developerSettings.dummyGrades, label: {
Text("Dummy grades")
})

HStack {
Text("Version")
Spacer()
Expand Down
1 change: 1 addition & 0 deletions Sources/Shared/Views/SettingsView/UserSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ struct DeveloperSettings: Codable {
var shouldCacheData: Bool = true
var overrideNetworkStatus: Bool = false
var networkStatus: networkStatus = .unsatisfied
var dummyGrades: Bool = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ struct FooterModalView: View {
Text("Cache data")
})

Toggle(isOn: $userSettings.developerSettings.dummyGrades, label: {
Text("Dummy grades")
})

HStack {
Text("Version")
Spacer()
Expand Down

0 comments on commit 63d9e54

Please sign in to comment.