Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick fix: Default alert color to white #583

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions HackIllinois.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2024.2.2;
MARKETING_VERSION = 2024.2.3;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -Xfrontend -warn-long-expression-type-checking=150";
PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios;
Expand Down Expand Up @@ -1407,7 +1407,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2024.2.2;
MARKETING_VERSION = 2024.2.3;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
10 changes: 7 additions & 3 deletions HackIllinois/ViewControllers/HIScanMentorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,19 @@ extension HIScanMentorViewController: AVCaptureMetadataOutputObjectsDelegate {
error = false
default:
alertTitle = "\n\nError!"
alertMessage = "\nSomething isn't quite right."
alertMessage = "\nThis QR code is invalid or you have already checked in to this mentor's office hours."
self.respondingToQRCodeFound = true
}
// Create custom alert for attendee check in functionality
let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)

let titleFont = UIFont(name: "MontserratRoman-Bold", size: 22)
let messageFont = UIFont(name: "MontserratRoman-Medium", size: 16)
let titleColor = #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)
let messageColor = #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)

let userInterfaceStyle = traitCollection.userInterfaceStyle
let titleColor: UIColor = (userInterfaceStyle == .dark) ? UIColor.white : #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)
let messageColor: UIColor = (userInterfaceStyle == .dark) ? UIColor.white : #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)

let attributedTitle = NSAttributedString(string: alertTitle, attributes: [NSAttributedString.Key.font: titleFont as Any, NSAttributedString.Key.foregroundColor: titleColor])
let attributedMessage = NSAttributedString(string: alertMessage, attributes: [NSAttributedString.Key.font: messageFont as Any, NSAttributedString.Key.foregroundColor: messageColor])
alert.setValue(attributedTitle, forKey: "attributedTitle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,18 @@ extension HIScanPointsShopViewController: AVCaptureMetadataOutputObjectsDelegate
self.respondingToQRCodeFound = true
default:
alertTitle = "\n\nError!"
alertMessage = "\nSomething isn't quite right."
alertMessage = "\nSomething isn't quite right. Double check your coins amount and make sure you have the correct QR code."
self.respondingToQRCodeFound = true
}
// Create custom alert for points shop
let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)

let titleFont = UIFont(name: "MontserratRoman-Bold", size: 22)
let messageFont = UIFont(name: "MontserratRoman-Medium", size: 16)
let titleColor = #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)
let messageColor = #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)

let userInterfaceStyle = traitCollection.userInterfaceStyle
let titleColor: UIColor = (userInterfaceStyle == .dark) ? UIColor.white : #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)
let messageColor: UIColor = (userInterfaceStyle == .dark) ? UIColor.white : #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)
let attributedTitle = NSAttributedString(string: alertTitle, attributes: [NSAttributedString.Key.font: titleFont as Any, NSAttributedString.Key.foregroundColor: titleColor])
let attributedMessage = NSAttributedString(string: alertMessage, attributes: [NSAttributedString.Key.font: messageFont as Any, NSAttributedString.Key.foregroundColor: messageColor])
alert.setValue(attributedTitle, forKey: "attributedTitle")
Expand Down
23 changes: 17 additions & 6 deletions HackIllinois/ViewControllers/HIScanQRCodeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,19 @@ extension HIScanQRCodeViewController: AVCaptureMetadataOutputObjectsDelegate {
self.respondingToQRCodeFound = true
default:
alertTitle = "\n\nError!"
alertMessage = "\nSomething isn't quite right."
alertMessage = "\nYou may have the incorrect QR code or you have already checked into this event."
self.respondingToQRCodeFound = true
}
// Create custom alert for attendee check in functionality
let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)

let titleFont = UIFont(name: "MontserratRoman-Bold", size: 22)
let messageFont = UIFont(name: "MontserratRoman-Medium", size: 16)
let titleColor = #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)
let messageColor = #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)

let userInterfaceStyle = traitCollection.userInterfaceStyle
let titleColor: UIColor = (userInterfaceStyle == .dark) ? UIColor.white : #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)
let messageColor: UIColor = (userInterfaceStyle == .dark) ? UIColor.white : #colorLiteral(red: 0.337254902, green: 0.1411764706, blue: 0.06666666667, alpha: 1)

let attributedTitle = NSAttributedString(string: alertTitle, attributes: [NSAttributedString.Key.font: titleFont as Any, NSAttributedString.Key.foregroundColor: titleColor])
let attributedMessage = NSAttributedString(string: alertMessage, attributes: [NSAttributedString.Key.font: messageFont as Any, NSAttributedString.Key.foregroundColor: messageColor])
alert.setValue(attributedTitle, forKey: "attributedTitle")
Expand Down Expand Up @@ -330,14 +334,19 @@ extension HIScanQRCodeViewController: AVCaptureMetadataOutputObjectsDelegate {
self.respondingToQRCodeFound = true
case "The operation couldn’t be completed. (APIManager.APIRequestError error 0.)":
alertTitle = "Error!"
alertMessage = "Your QR code is either invalid/expired or you have already checked into this event."
alertMessage = "The QR code is either invalid/expired or the user has already checked into this event."
self.respondingToQRCodeFound = true
case "Incorrect type of QR code":
alertTitle = "Error!"
alertMessage = "This is not a valid user QR code."
self.respondingToQRCodeFound = true
default:
alertTitle = "Error!"
alertMessage = "Something isn't quite right."
alertMessage = "The QR code is either invalid/expired or the user has already checked into this event."
self.respondingToQRCodeFound = true
}
let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)

if alertTitle == "Success!" {
alert.addAction(
UIAlertAction(title: "OK", style: .default, handler: { _ in
Expand Down Expand Up @@ -423,8 +432,10 @@ extension HIScanQRCodeViewController: AVCaptureMetadataOutputObjectsDelegate {
}
.authorize(with: HIApplicationStateController.shared.user)
.launch()
}
} else {
self.handleStaffCheckInAlert(status: "Incorrect type of QR code")
}
}
} else {
respondingToQRCodeFound = false
HIAPI.UserService.userScanEvent(userToken: user.token, eventID: code)
Expand Down
Loading