From e54166f852ff70d79660ced69883232ad37907da Mon Sep 17 00:00:00 2001 From: Sophia Liu Date: Sun, 18 Feb 2024 01:41:25 -0600 Subject: [PATCH] clean up code --- HackIllinois.xcodeproj/project.pbxproj | 4 - HackIllinois/AppDelegate.swift | 2 - .../Cells/HIBubbleCell/HIShiftCell.swift | 141 ------------------ .../HIEventDetailViewController.swift | 1 - .../HIPointsShopSwiftUIView.swift | 12 +- .../ViewControllers/HIProfileCardView.swift | 3 - .../HIProfileViewController.swift | 1 - 7 files changed, 2 insertions(+), 162 deletions(-) delete mode 100644 HackIllinois/UI/TableView/Cells/HIBubbleCell/HIShiftCell.swift diff --git a/HackIllinois.xcodeproj/project.pbxproj b/HackIllinois.xcodeproj/project.pbxproj index 9c8aace9..8ce9f9bf 100644 --- a/HackIllinois.xcodeproj/project.pbxproj +++ b/HackIllinois.xcodeproj/project.pbxproj @@ -139,7 +139,6 @@ D14D3AE3295FBDA200EB7995 /* HIBannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D14D3AE2295FBDA100EB7995 /* HIBannerViewController.swift */; }; D158EC312B5A2D440003D799 /* HIQRAttendeeScannerSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D158EC302B5A2D440003D799 /* HIQRAttendeeScannerSelection.swift */; }; D158EC332B5A2DFE0003D799 /* HIScanPointsShopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D158EC322B5A2DFE0003D799 /* HIScanPointsShopViewController.swift */; }; - D187BF582B781A1100AD7356 /* HIShiftCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D187BF572B781A1100AD7356 /* HIShiftCell.swift */; }; D187BF5A2B78317600AD7356 /* Mentor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D187BF592B78317600AD7356 /* Mentor.swift */; }; D187BF5C2B78318000AD7356 /* MentorService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D187BF5B2B78318000AD7356 /* MentorService.swift */; }; D19D4C932B794F9100376E1B /* HIScanMentorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D19D4C922B794F9100376E1B /* HIScanMentorViewController.swift */; }; @@ -363,7 +362,6 @@ D14D3AE2295FBDA100EB7995 /* HIBannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIBannerViewController.swift; sourceTree = ""; }; D158EC302B5A2D440003D799 /* HIQRAttendeeScannerSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIQRAttendeeScannerSelection.swift; sourceTree = ""; }; D158EC322B5A2DFE0003D799 /* HIScanPointsShopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIScanPointsShopViewController.swift; sourceTree = ""; }; - D187BF572B781A1100AD7356 /* HIShiftCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIShiftCell.swift; sourceTree = ""; }; D187BF592B78317600AD7356 /* Mentor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mentor.swift; sourceTree = ""; }; D187BF5B2B78318000AD7356 /* MentorService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MentorService.swift; sourceTree = ""; }; D19D4C922B794F9100376E1B /* HIScanMentorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIScanMentorViewController.swift; sourceTree = ""; }; @@ -693,7 +691,6 @@ 95A7D282203D4F54005EAEAF /* HIAnnouncementCell.swift */, 95A7D29F203D60E9005EAEAF /* HIBubbleCell.swift */, 95A7D281203D4F54005EAEAF /* HIEventCell.swift */, - D187BF572B781A1100AD7356 /* HIShiftCell.swift */, 3CF8DB1223B419980035ECAE /* HIProjectCell.swift */, ); path = HIBubbleCell; @@ -1100,7 +1097,6 @@ E1E4A5DA291C9BF800780BA1 /* HIOnboardingView.swift in Sources */, 95A7D290203D4F54005EAEAF /* HIAnnouncementCell.swift in Sources */, 9515E43722093E1300BCAF92 /* HIEventScannerViewController.swift in Sources */, - D187BF582B781A1100AD7356 /* HIShiftCell.swift in Sources */, 95A7D28F203D4F54005EAEAF /* HIEventCell.swift in Sources */, ACAA717626017EC4000F42B0 /* HICollectionViewFlowLayout.swift in Sources */, DF5B27C5299197E80034A8B9 /* Array.swift in Sources */, diff --git a/HackIllinois/AppDelegate.swift b/HackIllinois/AppDelegate.swift index 0c8cc171..4273588a 100644 --- a/HackIllinois/AppDelegate.swift +++ b/HackIllinois/AppDelegate.swift @@ -78,13 +78,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate, UNUser func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { // Called when the app has successfully registered with FCM and received a registration token self.fcmToken = fcmToken - print("FCM Token: \(fcmToken)") } func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { // Log the notification details - print("Received notification:") print(notification.request.content.userInfo) completionHandler([.alert, .sound, .badge]) diff --git a/HackIllinois/UI/TableView/Cells/HIBubbleCell/HIShiftCell.swift b/HackIllinois/UI/TableView/Cells/HIBubbleCell/HIShiftCell.swift deleted file mode 100644 index f886fd66..00000000 --- a/HackIllinois/UI/TableView/Cells/HIBubbleCell/HIShiftCell.swift +++ /dev/null @@ -1,141 +0,0 @@ -// -// HIShiftCell.swift -// HackIllinois -// -// Created by HackIllinois Team on 2/10/24. -// Copyright © 2017 HackIllinois. All rights reserved. -// This file is part of the Hackillinois iOS App. -// The Hackillinois iOS App is open source software, released under the University of -// Illinois/NCSA Open Source License. You should have received a copy of -// this license in a file with the distribution. -// - -import Foundation -import UIKit -import HIAPI - - -class HIShiftCell: HIBubbleCell { - // MARK: - Properties - var headerView = UIStackView() - var contentStackView = UIStackView() - var contentStackViewHeight = NSLayoutConstraint() - - var indexPath: IndexPath? - weak var delegate: HIEventCellDelegate? - - // MARK: - Init - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - var headerSpacingConstant: CGFloat = 1.0 - if UIDevice.current.userInterfaceIdiom == .pad { - headerSpacingConstant = 2.0 - } - backgroundColor = UIColor.clear - // add bubble view - contentView.layer.backgroundColor = UIColor.clear.cgColor - bubbleView.addSubview(headerView) - headerView.axis = .vertical - headerView.alignment = .leading - headerView.translatesAutoresizingMaskIntoConstraints = false - headerView.leadingAnchor.constraint(equalTo: bubbleView.leadingAnchor, constant: 17 * headerSpacingConstant).isActive = true - headerView.topAnchor.constraint(equalTo: bubbleView.topAnchor, constant: 16 * headerSpacingConstant).isActive = true - - bubbleView.addSubview(contentStackView) - contentStackView.axis = .vertical - contentStackView.alignment = .leading - contentStackView.translatesAutoresizingMaskIntoConstraints = false - contentStackView.leadingAnchor.constraint(equalTo: headerView.leadingAnchor).isActive = true - contentStackView.trailingAnchor.constraint(equalTo: bubbleView.trailingAnchor, constant: -16).isActive = true - contentStackView.topAnchor.constraint(equalTo: headerView.bottomAnchor, constant: 10 * headerSpacingConstant).isActive = true - contentStackView.bottomAnchor.constraint(greaterThanOrEqualTo: bubbleView.bottomAnchor, constant: -16 * headerSpacingConstant).isActive = true - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) should not be used.") - } -} - -// MARK: - Population -extension HIShiftCell { - static func heightForCell(with event: Event, width: CGFloat) -> CGFloat { - let heightFromEventName = HILabel.heightForView(text: event.name, font: HIAppearance.Font.eventTitle!, width: width - 137) - var heightConstant: CGFloat = 1.6 - if UIDevice.current.userInterfaceIdiom == .pad { - heightConstant = 11.0 - } - let height = heightFromEventName + 160 - if UIDevice.current.userInterfaceIdiom == .pad { - return height + (22 * (heightConstant / 1.45)) - } - return height + 5 - } - static func <- (lhs: HIShiftCell, rhs: Event) { - print(rhs) - var contentStackViewHeight: CGFloat = 0.0; var eventCellSpacing: CGFloat = 8.0 - var stackViewSpacing: CGFloat = 4.7; var bubbleConstant: CGFloat = 1.0 - var locationImageView = UIImageView(image: #imageLiteral(resourceName: "LocationSign")); var timeImageView = UIImageView(image: #imageLiteral(resourceName: "Clock")) - let titleLabel = HILabel(style: .event) - titleLabel.numberOfLines = 2; titleLabel.text = rhs.name - lhs.headerView.addArrangedSubview(titleLabel) - lhs.headerView.setCustomSpacing(9, after: titleLabel) - if UIDevice.current.userInterfaceIdiom == .pad { - eventCellSpacing = 12.0; stackViewSpacing = 15.0; bubbleConstant = 2.0 - locationImageView = UIImageView(image: #imageLiteral(resourceName: "VectorPad")) - timeImageView = UIImageView(image: #imageLiteral(resourceName: "TimePad")) - lhs.headerView.setCustomSpacing(18, after: titleLabel) - } - titleLabel.constrain(width: lhs.contentView.frame.width - 120, height: (HILabel.heightForView(text: rhs.name, font: HIAppearance.Font.eventTitle!, width: lhs.contentView.frame.width - 137)) * bubbleConstant) - let upperContainerView = HIView { - lhs.contentStackView.addArrangedSubview($0) - $0.translatesAutoresizingMaskIntoConstraints = false - } - let middleContainerView = HIView { - lhs.contentStackView.addArrangedSubview($0) - $0.translatesAutoresizingMaskIntoConstraints = false - } - let timeLabel = HILabel(style: .time) - // We can check for async events by checking if the event start and end time is 1970-01-01 00:00:00 +0000 - if rhs.startTime.timeIntervalSince1970 == 0 || rhs.endTime.timeIntervalSince1970 == 0 { - timeLabel.text = HIConstants.ASYNC_EVENT_TIME_TEXT - } else { - timeLabel.text = Formatter.simpleTime.string(from: rhs.startTime) + " - " + Formatter.simpleTime.string(from: rhs.endTime) - } - upperContainerView.addSubview(timeImageView) - upperContainerView.addSubview(timeLabel) - timeLabel.leadingAnchor.constraint(equalTo: timeImageView.trailingAnchor, constant: eventCellSpacing + 1).isActive = true - timeLabel.centerYAnchor.constraint(equalTo: timeImageView.centerYAnchor).isActive = true - let locationLabel = HILabel(style: .newLocation) - if rhs.locations.count > 0 { - locationLabel.text = rhs.locations.map({ ($0 as AnyObject).name }).joined(separator: ", ") - } - middleContainerView.addSubview(locationImageView) - locationImageView.translatesAutoresizingMaskIntoConstraints = false - middleContainerView.addSubview(locationLabel) - locationImageView.centerYAnchor.constraint(equalTo: timeImageView.centerYAnchor, constant: (stackViewSpacing * 2.5) + 14).isActive = true - locationImageView.centerXAnchor.constraint(equalTo: timeImageView.centerXAnchor).isActive = true - locationLabel.leadingAnchor.constraint(equalTo: timeLabel.leadingAnchor).isActive = true - locationLabel.centerYAnchor.constraint(equalTo: locationImageView.centerYAnchor).isActive = true - let descriptionLabel = HILabel(style: .cellDescription) - descriptionLabel.numberOfLines = 2 - descriptionLabel.text = "\(rhs.info)" - lhs.contentStackView.addArrangedSubview(descriptionLabel) - contentStackViewHeight += HILabel.heightForView(text: rhs.name, font: HIAppearance.Font.eventTitle!, width: lhs.contentView.frame.width - 98) - contentStackViewHeight += timeLabel.intrinsicContentSize.height + locationLabel.intrinsicContentSize.height + 13 + 40 + 3 + 40 - } -} - -// MARK: - UITableViewCell -extension HIShiftCell { - override func prepareForReuse() { - super.prepareForReuse() - headerView.subviews.forEach {(view) in - headerView.willRemoveSubview(view) - view.removeFromSuperview() - } - contentStackView.arrangedSubviews.forEach { (view) in - contentStackView.removeArrangedSubview(view) - view.removeFromSuperview() - } - } -} diff --git a/HackIllinois/ViewControllers/HIEventDetailViewController.swift b/HackIllinois/ViewControllers/HIEventDetailViewController.swift index eedb274f..4abfa303 100644 --- a/HackIllinois/ViewControllers/HIEventDetailViewController.swift +++ b/HackIllinois/ViewControllers/HIEventDetailViewController.swift @@ -241,7 +241,6 @@ extension HIEventDetailViewController { } func setupMap() { guard let event = event else { return } - print(event.mapImageUrl) // Check if the image URL ends with "svg" and replace it with "png" var imageUrlString = event.mapImageUrl diff --git a/HackIllinois/ViewControllers/HIPointsShopSwiftUIView.swift b/HackIllinois/ViewControllers/HIPointsShopSwiftUIView.swift index 16fae7bc..e7b81e8c 100644 --- a/HackIllinois/ViewControllers/HIPointsShopSwiftUIView.swift +++ b/HackIllinois/ViewControllers/HIPointsShopSwiftUIView.swift @@ -50,8 +50,7 @@ struct HIPointShopSwiftUIView: View { .resizable() .frame(width: isIpad ? 590 : 355, height:isIpad ? 185 : 105) .offset(y: -25) - //Spacer() - //.frame(height: 10) + VStack(spacing: 0) { CustomTopTabBar(tabIndex: $tabIndex) ScrollView(showsIndicators: false) { @@ -94,7 +93,6 @@ struct HIPointShopSwiftUIView: View { } } } - //} } func getItems() { HIAPI.ShopService.getAllItems() @@ -140,7 +138,6 @@ struct PointShopItemCell: View { Rectangle() .foregroundColor(.clear) .frame(width: UIScreen.main.bounds.width > 850 ? 800 : (isIpad ? 700 : 360), height: 10) - //.frame(width: isIpad ? 600 : 360, height: 10)//TODO: Change width .background(Color(red: 0.4, green: 0.17, blue: 0.07)) .cornerRadius(1) //transparent pane @@ -148,7 +145,6 @@ struct PointShopItemCell: View { Rectangle() .fill(.white) .frame(width: UIScreen.main.bounds.width > 850 ? 790 : (isIpad ? 690 : 350), height: 157) - //.frame(width: isIpad ? 590 : 350, height: 157)//TODO: Change width .opacity(0.4) HStack { Spacer() @@ -161,7 +157,7 @@ struct PointShopItemCell: View { .frame(width: 145, height: 145) Spacer() - //bubble-thing + //bubble view VStack { HStack{ Spacer() @@ -178,8 +174,6 @@ struct PointShopItemCell: View { .frame(maxWidth: .infinity) .padding(.trailing, 20) - /*Spacer() - .frame(width:20)*/ } HStack(alignment: .center, spacing: 7) { @@ -244,13 +238,11 @@ struct TabBarButton: View { Rectangle() .fill(Color(red: 0.85, green: 0.25, blue: 0.47)) .frame(width: UIScreen.main.bounds.width > 850 ? 350 : (isIpad ? 295 : 155), height: isIpad ? 90: 50) - //.frame(width: isIpad ? 250: 155, height: isIpad ? 90: 50)//190 .cornerRadius(10, corners: [.topLeft, .topRight]) }else{ Rectangle() .fill(Color(red: 0.85, green: 0.25, blue: 0.47)) .frame(width: UIScreen.main.bounds.width > 850 ? 350 : (isIpad ? 295 : 155), height: isIpad ? 90: 50) - //.frame(width: isIpad ? 250: 155, height: isIpad ? 90: 50)//190 .cornerRadius(10, corners: [.topLeft, .topRight]) .opacity(0) } diff --git a/HackIllinois/ViewControllers/HIProfileCardView.swift b/HackIllinois/ViewControllers/HIProfileCardView.swift index d02281c0..2380e229 100644 --- a/HackIllinois/ViewControllers/HIProfileCardView.swift +++ b/HackIllinois/ViewControllers/HIProfileCardView.swift @@ -90,7 +90,6 @@ struct HIProfileCardView: View { getRank { rank in self.rank = rank } - print(rank) } } }.padding(.bottom, isIpad ? 40*padFactor : 25*phoneFactor) @@ -199,7 +198,6 @@ struct HIProfileCardView: View { let (qr, _) = try result.get() DispatchQueue.main.async { self.qrInfo = qr.qrInfo - print("qrinfo with attendee jwt", qrInfo) } } catch { print("An error has occurred \(error)") @@ -218,7 +216,6 @@ struct HIProfileCardView: View { do { let (userRanking, _) = try result.get() rank = userRanking.ranking - print("rank:", rank) completion(rank) } catch { print("An error has occurred in ranking \(error)") diff --git a/HackIllinois/ViewControllers/HIProfileViewController.swift b/HackIllinois/ViewControllers/HIProfileViewController.swift index 525ecbaf..b4fa7c37 100644 --- a/HackIllinois/ViewControllers/HIProfileViewController.swift +++ b/HackIllinois/ViewControllers/HIProfileViewController.swift @@ -91,7 +91,6 @@ extension HIProfileViewController { // print("rank \(rank)") guard let user = HIApplicationStateController.shared.user else { return } var role = "General" - print(user.roles) if user.roles.contains(.PRO) { role = "Knight" }