mirror of
https://github.com/NinjaCheetah/RIT-Dining.git
synced 2026-03-05 05:25:29 -05:00
Changed icon to new RIT-trademark-free one
Replaced the icon with a more generic tiger pawprint so that I'm not using an RIT trademark, so that I'm prepared for the first App Store release. Also added information about where menu information is being sourced from on the about screen, and fixed a bug where vegetarian/vegan/no beef/no pork toggles would not be written to UserDefaults.
This commit is contained in:
@@ -20,35 +20,42 @@ struct AboutView: View {
|
||||
.clipShape(RoundedRectangle(cornerRadius: 20))
|
||||
Text("TigerDine")
|
||||
.font(.title)
|
||||
.fontWeight(.bold)
|
||||
Text("An unofficial RIT Dining app")
|
||||
.font(.subheadline)
|
||||
Text("Version \(appVersionString) (\(buildNumber))")
|
||||
.foregroundStyle(.secondary)
|
||||
.padding(.bottom, 2)
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Text("Dining locations, their descriptions, and their opening hours are sourced from the RIT student-run TigerCenter API. Building occupancy information is sourced from the official RIT maps API.")
|
||||
Text("Dining locations, their descriptions, and their opening hours are sourced from the RIT student-run TigerCenter API. Building occupancy information is sourced from the official RIT maps API. Menu and nutritional information is sourced from the data provided to FD MealPlanner by RIT Dining through the FD MealPlanner API.")
|
||||
Text("This app is not affiliated, associated, authorized, endorsed by, or in any way officially connected with the Rochester Institute of Technology. This app is student created and maintained.")
|
||||
HStack {
|
||||
Button(action: {
|
||||
openURL(URL(string: "https://github.com/NinjaCheetah/TigerDine")!)
|
||||
}) {
|
||||
Text("Source Code")
|
||||
VStack(alignment: .center, spacing: 8) {
|
||||
HStack(spacing: 8) {
|
||||
Button(action: {
|
||||
openURL(URL(string: "https://github.com/NinjaCheetah/TigerDine")!)
|
||||
}) {
|
||||
Label("Source Code", systemImage: "network")
|
||||
}
|
||||
Button(action: {
|
||||
openURL(URL(string: "https://tigercenter.rit.edu/")!)
|
||||
}) {
|
||||
Label("TigerCenter", systemImage: "fork.knife.circle")
|
||||
}
|
||||
}
|
||||
Text("•")
|
||||
.foregroundStyle(.secondary)
|
||||
Button(action: {
|
||||
openURL(URL(string: "https://tigercenter.rit.edu/")!)
|
||||
}) {
|
||||
Text("TigerCenter")
|
||||
}
|
||||
Text("•")
|
||||
.foregroundStyle(.secondary)
|
||||
Button(action: {
|
||||
openURL(URL(string: "https://maps.rit.edu/")!)
|
||||
}) {
|
||||
Text("Official RIT Map")
|
||||
HStack(spacing: 8) {
|
||||
Button(action: {
|
||||
openURL(URL(string: "https://maps.rit.edu/")!)
|
||||
}) {
|
||||
Label("Official RIT Map", systemImage: "map")
|
||||
}
|
||||
Button(action: {
|
||||
openURL(URL(string: "https://fdmealplanner.com/")!)
|
||||
}) {
|
||||
Label("FD MealPlanner", systemImage: "menucard")
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
@@ -15,32 +15,10 @@ struct MenuDietaryRestrictionsSheet: View {
|
||||
NavigationView {
|
||||
Form {
|
||||
Section(header: Text("Diet")) {
|
||||
Toggle(isOn: Binding(
|
||||
get: {
|
||||
dietaryRestrictionsModel.filteredDietaryMarkers.contains("Beef")
|
||||
},
|
||||
set: { isOn in
|
||||
if isOn {
|
||||
dietaryRestrictionsModel.filteredDietaryMarkers.insert("Beef")
|
||||
} else {
|
||||
dietaryRestrictionsModel.filteredDietaryMarkers.remove("Beef")
|
||||
}
|
||||
} )
|
||||
) {
|
||||
Toggle(isOn: $dietaryRestrictionsModel.noBeef) {
|
||||
Text("No Beef")
|
||||
}
|
||||
Toggle(isOn: Binding(
|
||||
get: {
|
||||
dietaryRestrictionsModel.filteredDietaryMarkers.contains("Pork")
|
||||
},
|
||||
set: { isOn in
|
||||
if isOn {
|
||||
dietaryRestrictionsModel.filteredDietaryMarkers.insert("Pork")
|
||||
} else {
|
||||
dietaryRestrictionsModel.filteredDietaryMarkers.remove("Pork")
|
||||
}
|
||||
} )
|
||||
) {
|
||||
Toggle(isOn: $dietaryRestrictionsModel.noPork) {
|
||||
Text("No Pork")
|
||||
}
|
||||
Toggle(isOn: $dietaryRestrictionsModel.isVegetarian) {
|
||||
|
||||
@@ -65,17 +65,6 @@ struct MenuView: View {
|
||||
|
||||
private var filteredMenuItems: [FDMenuItem] {
|
||||
var newItems = menuItems
|
||||
// Filter out dietary restrictions, starting with pork/beef since those are tagged.
|
||||
if !dietaryRestrictionsModel.filteredDietaryMarkers.isEmpty {
|
||||
newItems = newItems.filter { item in
|
||||
for marker in dietaryRestrictionsModel.filteredDietaryMarkers {
|
||||
if item.dietaryMarkers.contains(marker) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
// Filter out allergens.
|
||||
newItems = newItems.filter { item in
|
||||
if !item.allergens.isEmpty {
|
||||
@@ -100,6 +89,17 @@ struct MenuView: View {
|
||||
return false
|
||||
}
|
||||
}
|
||||
// Filter out pork/beef.
|
||||
if dietaryRestrictionsModel.noBeef {
|
||||
newItems = newItems.filter { item in
|
||||
item.dietaryMarkers.contains("Beef") == false
|
||||
}
|
||||
}
|
||||
if dietaryRestrictionsModel.noPork {
|
||||
newItems = newItems.filter { item in
|
||||
item.dietaryMarkers.contains("Pork") == false
|
||||
}
|
||||
}
|
||||
// Filter down to search contents.
|
||||
newItems = newItems.filter { item in
|
||||
let searchedLocations = searchText.isEmpty || item.name.localizedCaseInsensitiveContains(searchText)
|
||||
|
||||
Reference in New Issue
Block a user