Skip to content

Commit

Permalink
Wrap up QR scanner + UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
s0phialiu committed Feb 17, 2024
1 parent cd939a5 commit 54d303d
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 17 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "BookmarkSelected1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "BookmarkSelected2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "BookmarkSelected3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "BookmarkUnselected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "BookmarkUnselected2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "BookmarkUnselected3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 1 addition & 1 deletion HackIllinois/ViewControllers/HIBaseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ extension HIBaseViewController {
label.text = customTitle

let view = UIView(frame: CGRect(x: 0, y: 0, width: 80, height: 30))
view.bounds = view.bounds.offsetBy(dx: -24, dy: 0)
view.bounds = view.bounds.offsetBy(dx: -24, dy: (UIDevice.current.userInterfaceIdiom == .pad) ? 10 : 0)
view.addSubview(label)

self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(customView: view)
Expand Down
2 changes: 1 addition & 1 deletion HackIllinois/ViewControllers/HIPointsShopSwiftUIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct HIPointShopSwiftUIView: View {
.background(Color(red: 0.1647, green: 0.1647, blue: 0.1647))
.cornerRadius(1000)
.frame(maxWidth: .infinity, alignment: .trailing)
.offset(y: -38)
.offset(y: isIpad ? -42 : -38)
Spacer()
}
Image("KnickKnacks")
Expand Down
2 changes: 1 addition & 1 deletion HackIllinois/ViewControllers/HIProfileCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct HIProfileCardView: View {
let isIpad = UIDevice.current.userInterfaceIdiom == .pad
let role: String
@State var startFetchingQR = false
@State var qrInfo = ""
@State var qrInfo = "hackillinois://user?userToken=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
// Factors used to change frame to alter based on device
let padFactor = UIScreen.main.bounds.height/1366
let phoneFactor = UIScreen.main.bounds.height/844
Expand Down
4 changes: 2 additions & 2 deletions HackIllinois/ViewControllers/HIQRScannerSelection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class HIQRScannerSelection: HIBaseViewController {
@objc dynamic override func setUpBackgroundView() {
super.setUpBackgroundView()
if UIDevice.current.userInterfaceIdiom == .pad {
backgroundView.image = UIImage(named: "BackgroundPad")
backgroundView.image = #imageLiteral(resourceName: "Pink Background")
} else {
backgroundView.image = #imageLiteral(resourceName: "Staff")
}
Expand Down Expand Up @@ -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) ? .viewTitle : .viewTitleBrown)
let label = HILabel(style: (UIDevice.current.userInterfaceIdiom == .pad) ? .viewTitleBrown : .viewTitle)
label.text = "SCANNER"
view.addSubview(label)
label.centerYAnchor.constraint(equalTo: closeButton.centerYAnchor).isActive = true
Expand Down
2 changes: 2 additions & 0 deletions HackIllinois/ViewControllers/HIScanMentorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ extension HIScanMentorViewController: AVCaptureMetadataOutputObjectsDelegate {
}
.authorize(with: HIApplicationStateController.shared.user)
.launch()
} else {
self.handleMentorAlert(status: "Error")
}
}
func decode(_ token: String) -> [String: AnyObject]? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ extension HIScanPointsShopViewController: AVCaptureMetadataOutputObjectsDelegate
}
.authorize(with: HIApplicationStateController.shared.user)
.launch()
} else {
self.handlePointsShopAlert(status: "Error", itemName: "")
}
}
func decode(_ token: String) -> [String: AnyObject]? {
Expand Down
24 changes: 12 additions & 12 deletions HackIllinois/ViewControllers/HIScheduleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ extension HIScheduleViewController {
onlyFavorites = !onlyFavorites
sender.image = onlyFavorites ? #imageLiteral(resourceName: "Big Selected Bookmark") : #imageLiteral(resourceName: "Big Unselected Bookmark")
if UIDevice.current.userInterfaceIdiom == .pad {
sender.image = onlyFavorites ? #imageLiteral(resourceName: "FavoritedPad") : #imageLiteral(resourceName: "UnFavoritedPad")
sender.image = onlyFavorites ? #imageLiteral(resourceName: "BookmarkSelected") : #imageLiteral(resourceName: "BookmarkUnselected")
}
if sender.image == #imageLiteral(resourceName: "Big Selected Bookmark") {
super.setCustomTitle(customTitle: "SAVED EVENTS")
Expand Down Expand Up @@ -203,7 +203,7 @@ extension HIScheduleViewController {

extension HIScheduleViewController {
@objc func setStaffShiftsControl() {
let customFontSize = UIDevice.current.userInterfaceIdiom == .pad ? 44 : 24
let customFontSize = UIDevice.current.userInterfaceIdiom == .pad ? 48 : 24
let customFont = UIFont(name: "MontserratRoman-Bold", size: CGFloat(customFontSize))

// Create flexible space items to add space to the left
Expand Down Expand Up @@ -309,9 +309,9 @@ extension HIScheduleViewController {
continue
}
// Set fixed width and height for the container view
let containerViewWidth: CGFloat = (UIDevice.current.userInterfaceIdiom == .pad) ? 620 : 340.0
let containerViewHeight: CGFloat = (UIDevice.current.userInterfaceIdiom == .pad) ? 200 : 130.0

let containerViewWidth: CGFloat = UIScreen.main.bounds.width > 850 ? 820 : ((UIDevice.current.userInterfaceIdiom == .pad) ? 620 : 340.0)
let containerViewHeight: CGFloat = UIScreen.main.bounds.width > 850 ? 250 : ((UIDevice.current.userInterfaceIdiom == .pad) ? 200 : 130.0)
// Create a container view with a yellow background
let containerView = UIView()
containerView.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -353,9 +353,9 @@ extension HIScheduleViewController {
containerView.addSubview(timeImageView)
timeImageView.translatesAutoresizingMaskIntoConstraints = false
timeImageView.leadingAnchor.constraint(equalTo: label.leadingAnchor).isActive = true
timeImageView.bottomAnchor.constraint(equalTo: label.bottomAnchor, constant: (UIDevice.current.userInterfaceIdiom == .pad ? 40.0 : 25.0)).isActive = true
timeImageView.bottomAnchor.constraint(equalTo: label.bottomAnchor, constant: UIScreen.main.bounds.width > 850 ? 50 : ((UIDevice.current.userInterfaceIdiom == .pad) ? 40 : 25.0)).isActive = true
containerView.addSubview(timeLabel)
timeLabel.leadingAnchor.constraint(equalTo: timeImageView.trailingAnchor, constant: eventCellSpacing + 1).isActive = true
timeLabel.leadingAnchor.constraint(equalTo: timeImageView.trailingAnchor, constant: eventCellSpacing).isActive = true
timeLabel.centerYAnchor.constraint(equalTo: timeImageView.centerYAnchor).isActive = true

// Location label set up
Expand All @@ -368,8 +368,8 @@ extension HIScheduleViewController {
containerView.addSubview(locationImageView)
locationImageView.translatesAutoresizingMaskIntoConstraints = false
containerView.addSubview(locationLabel)
locationImageView.leadingAnchor.constraint(equalTo: timeImageView.leadingAnchor, constant: (UIDevice.current.userInterfaceIdiom == .pad ? 2.0 : 1.0)).isActive = true
locationImageView.bottomAnchor.constraint(equalTo: timeImageView.bottomAnchor, constant: (UIDevice.current.userInterfaceIdiom == .pad ? 40.0 : 25.0)).isActive = true
locationImageView.leadingAnchor.constraint(equalTo: timeImageView.leadingAnchor, constant: (UIDevice.current.userInterfaceIdiom == .pad ? 5.0 : 1.0)).isActive = true
locationImageView.bottomAnchor.constraint(equalTo: timeImageView.bottomAnchor, constant: UIScreen.main.bounds.width > 850 ? 50 : ((UIDevice.current.userInterfaceIdiom == .pad) ? 40 : 25.0)).isActive = true
locationLabel.leadingAnchor.constraint(equalTo: timeLabel.leadingAnchor).isActive = true
locationLabel.centerYAnchor.constraint(equalTo: locationImageView.centerYAnchor).isActive = true

Expand All @@ -380,8 +380,8 @@ extension HIScheduleViewController {
containerView.addSubview(descriptionLabel)
descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
descriptionLabel.leadingAnchor.constraint(equalTo: locationImageView.leadingAnchor).isActive = true
descriptionLabel.bottomAnchor.constraint(equalTo: locationImageView.bottomAnchor, constant: (UIDevice.current.userInterfaceIdiom == .pad ? 40.0 : 25.0)).isActive = true
padding += (UIDevice.current.userInterfaceIdiom == .pad ? 240.0 : 150.0)
descriptionLabel.bottomAnchor.constraint(equalTo: locationImageView.bottomAnchor, constant: UIScreen.main.bounds.width > 850 ? 50 : ((UIDevice.current.userInterfaceIdiom == .pad) ? 40 : 25.0)).isActive = true
padding += UIScreen.main.bounds.width > 850 ? 300 : ((UIDevice.current.userInterfaceIdiom == .pad) ? 240 : 150.0)
}
}
}
Expand All @@ -394,7 +394,7 @@ extension HIScheduleViewController {
if !HIApplicationStateController.shared.isGuest {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "MenuUnfavorited"), style: .plain, target: self, action: #selector(didSelectFavoritesIcon(_:)))
if UIDevice.current.userInterfaceIdiom == .pad {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "UnFavoritedPad"), style: .plain, target: self, action: #selector(didSelectFavoritesIcon(_:)))
navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "BookmarkUnselected"), style: .plain, target: self, action: #selector(didSelectFavoritesIcon(_:)))
}
}
}
Expand Down

0 comments on commit 54d303d

Please sign in to comment.