mirror of
https://github.com/NinjaCheetah/RIT-Dining.git
synced 2026-03-05 05:25:29 -05:00
Added dining location menus from FD MealPlanner API
Dining locations that also exist on FD MealPlanner now have a "View Menu" button under the favorite/OnDemand/map buttons that take you to a new view that pulls the location's menu from FD MealPlanner. You can view all of the menu items that have actually been added to that site, and tap them for more details (which will be expanded on later). Searching the item list is supported, with more filtering options coming in the next update. Meal periods can be browsed using the clock button in the top right for locations that are open more than once per day. Other changes: - App renamed from "RIT Dining" to "TigerDine" to not get me in trouble for an App Store release - Slightly changed the way that dining locations' short descriptions and current open times are displayed in the detail view - Fixed the box truck icon used in the food truck view being squished
This commit is contained in:
16
RIT Dining/Data/Static/FDMPMealPeriods.swift
Normal file
16
RIT Dining/Data/Static/FDMPMealPeriods.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// FDMPMealPeriods.swift
|
||||
// RIT Dining
|
||||
//
|
||||
// Created by Campbell on 11/8/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
let fdmpMealPeriodsMap: [Int: String] = [
|
||||
1: "Breakfast",
|
||||
2: "Lunch",
|
||||
3: "Dinner",
|
||||
6: "Late Night",
|
||||
8: "All Day",
|
||||
]
|
||||
25
RIT Dining/Data/Static/TCtoFDMPMap.swift
Normal file
25
RIT Dining/Data/Static/TCtoFDMPMap.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// TCtoFDMPMap.swift
|
||||
// RIT Dining
|
||||
//
|
||||
// Created by Campbell on 11/8/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Maps the IDs used by TigerCenter to the locationId and accountId values used by FD MealPlanner. This is used to get menus for locations from their detail views.
|
||||
let tCtoFDMPMap: [Int: (Int, Int)] = [
|
||||
// These are ordered based on the way that they're ordered in the FD MealPlanner search API response.
|
||||
30: (1, 1), // Artesano
|
||||
31: (2, 2), // Beanz
|
||||
23: (7, 7), // Crossroads
|
||||
25: (8, 8), // Cantina
|
||||
34: (6, 6), // Ctr-Alt-DELi
|
||||
21: (10, 10), // Gracie's
|
||||
22: (4, 4), // Brick City Cafe
|
||||
441: (11, 11), // Loaded Latke
|
||||
38: (12, 12), // Midnight Oil
|
||||
26: (14, 4), // RITZ
|
||||
9041: (18, 17), // The College Grind
|
||||
24: (15, 14), // The Commons
|
||||
]
|
||||
90
RIT Dining/Data/Types/FDMealPlannerTypes.swift
Normal file
90
RIT Dining/Data/Types/FDMealPlannerTypes.swift
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// FDMealPlannerTypes.swift
|
||||
// RIT Dining
|
||||
//
|
||||
// Created by Campbell on 11/3/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Struct to parse the response from the FDMP search API. This API returns all of the dining locations that are have menus available and the required IDs needed to get those menus.
|
||||
struct FDSearchResponseParser: Decodable {
|
||||
/// The main response body containing the result count and the results themselves.
|
||||
struct Data: Decodable {
|
||||
/// The key information returned for each location in the search results. These values are required to pass along to the menu API.
|
||||
struct Result: Decodable {
|
||||
let locationId: Int
|
||||
let accountId: Int
|
||||
let tenantId: Int
|
||||
let locationName: String
|
||||
let locationCode: String
|
||||
let locationDisplayName: String
|
||||
let accountName: String
|
||||
}
|
||||
let result: [Result]
|
||||
let totalCount: Int
|
||||
}
|
||||
let success: Bool
|
||||
let errorMessage: String?
|
||||
let data: Data
|
||||
}
|
||||
|
||||
/// Struct to parse the response from the FDMP meal periods API. This API returns all potentail meal periods for a location based on its ID. This meal period ID is required to get the menu for that meal period from the meals API.
|
||||
struct FDMealPeriodsParser: Decodable {
|
||||
/// The response body, which is a list of responses that include a meal period and the ID that maps to it.
|
||||
struct Data: Decodable {
|
||||
let id: Int
|
||||
let mealPeriodName: String
|
||||
}
|
||||
let success: Bool
|
||||
let errorMessage: String?
|
||||
let data: [Data]
|
||||
}
|
||||
|
||||
/// Struct to parse the response from the FDMP meals API. This API contains the actual menu information for the specified location during the specified meal period. It doesn't contain every menu item, but it's the best source of menu information that I can access.
|
||||
struct FDMealsParser: Decodable, Hashable {
|
||||
/// The actual response body.
|
||||
struct Result: Decodable, Hashable {
|
||||
/// An individual item on the menu at this location and its information.
|
||||
struct MenuRecipe: Decodable, Hashable {
|
||||
let componentName: String
|
||||
let componentId: Int
|
||||
let componentTypeId: Int
|
||||
let englishAlternateName: String
|
||||
let category: String
|
||||
let allergenName: String
|
||||
let calories: String
|
||||
let recipeProductDietaryName: String
|
||||
let ingredientStatement: String
|
||||
let sellingPrice: Double
|
||||
let productMeasuringSize: Int
|
||||
let productMeasuringSizeUnit: String
|
||||
let itemsToOrder: Int
|
||||
}
|
||||
let menuId: Int
|
||||
let menuForDate: String
|
||||
let menuToDate: String
|
||||
let accountId: Int
|
||||
let accountName: String
|
||||
let menuTypeName: String
|
||||
let mealPeriodId: Int
|
||||
let allMenuRecipes: [MenuRecipe]?
|
||||
}
|
||||
let responseStatus: String?
|
||||
let result: [Result]
|
||||
}
|
||||
|
||||
/// A single menu item, stripped down and reorganized to a format that actually makes sense for me to use in the rest of the app.
|
||||
struct FDMenuItem: Hashable, Identifiable {
|
||||
let id: Int
|
||||
let name: String
|
||||
let exactName: String
|
||||
let category: String
|
||||
let allergens: [String]
|
||||
let calories: Int
|
||||
let dietaryMarkers: [String]
|
||||
let ingredients: String
|
||||
let price: Double
|
||||
let servingSize: Int
|
||||
let servingSizeUnit: String
|
||||
}
|
||||
18
RIT Dining/Data/Types/FoodTruckTypes.swift
Normal file
18
RIT Dining/Data/Types/FoodTruckTypes.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// FoodTruckTypes.swift
|
||||
// RIT Dining
|
||||
//
|
||||
// Created by Campbell on 11/3/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// A weekend food trucks even representing when it's happening and what food trucks will be there.
|
||||
struct FoodTruckEvent: Hashable {
|
||||
let date: Date
|
||||
let openTime: Date
|
||||
let closeTime: Date
|
||||
let location: String
|
||||
let trucks: [String]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Types.swift
|
||||
// TigerCenterTypes.swift
|
||||
// RIT Dining
|
||||
//
|
||||
// Created by Campbell on 9/2/25.
|
||||
@@ -88,10 +88,17 @@ struct DailySpecial: Equatable, Hashable {
|
||||
let type: String
|
||||
}
|
||||
|
||||
// The IDs required to get the menu for a location from FD MealPlanner. Only present if the location appears in the map.
|
||||
struct FDMPIds: Hashable {
|
||||
let locationId: Int
|
||||
let accountId: Int
|
||||
}
|
||||
|
||||
// The basic information about a dining location needed to display it in the app after parsing is finished.
|
||||
struct DiningLocation: Identifiable, Hashable {
|
||||
let id: Int
|
||||
let mdoId: Int
|
||||
let fdmpIds: FDMPIds?
|
||||
let name: String
|
||||
let summary: String
|
||||
let desc: String
|
||||
@@ -129,12 +136,3 @@ struct WeeklyHours: Hashable {
|
||||
let date: Date
|
||||
let timeStrings: [String]
|
||||
}
|
||||
|
||||
// A weekend food trucks even representing when it's happening and what food trucks will be there.
|
||||
struct FoodTruckEvent: Hashable {
|
||||
let date: Date
|
||||
let openTime: Date
|
||||
let closeTime: Date
|
||||
let location: String
|
||||
let trucks: [String]
|
||||
}
|
||||
Reference in New Issue
Block a user