diff --git a/HIAPI/Models/Staff.swift b/HIAPI/Models/Staff.swift index 3a088cc8..805c101f 100644 --- a/HIAPI/Models/Staff.swift +++ b/HIAPI/Models/Staff.swift @@ -55,7 +55,6 @@ public struct Staff: Codable { public let isPrivate: Bool public let displayOnStaffCheckIn: Bool - } public struct UserAttendanceContainer: Codable, APIReturnable { @@ -66,7 +65,7 @@ public struct UserAttendanceContainer: Codable, APIReturnable { } public let success: Bool public let error: String? - public let dietaryRestrictions: [String] + public let dietaryRestrictions: [String]? } public struct StaffAttendanceContainer: Codable, APIReturnable { diff --git a/HackIllinois/ViewControllers/HIQRScannerSelection.swift b/HackIllinois/ViewControllers/HIQRScannerSelection.swift index b5803784..b09e0a5d 100644 --- a/HackIllinois/ViewControllers/HIQRScannerSelection.swift +++ b/HackIllinois/ViewControllers/HIQRScannerSelection.swift @@ -116,7 +116,7 @@ extension HIQRScannerSelection { closeButton.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 8).isActive = true closeButton.constrain(width: 60, height: 60) closeButton.imageView?.contentMode = .scaleToFill - let label = HILabel(style: (UIDevice.current.userInterfaceIdiom == .pad) ? .viewTitleBrown : .viewTitle) + let label = HILabel(style: (UIDevice.current.userInterfaceIdiom == .pad) ? .viewTitleBrown : .viewTitleBrown) label.text = "SCANNER" view.addSubview(label) label.centerYAnchor.constraint(equalTo: closeButton.centerYAnchor).isActive = true diff --git a/HackIllinois/ViewControllers/HIScanQRCodeViewController.swift b/HackIllinois/ViewControllers/HIScanQRCodeViewController.swift index 2b90c52f..8f139d6e 100644 --- a/HackIllinois/ViewControllers/HIScanQRCodeViewController.swift +++ b/HackIllinois/ViewControllers/HIScanQRCodeViewController.swift @@ -314,7 +314,8 @@ extension HIScanQRCodeViewController: AVCaptureMetadataOutputObjectsDelegate { switch status { case "Success": alertTitle = "Success!" - alertMessage = "Name: \(currentUserName)\n Diet: \(dietaryString)" + alertMessage = "Dietary Restrictions: \(dietaryString)" + //alertMessage = "Name: \(currentUserName)\n Diet: \(dietaryString)" case "InvalidEventId": alertTitle = "Error!" alertMessage = "Invalid Event ID" @@ -397,6 +398,18 @@ extension HIScanQRCodeViewController: AVCaptureMetadataOutputObjectsDelegate { let (codeResult, _) = try result.get() DispatchQueue.main.async { [self] in print(codeResult.dietaryRestrictions) + // Parse dietary string + dietaryString = "" + if let dietaryRestrictions = codeResult.dietaryRestrictions, !dietaryRestrictions.isEmpty { + for (index, diet) in dietaryRestrictions.enumerated() { + dietaryString += diet + if index < dietaryRestrictions.count - 1 { + dietaryString += ", " + } + } + } else { + dietaryString = "None" + } self.handleStaffCheckInAlert(status: "Success") } } catch {