From 158852e9ccc58d4141db27dec13f9f0f2fd7eb30 Mon Sep 17 00:00:00 2001 From: anushkasankaran Date: Mon, 24 Feb 2025 00:39:32 -0600 Subject: [PATCH 1/6] Fix staff shift model --- HIAPI/Models/Staff.swift | 10 ++++------ HackIllinois.xcodeproj/project.pbxproj | 4 ++-- .../HIScheduleViewController.swift | 19 +++---------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/HIAPI/Models/Staff.swift b/HIAPI/Models/Staff.swift index 91240c51..e3950bae 100644 --- a/HIAPI/Models/Staff.swift +++ b/HIAPI/Models/Staff.swift @@ -23,7 +23,7 @@ public struct StaffContainer: Decodable, APIReturnable { public struct Staff: Codable { internal enum CodingKeys: String, CodingKey { - case isPro + case _id case eventId case isStaff case name @@ -31,15 +31,14 @@ public struct Staff: Codable { case startTime case endTime case eventType - case exp case locations case isAsync - case mapImageUrl case points case isPrivate case displayOnStaffCheckIn + case isPro } - public let isPro: Bool + public let _id: String public let eventId: String public let isStaff: Bool public let name: String @@ -47,13 +46,12 @@ public struct Staff: Codable { public let startTime: Date public let endTime: Date public let eventType: String - public let exp: Int public let locations: [Location] public let isAsync: Bool - public let mapImageUrl: String public let points: Int public let isPrivate: Bool public let displayOnStaffCheckIn: Bool + public let isPro: Bool } diff --git a/HackIllinois.xcodeproj/project.pbxproj b/HackIllinois.xcodeproj/project.pbxproj index a4012740..c5bda09f 100644 --- a/HackIllinois.xcodeproj/project.pbxproj +++ b/HackIllinois.xcodeproj/project.pbxproj @@ -1380,7 +1380,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2025.1.1; + MARKETING_VERSION = 2025.1.2; ONLY_ACTIVE_ARCH = YES; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -Xfrontend -warn-long-expression-type-checking=150"; PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios; @@ -1417,7 +1417,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2025.1.1; + MARKETING_VERSION = 2025.1.2; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/HackIllinois/ViewControllers/HIScheduleViewController.swift b/HackIllinois/ViewControllers/HIScheduleViewController.swift index 4c237fc6..3c563f08 100644 --- a/HackIllinois/ViewControllers/HIScheduleViewController.swift +++ b/HackIllinois/ViewControllers/HIScheduleViewController.swift @@ -130,22 +130,9 @@ extension HIScheduleViewController { func animateReload() { try? fetchedResultsController.performFetch() - - if onlyShifts { - // Clear schedule events - tableView?.reloadData() - - // Make sure shifts are displayed if we have them - if hasSelectedShift && !staffShifts.isEmpty { - removeStaffShiftContainerViews() // Clear old shift views - setUpShiftCells() // Re-display current shifts - } - } else { - // Normal reload for schedule view - animateTableViewReload() - if let tableView = tableView, !tableView.visibleCells.isEmpty { - tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false) - } + animateTableViewReload() + if let tableView = tableView, !tableView.visibleCells.isEmpty { + tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false) } } } From f1ecdc6f16889dd6ae13812502a10e1aadb6e11b Mon Sep 17 00:00:00 2001 From: anushkasankaran Date: Mon, 24 Feb 2025 00:52:52 -0600 Subject: [PATCH 2/6] Add optional map url --- HIAPI/Models/Staff.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HIAPI/Models/Staff.swift b/HIAPI/Models/Staff.swift index e3950bae..dc838d96 100644 --- a/HIAPI/Models/Staff.swift +++ b/HIAPI/Models/Staff.swift @@ -36,6 +36,7 @@ public struct Staff: Codable { case points case isPrivate case displayOnStaffCheckIn + case mapImageUrl case isPro } public let _id: String @@ -51,6 +52,7 @@ public struct Staff: Codable { public let points: Int public let isPrivate: Bool public let displayOnStaffCheckIn: Bool + public let mapImageUrl: String? public let isPro: Bool } From a6b280a4b7475b8836a3d069ce3178cee601a1ea Mon Sep 17 00:00:00 2001 From: anushkasankaran Date: Wed, 26 Feb 2025 00:11:51 -0600 Subject: [PATCH 3/6] iPad crash temp fix --- HackIllinois/FlowControllers/HITabBarController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/HackIllinois/FlowControllers/HITabBarController.swift b/HackIllinois/FlowControllers/HITabBarController.swift index 308acf21..be580161 100644 --- a/HackIllinois/FlowControllers/HITabBarController.swift +++ b/HackIllinois/FlowControllers/HITabBarController.swift @@ -30,7 +30,9 @@ class HITabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() setupQRScanButton() - setupTabBar() + if !(UIDevice.current.userInterfaceIdiom == .pad) { + setupTabBar() + } } override func viewDidLayoutSubviews() { From d206868dc3d992dc5a91bfbc6c678fe968e13946 Mon Sep 17 00:00:00 2001 From: anushkasankaran Date: Wed, 26 Feb 2025 00:19:14 -0600 Subject: [PATCH 4/6] Took out QR scanner setup --- HackIllinois/FlowControllers/HITabBarController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HackIllinois/FlowControllers/HITabBarController.swift b/HackIllinois/FlowControllers/HITabBarController.swift index be580161..b4ca0d03 100644 --- a/HackIllinois/FlowControllers/HITabBarController.swift +++ b/HackIllinois/FlowControllers/HITabBarController.swift @@ -29,8 +29,8 @@ class HITabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() - setupQRScanButton() if !(UIDevice.current.userInterfaceIdiom == .pad) { + setupQRScanButton() setupTabBar() } } From 5379d7c42e5b4dfdcac3579e594122f7f97e38ff Mon Sep 17 00:00:00 2001 From: anushkasankaran Date: Wed, 26 Feb 2025 18:39:28 -0600 Subject: [PATCH 5/6] Stashing changes --- HackIllinois.xcodeproj/project.pbxproj | 4 ++-- .../HIScheduleViewController.swift | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/HackIllinois.xcodeproj/project.pbxproj b/HackIllinois.xcodeproj/project.pbxproj index c5bda09f..2b2de29b 100644 --- a/HackIllinois.xcodeproj/project.pbxproj +++ b/HackIllinois.xcodeproj/project.pbxproj @@ -1380,7 +1380,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2025.1.2; + MARKETING_VERSION = 2025.1.3; ONLY_ACTIVE_ARCH = YES; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -Xfrontend -warn-long-expression-type-checking=150"; PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios; @@ -1417,7 +1417,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2025.1.2; + MARKETING_VERSION = 2025.1.3; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/HackIllinois/ViewControllers/HIScheduleViewController.swift b/HackIllinois/ViewControllers/HIScheduleViewController.swift index 3c563f08..641ae976 100644 --- a/HackIllinois/ViewControllers/HIScheduleViewController.swift +++ b/HackIllinois/ViewControllers/HIScheduleViewController.swift @@ -117,14 +117,15 @@ extension HIScheduleViewController { } func currentPredicate() -> NSPredicate { - if onlyShifts { - // Return a predicate that matches no events when in shifts view - return NSPredicate(value: false) - } else if onlyFavorites { - let currentTabPredicate = dataStore[currentTab].predicate - return NSCompoundPredicate(andPredicateWithSubpredicates: [currentTabPredicate, onlyFavoritesPredicate]) + let currentTabPredicate = dataStore[currentTab].predicate + if onlyFavorites { + let compoundPredicate = NSCompoundPredicate(andPredicateWithSubpredicates: [currentTabPredicate, onlyFavoritesPredicate]) + return compoundPredicate + } else if onlyShifts { + let noEventsPredicate = NSPredicate(value: false) + return noEventsPredicate } else { - return dataStore[currentTab].predicate + return currentTabPredicate } } From d8fc406d7f667ffb85689a711ac9fa06c73adf88 Mon Sep 17 00:00:00 2001 From: anushkasankaran Date: Wed, 26 Feb 2025 19:00:00 -0600 Subject: [PATCH 6/6] Display Friday staff shifts --- HackIllinois/ViewControllers/HIScheduleViewController.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/HackIllinois/ViewControllers/HIScheduleViewController.swift b/HackIllinois/ViewControllers/HIScheduleViewController.swift index 641ae976..cbd68f98 100644 --- a/HackIllinois/ViewControllers/HIScheduleViewController.swift +++ b/HackIllinois/ViewControllers/HIScheduleViewController.swift @@ -370,7 +370,7 @@ extension HIScheduleViewController { @objc func shiftsButtonTapped(_ sender: UIButton) { if !onlyShifts { - onlyShifts = true + onlyShifts = !onlyShifts backgroundView.image = #imageLiteral(resourceName: "BackgroundShifts") hasSelectedShift = true labelColor = #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1) @@ -392,6 +392,8 @@ extension HIScheduleViewController { DispatchQueue.main.async { self.setUpShiftCells() + self.updatePredicate() + self.animateReload() } } catch { print("An error has occurred in getting staff shifts \(error)") @@ -431,7 +433,7 @@ extension HIScheduleViewController { let calendar = Calendar.current let dayComponent = calendar.component(.day, from: dateString) var curr_idx = segmentedControl.selectedIndex - if curr_idx == 0 && dayComponent != 28 { + if curr_idx == 0 && dayComponent != 29 { continue } else if curr_idx == 1 && dayComponent != 1 { continue