From 4d4f7e3bfc83182a98731a49b98ebca364e32cf4 Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Sun, 12 Sep 2021 12:44:12 -0400 Subject: [PATCH 01/14] GSR Cleanup complete --- PennMobile.xcodeproj/project.pbxproj | 24 +- .../Controllers/GSRController.swift | 14 -- .../Controllers/GSRLoginController.swift | 214 ------------------ .../GSRWebviewLoginController.swift | 39 ---- PennMobile/GSR-Booking/Model/GSRUser.swift | 61 ----- .../Networking/GSRNetworkManager.swift | 34 --- .../General/UserDefaults + Helpers.swift | 24 -- .../Home/Networking/HomeAPIService.swift | 3 - PennMobile/Login/LabsLoginController.swift | 3 - PennMobile/New Group/MoreViewController.swift | 8 +- .../RootViewController.swift | 24 -- 11 files changed, 10 insertions(+), 438 deletions(-) delete mode 100644 PennMobile/GSR-Booking/Controllers/GSRLoginController.swift delete mode 100644 PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift delete mode 100644 PennMobile/GSR-Booking/Model/GSRUser.swift diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index 763e1d045..2bc358740 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -73,7 +73,6 @@ 21879B1E1FB3FF54003CF552 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21879B1D1FB3FF54003CF552 /* Storage.swift */; }; 2188C6D7223C7E8400F18D90 /* SecureStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2188C6D6223C7E8300F18D90 /* SecureStore.swift */; }; 2189C0832027CDB800771C1F /* GSRBookable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0802027CDB800771C1F /* GSRBookable.swift */; }; - 2189C0842027CDB800771C1F /* GSRLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0812027CDB800771C1F /* GSRLoginController.swift */; }; 2189C0852027CDB800771C1F /* GSRController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0822027CDB800771C1F /* GSRController.swift */; }; 2189C0872027CDD700771C1F /* GSRNetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0862027CDD700771C1F /* GSRNetworkManager.swift */; }; 2189C08C2027CE2600771C1F /* GSRTimeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0882027CE2600771C1F /* GSRTimeCell.swift */; }; @@ -83,7 +82,6 @@ 2189C09B2027CE4100771C1F /* GSRTimeSlot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0922027CE3F00771C1F /* GSRTimeSlot.swift */; }; 2189C09C2027CE4100771C1F /* GSRDateHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0932027CE3F00771C1F /* GSRDateHandler.swift */; }; 2189C09D2027CE4100771C1F /* GSRLocationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0942027CE3F00771C1F /* GSRLocationModel.swift */; }; - 2189C09F2027CE4100771C1F /* GSRUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0962027CE4000771C1F /* GSRUser.swift */; }; 2189C0A12027CE4100771C1F /* GSRBooking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0982027CE4000771C1F /* GSRBooking.swift */; }; 2189C0A22027CE4100771C1F /* GSRRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0992027CE4000771C1F /* GSRRoom.swift */; }; 2189C0A32027CE4100771C1F /* GSRLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C09A2027CE4000771C1F /* GSRLocation.swift */; }; @@ -127,7 +125,6 @@ 21E6A109224BDFEB00DC457A /* HomeViewController + Delegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E6A108224BDFEB00DC457A /* HomeViewController + Delegates.swift */; }; 21EB4D30203D330C0029A460 /* UserDBManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21EB4D2F203D330C0029A460 /* UserDBManager.swift */; }; 21ECADA11F2FFE0600569883 /* UserDefaults + Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21ECADA01F2FFE0600569883 /* UserDefaults + Helpers.swift */; }; - 21EF283921F509C0001B05B7 /* GSRWebviewLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21EF283821F509C0001B05B7 /* GSRWebviewLoginController.swift */; }; 21F5F8F120538A87005B143F /* HomeFlingCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F5F8F020538A87005B143F /* HomeFlingCellItem.swift */; }; 21F5F8F320538A90005B143F /* HomeFlingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F5F8F220538A90005B143F /* HomeFlingCell.swift */; }; 21F5F8F520538AFC005B143F /* FlingPerformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F5F8F420538AFC005B143F /* FlingPerformer.swift */; }; @@ -415,7 +412,6 @@ 21879B1D1FB3FF54003CF552 /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = ""; }; 2188C6D6223C7E8300F18D90 /* SecureStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureStore.swift; sourceTree = ""; }; 2189C0802027CDB800771C1F /* GSRBookable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRBookable.swift; sourceTree = ""; }; - 2189C0812027CDB800771C1F /* GSRLoginController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRLoginController.swift; sourceTree = ""; }; 2189C0822027CDB800771C1F /* GSRController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRController.swift; sourceTree = ""; }; 2189C0862027CDD700771C1F /* GSRNetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRNetworkManager.swift; sourceTree = ""; }; 2189C0882027CE2600771C1F /* GSRTimeCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRTimeCell.swift; sourceTree = ""; }; @@ -425,7 +421,6 @@ 2189C0922027CE3F00771C1F /* GSRTimeSlot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRTimeSlot.swift; sourceTree = ""; }; 2189C0932027CE3F00771C1F /* GSRDateHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRDateHandler.swift; sourceTree = ""; }; 2189C0942027CE3F00771C1F /* GSRLocationModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRLocationModel.swift; sourceTree = ""; }; - 2189C0962027CE4000771C1F /* GSRUser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRUser.swift; sourceTree = ""; }; 2189C0982027CE4000771C1F /* GSRBooking.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRBooking.swift; sourceTree = ""; }; 2189C0992027CE4000771C1F /* GSRRoom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRRoom.swift; sourceTree = ""; }; 2189C09A2027CE4000771C1F /* GSRLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRLocation.swift; sourceTree = ""; }; @@ -469,7 +464,6 @@ 21E6A108224BDFEB00DC457A /* HomeViewController + Delegates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HomeViewController + Delegates.swift"; sourceTree = ""; }; 21EB4D2F203D330C0029A460 /* UserDBManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDBManager.swift; sourceTree = ""; }; 21ECADA01F2FFE0600569883 /* UserDefaults + Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults + Helpers.swift"; sourceTree = ""; }; - 21EF283821F509C0001B05B7 /* GSRWebviewLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GSRWebviewLoginController.swift; sourceTree = ""; }; 21F5F8F020538A87005B143F /* HomeFlingCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeFlingCellItem.swift; sourceTree = ""; }; 21F5F8F220538A90005B143F /* HomeFlingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeFlingCell.swift; sourceTree = ""; }; 21F5F8F420538AFC005B143F /* FlingPerformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlingPerformer.swift; sourceTree = ""; }; @@ -1062,7 +1056,6 @@ 2189C0932027CE3F00771C1F /* GSRDateHandler.swift */, 2189C0942027CE3F00771C1F /* GSRLocationModel.swift */, 2189C0922027CE3F00771C1F /* GSRTimeSlot.swift */, - 2189C0962027CE4000771C1F /* GSRUser.swift */, 2189C09A2027CE4000771C1F /* GSRLocation.swift */, 2138D55E22599D4700D67CA2 /* GSRGroup.swift */, ); @@ -1103,8 +1096,6 @@ 214E254822480818004CB9C4 /* GSRDeletable.swift */, 2189C0822027CDB800771C1F /* GSRController.swift */, 21A6B6CF22162652003A357D /* GSRReservationsController.swift */, - 21EF283821F509C0001B05B7 /* GSRWebviewLoginController.swift */, - 2189C0812027CDB800771C1F /* GSRLoginController.swift */, 2138D55422598AA800D67CA2 /* GSRTabController.swift */, ); path = Controllers; @@ -2025,7 +2016,6 @@ 97E79E052100DA1200D3D606 /* BuildingSectionHeader.swift in Sources */, 217A7843204D995C004F1227 /* ModularTableViewCell.swift in Sources */, 21640D5C20105B98002F33CA /* HomeDiningCell.swift in Sources */, - 21EF283921F509C0001B05B7 /* GSRWebviewLoginController.swift in Sources */, 2138D559225998A300D67CA2 /* GSRGroupController.swift in Sources */, 217A783D204D97B6004F1227 /* ModularTableViewModel.swift in Sources */, EF389EC621861B8500E29C6A /* HomeNavigationController.swift in Sources */, @@ -2096,7 +2086,6 @@ 6CAE438D253370E600BD0200 /* DiningInsightsView.swift in Sources */, 210AC14520684F9B0050D837 /* HomeCellProtocols.swift in Sources */, 97AA806B23D26BC700C23488 /* DiningHeaderView.swift in Sources */, - 2189C09F2027CE4100771C1F /* GSRUser.swift in Sources */, B9F8423123DDFD6700814975 /* GroupInviteUserCell.swift in Sources */, 2189C09D2027CE4100771C1F /* GSRLocationModel.swift in Sources */, 6C6035FA26E722E60025FBC7 /* GSRAPIResponse.swift in Sources */, @@ -2197,7 +2186,6 @@ 2189C0A82027CE4B00771C1F /* ThumbLayer.swift in Sources */, 97AA806D23D26BC700C23488 /* DiningBalanceCollectionViewCell.swift in Sources */, 21B653B92245EB67001A97C5 /* PennAuthRequestable.swift in Sources */, - 2189C0842027CDB800771C1F /* GSRLoginController.swift in Sources */, F2C7E5F5259EE1CA0043A98A /* CourseAlertSettings.swift in Sources */, 211DA1AF204921030065BC2C /* LaundryMachinesView.swift in Sources */, EFE2D6F2239B11050020F6BF /* GroupMemberCell.swift in Sources */, @@ -2318,8 +2306,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6601; - CF_BUNDLE_SHORT_VERSION_STRING = 6.6.0; + CF_BUNDLE_LONG_VERSION_STRING = 6612; + CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -2380,8 +2368,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6601; - CF_BUNDLE_SHORT_VERSION_STRING = 6.6.0; + CF_BUNDLE_LONG_VERSION_STRING = 6612; + CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -2453,7 +2441,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 6.6.0; + MARKETING_VERSION = "$(CF_BUNDLE_SHORT_VERSION_STRING"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = org.pennlabs.PennMobile; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2486,7 +2474,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 6.6.0; + MARKETING_VERSION = "$(CF_BUNDLE_SHORT_VERSION_STRING"; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = org.pennlabs.PennMobile; diff --git a/PennMobile/GSR-Booking/Controllers/GSRController.swift b/PennMobile/GSR-Booking/Controllers/GSRController.swift index 1f1f5b781..3f1f0a14b 100644 --- a/PennMobile/GSR-Booking/Controllers/GSRController.swift +++ b/PennMobile/GSR-Booking/Controllers/GSRController.swift @@ -289,20 +289,6 @@ extension GSRController: GSRBookable { let grc = GSRReservationsController() self.navigationController?.pushViewController(grc, animated: true) } - - private func presentWebviewLoginController(_ completion: (() -> Void)? = nil) { - let wv = GSRWebviewLoginController() - wv.completion = completion - let nvc = UINavigationController(rootViewController: wv) - present(nvc, animated: true, completion: nil) - } - - private func presentLoginController(with booking: GSRBooking? = nil) { - let glc = GSRLoginController() - glc.booking = booking - let nvc = UINavigationController(rootViewController: glc) - present(nvc, animated: true, completion: nil) - } } // MARK: - Update For New Day diff --git a/PennMobile/GSR-Booking/Controllers/GSRLoginController.swift b/PennMobile/GSR-Booking/Controllers/GSRLoginController.swift deleted file mode 100644 index 06cea23c9..000000000 --- a/PennMobile/GSR-Booking/Controllers/GSRLoginController.swift +++ /dev/null @@ -1,214 +0,0 @@ -// -// GSRLoginController.swift -// PennMobile -// -// Created by Josh Doman on 2/4/18. -// Copyright © 2018 PennLabs. All rights reserved. -// - -import Foundation -import UIKit -import SCLAlertView - -class GSRLoginController: UIViewController, IndicatorEnabled, ShowsAlert { - - fileprivate var firstNameField: UITextField! - fileprivate var lastNameField: UITextField! - fileprivate var emailField: UITextField! - - fileprivate var messageView: UITextView! - - fileprivate let edgeOffset: CGFloat = 24 - fileprivate let spaceBetween: CGFloat = 20 - - var booking: GSRBooking! - - var shouldShowCancel: Bool = true - var shouldShowSuccessMessage: Bool = false - - var message: String? // "Built by Eric Wang '21 and Josh Doman '20. Special thanks to Yagil Burowski '17 for donating the original design of this feature to Penn Labs." - - override func viewDidLoad() { - super.viewDidLoad() - view.backgroundColor = .white - navigationItem.title = booking == nil ? "Contact Info" : "Reserve" - - if booking == nil { - navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: #selector(saveCredentials(_:))) - } else { - navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Submit", style: .plain, target: self, action: #selector(saveCredentials(_:))) - } - if shouldShowCancel { - navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancel(_:))) - } - - self.prepareUI() - - if let user = GSRUser.getUser() { - self.firstNameField.text = user.firstName - self.lastNameField.text = user.lastName - self.emailField.text = user.email - self.firstNameField.becomeFirstResponder() - } else if let account = Account.getAccount() { - self.firstNameField.text = account.first - self.lastNameField.text = account.last - self.emailField.text = account.email - if self.firstNameField.text != nil && self.emailField.text == nil { - self.emailField.becomeFirstResponder() - } else { - self.firstNameField.becomeFirstResponder() - } - } else { - self.firstNameField.becomeFirstResponder() - } - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - } - - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - emailField.resignFirstResponder() - } - - override func resignFirstResponder() -> Bool { - super.resignFirstResponder() - return firstNameField.resignFirstResponder() || - lastNameField.resignFirstResponder() || - emailField.resignFirstResponder() // || - // phoneNumberField.resignFirstResponder() - } -} - -// MARK: - Setup UI -extension GSRLoginController { - fileprivate func prepareUI() { - view.backgroundColor = .uiBackground - prepareFirstNameField() - prepareLastNameField() - prepareEmailField() - prepareMessage() - } - - private func prepareFirstNameField() { - firstNameField = UITextField() - firstNameField.placeholder = "First" - firstNameField.font = UIFont.systemFont(ofSize: 14) - firstNameField.keyboardType = .alphabet - firstNameField.textAlignment = .natural - firstNameField.borderStyle = .roundedRect - firstNameField.autocorrectionType = .no - firstNameField.spellCheckingType = .no - firstNameField.autocapitalizationType = .words - firstNameField.delegate = self - firstNameField.tag = 0 - - view.addSubview(firstNameField) - _ = firstNameField.anchor(nil, left: view.leftAnchor, bottom: nil, right: view.centerXAnchor, topConstant: 0, leftConstant: edgeOffset, bottomConstant: 0, rightConstant: edgeOffset/2, widthConstant: 0, heightConstant: 44) - - if #available(iOS 11.0, *) { - firstNameField.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 50).isActive = true - } else { - firstNameField.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor, constant: 50).isActive = true - } - } - - private func prepareLastNameField() { - lastNameField = UITextField() - lastNameField.placeholder = "Last" - lastNameField.font = UIFont.systemFont(ofSize: 14) - lastNameField.keyboardType = .alphabet - lastNameField.textAlignment = .natural - lastNameField.borderStyle = .roundedRect - lastNameField.autocorrectionType = .no - lastNameField.spellCheckingType = .no - lastNameField.autocapitalizationType = .words - lastNameField.delegate = self - lastNameField.tag = 1 - - view.addSubview(lastNameField) - _ = lastNameField.anchor(firstNameField.topAnchor, left: view.centerXAnchor, bottom: nil, right: view.rightAnchor, topConstant: 0, leftConstant: edgeOffset/2, bottomConstant: 0, rightConstant: edgeOffset, widthConstant: 0, heightConstant: 44) - } - - private func prepareEmailField() { - emailField = UITextField() - emailField.placeholder = "Penn email (e.g. amyg@sas.upenn.edu)" - emailField.font = UIFont.systemFont(ofSize: 14) - emailField.keyboardType = .emailAddress - emailField.textAlignment = .natural - emailField.borderStyle = .roundedRect - emailField.autocorrectionType = .no - emailField.spellCheckingType = .no - emailField.autocapitalizationType = .none - emailField.delegate = self - emailField.returnKeyType = .done - emailField.tag = 2 - - view.addSubview(emailField) - let topAnchor = firstNameField.bottomAnchor - _ = emailField.anchor(topAnchor, left: firstNameField.leftAnchor, bottom: nil, right: lastNameField.rightAnchor, topConstant: spaceBetween, leftConstant: 0, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 44) - } - - private func prepareMessage() { - guard let message = message else { return } - let messageView = UITextView() - messageView.text = message - messageView.textColor = UIColor.grey3 - messageView.isScrollEnabled = false - messageView.isEditable = false - messageView.isSelectable = false - messageView.font = UIFont.systemFont(ofSize: 14) - - view.addSubview(messageView) - _ = messageView.anchor(emailField.bottomAnchor, left: emailField.leftAnchor, bottom: nil, right: emailField.rightAnchor, topConstant: spaceBetween, leftConstant: -4, bottomConstant: 0, rightConstant: -4, widthConstant: 0, heightConstant: 0) - } -} - -// MARK: - TextFieldDelegate -extension GSRLoginController: UITextFieldDelegate { - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - if let nextField = textField.superview?.viewWithTag(textField.tag + 1) as? UITextField { - nextField.becomeFirstResponder() - } else { - saveCredentials(textField) - } - return false - } -} - -// MARK: - Handlers -extension GSRLoginController: GSRBookable { - @objc fileprivate func saveCredentials(_ sender: Any) { - guard let firstName = firstNameField.text, let lastName = lastNameField.text, let email = emailField.text else { - return - } - - if firstName == "" || lastName == "" || email == "" { - showAlert(withMsg: "A field was left blank. Please fill it out before submitting.", completion: nil) - return // A field is left blank - } else if !email.contains("upenn.edu") || !email.contains("@") { - showAlert(withMsg: "The email field is malformed. Please make sure to use your Penn email.", completion: nil) - return // Malformed email, please use email ending in upenn.edu - } - - _ = resignFirstResponder() - - let user = GSRUser(firstName: firstName, lastName: lastName, email: email, phone: "2158986533") - if booking != nil { - submitBooking(for: booking) - } else { - GSRUser.save(user: user) - dismiss(animated: true, completion: nil) - - if shouldShowSuccessMessage { - showAlert(withMsg: "Your information has been saved.", title: "Success!", completion: nil) - } - } - } - - @objc fileprivate func cancel(_ sender: Any) { - _ = self.resignFirstResponder() - dismiss(animated: true, completion: nil) - } -} diff --git a/PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift b/PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift deleted file mode 100644 index 09d6fb76e..000000000 --- a/PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// GSRWebviewLogin.swift -// PennMobile -// -// Created by Josh Doman on 1/20/19. -// Copyright © 2019 PennLabs. All rights reserved. -// - -import UIKit -import WebKit - -class GSRWebviewLoginController: PennLoginController { - - var completion: (() -> Void)? - var shouldAnimate = true - - override var urlStr: String { - return "https://apps.wharton.upenn.edu/gsr/" - } - - override func handleSuccessfulNavigation(_ webView: WKWebView, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { - let cookieStore = webView.configuration.websiteDataStore.httpCookieStore - cookieStore.getAllCookies { (cookies) in - DispatchQueue.main.async { - for cookie in cookies { - HTTPCookieStorage.shared.setCookie(cookie) - } - decisionHandler(.cancel) - self.dismiss(animated: self.shouldAnimate, completion: nil) - self.completion?() - UserDefaults.standard.storeCookies() - - if GSRUser.getSessionCookie() != nil { - UserDefaults.standard.set(isInWharton: true) - } - } - } - } -} diff --git a/PennMobile/GSR-Booking/Model/GSRUser.swift b/PennMobile/GSR-Booking/Model/GSRUser.swift deleted file mode 100644 index cee47b258..000000000 --- a/PennMobile/GSR-Booking/Model/GSRUser.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// GSRUser.swift -// PennMobile -// -// Created by Josh Doman on 2/4/18. -// Copyright © 2018 PennLabs. All rights reserved. -// - -import Foundation - -struct GSRUser: Codable { - let firstName: String - let lastName: String - let email: String - let phone: String - - static func save(user: GSRUser) { - UserDefaults.standard.setGSRUser(value: user) - if let account = Account.getAccount(), account.first != user.firstName { - // Clear cache so that home title updates with new first name - guard let homeVC = ControllerModel.shared.viewController(for: .home) as? HomeViewController else { - return - } - homeVC.clearCache() - } - Account.update(firstName: user.firstName, lastName: user.lastName, email: user.email) - } - - static func hasSavedUser() -> Bool { - return UserDefaults.standard.getGSRUser() != nil - } - - static func getUser() -> GSRUser? { - return UserDefaults.standard.getGSRUser() - } - - static func clear() { - UserDefaults.standard.clearGSRUser() - clearSessionID() - } - - static func getSessionID() -> String? { - let cookie = getSessionCookie() - return cookie?.value - } - - static func clearSessionID() { - guard let cookie = getSessionCookie() else { return } - HTTPCookieStorage.shared.deleteCookie(cookie) - UserDefaults.standard.storeCookies() - } - - static func getSessionCookie() -> HTTPCookie? { - guard let cookies = HTTPCookieStorage.shared.cookies else { return nil } - if let cookie = (cookies.filter { $0.name == "sessionid" }).first { - return cookie - } else { - return nil - } - } -} diff --git a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift index 1642bc5cc..d6beb839a 100644 --- a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift +++ b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift @@ -238,37 +238,3 @@ extension GSRNetworkManager { task.resume() } } - -// MARK: - Session ID -extension GSRNetworkManager: PennAuthRequestable { - - private var serviceDown: String { - return "https://servicedown.wharton.upenn.edu/" - } - - private var whartonUrl: String { - return "https://apps.wharton.upenn.edu/gsr/" - } - - private var shibbolethUrl: String { - return "https://apps.wharton.upenn.edu/django-shib/Shibboleth.sso/SAML2/POST" - } - - - func getSessionID(_ callback: (((_ success: Bool) -> Void))? = nil) { - self.getSessionIDWithDownFlag { (success, _) in - callback?(success) - } - } - - func getSessionIDWithDownFlag(_ callback: @escaping ((_ success: Bool, _ serviceDown: Bool) -> Void)) { - makeAuthRequest(targetUrl: whartonUrl, shibbolethUrl: shibbolethUrl) { (data, response, error) in - if let urlStr = response?.url?.absoluteString, urlStr == self.serviceDown { - callback(false, true) - return - } - - callback(GSRUser.getSessionID() != nil, false) - } - } -} diff --git a/PennMobile/General/UserDefaults + Helpers.swift b/PennMobile/General/UserDefaults + Helpers.swift index 23a98b086..d7770233e 100644 --- a/PennMobile/General/UserDefaults + Helpers.swift +++ b/PennMobile/General/UserDefaults + Helpers.swift @@ -19,7 +19,6 @@ extension UserDefaults { case sessionCount case laundryPreferences case isOnboarded - case gsrUSer case appVersion case cookies case wharton @@ -139,29 +138,6 @@ extension UserDefaults { } } -// MARK: GSR User -extension UserDefaults { - func setGSRUser(value: GSRUser) { - let encoder = JSONEncoder() - if let encoded = try? encoder.encode(value) { - UserDefaults.standard.set(encoded, forKey: UserDefaultsKeys.gsrUSer.rawValue) - } - synchronize() - } - - func getGSRUser() -> GSRUser? { - let decoder = JSONDecoder() - if let decodedData = UserDefaults.standard.data(forKey: UserDefaultsKeys.gsrUSer.rawValue) { - return try? decoder.decode(GSRUser.self, from: decodedData) - } - return nil - } - - func clearGSRUser() { - removeObject(forKey: UserDefaultsKeys.gsrUSer.rawValue) - } -} - // MARK: Account extension UserDefaults { func saveAccount(_ account: Account) { diff --git a/PennMobile/Home/Networking/HomeAPIService.swift b/PennMobile/Home/Networking/HomeAPIService.swift index 2d2b449bd..64c1ac1fe 100644 --- a/PennMobile/Home/Networking/HomeAPIService.swift +++ b/PennMobile/Home/Networking/HomeAPIService.swift @@ -16,9 +16,6 @@ final class HomeAPIService: Requestable { func fetchModel(_ completion: @escaping (_ model: HomeTableViewModel?, _ error: NetworkingError?) -> Void) { let version = UserDefaults.standard.getAppVersion() var url = "https://api.pennlabs.org/homepage?version=\(version)" - if let sessionID = GSRUser.getSessionID() { - url = "\(url)&sessionid=\(sessionID)" - } if let courses = UserDefaults.standard.getCourses(), !courses.enrolledIn.isEmpty { if courses.taughtToday.hasUpcomingCourse { url = "\(url)&hasCourses=today" diff --git a/PennMobile/Login/LabsLoginController.swift b/PennMobile/Login/LabsLoginController.swift index 918fc8b75..75e67cb89 100644 --- a/PennMobile/Login/LabsLoginController.swift +++ b/PennMobile/Login/LabsLoginController.swift @@ -207,9 +207,6 @@ extension LabsLoginController { if UserDefaults.standard.getPreference(for: .collegeHouse) { CampusExpressNetworkManager.instance.updateHousingData() } - if UserDefaults.standard.isInWharton() { - GSRNetworkManager.instance.getSessionID() - } self.getDiningBalance() self.getDiningTransactions() self.getAndSaveLaundryPreferences() diff --git a/PennMobile/New Group/MoreViewController.swift b/PennMobile/New Group/MoreViewController.swift index 52dbd6eee..5570aa3b0 100644 --- a/PennMobile/New Group/MoreViewController.swift +++ b/PennMobile/New Group/MoreViewController.swift @@ -168,10 +168,10 @@ extension MoreViewController { tableView.deselectRow(at: indexPath, animated: true) if indexPath.section == 0 { if indexPath.row == 0 { - let targetController = GSRLoginController() - targetController.shouldShowSuccessMessage = true - targetController.shouldShowCancel = false - targetController.message = "This information is used when booking GSRs and when displaying your name on the homepage." + let targetController = UIViewController() +// targetController.shouldShowSuccessMessage = true +// targetController.shouldShowCancel = false +// targetController.message = "This information is used when booking GSRs and when displaying your name on the homepage." navigationController?.pushViewController(targetController, animated: true) } else if indexPath.row == 1 { let targetController = ControllerModel.shared.viewController(for: .pacCode) diff --git a/PennMobile/Setup + Navigation/RootViewController.swift b/PennMobile/Setup + Navigation/RootViewController.swift index b796ecd57..443ef2873 100644 --- a/PennMobile/Setup + Navigation/RootViewController.swift +++ b/PennMobile/Setup + Navigation/RootViewController.swift @@ -70,29 +70,6 @@ class RootViewController: UIViewController, NotificationRequestable { } } - // If student is in Wharton but does not have a session ID, retrieve one if possible - if UserDefaults.standard.isInWharton() && GSRUser.getSessionID() == nil { - let now = Date() - if lastLoginAttempt != nil && lastLoginAttempt!.minutesFrom(date: now) < 720 { - // Don't try to auto re-login if it's been less than 12 hours since last attempt - return - } - self.lastLoginAttempt = Date() - // Wait 0.5 seconds so that the home page request is not held up - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - GSRNetworkManager.instance.getSessionIDWithDownFlag { (success, serviceDown) in - DispatchQueue.main.async { - if !success && !serviceDown && self.current is HomeNavigationController { - // Only pop up login controller if not successful, service is not down, and not on login screen - let gwc = GSRWebviewLoginController() - let nvc = UINavigationController(rootViewController: gwc) - self.current.present(nvc, animated: true, completion: nil) - } - } - } - } - } - // Fetch transaction data at least once a week, starting on Sundays if shouldFetchTransactions() { if UserDefaults.standard.isAuthedIn() { @@ -205,7 +182,6 @@ class RootViewController: UIViewController, NotificationRequestable { OAuth2NetworkManager.instance.clearRefreshToken() OAuth2NetworkManager.instance.clearCurrentAccessToken() Account.clear() - GSRUser.clear() Storage.remove(DiningInsightsAPIResponse.directory, from: .caches) } From 534c3d5ddcbd71fa89d52337a5581d53e1ca7828 Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Sun, 12 Sep 2021 12:44:12 -0400 Subject: [PATCH 02/14] GSR Cleanup complete --- PennMobile.xcodeproj/project.pbxproj | 24 +- .../Controllers/GSRController.swift | 14 -- .../Controllers/GSRLoginController.swift | 214 ------------------ .../GSRWebviewLoginController.swift | 39 ---- PennMobile/GSR-Booking/Model/GSRUser.swift | 61 ----- .../Networking/GSRNetworkManager.swift | 34 --- .../General/UserDefaults + Helpers.swift | 24 -- .../Home/Networking/HomeAPIService.swift | 3 - PennMobile/Login/LabsLoginController.swift | 3 - PennMobile/New Group/MoreViewController.swift | 8 +- .../RootViewController.swift | 24 -- 11 files changed, 10 insertions(+), 438 deletions(-) delete mode 100644 PennMobile/GSR-Booking/Controllers/GSRLoginController.swift delete mode 100644 PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift delete mode 100644 PennMobile/GSR-Booking/Model/GSRUser.swift diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index 763e1d045..2bc358740 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -73,7 +73,6 @@ 21879B1E1FB3FF54003CF552 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21879B1D1FB3FF54003CF552 /* Storage.swift */; }; 2188C6D7223C7E8400F18D90 /* SecureStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2188C6D6223C7E8300F18D90 /* SecureStore.swift */; }; 2189C0832027CDB800771C1F /* GSRBookable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0802027CDB800771C1F /* GSRBookable.swift */; }; - 2189C0842027CDB800771C1F /* GSRLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0812027CDB800771C1F /* GSRLoginController.swift */; }; 2189C0852027CDB800771C1F /* GSRController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0822027CDB800771C1F /* GSRController.swift */; }; 2189C0872027CDD700771C1F /* GSRNetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0862027CDD700771C1F /* GSRNetworkManager.swift */; }; 2189C08C2027CE2600771C1F /* GSRTimeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0882027CE2600771C1F /* GSRTimeCell.swift */; }; @@ -83,7 +82,6 @@ 2189C09B2027CE4100771C1F /* GSRTimeSlot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0922027CE3F00771C1F /* GSRTimeSlot.swift */; }; 2189C09C2027CE4100771C1F /* GSRDateHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0932027CE3F00771C1F /* GSRDateHandler.swift */; }; 2189C09D2027CE4100771C1F /* GSRLocationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0942027CE3F00771C1F /* GSRLocationModel.swift */; }; - 2189C09F2027CE4100771C1F /* GSRUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0962027CE4000771C1F /* GSRUser.swift */; }; 2189C0A12027CE4100771C1F /* GSRBooking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0982027CE4000771C1F /* GSRBooking.swift */; }; 2189C0A22027CE4100771C1F /* GSRRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C0992027CE4000771C1F /* GSRRoom.swift */; }; 2189C0A32027CE4100771C1F /* GSRLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2189C09A2027CE4000771C1F /* GSRLocation.swift */; }; @@ -127,7 +125,6 @@ 21E6A109224BDFEB00DC457A /* HomeViewController + Delegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E6A108224BDFEB00DC457A /* HomeViewController + Delegates.swift */; }; 21EB4D30203D330C0029A460 /* UserDBManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21EB4D2F203D330C0029A460 /* UserDBManager.swift */; }; 21ECADA11F2FFE0600569883 /* UserDefaults + Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21ECADA01F2FFE0600569883 /* UserDefaults + Helpers.swift */; }; - 21EF283921F509C0001B05B7 /* GSRWebviewLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21EF283821F509C0001B05B7 /* GSRWebviewLoginController.swift */; }; 21F5F8F120538A87005B143F /* HomeFlingCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F5F8F020538A87005B143F /* HomeFlingCellItem.swift */; }; 21F5F8F320538A90005B143F /* HomeFlingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F5F8F220538A90005B143F /* HomeFlingCell.swift */; }; 21F5F8F520538AFC005B143F /* FlingPerformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F5F8F420538AFC005B143F /* FlingPerformer.swift */; }; @@ -415,7 +412,6 @@ 21879B1D1FB3FF54003CF552 /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = ""; }; 2188C6D6223C7E8300F18D90 /* SecureStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureStore.swift; sourceTree = ""; }; 2189C0802027CDB800771C1F /* GSRBookable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRBookable.swift; sourceTree = ""; }; - 2189C0812027CDB800771C1F /* GSRLoginController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRLoginController.swift; sourceTree = ""; }; 2189C0822027CDB800771C1F /* GSRController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRController.swift; sourceTree = ""; }; 2189C0862027CDD700771C1F /* GSRNetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRNetworkManager.swift; sourceTree = ""; }; 2189C0882027CE2600771C1F /* GSRTimeCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRTimeCell.swift; sourceTree = ""; }; @@ -425,7 +421,6 @@ 2189C0922027CE3F00771C1F /* GSRTimeSlot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRTimeSlot.swift; sourceTree = ""; }; 2189C0932027CE3F00771C1F /* GSRDateHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRDateHandler.swift; sourceTree = ""; }; 2189C0942027CE3F00771C1F /* GSRLocationModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRLocationModel.swift; sourceTree = ""; }; - 2189C0962027CE4000771C1F /* GSRUser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRUser.swift; sourceTree = ""; }; 2189C0982027CE4000771C1F /* GSRBooking.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRBooking.swift; sourceTree = ""; }; 2189C0992027CE4000771C1F /* GSRRoom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRRoom.swift; sourceTree = ""; }; 2189C09A2027CE4000771C1F /* GSRLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GSRLocation.swift; sourceTree = ""; }; @@ -469,7 +464,6 @@ 21E6A108224BDFEB00DC457A /* HomeViewController + Delegates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HomeViewController + Delegates.swift"; sourceTree = ""; }; 21EB4D2F203D330C0029A460 /* UserDBManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDBManager.swift; sourceTree = ""; }; 21ECADA01F2FFE0600569883 /* UserDefaults + Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults + Helpers.swift"; sourceTree = ""; }; - 21EF283821F509C0001B05B7 /* GSRWebviewLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GSRWebviewLoginController.swift; sourceTree = ""; }; 21F5F8F020538A87005B143F /* HomeFlingCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeFlingCellItem.swift; sourceTree = ""; }; 21F5F8F220538A90005B143F /* HomeFlingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeFlingCell.swift; sourceTree = ""; }; 21F5F8F420538AFC005B143F /* FlingPerformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlingPerformer.swift; sourceTree = ""; }; @@ -1062,7 +1056,6 @@ 2189C0932027CE3F00771C1F /* GSRDateHandler.swift */, 2189C0942027CE3F00771C1F /* GSRLocationModel.swift */, 2189C0922027CE3F00771C1F /* GSRTimeSlot.swift */, - 2189C0962027CE4000771C1F /* GSRUser.swift */, 2189C09A2027CE4000771C1F /* GSRLocation.swift */, 2138D55E22599D4700D67CA2 /* GSRGroup.swift */, ); @@ -1103,8 +1096,6 @@ 214E254822480818004CB9C4 /* GSRDeletable.swift */, 2189C0822027CDB800771C1F /* GSRController.swift */, 21A6B6CF22162652003A357D /* GSRReservationsController.swift */, - 21EF283821F509C0001B05B7 /* GSRWebviewLoginController.swift */, - 2189C0812027CDB800771C1F /* GSRLoginController.swift */, 2138D55422598AA800D67CA2 /* GSRTabController.swift */, ); path = Controllers; @@ -2025,7 +2016,6 @@ 97E79E052100DA1200D3D606 /* BuildingSectionHeader.swift in Sources */, 217A7843204D995C004F1227 /* ModularTableViewCell.swift in Sources */, 21640D5C20105B98002F33CA /* HomeDiningCell.swift in Sources */, - 21EF283921F509C0001B05B7 /* GSRWebviewLoginController.swift in Sources */, 2138D559225998A300D67CA2 /* GSRGroupController.swift in Sources */, 217A783D204D97B6004F1227 /* ModularTableViewModel.swift in Sources */, EF389EC621861B8500E29C6A /* HomeNavigationController.swift in Sources */, @@ -2096,7 +2086,6 @@ 6CAE438D253370E600BD0200 /* DiningInsightsView.swift in Sources */, 210AC14520684F9B0050D837 /* HomeCellProtocols.swift in Sources */, 97AA806B23D26BC700C23488 /* DiningHeaderView.swift in Sources */, - 2189C09F2027CE4100771C1F /* GSRUser.swift in Sources */, B9F8423123DDFD6700814975 /* GroupInviteUserCell.swift in Sources */, 2189C09D2027CE4100771C1F /* GSRLocationModel.swift in Sources */, 6C6035FA26E722E60025FBC7 /* GSRAPIResponse.swift in Sources */, @@ -2197,7 +2186,6 @@ 2189C0A82027CE4B00771C1F /* ThumbLayer.swift in Sources */, 97AA806D23D26BC700C23488 /* DiningBalanceCollectionViewCell.swift in Sources */, 21B653B92245EB67001A97C5 /* PennAuthRequestable.swift in Sources */, - 2189C0842027CDB800771C1F /* GSRLoginController.swift in Sources */, F2C7E5F5259EE1CA0043A98A /* CourseAlertSettings.swift in Sources */, 211DA1AF204921030065BC2C /* LaundryMachinesView.swift in Sources */, EFE2D6F2239B11050020F6BF /* GroupMemberCell.swift in Sources */, @@ -2318,8 +2306,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6601; - CF_BUNDLE_SHORT_VERSION_STRING = 6.6.0; + CF_BUNDLE_LONG_VERSION_STRING = 6612; + CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -2380,8 +2368,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6601; - CF_BUNDLE_SHORT_VERSION_STRING = 6.6.0; + CF_BUNDLE_LONG_VERSION_STRING = 6612; + CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -2453,7 +2441,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 6.6.0; + MARKETING_VERSION = "$(CF_BUNDLE_SHORT_VERSION_STRING"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = org.pennlabs.PennMobile; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2486,7 +2474,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 6.6.0; + MARKETING_VERSION = "$(CF_BUNDLE_SHORT_VERSION_STRING"; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = org.pennlabs.PennMobile; diff --git a/PennMobile/GSR-Booking/Controllers/GSRController.swift b/PennMobile/GSR-Booking/Controllers/GSRController.swift index 1f1f5b781..3f1f0a14b 100644 --- a/PennMobile/GSR-Booking/Controllers/GSRController.swift +++ b/PennMobile/GSR-Booking/Controllers/GSRController.swift @@ -289,20 +289,6 @@ extension GSRController: GSRBookable { let grc = GSRReservationsController() self.navigationController?.pushViewController(grc, animated: true) } - - private func presentWebviewLoginController(_ completion: (() -> Void)? = nil) { - let wv = GSRWebviewLoginController() - wv.completion = completion - let nvc = UINavigationController(rootViewController: wv) - present(nvc, animated: true, completion: nil) - } - - private func presentLoginController(with booking: GSRBooking? = nil) { - let glc = GSRLoginController() - glc.booking = booking - let nvc = UINavigationController(rootViewController: glc) - present(nvc, animated: true, completion: nil) - } } // MARK: - Update For New Day diff --git a/PennMobile/GSR-Booking/Controllers/GSRLoginController.swift b/PennMobile/GSR-Booking/Controllers/GSRLoginController.swift deleted file mode 100644 index 06cea23c9..000000000 --- a/PennMobile/GSR-Booking/Controllers/GSRLoginController.swift +++ /dev/null @@ -1,214 +0,0 @@ -// -// GSRLoginController.swift -// PennMobile -// -// Created by Josh Doman on 2/4/18. -// Copyright © 2018 PennLabs. All rights reserved. -// - -import Foundation -import UIKit -import SCLAlertView - -class GSRLoginController: UIViewController, IndicatorEnabled, ShowsAlert { - - fileprivate var firstNameField: UITextField! - fileprivate var lastNameField: UITextField! - fileprivate var emailField: UITextField! - - fileprivate var messageView: UITextView! - - fileprivate let edgeOffset: CGFloat = 24 - fileprivate let spaceBetween: CGFloat = 20 - - var booking: GSRBooking! - - var shouldShowCancel: Bool = true - var shouldShowSuccessMessage: Bool = false - - var message: String? // "Built by Eric Wang '21 and Josh Doman '20. Special thanks to Yagil Burowski '17 for donating the original design of this feature to Penn Labs." - - override func viewDidLoad() { - super.viewDidLoad() - view.backgroundColor = .white - navigationItem.title = booking == nil ? "Contact Info" : "Reserve" - - if booking == nil { - navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: #selector(saveCredentials(_:))) - } else { - navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Submit", style: .plain, target: self, action: #selector(saveCredentials(_:))) - } - if shouldShowCancel { - navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancel(_:))) - } - - self.prepareUI() - - if let user = GSRUser.getUser() { - self.firstNameField.text = user.firstName - self.lastNameField.text = user.lastName - self.emailField.text = user.email - self.firstNameField.becomeFirstResponder() - } else if let account = Account.getAccount() { - self.firstNameField.text = account.first - self.lastNameField.text = account.last - self.emailField.text = account.email - if self.firstNameField.text != nil && self.emailField.text == nil { - self.emailField.becomeFirstResponder() - } else { - self.firstNameField.becomeFirstResponder() - } - } else { - self.firstNameField.becomeFirstResponder() - } - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - } - - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - emailField.resignFirstResponder() - } - - override func resignFirstResponder() -> Bool { - super.resignFirstResponder() - return firstNameField.resignFirstResponder() || - lastNameField.resignFirstResponder() || - emailField.resignFirstResponder() // || - // phoneNumberField.resignFirstResponder() - } -} - -// MARK: - Setup UI -extension GSRLoginController { - fileprivate func prepareUI() { - view.backgroundColor = .uiBackground - prepareFirstNameField() - prepareLastNameField() - prepareEmailField() - prepareMessage() - } - - private func prepareFirstNameField() { - firstNameField = UITextField() - firstNameField.placeholder = "First" - firstNameField.font = UIFont.systemFont(ofSize: 14) - firstNameField.keyboardType = .alphabet - firstNameField.textAlignment = .natural - firstNameField.borderStyle = .roundedRect - firstNameField.autocorrectionType = .no - firstNameField.spellCheckingType = .no - firstNameField.autocapitalizationType = .words - firstNameField.delegate = self - firstNameField.tag = 0 - - view.addSubview(firstNameField) - _ = firstNameField.anchor(nil, left: view.leftAnchor, bottom: nil, right: view.centerXAnchor, topConstant: 0, leftConstant: edgeOffset, bottomConstant: 0, rightConstant: edgeOffset/2, widthConstant: 0, heightConstant: 44) - - if #available(iOS 11.0, *) { - firstNameField.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 50).isActive = true - } else { - firstNameField.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor, constant: 50).isActive = true - } - } - - private func prepareLastNameField() { - lastNameField = UITextField() - lastNameField.placeholder = "Last" - lastNameField.font = UIFont.systemFont(ofSize: 14) - lastNameField.keyboardType = .alphabet - lastNameField.textAlignment = .natural - lastNameField.borderStyle = .roundedRect - lastNameField.autocorrectionType = .no - lastNameField.spellCheckingType = .no - lastNameField.autocapitalizationType = .words - lastNameField.delegate = self - lastNameField.tag = 1 - - view.addSubview(lastNameField) - _ = lastNameField.anchor(firstNameField.topAnchor, left: view.centerXAnchor, bottom: nil, right: view.rightAnchor, topConstant: 0, leftConstant: edgeOffset/2, bottomConstant: 0, rightConstant: edgeOffset, widthConstant: 0, heightConstant: 44) - } - - private func prepareEmailField() { - emailField = UITextField() - emailField.placeholder = "Penn email (e.g. amyg@sas.upenn.edu)" - emailField.font = UIFont.systemFont(ofSize: 14) - emailField.keyboardType = .emailAddress - emailField.textAlignment = .natural - emailField.borderStyle = .roundedRect - emailField.autocorrectionType = .no - emailField.spellCheckingType = .no - emailField.autocapitalizationType = .none - emailField.delegate = self - emailField.returnKeyType = .done - emailField.tag = 2 - - view.addSubview(emailField) - let topAnchor = firstNameField.bottomAnchor - _ = emailField.anchor(topAnchor, left: firstNameField.leftAnchor, bottom: nil, right: lastNameField.rightAnchor, topConstant: spaceBetween, leftConstant: 0, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 44) - } - - private func prepareMessage() { - guard let message = message else { return } - let messageView = UITextView() - messageView.text = message - messageView.textColor = UIColor.grey3 - messageView.isScrollEnabled = false - messageView.isEditable = false - messageView.isSelectable = false - messageView.font = UIFont.systemFont(ofSize: 14) - - view.addSubview(messageView) - _ = messageView.anchor(emailField.bottomAnchor, left: emailField.leftAnchor, bottom: nil, right: emailField.rightAnchor, topConstant: spaceBetween, leftConstant: -4, bottomConstant: 0, rightConstant: -4, widthConstant: 0, heightConstant: 0) - } -} - -// MARK: - TextFieldDelegate -extension GSRLoginController: UITextFieldDelegate { - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - if let nextField = textField.superview?.viewWithTag(textField.tag + 1) as? UITextField { - nextField.becomeFirstResponder() - } else { - saveCredentials(textField) - } - return false - } -} - -// MARK: - Handlers -extension GSRLoginController: GSRBookable { - @objc fileprivate func saveCredentials(_ sender: Any) { - guard let firstName = firstNameField.text, let lastName = lastNameField.text, let email = emailField.text else { - return - } - - if firstName == "" || lastName == "" || email == "" { - showAlert(withMsg: "A field was left blank. Please fill it out before submitting.", completion: nil) - return // A field is left blank - } else if !email.contains("upenn.edu") || !email.contains("@") { - showAlert(withMsg: "The email field is malformed. Please make sure to use your Penn email.", completion: nil) - return // Malformed email, please use email ending in upenn.edu - } - - _ = resignFirstResponder() - - let user = GSRUser(firstName: firstName, lastName: lastName, email: email, phone: "2158986533") - if booking != nil { - submitBooking(for: booking) - } else { - GSRUser.save(user: user) - dismiss(animated: true, completion: nil) - - if shouldShowSuccessMessage { - showAlert(withMsg: "Your information has been saved.", title: "Success!", completion: nil) - } - } - } - - @objc fileprivate func cancel(_ sender: Any) { - _ = self.resignFirstResponder() - dismiss(animated: true, completion: nil) - } -} diff --git a/PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift b/PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift deleted file mode 100644 index 09d6fb76e..000000000 --- a/PennMobile/GSR-Booking/Controllers/GSRWebviewLoginController.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// GSRWebviewLogin.swift -// PennMobile -// -// Created by Josh Doman on 1/20/19. -// Copyright © 2019 PennLabs. All rights reserved. -// - -import UIKit -import WebKit - -class GSRWebviewLoginController: PennLoginController { - - var completion: (() -> Void)? - var shouldAnimate = true - - override var urlStr: String { - return "https://apps.wharton.upenn.edu/gsr/" - } - - override func handleSuccessfulNavigation(_ webView: WKWebView, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { - let cookieStore = webView.configuration.websiteDataStore.httpCookieStore - cookieStore.getAllCookies { (cookies) in - DispatchQueue.main.async { - for cookie in cookies { - HTTPCookieStorage.shared.setCookie(cookie) - } - decisionHandler(.cancel) - self.dismiss(animated: self.shouldAnimate, completion: nil) - self.completion?() - UserDefaults.standard.storeCookies() - - if GSRUser.getSessionCookie() != nil { - UserDefaults.standard.set(isInWharton: true) - } - } - } - } -} diff --git a/PennMobile/GSR-Booking/Model/GSRUser.swift b/PennMobile/GSR-Booking/Model/GSRUser.swift deleted file mode 100644 index cee47b258..000000000 --- a/PennMobile/GSR-Booking/Model/GSRUser.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// GSRUser.swift -// PennMobile -// -// Created by Josh Doman on 2/4/18. -// Copyright © 2018 PennLabs. All rights reserved. -// - -import Foundation - -struct GSRUser: Codable { - let firstName: String - let lastName: String - let email: String - let phone: String - - static func save(user: GSRUser) { - UserDefaults.standard.setGSRUser(value: user) - if let account = Account.getAccount(), account.first != user.firstName { - // Clear cache so that home title updates with new first name - guard let homeVC = ControllerModel.shared.viewController(for: .home) as? HomeViewController else { - return - } - homeVC.clearCache() - } - Account.update(firstName: user.firstName, lastName: user.lastName, email: user.email) - } - - static func hasSavedUser() -> Bool { - return UserDefaults.standard.getGSRUser() != nil - } - - static func getUser() -> GSRUser? { - return UserDefaults.standard.getGSRUser() - } - - static func clear() { - UserDefaults.standard.clearGSRUser() - clearSessionID() - } - - static func getSessionID() -> String? { - let cookie = getSessionCookie() - return cookie?.value - } - - static func clearSessionID() { - guard let cookie = getSessionCookie() else { return } - HTTPCookieStorage.shared.deleteCookie(cookie) - UserDefaults.standard.storeCookies() - } - - static func getSessionCookie() -> HTTPCookie? { - guard let cookies = HTTPCookieStorage.shared.cookies else { return nil } - if let cookie = (cookies.filter { $0.name == "sessionid" }).first { - return cookie - } else { - return nil - } - } -} diff --git a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift index 1642bc5cc..d6beb839a 100644 --- a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift +++ b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift @@ -238,37 +238,3 @@ extension GSRNetworkManager { task.resume() } } - -// MARK: - Session ID -extension GSRNetworkManager: PennAuthRequestable { - - private var serviceDown: String { - return "https://servicedown.wharton.upenn.edu/" - } - - private var whartonUrl: String { - return "https://apps.wharton.upenn.edu/gsr/" - } - - private var shibbolethUrl: String { - return "https://apps.wharton.upenn.edu/django-shib/Shibboleth.sso/SAML2/POST" - } - - - func getSessionID(_ callback: (((_ success: Bool) -> Void))? = nil) { - self.getSessionIDWithDownFlag { (success, _) in - callback?(success) - } - } - - func getSessionIDWithDownFlag(_ callback: @escaping ((_ success: Bool, _ serviceDown: Bool) -> Void)) { - makeAuthRequest(targetUrl: whartonUrl, shibbolethUrl: shibbolethUrl) { (data, response, error) in - if let urlStr = response?.url?.absoluteString, urlStr == self.serviceDown { - callback(false, true) - return - } - - callback(GSRUser.getSessionID() != nil, false) - } - } -} diff --git a/PennMobile/General/UserDefaults + Helpers.swift b/PennMobile/General/UserDefaults + Helpers.swift index 23a98b086..d7770233e 100644 --- a/PennMobile/General/UserDefaults + Helpers.swift +++ b/PennMobile/General/UserDefaults + Helpers.swift @@ -19,7 +19,6 @@ extension UserDefaults { case sessionCount case laundryPreferences case isOnboarded - case gsrUSer case appVersion case cookies case wharton @@ -139,29 +138,6 @@ extension UserDefaults { } } -// MARK: GSR User -extension UserDefaults { - func setGSRUser(value: GSRUser) { - let encoder = JSONEncoder() - if let encoded = try? encoder.encode(value) { - UserDefaults.standard.set(encoded, forKey: UserDefaultsKeys.gsrUSer.rawValue) - } - synchronize() - } - - func getGSRUser() -> GSRUser? { - let decoder = JSONDecoder() - if let decodedData = UserDefaults.standard.data(forKey: UserDefaultsKeys.gsrUSer.rawValue) { - return try? decoder.decode(GSRUser.self, from: decodedData) - } - return nil - } - - func clearGSRUser() { - removeObject(forKey: UserDefaultsKeys.gsrUSer.rawValue) - } -} - // MARK: Account extension UserDefaults { func saveAccount(_ account: Account) { diff --git a/PennMobile/Home/Networking/HomeAPIService.swift b/PennMobile/Home/Networking/HomeAPIService.swift index 2d2b449bd..64c1ac1fe 100644 --- a/PennMobile/Home/Networking/HomeAPIService.swift +++ b/PennMobile/Home/Networking/HomeAPIService.swift @@ -16,9 +16,6 @@ final class HomeAPIService: Requestable { func fetchModel(_ completion: @escaping (_ model: HomeTableViewModel?, _ error: NetworkingError?) -> Void) { let version = UserDefaults.standard.getAppVersion() var url = "https://api.pennlabs.org/homepage?version=\(version)" - if let sessionID = GSRUser.getSessionID() { - url = "\(url)&sessionid=\(sessionID)" - } if let courses = UserDefaults.standard.getCourses(), !courses.enrolledIn.isEmpty { if courses.taughtToday.hasUpcomingCourse { url = "\(url)&hasCourses=today" diff --git a/PennMobile/Login/LabsLoginController.swift b/PennMobile/Login/LabsLoginController.swift index 918fc8b75..75e67cb89 100644 --- a/PennMobile/Login/LabsLoginController.swift +++ b/PennMobile/Login/LabsLoginController.swift @@ -207,9 +207,6 @@ extension LabsLoginController { if UserDefaults.standard.getPreference(for: .collegeHouse) { CampusExpressNetworkManager.instance.updateHousingData() } - if UserDefaults.standard.isInWharton() { - GSRNetworkManager.instance.getSessionID() - } self.getDiningBalance() self.getDiningTransactions() self.getAndSaveLaundryPreferences() diff --git a/PennMobile/New Group/MoreViewController.swift b/PennMobile/New Group/MoreViewController.swift index 52dbd6eee..5570aa3b0 100644 --- a/PennMobile/New Group/MoreViewController.swift +++ b/PennMobile/New Group/MoreViewController.swift @@ -168,10 +168,10 @@ extension MoreViewController { tableView.deselectRow(at: indexPath, animated: true) if indexPath.section == 0 { if indexPath.row == 0 { - let targetController = GSRLoginController() - targetController.shouldShowSuccessMessage = true - targetController.shouldShowCancel = false - targetController.message = "This information is used when booking GSRs and when displaying your name on the homepage." + let targetController = UIViewController() +// targetController.shouldShowSuccessMessage = true +// targetController.shouldShowCancel = false +// targetController.message = "This information is used when booking GSRs and when displaying your name on the homepage." navigationController?.pushViewController(targetController, animated: true) } else if indexPath.row == 1 { let targetController = ControllerModel.shared.viewController(for: .pacCode) diff --git a/PennMobile/Setup + Navigation/RootViewController.swift b/PennMobile/Setup + Navigation/RootViewController.swift index b796ecd57..443ef2873 100644 --- a/PennMobile/Setup + Navigation/RootViewController.swift +++ b/PennMobile/Setup + Navigation/RootViewController.swift @@ -70,29 +70,6 @@ class RootViewController: UIViewController, NotificationRequestable { } } - // If student is in Wharton but does not have a session ID, retrieve one if possible - if UserDefaults.standard.isInWharton() && GSRUser.getSessionID() == nil { - let now = Date() - if lastLoginAttempt != nil && lastLoginAttempt!.minutesFrom(date: now) < 720 { - // Don't try to auto re-login if it's been less than 12 hours since last attempt - return - } - self.lastLoginAttempt = Date() - // Wait 0.5 seconds so that the home page request is not held up - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - GSRNetworkManager.instance.getSessionIDWithDownFlag { (success, serviceDown) in - DispatchQueue.main.async { - if !success && !serviceDown && self.current is HomeNavigationController { - // Only pop up login controller if not successful, service is not down, and not on login screen - let gwc = GSRWebviewLoginController() - let nvc = UINavigationController(rootViewController: gwc) - self.current.present(nvc, animated: true, completion: nil) - } - } - } - } - } - // Fetch transaction data at least once a week, starting on Sundays if shouldFetchTransactions() { if UserDefaults.standard.isAuthedIn() { @@ -205,7 +182,6 @@ class RootViewController: UIViewController, NotificationRequestable { OAuth2NetworkManager.instance.clearRefreshToken() OAuth2NetworkManager.instance.clearCurrentAccessToken() Account.clear() - GSRUser.clear() Storage.remove(DiningInsightsAPIResponse.directory, from: .caches) } From bb69ecac7b63e4ce1f41a7bd9b1f42f93711b5f5 Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Sun, 12 Sep 2021 12:59:09 -0400 Subject: [PATCH 03/14] Remove GSRUser from homescreen --- PennMobile/Home/Controllers/HomeViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PennMobile/Home/Controllers/HomeViewController.swift b/PennMobile/Home/Controllers/HomeViewController.swift index 3c27a5745..427f9b9a2 100644 --- a/PennMobile/Home/Controllers/HomeViewController.swift +++ b/PennMobile/Home/Controllers/HomeViewController.swift @@ -67,7 +67,7 @@ class HomeViewController: GenericViewController { if titleCacheTimestamp.minutesFrom(date: now) <= 60 && self.displayTitle != nil { return self.displayTitle } else { - let firstName = Account.getAccount()?.first ?? GSRUser.getUser()?.firstName + let firstName = Account.getAccount()?.first let intros = ["Welcome", "Howdy", "Hi there", "Hello", "Greetings", "Sup"] From d574453df988a247767a38c7278238a609c8d87f Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Wed, 15 Sep 2021 17:13:28 -0400 Subject: [PATCH 04/14] removed names from about page --- PennMobile.xcodeproj/project.pbxproj | 26 +- .../About/AboutPageCollectionViewCell.swift | 59 ---- .../About/AboutPageCollectionViewHeader.swift | 33 -- .../Controllers/AboutViewController.swift | 327 ------------------ .../New Group/AboutViewController.swift | 168 +++++++++ 5 files changed, 169 insertions(+), 444 deletions(-) delete mode 100644 PennMobile/About/AboutPageCollectionViewCell.swift delete mode 100644 PennMobile/About/AboutPageCollectionViewHeader.swift delete mode 100644 PennMobile/About/Controllers/AboutViewController.swift create mode 100644 PennMobile/New Group/AboutViewController.swift diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index 2bc358740..ca2b69672 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -220,8 +220,6 @@ B6FE7A02207BE29000F60838 /* HomeGSRBookingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6FE7A01207BE29000F60838 /* HomeGSRBookingButton.swift */; }; B9AA4EEF236F3E1B0010D7AC /* GSRGroupInviteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9AA4EEE236F3E1B0010D7AC /* GSRGroupInviteViewController.swift */; }; B9F8423123DDFD6700814975 /* GroupInviteUserCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F8423023DDFD6700814975 /* GroupInviteUserCell.swift */; }; - C10A59A42183CDD60059130B /* AboutPageCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C10A59A32183CDD60059130B /* AboutPageCollectionViewCell.swift */; }; - C10A59A62183CE120059130B /* AboutPageCollectionViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C10A59A52183CE120059130B /* AboutPageCollectionViewHeader.swift */; }; C11B38E322508A8D009B752A /* DiningBalance.swift in Sources */ = {isa = PBXBuildFile; fileRef = C11B38E222508A8D009B752A /* DiningBalance.swift */; }; C11DFA2F219F8A65000FC573 /* CalendarAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C11DFA2E219F8A65000FC573 /* CalendarAPI.swift */; }; C11DFA31219F90E5000FC573 /* CalendarEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C11DFA30219F90E5000FC573 /* CalendarEvent.swift */; }; @@ -557,8 +555,6 @@ B9AA4EEE236F3E1B0010D7AC /* GSRGroupInviteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GSRGroupInviteViewController.swift; sourceTree = ""; }; B9F8423023DDFD6700814975 /* GroupInviteUserCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupInviteUserCell.swift; sourceTree = ""; }; BED8AA4945D67F0ED89FA9B0 /* Pods_PennMobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PennMobile.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C10A59A32183CDD60059130B /* AboutPageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutPageCollectionViewCell.swift; sourceTree = ""; }; - C10A59A52183CE120059130B /* AboutPageCollectionViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutPageCollectionViewHeader.swift; sourceTree = ""; }; C11B38E222508A8D009B752A /* DiningBalance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiningBalance.swift; sourceTree = ""; }; C11DFA2E219F8A65000FC573 /* CalendarAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarAPI.swift; sourceTree = ""; }; C11DFA30219F90E5000FC573 /* CalendarEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarEvent.swift; sourceTree = ""; }; @@ -833,7 +829,6 @@ 216640D31EBB80FD00746B8E /* News */, 216640EE1EBB867600746B8E /* Contacts */, CF1CE9B8205D5BF100C51F46 /* More Tab */, - 216640F91EBB898700746B8E /* About */, 216640831EBADB7000746B8E /* Supporting_Files */, ); path = PennMobile; @@ -961,16 +956,6 @@ path = Contacts; sourceTree = ""; }; - 216640F91EBB898700746B8E /* About */ = { - isa = PBXGroup; - children = ( - C10A59A32183CDD60059130B /* AboutPageCollectionViewCell.swift */, - C10A59A52183CE120059130B /* AboutPageCollectionViewHeader.swift */, - B6111DB820184C9B00DC7877 /* Controllers */, - ); - path = About; - sourceTree = ""; - }; 217A7839204D977E004F1227 /* ModularTableView */ = { isa = PBXGroup; children = ( @@ -1383,14 +1368,6 @@ name = "Recovered References"; sourceTree = ""; }; - B6111DB820184C9B00DC7877 /* Controllers */ = { - isa = PBXGroup; - children = ( - B6111DB320184C4A00DC7877 /* AboutViewController.swift */, - ); - path = Controllers; - sourceTree = ""; - }; B62875E82112591700FB2873 /* Buildings */ = { isa = PBXGroup; children = ( @@ -1538,6 +1515,7 @@ CF1CE9B8205D5BF100C51F46 /* More Tab */ = { isa = PBXGroup; children = ( + B6111DB320184C4A00DC7877 /* AboutViewController.swift */, C8C96F12241407320069D56A /* PAC Code */, CF1CE9B9205D5C3F00C51F46 /* MoreViewController.swift */, CF1CE9BC205D664700C51F46 /* MoreCell.swift */, @@ -2128,7 +2106,6 @@ EFE2D6F3239B11050020F6BF /* CreateGroupCell.swift in Sources */, 2180D2302013F3B4008C94CF /* NotificationRequestable.swift in Sources */, 212B8359222A331D00F835D6 /* Post.swift in Sources */, - C10A59A62183CE120059130B /* AboutPageCollectionViewHeader.swift in Sources */, B67881D8211CBF2A000DA750 /* MenuTableView.swift in Sources */, EFE2D700239B124D0020F6BF /* GSRGroupUser.swift in Sources */, 6CFA06F626E8352F00944B8E /* HomeStudyRoomCell.swift in Sources */, @@ -2136,7 +2113,6 @@ 21ABE2AF223D7E2B00199D29 /* Time.swift in Sources */, 21A6B6D42216824C003A357D /* ReservationCell.swift in Sources */, EFE2D6EF239B11050020F6BF /* GroupIndividualSettingView.swift in Sources */, - C10A59A42183CDD60059130B /* AboutPageCollectionViewCell.swift in Sources */, EF6329A22409D2CE00E7ED36 /* GSRGroupConfirmBookingController.swift in Sources */, 21D5E07423BCFE0300B331CC /* CoursePrivacyController.swift in Sources */, 6C23AF9526E57903002F60F0 /* (null) in Sources */, diff --git a/PennMobile/About/AboutPageCollectionViewCell.swift b/PennMobile/About/AboutPageCollectionViewCell.swift deleted file mode 100644 index 29d97ebd2..000000000 --- a/PennMobile/About/AboutPageCollectionViewCell.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// AboutPageCollectionViewCell.swift -// PennMobile -// -// Created by Marta García Ferreiro on 10/26/18. -// Copyright © 2018 PennLabs. All rights reserved. -// - -import UIKit - -class AboutPageCollectionViewCell: UICollectionViewCell { - - let profileImage: UIImageView = { - let image = UIImageView() - image.layer.cornerRadius = 83/2 - image.clipsToBounds = true - image.image = UIImage() - image.translatesAutoresizingMaskIntoConstraints = false - image.widthAnchor.constraint(equalToConstant: 83).isActive = true - image.heightAnchor.constraint(equalToConstant: 83).isActive = true - image.backgroundColor = .grey4 - image.contentMode = .scaleAspectFill - return image - }() - - let name: UILabel = { - let label = UILabel() - label.font = .secondaryTitleFont - label.textColor = UIColor.labelSecondary - label.textAlignment = .center - label.translatesAutoresizingMaskIntoConstraints = false - label.adjustsFontSizeToFitWidth = true - label.minimumScaleFactor = 0.5 - label.numberOfLines = 1 - return label - }() - - override func awakeFromNib() { - super.awakeFromNib() - } - - override init(frame: CGRect) { - super.init(frame: frame) - let stackView = UIStackView(arrangedSubviews: [profileImage, name]) - stackView.axis = .vertical - stackView.distribution = .fill - stackView.alignment = .center - stackView.spacing = 2 - stackView.translatesAutoresizingMaskIntoConstraints = false - addSubview(stackView) - stackView.widthAnchor.constraint(equalToConstant: 90).isActive = true - stackView.heightAnchor.constraint(equalToConstant: 105).isActive = true - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - -} diff --git a/PennMobile/About/AboutPageCollectionViewHeader.swift b/PennMobile/About/AboutPageCollectionViewHeader.swift deleted file mode 100644 index 2149e3cfe..000000000 --- a/PennMobile/About/AboutPageCollectionViewHeader.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// AboutPageCollectionViewHeader.swift -// PennMobile -// -// Created by Marta García Ferreiro on 10/26/18. -// Copyright © 2018 PennLabs. All rights reserved. -// - -import UIKit - -class AboutPageCollectionViewHeader: UICollectionReusableView { - - let label: UILabel = { - let label = UILabel() - label.text = "Built By" - label.font = UIFont.systemFont(ofSize: 26, weight: .medium) - label.textColor = UIColor.labelPrimary - label.textAlignment = .center - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - override init(frame: CGRect) { - super.init(frame: frame) - addSubview(label) - label.widthAnchor.constraint(equalToConstant: 200).isActive = true - label.heightAnchor.constraint(equalToConstant: 30).isActive = true - label.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} diff --git a/PennMobile/About/Controllers/AboutViewController.swift b/PennMobile/About/Controllers/AboutViewController.swift deleted file mode 100644 index 8a0c85b7e..000000000 --- a/PennMobile/About/Controllers/AboutViewController.swift +++ /dev/null @@ -1,327 +0,0 @@ -// -// AboutViewController.swift -// PennMobile -// -// Created by Marta García Ferreiro on 10/26/18. -// Copyright © 2018 PennLabs. All rights reserved. -// - -import UIKit -import Kingfisher - -class Member: Comparable { - - var firstName: String - var lastName: String - var imageURL: URL? - var websiteURL: URL? - - // initialize properties of the class Member - init (firstName: String, lastName: String, image: String, website: String? = nil) { - self.firstName = firstName - self.lastName = lastName - if let website = website { - self.websiteURL = URL(string: website) - } - self.imageURL = URL(string: "https://s3.us-east-2.amazonaws.com/penn.mobile/about/" + image) - } - - static func < (lhs: Member, rhs: Member) -> Bool { - ///sort by last name then first - if lhs.lastName == rhs.lastName { - return lhs.firstName < rhs.firstName - } - return lhs.lastName < rhs.lastName - } - - static func == (lhs: Member, rhs: Member) -> Bool { - return lhs.firstName == rhs.firstName && lhs.lastName == rhs.lastName && lhs.imageURL == rhs.imageURL - } -} - -class AboutViewController : UIViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource { - - var logo: UIImageView! - var subtitle: UITextView! - var descriptionTextView: UITextView! - var learnMoreButton: UIButton! - var madeWithLoveLabel: UILabel! - var copyrightLabel: UILabel! - var members = [[Member]]() - var collectionView: UICollectionView? - - private func loadMembers() { - - let dom = Member(firstName: "Dominic", lastName: "Holmes", image: "dominic.jpeg", website: "https://dominic.land") - let ben = Member(firstName: "Ben", lastName: "Leimberger", image: "ben.jpeg") - let carin = Member(firstName: "Carin", lastName: "Gan", image: "carin.jpeg") - let salib = Member(firstName: "Daniel", lastName: "Salib", image: "salib.jpeg") - let marta = Member(firstName: "Marta", lastName: "García", image: "marta.jpg") - let grace = Member(firstName: "Grace", lastName: "Jiang", image: "grace.jpeg") - let josh = Member(firstName: "Josh", lastName: "Doman", image: "josh.jpeg") - let tiff = Member(firstName: "Tiffany", lastName: "Chang", image: "tiff.jpeg") - let zhilei = Member(firstName: "Zhilei", lastName: "Zheng", image: "zhilei.jpeg") - let laura = Member(firstName: "Laura", lastName: "Gao", image: "laura.jpeg") - let yagil = Member(firstName: "Yagil", lastName: "Burowski", image: "yagil.jpeg") - let adel = Member(firstName: "Adel", lastName: "Qalieh", image: "adel.jpeg") - let rehaan = Member(firstName: "Rehaan", lastName: "Furniturewala", image: "rehaan.jpeg") - let liz = Member(firstName: "Liz", lastName: "Powell", image: "liz.jpeg") - let henrique = Member(firstName: "Henrique", lastName: "Lorente", image: "henrique.jpeg") - let lucy = Member(firstName: "Lucy", lastName: "Yuan", image: "lucy.jpeg") - let matthew = Member(firstName: "Matthew", lastName: "Rosca-Halmagean", image: "matthew.jpeg") - let hassan = Member(firstName: "Hassan", lastName: "Hammoud", image: "hassan.jpeg") - let jongmin = Member(firstName: "Jong Min", lastName: "Choi", image: "jongmin.jpeg") - let adam = Member(firstName: "Adam", lastName: "Strike", image: "adam.jpeg") - let justin = Member(firstName: "Justin", lastName: "Lieb", image: "justin.jpeg") - let daniel = Member(firstName: "Daniel", lastName: "Duan", image: "daniel.jpg") - let raunaq = Member(firstName: "Raunaq", lastName: "Singh", image: "raunaq.jpeg") - let benK = Member(firstName: "Ben", lastName: "Kaufman", image: "benk.jpg") - let sherie = Member(firstName: "Sherie", lastName: "Pan", image: "sherie.jpeg") - let eli = Member(firstName: "Eli", lastName: "Nathan", image: "eli.jpeg") - - - var currentMembers = [Member]() - var pastMembers = [Member]() - - //fill the arrays with members, and sort alphabetically - pastMembers += [marta, grace, ben, tiff, zhilei, laura, adel, yagil, josh, dom, carin, salib, liz] - currentMembers += [rehaan, henrique, lucy, matthew, hassan, jongmin, adam, justin, raunaq, daniel, benK, sherie, eli] - - pastMembers.sort(by: {$0 < $1}) - currentMembers.sort(by: {$0 < $1}) - members += [currentMembers, pastMembers] - } - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = .uiBackground - self.title = "About" - - loadMembers() - setupLogo() - setupSubtitle() - setupDescription() - setupButton() - setupCollection() - setUpMadeWithLoveLabel() - setupCopyrightLabel() - setupStack() - } - - // MARK: set up logo and informational text - - func setupLogo() { - let logoImage: UIImage = UIImage(named: "logotype") ?? UIImage() - logo = UIImageView(image: logoImage) - logo.contentMode = .scaleAspectFit - logo.translatesAutoresizingMaskIntoConstraints = false - logo.widthAnchor.constraint(equalToConstant: 230.0).isActive = true - logo.heightAnchor.constraint(equalToConstant: 129.0).isActive = true - } - - func setupSubtitle() { - - subtitle = UITextView() - subtitle.isEditable = false - subtitle.isSelectable = false - subtitle.textContainer.maximumNumberOfLines = 0 - - let str = "Hi, we’re Penn Labs: a team of student software engineers, product designers, and business developers." - let font = UIFont.systemFont(ofSize: 18) - let boldFont = UIFont.systemFont(ofSize: 18, weight: .semibold) - - let attributedString = NSMutableAttributedString(string: str, attributes: convertToOptionalNSAttributedStringKeyDictionary([convertFromNSAttributedStringKey(NSAttributedString.Key.font) : font])) - attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(10, 9)) - attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(39, 18)) - attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(58, 18)) - attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(81, 20)) - - subtitle.attributedText = attributedString - subtitle.textColor = UIColor.labelPrimary - subtitle.textAlignment = .center - subtitle.isScrollEnabled = false - - subtitle.translatesAutoresizingMaskIntoConstraints = false - subtitle.widthAnchor.constraint(equalToConstant: 280.0).isActive = true - } - - func setupDescription() { - descriptionTextView = UITextView() - descriptionTextView.isEditable = false - descriptionTextView.isSelectable = false - descriptionTextView.textContainer.maximumNumberOfLines = 0 - descriptionTextView.text = "Penn Labs empowers others to make connections: connections to resources, connections to people, and connections to the greater Penn community.\n\n Our ultimate goal is improving the Penn community. We aim to do so not only by creating high quality products, but also by giving back to the community with educational resources and technical support." - descriptionTextView.font = .systemFont(ofSize: 14) - descriptionTextView.textColor = .labelPrimary - descriptionTextView.textAlignment = .center - descriptionTextView.isScrollEnabled = false - descriptionTextView.translatesAutoresizingMaskIntoConstraints = false - descriptionTextView.widthAnchor.constraint(equalToConstant: 280.0).isActive = true - } - - // MARK: set up learn more button - - func setupButton() { - learnMoreButton = UIButton() - learnMoreButton.backgroundColor = .baseBlue - learnMoreButton.titleLabel?.font = .systemFont(ofSize: 16, weight: .semibold) - learnMoreButton.setTitle("Learn More", for: []) - learnMoreButton.setTitleColor(UIColor.white, for: []) - - learnMoreButton.layer.cornerRadius = 36.0/2 - learnMoreButton.layer.masksToBounds = true - learnMoreButton.translatesAutoresizingMaskIntoConstraints = false - learnMoreButton.heightAnchor.constraint(equalToConstant: 36.0).isActive = true - learnMoreButton.widthAnchor.constraint(equalToConstant: 132.0).isActive = true - learnMoreButton.addTarget(self, action: #selector(didTapLearnMoreButton), for: .touchUpInside) - } - - @objc func didTapLearnMoreButton(sender: UIButton!) { - if let url = URL(string: "https://pennlabs.org") { - UIApplication.shared.open(url, options: [:]) - } - } - - func setUpMadeWithLoveLabel() { - madeWithLoveLabel = UILabel() - madeWithLoveLabel.font = .systemFont(ofSize: 18, weight: .medium) - madeWithLoveLabel.text = "Made with \u{1F496} by Penn Labs" - madeWithLoveLabel.textColor = .labelSecondary - madeWithLoveLabel.textAlignment = .center - madeWithLoveLabel.translatesAutoresizingMaskIntoConstraints = false - madeWithLoveLabel.heightAnchor.constraint(equalToConstant: 30).isActive = true - } - - func setupCopyrightLabel() { - let now = Date() - copyrightLabel = UILabel() - copyrightLabel.font = .systemFont(ofSize: 11) - copyrightLabel.text = "Penn Labs \u{00A9} \(now.year)" - copyrightLabel.textColor = .labelTertiary - copyrightLabel.textAlignment = .center - copyrightLabel.translatesAutoresizingMaskIntoConstraints = false - copyrightLabel.heightAnchor.constraint(equalToConstant: 30).isActive = true - } - - // MARK: set up collection view - func numberOfSections(in collectionView: UICollectionView) -> Int { - return 2 - } - - func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { - if (kind == UICollectionView.elementKindSectionHeader) { - let section = indexPath.section - let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "AboutPageSectionHeader", for: indexPath) as! AboutPageCollectionViewHeader - header.label.text = (section == 0) ? "Meet the Team" : "Alumni" - return header - } - return AboutPageCollectionViewHeader() - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { - return CGSize(width: view.bounds.width, height: 40) - } - - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return members[section].count - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return CGSize(width: 90.0, height: 105.0) - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - //create cell that has the properties of the CollectionViewCell we defined, otherwise it gives an error - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "AboutPageCell", for: indexPath) as? AboutPageCollectionViewCell else { - fatalError("The dequeued cell is not an instance of AboutPageCollectionViewCell.") - } - //put the data for the people in the cell - let member = members[indexPath.section][indexPath.row] - cell.name.text = "\(member.firstName) \(member.lastName)" - if let imageURL = member.imageURL { - cell.profileImage.kf.setImage(with: imageURL) - } - return cell - } - - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let member = members[indexPath.section][indexPath.row] - if let url = member.websiteURL { - UIApplication.shared.open(url, options: [:]) - } - } - - func setupCollection() { - let frame = self.view.frame - let layout = UICollectionViewFlowLayout() - layout.scrollDirection = .vertical - layout.sectionInset = UIEdgeInsets(top: 20, left: 0, bottom: 20, right: 0) - collectionView = UICollectionView(frame: frame, collectionViewLayout: layout) - collectionView?.delegate = self - collectionView?.dataSource = self - self.collectionView?.backgroundColor = .clear - self.collectionView?.isScrollEnabled = false - self.collectionView?.register(AboutPageCollectionViewCell.self, forCellWithReuseIdentifier: "AboutPageCell") - self.collectionView?.register(AboutPageCollectionViewHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "AboutPageSectionHeader") - - collectionView?.translatesAutoresizingMaskIntoConstraints = false - collectionView?.widthAnchor.constraint(equalToConstant: 300).isActive = true - collectionView?.heightAnchor.constraint(equalToConstant: 1175).isActive = true - - } - - // MARK: set up scroll view and stack view - - func setupStack() { - let space = UIView() - space.translatesAutoresizingMaskIntoConstraints = false - space.widthAnchor.constraint(equalToConstant: 1.0).isActive = true - space.heightAnchor.constraint(equalToConstant: 50.0).isActive = true - - let smallSpace = UIView() - space.translatesAutoresizingMaskIntoConstraints = false - space.widthAnchor.constraint(equalToConstant: 1.0).isActive = true - space.heightAnchor.constraint(equalToConstant: 25.0).isActive = true - - let stackView = UIStackView(arrangedSubviews: [space, logo, subtitle, descriptionTextView, learnMoreButton, smallSpace, collectionView!, madeWithLoveLabel, copyrightLabel]) - - stackView.axis = .vertical - stackView.distribution = .fill - stackView.alignment = .center - stackView.spacing = 20 - stackView.translatesAutoresizingMaskIntoConstraints = false - - let scrollView = UIScrollView() - scrollView.translatesAutoresizingMaskIntoConstraints = false - - view.addSubview(scrollView) - - //add constraints to scrollView - scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true - scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true - scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true - scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true - - scrollView.addSubview(stackView) - - //add constraints to stackView - stackView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor).isActive = true - stackView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor).isActive = true - stackView.topAnchor.constraint(equalTo: scrollView.topAnchor).isActive = true - stackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true - stackView.widthAnchor.constraint(equalTo: scrollView.widthAnchor).isActive = true - - } -} - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertToOptionalNSAttributedStringKeyDictionary(_ input: [String: Any]?) -> [NSAttributedString.Key: Any]? { - guard let input = input else { return nil } - return Dictionary(uniqueKeysWithValues: input.map { key, value in (NSAttributedString.Key(rawValue: key), value)}) -} - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertFromNSAttributedStringKey(_ input: NSAttributedString.Key) -> String { - return input.rawValue -} diff --git a/PennMobile/New Group/AboutViewController.swift b/PennMobile/New Group/AboutViewController.swift new file mode 100644 index 000000000..200eb7d8c --- /dev/null +++ b/PennMobile/New Group/AboutViewController.swift @@ -0,0 +1,168 @@ +// +// AboutViewController.swift +// PennMobile +// +// Created by Marta García Ferreiro on 10/26/18. +// Copyright © 2018 PennLabs. All rights reserved. +// + +import Foundation + +class AboutViewController : UIViewController { + + var logo: UIImageView! + var subtitle: UITextView! + var descriptionTextView: UITextView! + var learnMoreButton: UIButton! + var madeWithLoveLabel: UILabel! + var copyrightLabel: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .uiBackground + self.title = "About" + + setupLogo() + setupSubtitle() + setupDescription() + setupButton() + setUpMadeWithLoveLabel() + setupCopyrightLabel() + setupStack() + } + + // MARK: set up logo and informational text + func setupLogo() { + let logoImage: UIImage = UIImage(named: "logotype") ?? UIImage() + logo = UIImageView(image: logoImage) + logo.contentMode = .scaleAspectFit + logo.translatesAutoresizingMaskIntoConstraints = false + logo.widthAnchor.constraint(equalToConstant: 230.0).isActive = true + logo.heightAnchor.constraint(equalToConstant: 129.0).isActive = true + } + + func setupSubtitle() { + subtitle = UITextView() + subtitle.isEditable = false + subtitle.isSelectable = false + subtitle.textContainer.maximumNumberOfLines = 0 + + let str = "Hi, we’re Penn Labs: a team of student software engineers, product designers, and business developers." + let font = UIFont.systemFont(ofSize: 18) + let boldFont = UIFont.systemFont(ofSize: 18, weight: .semibold) + + let attributedString = NSMutableAttributedString(string: str, attributes: [.font: font]) + attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(10, 9)) + attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(39, 18)) + attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(58, 18)) + attributedString.addAttribute(NSAttributedString.Key.font, value: boldFont, range: NSMakeRange(81, 20)) + + subtitle.attributedText = attributedString + subtitle.textColor = UIColor.labelPrimary + subtitle.textAlignment = .center + subtitle.isScrollEnabled = false + + subtitle.translatesAutoresizingMaskIntoConstraints = false + subtitle.widthAnchor.constraint(equalToConstant: 280.0).isActive = true + } + + func setupDescription() { + descriptionTextView = UITextView() + descriptionTextView.isEditable = false + descriptionTextView.isSelectable = false + descriptionTextView.textContainer.maximumNumberOfLines = 0 + descriptionTextView.text = "Penn Labs empowers others to make connections: connections to resources, connections to people, and connections to the greater Penn community.\n\n Our ultimate goal is improving the Penn community. We aim to do so not only by creating high quality products, but also by giving back to the community with educational resources and technical support." + descriptionTextView.font = .systemFont(ofSize: 14) + descriptionTextView.textColor = .labelPrimary + descriptionTextView.textAlignment = .center + descriptionTextView.isScrollEnabled = false + descriptionTextView.translatesAutoresizingMaskIntoConstraints = false + descriptionTextView.widthAnchor.constraint(equalToConstant: 280.0).isActive = true + } + + // MARK: set up learn more button + + func setupButton() { + learnMoreButton = UIButton() + learnMoreButton.backgroundColor = .baseBlue + learnMoreButton.titleLabel?.font = .systemFont(ofSize: 16, weight: .semibold) + learnMoreButton.setTitle("Learn More", for: []) + learnMoreButton.setTitleColor(UIColor.white, for: []) + + learnMoreButton.layer.cornerRadius = 36.0/2 + learnMoreButton.layer.masksToBounds = true + learnMoreButton.translatesAutoresizingMaskIntoConstraints = false + learnMoreButton.heightAnchor.constraint(equalToConstant: 36.0).isActive = true + learnMoreButton.widthAnchor.constraint(equalToConstant: 132.0).isActive = true + learnMoreButton.addTarget(self, action: #selector(didTapLearnMoreButton), for: .touchUpInside) + } + + @objc func didTapLearnMoreButton(sender: UIButton!) { + if let url = URL(string: "https://pennlabs.org") { + UIApplication.shared.open(url, options: [:]) + } + } + + func setUpMadeWithLoveLabel() { + madeWithLoveLabel = UILabel() + madeWithLoveLabel.font = .systemFont(ofSize: 18, weight: .medium) + madeWithLoveLabel.text = "Made with \u{1F496} by Penn Labs" + madeWithLoveLabel.textColor = .labelSecondary + madeWithLoveLabel.textAlignment = .center + madeWithLoveLabel.translatesAutoresizingMaskIntoConstraints = false + madeWithLoveLabel.heightAnchor.constraint(equalToConstant: 30).isActive = true + } + + func setupCopyrightLabel() { + let now = Date() + copyrightLabel = UILabel() + copyrightLabel.font = .systemFont(ofSize: 11) + copyrightLabel.text = "Penn Labs \u{00A9} \(now.year)" + copyrightLabel.textColor = .labelTertiary + copyrightLabel.textAlignment = .center + copyrightLabel.translatesAutoresizingMaskIntoConstraints = false + copyrightLabel.heightAnchor.constraint(equalToConstant: 30).isActive = true + } + + // MARK: set up scroll view and stack view + func setupStack() { + let space = UIView() + space.translatesAutoresizingMaskIntoConstraints = false + space.widthAnchor.constraint(equalToConstant: 1.0).isActive = true + space.heightAnchor.constraint(equalToConstant: 50.0).isActive = true + + let smallSpace = UIView() + space.translatesAutoresizingMaskIntoConstraints = false + space.widthAnchor.constraint(equalToConstant: 1.0).isActive = true + space.heightAnchor.constraint(equalToConstant: 25.0).isActive = true + + let stackView = UIStackView(arrangedSubviews: [space, logo, subtitle, descriptionTextView, learnMoreButton, smallSpace, madeWithLoveLabel, copyrightLabel]) + + stackView.axis = .vertical + stackView.distribution = .fill + stackView.alignment = .center + stackView.spacing = 20 + stackView.translatesAutoresizingMaskIntoConstraints = false + + let scrollView = UIScrollView() + scrollView.translatesAutoresizingMaskIntoConstraints = false + + view.addSubview(scrollView) + + //add constraints to scrollView + scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true + scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true + scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true + + scrollView.addSubview(stackView) + + //add constraints to stackView + stackView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor).isActive = true + stackView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor).isActive = true + stackView.topAnchor.constraint(equalTo: scrollView.topAnchor).isActive = true + stackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true + stackView.widthAnchor.constraint(equalTo: scrollView.widthAnchor).isActive = true + } +} From cc49534bf87de9f2347880882bf9e0d03a732d60 Mon Sep 17 00:00:00 2001 From: Andrew Antenberg Date: Sun, 26 Sep 2021 13:35:37 -0400 Subject: [PATCH 05/14] changed profile --- PennMobile.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index ca2b69672..20c5d3b2c 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -2408,7 +2408,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(CF_BUNDLE_LONG_VERSION_STRING"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = VU59R57FGM; + DEVELOPMENT_TEAM = 8988DRMFXA; EXCLUDED_ARCHS = ""; GCC_PREFIX_HEADER = PennMobile/Supporting_Files/PrefixHeader.pch; INFOPLIST_FILE = PennMobile/Supporting_Files/Info.plist; From 3193f13bbaee2e1459ee136dac853e15936335f5 Mon Sep 17 00:00:00 2001 From: Andrew Antenberg Date: Tue, 28 Sep 2021 20:13:29 -0400 Subject: [PATCH 06/14] my first commit --- PennMobile.xcodeproj/project.pbxproj | 12 +- .../New Group/AccountPageViewController.swift | 136 ++++++++++++++++++ PennMobile/New Group/MoreViewController.swift | 2 +- Podfile.lock | 2 +- 4 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 PennMobile/New Group/AccountPageViewController.swift diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index 20c5d3b2c..b864ac705 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -203,7 +203,6 @@ 97E79E1A2100E51A00D3D606 /* FitnessFacilityName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E79E192100E51A00D3D606 /* FitnessFacilityName.swift */; }; 97E79E1C2100F32E00D3D606 /* FitnessViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E79E1B2100F32E00D3D606 /* FitnessViewModel.swift */; }; B6040A361F8F24D900E4B783 /* AddLaundryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6040A351F8F24D900E4B783 /* AddLaundryCell.swift */; }; - B6111DB22018497400DC7877 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B6111DB12018497400DC7877 /* GoogleService-Info.plist */; }; B6111DB420184C4A00DC7877 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6111DB320184C4A00DC7877 /* AboutViewController.swift */; }; B62875EB2115302200FB2873 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B62875EA2115302200FB2873 /* MapViewController.swift */; }; B62875ED2115433100FB2873 /* PennCoordinate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B62875EC2115433100FB2873 /* PennCoordinate.swift */; }; @@ -240,6 +239,8 @@ CF29A1771FB788820067D946 /* OnboardingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF29A1671FB7887E0067D946 /* OnboardingController.swift */; }; CF29A1781FB788820067D946 /* PageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF29A1681FB7887E0067D946 /* PageCell.swift */; }; CF7FCA761FAFCD9E0052F0A9 /* RoomSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF7FCA751FAFCD9E0052F0A9 /* RoomSelectionViewController.swift */; }; + E594463B2700EAA2002CF1CA /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E594463A2700EAA1002CF1CA /* GoogleService-Info.plist */; }; + E594463D2700EB5D002CF1CA /* AccountPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E594463C2700EB5D002CF1CA /* AccountPageViewController.swift */; }; EF23946423EF4117005BA55F /* GSRGroupInviteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF23946323EF4117005BA55F /* GSRGroupInviteCell.swift */; }; EF30077223EE1380006C9CF0 /* HomeGroupInvitesCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF30077123EE1380006C9CF0 /* HomeGroupInvitesCellItem.swift */; }; EF30077423EE139F006C9CF0 /* HomeGroupInvitesCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF30077323EE139F006C9CF0 /* HomeGroupInvitesCell.swift */; }; @@ -536,7 +537,6 @@ 97E79E192100E51A00D3D606 /* FitnessFacilityName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FitnessFacilityName.swift; sourceTree = ""; }; 97E79E1B2100F32E00D3D606 /* FitnessViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FitnessViewModel.swift; sourceTree = ""; }; B6040A351F8F24D900E4B783 /* AddLaundryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddLaundryCell.swift; sourceTree = ""; }; - B6111DB12018497400DC7877 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; B6111DB320184C4A00DC7877 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = ""; }; B62875EA2115302200FB2873 /* MapViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapViewController.swift; sourceTree = ""; }; B62875EC2115433100FB2873 /* PennCoordinate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PennCoordinate.swift; sourceTree = ""; }; @@ -576,6 +576,8 @@ CF29A1681FB7887E0067D946 /* PageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageCell.swift; sourceTree = ""; }; CF7FCA751FAFCD9E0052F0A9 /* RoomSelectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSelectionViewController.swift; sourceTree = ""; }; CFDEBFEB2794599F175AD811 /* Pods_AutomatedScreenshotUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AutomatedScreenshotUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E594463A2700EAA1002CF1CA /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; + E594463C2700EB5D002CF1CA /* AccountPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountPageViewController.swift; sourceTree = ""; }; EF23946323EF4117005BA55F /* GSRGroupInviteCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GSRGroupInviteCell.swift; sourceTree = ""; }; EF30077123EE1380006C9CF0 /* HomeGroupInvitesCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeGroupInvitesCellItem.swift; sourceTree = ""; }; EF30077323EE139F006C9CF0 /* HomeGroupInvitesCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeGroupInvitesCell.swift; sourceTree = ""; }; @@ -837,7 +839,7 @@ 216640831EBADB7000746B8E /* Supporting_Files */ = { isa = PBXGroup; children = ( - B6111DB12018497400DC7877 /* GoogleService-Info.plist */, + E594463A2700EAA1002CF1CA /* GoogleService-Info.plist */, 2166406F1EBADADA00746B8E /* Info.plist */, 2166406C1EBADADA00746B8E /* LaunchScreen.storyboard */, 216640841EBADB8200746B8E /* PennMobile-Bridging-Header.h */, @@ -1516,6 +1518,7 @@ isa = PBXGroup; children = ( B6111DB320184C4A00DC7877 /* AboutViewController.swift */, + E594463C2700EB5D002CF1CA /* AccountPageViewController.swift */, C8C96F12241407320069D56A /* PAC Code */, CF1CE9B9205D5C3F00C51F46 /* MoreViewController.swift */, CF1CE9BC205D664700C51F46 /* MoreCell.swift */, @@ -1815,8 +1818,8 @@ files = ( 6CAE4392253370E600BD0200 /* sample-dining-venue.json in Resources */, 2166406E1EBADADA00746B8E /* LaunchScreen.storyboard in Resources */, + E594463B2700EAA2002CF1CA /* GoogleService-Info.plist in Resources */, 6C6035F826E722890025FBC7 /* mock_menu.json in Resources */, - B6111DB22018497400DC7877 /* GoogleService-Info.plist in Resources */, 2190FD2F1EBBC8BA00EC683C /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2195,6 +2198,7 @@ 21B556192224FDF700D80F61 /* SplashViewController.swift in Sources */, B650C5641FA43FC600922E98 /* LaundryRoom.swift in Sources */, EF30077423EE139F006C9CF0 /* HomeGroupInvitesCell.swift in Sources */, + E594463D2700EB5D002CF1CA /* AccountPageViewController.swift in Sources */, 217C6DD920139AC500F07C3D /* AsynchronousOperation.swift in Sources */, 21B8BBBD2224F9AA00EBC1D0 /* LoginController.swift in Sources */, 6CAE4381253370E500BD0200 /* RecentTransactionsView.swift in Sources */, diff --git a/PennMobile/New Group/AccountPageViewController.swift b/PennMobile/New Group/AccountPageViewController.swift new file mode 100644 index 000000000..376882e34 --- /dev/null +++ b/PennMobile/New Group/AccountPageViewController.swift @@ -0,0 +1,136 @@ +// +// AccountPageViewController.swift +// PennMobile +// +// Created by Andrew Antenberg on 9/26/21. +// Copyright © 2021 PennLabs. All rights reserved. +// + +import Foundation +import UIKit + +class AccountPageViewController: UIViewController, ShowsAlertForError, UITableViewDelegate, UITableViewDataSource { + var account: Account! + var titleLabel = UILabel() + let tableView = UITableView(frame: .zero, style: .insetGrouped) + var descriptionLabel = UILabel() + let textList = ["Name", "Username", "Email"] + var infoList = ["", "", ""] + let nameView = UIView() + let usernameView = UIView() + let emailView = UIView() + var viewList: [UIView] { + return [nameView, usernameView, emailView] + } + + override func viewDidLoad() { + super.viewDidLoad() + + self.title = "Account" + view.backgroundColor = .uiGroupedBackground + account = Account.getAccount() + + + if !Account.isLoggedIn { + self.showAlert(withMsg: "Please login to use this feature", title: "Login Error", completion: { self.navigationController?.popViewController(animated: true)} ) + return + } + setupTitleLabel() + setupTableView() + setupDescriptionLabel() + setupInfo() + setupCellViews() + } + + func setupTitleLabel() { + titleLabel.text = "PROFILE" + titleLabel.textColor = .labelSecondary + titleLabel.font = UIFont.systemFont(ofSize: 16) + view.addSubview(titleLabel) + titleLabel.translatesAutoresizingMaskIntoConstraints = false + titleLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20).isActive = true + titleLabel.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor, multiplier: 0.80).isActive = true + titleLabel.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true + } + + func setupTableView() { + view.addSubview(tableView) + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") + tableView.translatesAutoresizingMaskIntoConstraints = false + tableView.isScrollEnabled = false + var frame = CGRect.zero + frame.size.height = .leastNormalMagnitude + tableView.tableHeaderView = UIView(frame: frame) + tableView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 20).isActive = true + tableView.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor, constant: 1).isActive = true + tableView.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true + tableView.bottomAnchor.constraint(equalTo: tableView.topAnchor, constant: 140).isActive = true + tableView.delegate = self + tableView.dataSource = self + } + + func setupDescriptionLabel() { + descriptionLabel.text = "If your information is incorrect, please send an email to contact@pennclubs.com detailing your issue." + descriptionLabel.textColor = .labelSecondary + descriptionLabel.font = UIFont.systemFont(ofSize: 16) + + descriptionLabel.numberOfLines = 0 + descriptionLabel.textAlignment = .left + + view.addSubview(descriptionLabel) + descriptionLabel.translatesAutoresizingMaskIntoConstraints = false + descriptionLabel.topAnchor.constraint(equalTo: tableView.bottomAnchor).isActive = true + descriptionLabel.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor, multiplier: 0.80).isActive = true + descriptionLabel.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true + } + + func setupInfo() { + guard let firstName = account.first, let lastName = account.last else { + return + } + infoList[0] = "\(firstName) \(lastName)" + infoList[1] = (account.pennkey) + guard let email = account.email else { + return + } + infoList[2] = email + + } + + func setupCellViews() { + for i in 0.. Int { + return textList.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) + let whichView = viewList[indexPath.row] + cell.addSubview(whichView) + whichView.translatesAutoresizingMaskIntoConstraints = false + whichView.heightAnchor.constraint(equalTo: cell.heightAnchor, multiplier: 0.5).isActive = true + whichView.widthAnchor.constraint(equalTo: cell.widthAnchor).isActive = true + whichView.leadingAnchor.constraint(equalTo: cell.leadingAnchor).isActive = true + whichView.centerYAnchor.constraint(equalTo: cell.centerYAnchor).isActive = true + cell.selectionStyle = .none + cell.backgroundColor = .uiGroupedBackgroundSecondary + return cell + } +} diff --git a/PennMobile/New Group/MoreViewController.swift b/PennMobile/New Group/MoreViewController.swift index 5570aa3b0..e61cee227 100644 --- a/PennMobile/New Group/MoreViewController.swift +++ b/PennMobile/New Group/MoreViewController.swift @@ -168,7 +168,7 @@ extension MoreViewController { tableView.deselectRow(at: indexPath, animated: true) if indexPath.section == 0 { if indexPath.row == 0 { - let targetController = UIViewController() + let targetController = AccountPageViewController() // targetController.shouldShowSuccessMessage = true // targetController.shouldShowCancel = false // targetController.message = "This information is used when booking GSRs and when displaying your name on the homepage." diff --git a/Podfile.lock b/Podfile.lock index 14376c527..93cf4e644 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -37,4 +37,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9e5e28b991a790112963ed77c95535421e3a89ff -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 From 26edb552b7b0cd52e7d208a9efd3e1504e730fc4 Mon Sep 17 00:00:00 2001 From: Andrew Antenberg Date: Sun, 3 Oct 2021 13:31:42 -0400 Subject: [PATCH 07/14] Finished profile page controller --- PennMobile.xcodeproj/project.pbxproj | 4 + .../New Group/AccountPageViewController.swift | 169 +++++++++--------- PennMobile/New Group/MoreViewController.swift | 2 +- .../New Group/ProfilePageTableViewCell.swift | 60 +++++++ 4 files changed, 146 insertions(+), 89 deletions(-) create mode 100644 PennMobile/New Group/ProfilePageTableViewCell.swift diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index b864ac705..07e908ec8 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -241,6 +241,7 @@ CF7FCA761FAFCD9E0052F0A9 /* RoomSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF7FCA751FAFCD9E0052F0A9 /* RoomSelectionViewController.swift */; }; E594463B2700EAA2002CF1CA /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E594463A2700EAA1002CF1CA /* GoogleService-Info.plist */; }; E594463D2700EB5D002CF1CA /* AccountPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E594463C2700EB5D002CF1CA /* AccountPageViewController.swift */; }; + E5BEF7162704C133009FCDD0 /* ProfilePageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5BEF7152704C133009FCDD0 /* ProfilePageTableViewCell.swift */; }; EF23946423EF4117005BA55F /* GSRGroupInviteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF23946323EF4117005BA55F /* GSRGroupInviteCell.swift */; }; EF30077223EE1380006C9CF0 /* HomeGroupInvitesCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF30077123EE1380006C9CF0 /* HomeGroupInvitesCellItem.swift */; }; EF30077423EE139F006C9CF0 /* HomeGroupInvitesCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF30077323EE139F006C9CF0 /* HomeGroupInvitesCell.swift */; }; @@ -578,6 +579,7 @@ CFDEBFEB2794599F175AD811 /* Pods_AutomatedScreenshotUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AutomatedScreenshotUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E594463A2700EAA1002CF1CA /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; E594463C2700EB5D002CF1CA /* AccountPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountPageViewController.swift; sourceTree = ""; }; + E5BEF7152704C133009FCDD0 /* ProfilePageTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfilePageTableViewCell.swift; sourceTree = ""; }; EF23946323EF4117005BA55F /* GSRGroupInviteCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GSRGroupInviteCell.swift; sourceTree = ""; }; EF30077123EE1380006C9CF0 /* HomeGroupInvitesCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeGroupInvitesCellItem.swift; sourceTree = ""; }; EF30077323EE139F006C9CF0 /* HomeGroupInvitesCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeGroupInvitesCell.swift; sourceTree = ""; }; @@ -1519,6 +1521,7 @@ children = ( B6111DB320184C4A00DC7877 /* AboutViewController.swift */, E594463C2700EB5D002CF1CA /* AccountPageViewController.swift */, + E5BEF7152704C133009FCDD0 /* ProfilePageTableViewCell.swift */, C8C96F12241407320069D56A /* PAC Code */, CF1CE9B9205D5C3F00C51F46 /* MoreViewController.swift */, CF1CE9BC205D664700C51F46 /* MoreCell.swift */, @@ -2232,6 +2235,7 @@ 21B653BE2246F338001A97C5 /* CoursesWebviewController.swift in Sources */, CF29A1751FB788820067D946 /* Page.swift in Sources */, 216640CD1EBADCA400746B8E /* FirebaseAnalyticsManager.swift in Sources */, + E5BEF7162704C133009FCDD0 /* ProfilePageTableViewCell.swift in Sources */, C13F9E9921928638000B866A /* HomeCalendarCellItem.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/PennMobile/New Group/AccountPageViewController.swift b/PennMobile/New Group/AccountPageViewController.swift index 376882e34..aa4fd47c6 100644 --- a/PennMobile/New Group/AccountPageViewController.swift +++ b/PennMobile/New Group/AccountPageViewController.swift @@ -11,126 +11,119 @@ import UIKit class AccountPageViewController: UIViewController, ShowsAlertForError, UITableViewDelegate, UITableViewDataSource { var account: Account! - var titleLabel = UILabel() let tableView = UITableView(frame: .zero, style: .insetGrouped) - var descriptionLabel = UILabel() - let textList = ["Name", "Username", "Email"] - var infoList = ["", "", ""] - let nameView = UIView() - let usernameView = UIView() - let emailView = UIView() - var viewList: [UIView] { - return [nameView, usernameView, emailView] - } + var profileInfo = [(text: "Name", info: " "), (text: "Username", info: " "), (text: "Email", info: " ")] + var educationInfo = [(text: "Graduation Term", info: " "), (text: "School", info: " "), (text: "Major", info: " ")] override func viewDidLoad() { super.viewDidLoad() - self.title = "Account" - view.backgroundColor = .uiGroupedBackground - account = Account.getAccount() - - - if !Account.isLoggedIn { + setupView() + setupTableView() + guard Account.isLoggedIn else { self.showAlert(withMsg: "Please login to use this feature", title: "Login Error", completion: { self.navigationController?.popViewController(animated: true)} ) return } - setupTitleLabel() - setupTableView() - setupDescriptionLabel() - setupInfo() - setupCellViews() + setupProfileInfo() + setupEducationInfo() } - func setupTitleLabel() { - titleLabel.text = "PROFILE" - titleLabel.textColor = .labelSecondary - titleLabel.font = UIFont.systemFont(ofSize: 16) - view.addSubview(titleLabel) - titleLabel.translatesAutoresizingMaskIntoConstraints = false - titleLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20).isActive = true - titleLabel.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor, multiplier: 0.80).isActive = true - titleLabel.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true + func setupView() { + self.title = "Account" + view.backgroundColor = .uiGroupedBackground + account = Account.getAccount() } - func setupTableView() { view.addSubview(tableView) - tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") + tableView.register(ProfilePageTableViewCell.self, forCellReuseIdentifier: ProfilePageTableViewCell.identifier) + tableView.translatesAutoresizingMaskIntoConstraints = false - tableView.isScrollEnabled = false - var frame = CGRect.zero - frame.size.height = .leastNormalMagnitude - tableView.tableHeaderView = UIView(frame: frame) - tableView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 20).isActive = true - tableView.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor, constant: 1).isActive = true - tableView.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true - tableView.bottomAnchor.constraint(equalTo: tableView.topAnchor, constant: 140).isActive = true + tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true + tableView.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor).isActive = true + tableView.heightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.heightAnchor).isActive = true tableView.delegate = self tableView.dataSource = self } - func setupDescriptionLabel() { - descriptionLabel.text = "If your information is incorrect, please send an email to contact@pennclubs.com detailing your issue." - descriptionLabel.textColor = .labelSecondary - descriptionLabel.font = UIFont.systemFont(ofSize: 16) - - descriptionLabel.numberOfLines = 0 - descriptionLabel.textAlignment = .left - - view.addSubview(descriptionLabel) - descriptionLabel.translatesAutoresizingMaskIntoConstraints = false - descriptionLabel.topAnchor.constraint(equalTo: tableView.bottomAnchor).isActive = true - descriptionLabel.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor, multiplier: 0.80).isActive = true - descriptionLabel.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true - } - - func setupInfo() { + func setupProfileInfo() { guard let firstName = account.first, let lastName = account.last else { return } - infoList[0] = "\(firstName) \(lastName)" - infoList[1] = (account.pennkey) + profileInfo[0].info = "\(firstName) \(lastName)" + profileInfo[1].info = (account.pennkey) guard let email = account.email else { return } - infoList[2] = email - + profileInfo[2].info = email } - func setupCellViews() { - for i in 0..() + var schoolsSet = Set() + for degree in degrees { + let majors = degree.majors + schoolsSet.insert(degree.schoolName) + for major in majors { + majorsSet.insert(major.name) + } + educationInfo[0].info = degree.expectedGradTerm } + + if schoolsSet.count > 1 { + educationInfo[1].text += "s" + } + + if majorsSet.count > 1 { + educationInfo[2].text += "s" + } + educationInfo[1].info = Array(schoolsSet).joined(separator: ", ") + educationInfo[2].info = Array(majorsSet).joined(separator: ", ") } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return textList.count + if (section == 0) { + return profileInfo.count + } else { + return educationInfo.count + } } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) - let whichView = viewList[indexPath.row] - cell.addSubview(whichView) - whichView.translatesAutoresizingMaskIntoConstraints = false - whichView.heightAnchor.constraint(equalTo: cell.heightAnchor, multiplier: 0.5).isActive = true - whichView.widthAnchor.constraint(equalTo: cell.widthAnchor).isActive = true - whichView.leadingAnchor.constraint(equalTo: cell.leadingAnchor).isActive = true - whichView.centerYAnchor.constraint(equalTo: cell.centerYAnchor).isActive = true - cell.selectionStyle = .none - cell.backgroundColor = .uiGroupedBackgroundSecondary - return cell + if (indexPath.section == 0) { + let cell = tableView.dequeueReusableCell(withIdentifier: ProfilePageTableViewCell.identifier, for: indexPath) as! ProfilePageTableViewCell + cell.key = profileInfo[indexPath.row].text + cell.info = profileInfo[indexPath.row].info + cell.selectionStyle = .none + return cell + } else { + let cell = tableView.dequeueReusableCell(withIdentifier: ProfilePageTableViewCell.identifier, for: indexPath) as! ProfilePageTableViewCell + cell.key = educationInfo[indexPath.row].text + cell.info = educationInfo[indexPath.row].info + cell.selectionStyle = .none + return cell + } + + + } + + func numberOfSections(in tableView: UITableView) -> Int { + Account.isLoggedIn && account.isStudent ? 2 : 1 + } + + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + if section == 0 { + return "PROFILE" + } + return "EDUCATION" + } + + func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { + if section == 0 { + return "If your information is incorrect, please send an email to contact@pennlabs.org detailing your issue." + } + return nil } } diff --git a/PennMobile/New Group/MoreViewController.swift b/PennMobile/New Group/MoreViewController.swift index e61cee227..a85c4e66c 100644 --- a/PennMobile/New Group/MoreViewController.swift +++ b/PennMobile/New Group/MoreViewController.swift @@ -111,7 +111,7 @@ extension MoreViewController { if indexPath.section == 0 { if indexPath.row == 0 { if let cell = tableView.dequeueReusableCell(withIdentifier: "more") as? MoreCell { - cell.setUpView(with: "Edit your profile") + cell.setUpView(with: "View your profile") cell.backgroundColor = .uiGroupedBackgroundSecondary cell.accessoryType = .disclosureIndicator return cell diff --git a/PennMobile/New Group/ProfilePageTableViewCell.swift b/PennMobile/New Group/ProfilePageTableViewCell.swift new file mode 100644 index 000000000..42c7cf09b --- /dev/null +++ b/PennMobile/New Group/ProfilePageTableViewCell.swift @@ -0,0 +1,60 @@ +// +// ProfilePageTableViewCell.swift +// PennMobile +// +// Created by Andrew Antenberg on 9/29/21. +// Copyright © 2021 PennLabs. All rights reserved. +// + +import UIKit + +class ProfilePageTableViewCell: UITableViewCell { + static let identifier = "profileCell" + var key: String! { + didSet { + keyLabel.text = key + } + } + var info: String! { + didSet { + infoLabel.text = info + } + } + fileprivate var keyLabel = UILabel() + fileprivate var infoLabel = UILabel() + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + self.prepareUI() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + fileprivate func prepareUI() { + backgroundColor = .uiGroupedBackgroundSecondary + prepareKeyLabel() + prepareInfoLabel() + self.heightAnchor.constraint(equalTo: infoLabel.heightAnchor, constant: 20).isActive = true + } + + fileprivate func prepareKeyLabel() { + self.contentView.addSubview(keyLabel) + keyLabel.translatesAutoresizingMaskIntoConstraints = false + keyLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true + keyLabel.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: 20).isActive = true + keyLabel.heightAnchor.constraint(equalTo: self.heightAnchor).isActive = true + } + + fileprivate func prepareInfoLabel() { + self.contentView.addSubview(infoLabel) + infoLabel.textAlignment = .right + infoLabel.numberOfLines = 0 + infoLabel.translatesAutoresizingMaskIntoConstraints = false + infoLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true + infoLabel.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor, constant: -20.0).isActive = true + infoLabel.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.65).isActive = true + } + +} From 3be8b6ed27bada3dd628e585c29bea3f9e16ab66 Mon Sep 17 00:00:00 2001 From: Andrew Antenberg Date: Sun, 3 Oct 2021 21:10:59 -0400 Subject: [PATCH 08/14] Profile Page comments resolved --- PennMobile/New Group/AccountPageViewController.swift | 9 ++++++--- PennMobile/New Group/MoreViewController.swift | 3 --- PennMobile/New Group/ProfilePageTableViewCell.swift | 12 +++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/PennMobile/New Group/AccountPageViewController.swift b/PennMobile/New Group/AccountPageViewController.swift index aa4fd47c6..fc59bba0d 100644 --- a/PennMobile/New Group/AccountPageViewController.swift +++ b/PennMobile/New Group/AccountPageViewController.swift @@ -39,8 +39,11 @@ class AccountPageViewController: UIViewController, ShowsAlertForError, UITableVi tableView.translatesAutoresizingMaskIntoConstraints = false tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true - tableView.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor).isActive = true - tableView.heightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.heightAnchor).isActive = true + tableView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor).isActive = true + tableView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true + tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 600 tableView.delegate = self tableView.dataSource = self } @@ -110,7 +113,7 @@ class AccountPageViewController: UIViewController, ShowsAlertForError, UITableVi } func numberOfSections(in tableView: UITableView) -> Int { - Account.isLoggedIn && account.isStudent ? 2 : 1 + 2 } func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { diff --git a/PennMobile/New Group/MoreViewController.swift b/PennMobile/New Group/MoreViewController.swift index a85c4e66c..39afb50f7 100644 --- a/PennMobile/New Group/MoreViewController.swift +++ b/PennMobile/New Group/MoreViewController.swift @@ -169,9 +169,6 @@ extension MoreViewController { if indexPath.section == 0 { if indexPath.row == 0 { let targetController = AccountPageViewController() -// targetController.shouldShowSuccessMessage = true -// targetController.shouldShowCancel = false -// targetController.message = "This information is used when booking GSRs and when displaying your name on the homepage." navigationController?.pushViewController(targetController, animated: true) } else if indexPath.row == 1 { let targetController = ControllerModel.shared.viewController(for: .pacCode) diff --git a/PennMobile/New Group/ProfilePageTableViewCell.swift b/PennMobile/New Group/ProfilePageTableViewCell.swift index 42c7cf09b..e8641b2b7 100644 --- a/PennMobile/New Group/ProfilePageTableViewCell.swift +++ b/PennMobile/New Group/ProfilePageTableViewCell.swift @@ -36,15 +36,16 @@ class ProfilePageTableViewCell: UITableViewCell { backgroundColor = .uiGroupedBackgroundSecondary prepareKeyLabel() prepareInfoLabel() - self.heightAnchor.constraint(equalTo: infoLabel.heightAnchor, constant: 20).isActive = true } fileprivate func prepareKeyLabel() { self.contentView.addSubview(keyLabel) + keyLabel.numberOfLines = 1 keyLabel.translatesAutoresizingMaskIntoConstraints = false - keyLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true + keyLabel.topAnchor.constraint(equalTo: self.contentView.topAnchor, constant: 10.0).isActive = true + keyLabel.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor, constant: -10.0).isActive = true keyLabel.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: 20).isActive = true - keyLabel.heightAnchor.constraint(equalTo: self.heightAnchor).isActive = true + keyLabel.widthAnchor.constraint(equalTo: self.contentView.widthAnchor, multiplier: 0.35).isActive = true } fileprivate func prepareInfoLabel() { @@ -52,9 +53,10 @@ class ProfilePageTableViewCell: UITableViewCell { infoLabel.textAlignment = .right infoLabel.numberOfLines = 0 infoLabel.translatesAutoresizingMaskIntoConstraints = false - infoLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true + infoLabel.topAnchor.constraint(equalTo: self.contentView.topAnchor, constant: 10.0).isActive = true + infoLabel.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor, constant: -10.0).isActive = true infoLabel.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor, constant: -20.0).isActive = true - infoLabel.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.65).isActive = true + infoLabel.widthAnchor.constraint(equalTo: self.contentView.widthAnchor, multiplier: 0.65).isActive = true } } From 4c4a0a52b32fc4c932632f61ae9cc2e1dc151949 Mon Sep 17 00:00:00 2001 From: Andrew Antenberg Date: Sun, 3 Oct 2021 23:07:37 -0400 Subject: [PATCH 09/14] Refactored profileInfo and educationInfo --- .../New Group/AccountPageViewController.swift | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/PennMobile/New Group/AccountPageViewController.swift b/PennMobile/New Group/AccountPageViewController.swift index fc59bba0d..016367e24 100644 --- a/PennMobile/New Group/AccountPageViewController.swift +++ b/PennMobile/New Group/AccountPageViewController.swift @@ -13,17 +13,17 @@ class AccountPageViewController: UIViewController, ShowsAlertForError, UITableVi var account: Account! let tableView = UITableView(frame: .zero, style: .insetGrouped) - var profileInfo = [(text: "Name", info: " "), (text: "Username", info: " "), (text: "Email", info: " ")] - var educationInfo = [(text: "Graduation Term", info: " "), (text: "School", info: " "), (text: "Major", info: " ")] + var profileInfo: [(text: String, info: String)] = [] + var educationInfo: [(text: String, info: String)] = [] override func viewDidLoad() { super.viewDidLoad() setupView() - setupTableView() guard Account.isLoggedIn else { self.showAlert(withMsg: "Please login to use this feature", title: "Login Error", completion: { self.navigationController?.popViewController(animated: true)} ) return } + setupTableView() setupProfileInfo() setupEducationInfo() } @@ -42,6 +42,7 @@ class AccountPageViewController: UIViewController, ShowsAlertForError, UITableVi tableView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor).isActive = true tableView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true + tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 600 tableView.delegate = self @@ -52,12 +53,13 @@ class AccountPageViewController: UIViewController, ShowsAlertForError, UITableVi guard let firstName = account.first, let lastName = account.last else { return } - profileInfo[0].info = "\(firstName) \(lastName)" - profileInfo[1].info = (account.pennkey) + profileInfo.append((text: "Name", info: "\(firstName) \(lastName)")) + profileInfo.append((text: "Username", info: account.pennkey)) + guard let email = account.email else { return } - profileInfo[2].info = email + profileInfo.append((text: "Email", info: email)) } func setupEducationInfo() { @@ -66,15 +68,18 @@ class AccountPageViewController: UIViewController, ShowsAlertForError, UITableVi } var majorsSet = Set() var schoolsSet = Set() + var gradTerm = String() for degree in degrees { let majors = degree.majors schoolsSet.insert(degree.schoolName) for major in majors { majorsSet.insert(major.name) } - educationInfo[0].info = degree.expectedGradTerm + gradTerm = degree.expectedGradTerm } - + educationInfo.append((text: "Graduation Term", info: gradTerm)) + educationInfo.append((text: "School", info: Array(schoolsSet).joined(separator: ", "))) + educationInfo.append((text: "Major", info: Array(majorsSet).joined(separator: ", "))) if schoolsSet.count > 1 { educationInfo[1].text += "s" } @@ -82,8 +87,6 @@ class AccountPageViewController: UIViewController, ShowsAlertForError, UITableVi if majorsSet.count > 1 { educationInfo[2].text += "s" } - educationInfo[1].info = Array(schoolsSet).joined(separator: ", ") - educationInfo[2].info = Array(majorsSet).joined(separator: ", ") } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { From ab6f7e834c70d7ee4fe0f4f74199f58105140975 Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Sun, 17 Oct 2021 23:55:09 -0400 Subject: [PATCH 10/14] Fixed gsr, revert dining redesign release --- PennMobile.xcodeproj/project.pbxproj | 4 +- .../GSR-Booking/Model/GSRLocation.swift | 2 +- .../GSR-Booking/Model/GSRLocationModel.swift | 2 +- .../Networking/GSRNetworkManager.swift | 42 ++++++++----------- .../HomeGSRLocationsCellItem.swift | 4 +- .../HomeViewController + Delegates.swift | 11 ++--- .../Setup + Navigation/ControllerModel.swift | 10 ++--- 7 files changed, 34 insertions(+), 41 deletions(-) diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index 07e908ec8..1b2aeb188 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -2416,7 +2416,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(CF_BUNDLE_LONG_VERSION_STRING"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = 8988DRMFXA; + DEVELOPMENT_TEAM = ""; EXCLUDED_ARCHS = ""; GCC_PREFIX_HEADER = PennMobile/Supporting_Files/PrefixHeader.pch; INFOPLIST_FILE = PennMobile/Supporting_Files/Info.plist; @@ -2449,7 +2449,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(CF_BUNDLE_LONG_VERSION_STRING"; - DEVELOPMENT_TEAM = VU59R57FGM; + DEVELOPMENT_TEAM = ""; EXCLUDED_ARCHS = ""; GCC_PREFIX_HEADER = PennMobile/Supporting_Files/PrefixHeader.pch; INFOPLIST_FILE = PennMobile/Supporting_Files/Info.plist; diff --git a/PennMobile/GSR-Booking/Model/GSRLocation.swift b/PennMobile/GSR-Booking/Model/GSRLocation.swift index 2db048194..30f8878a3 100644 --- a/PennMobile/GSR-Booking/Model/GSRLocation.swift +++ b/PennMobile/GSR-Booking/Model/GSRLocation.swift @@ -9,7 +9,7 @@ import Foundation struct GSRLocation: Codable, Equatable { - let lid: Int + let lid: String let gid: Int let name: String let kind: String diff --git a/PennMobile/GSR-Booking/Model/GSRLocationModel.swift b/PennMobile/GSR-Booking/Model/GSRLocationModel.swift index 1e8b04b8c..da42f7051 100644 --- a/PennMobile/GSR-Booking/Model/GSRLocationModel.swift +++ b/PennMobile/GSR-Booking/Model/GSRLocationModel.swift @@ -18,7 +18,7 @@ class GSRLocationModel { return locations } - func getLocationName(for lid: Int, gid: Int?) -> String { + func getLocationName(for lid: String, gid: Int?) -> String { for location in locations { if location.lid == lid && location.gid == gid { return location.name diff --git a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift index d6beb839a..f315f2297 100644 --- a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift +++ b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift @@ -13,14 +13,12 @@ class GSRNetworkManager: NSObject, Requestable { static let instance = GSRNetworkManager() - let availUrl = "https://studentlife.pennlabs.org/availability/" - let locationsUrl = "https://studentlife.pennlabs.org/locations/" - let bookingUrl = "https://studentlife.pennlabs.org/book/" - let reservationURL = "https://studentlife.pennlabs.org/reservations/" - let cancelURL = "https://studentlife.pennlabs.org/cancel/" + let availUrl = "https://pennmobile.org/api/gsr/availability/" + let locationsUrl = "https://pennmobile.org/api/gsr/locations/" + let bookingUrl = "https://pennmobile.org/api/gsr/book/" + let reservationURL = "https://pennmobile.org/api/gsr/reservations/" + let cancelURL = "https://pennmobile.org/api/gsr/cancel/" - var bookingRequestOutstanding = false - func getLocations (completion: @escaping (Result<[GSRLocation], NetworkingError>) -> Void) { let url = URL(string: self.locationsUrl)! @@ -31,7 +29,10 @@ class GSRNetworkManager: NSObject, Requestable { decoder.keyDecodingStrategy = .convertFromSnakeCase do { - let gsrLocations = try decoder.decode([GSRLocation].self, from: data) + var gsrLocations = try decoder.decode([GSRLocation].self, from: data) + // Manually placing Huntsman as first row. + // TODO: use analytics to decide on orders + gsrLocations.sort(by: {a, b in a.gid < b.gid}) completion(.success(gsrLocations)) } catch { completion(.failure(.parsingError)) @@ -42,15 +43,17 @@ class GSRNetworkManager: NSObject, Requestable { task.resume() } - func getAvailability(lid: Int, gid: Int, startDate: String? = nil, endDate: String? = nil, completion: @escaping (Result<[GSRRoom], NetworkingError>) -> Void) { + func getAvailability(lid: String, gid: Int, startDate: String? = nil, endDate: String? = nil, completion: @escaping (Result<[GSRRoom], NetworkingError>) -> Void) { OAuth2NetworkManager.instance.getAccessToken { token in var url = URL(string: "\(self.availUrl)")! - url.appendPathComponent("\(lid)") + url.appendPathComponent(lid) + url.appendPathComponent("\(gid)") +// print(url) if let startDate = startDate { url.appendQueryItem(name: "start", value: startDate) } - + if let endDate = endDate { url.appendQueryItem(name: "end", value: endDate) } @@ -63,21 +66,9 @@ class GSRNetworkManager: NSObject, Requestable { let decoder = JSONDecoder() decoder.keyDecodingStrategy = .convertFromSnakeCase decoder.dateDecodingStrategy = .iso8601 - let response = try decoder.decode([GSRAvailabilityAPIResponse].self, from: data) + let response = try decoder.decode(GSRAvailabilityAPIResponse.self, from: data) - if lid == 1086 { - if let rooms = response.first(where: {$0.gid == gid})?.rooms { - completion(.success(rooms)) - } else { - completion(.success([])) - } - } else { - if let rooms = response.first?.rooms { - completion(.success(rooms)) - } else { - completion(.failure(.serverError)) - } - } + completion(.success(response.rooms)) } catch { completion(.failure(.parsingError)) } @@ -143,6 +134,7 @@ extension GSRNetworkManager { func getReservations(_ completion: @escaping (_ reservations: Result<[GSRReservation], NetworkingError>) -> Void) { OAuth2NetworkManager.instance.getAccessToken { token in guard let token = token else { + print(token) completion(.failure(.authenticationError)) return } diff --git a/PennMobile/Home/Cells/GSR Locations/HomeGSRLocationsCellItem.swift b/PennMobile/Home/Cells/GSR Locations/HomeGSRLocationsCellItem.swift index 2d9c05e92..3d911b203 100644 --- a/PennMobile/Home/Cells/GSR Locations/HomeGSRLocationsCellItem.swift +++ b/PennMobile/Home/Cells/GSR Locations/HomeGSRLocationsCellItem.swift @@ -30,9 +30,9 @@ final class HomeGSRLocationsCellItem: HomeCellItem { } static func getItem(for json: JSON?) -> HomeCellItem? { - guard let lids = json?.arrayObject as? [Int] else { return nil } + guard let lids = json?.arrayObject as? [String] else { return nil } var locations = GSRLocationModel.shared.getLocations().filter { lids.contains( $0.lid ) } - locations = locations.filter { $0.lid != 1086 || $0.gid == 1889 } + locations = locations.filter { $0.lid != "1086" || $0.gid == 1889 } return HomeGSRLocationsCellItem(locations: locations) } } diff --git a/PennMobile/Home/Controllers/HomeViewController + Delegates.swift b/PennMobile/Home/Controllers/HomeViewController + Delegates.swift index ebb711746..136071200 100644 --- a/PennMobile/Home/Controllers/HomeViewController + Delegates.swift +++ b/PennMobile/Home/Controllers/HomeViewController + Delegates.swift @@ -97,10 +97,11 @@ extension HomeViewController { // MARK: - Dining Delegate extension HomeViewController { func handleVenueSelected(_ venue: DiningVenue) { - if #available(iOS 14, *) { - let hostingView = UIHostingController(rootView: DiningVenueDetailView(for: venue).environmentObject(DiningViewModelSwiftUI.instance)) - self.navigationController?.pushViewController(hostingView, animated: true) - } else { + // TODO: Release Dining Redesign +// if #available(iOS 14, *) { +// let hostingView = UIHostingController(rootView: DiningVenueDetailView(for: venue).environmentObject(DiningViewModelSwiftUI.instance)) +// self.navigationController?.pushViewController(hostingView, animated: true) +// } else { if let url = venue.facilityURL { let vc = UIViewController() let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)) @@ -109,7 +110,7 @@ extension HomeViewController { vc.title = venue.name self.navigationController?.pushViewController(vc, animated: true) } - } +// } } func handleSettingsTapped(venues: [DiningVenue]) { diff --git a/PennMobile/Setup + Navigation/ControllerModel.swift b/PennMobile/Setup + Navigation/ControllerModel.swift index 8928eb3cd..c6af346a8 100644 --- a/PennMobile/Setup + Navigation/ControllerModel.swift +++ b/PennMobile/Setup + Navigation/ControllerModel.swift @@ -41,11 +41,11 @@ class ControllerModel: NSObject { func prepare() { vcDictionary = [Feature: UIViewController]() vcDictionary[.home] = HomeViewController() - if #available(iOS 14, *) { - vcDictionary[.dining] = DiningViewControllerSwiftUI() - } else { +// if #available(iOS 14, *) { +// vcDictionary[.dining] = DiningViewControllerSwiftUI() +// } else { vcDictionary[.dining] = DiningViewController() - } +// } vcDictionary[.studyRoomBooking] = GSRTabController() vcDictionary[.laundry] = LaundryTableViewController() vcDictionary[.more] = MoreViewController() @@ -95,7 +95,7 @@ class ControllerModel: NSObject { #if DEBUG return [#imageLiteral(resourceName: "News"), #imageLiteral(resourceName: "Contacts"), #imageLiteral(resourceName: "Calendar Light"), #imageLiteral(resourceName: "PCA"), #imageLiteral(resourceName: "logo-small")] #else - return [#imageLiteral(resourceName: "News"), #imageLiteral(resourceName: "Contacts"), #imageLiteral(resourceName: "Calendar Light"), #imageLiteral(resourceName: "PCA"), #imageLiteral(resourceName: "logo-small")] + return [#imageLiteral(resourceName: "News"), #imageLiteral(resourceName: "Contacts"), #imageLiteral(resourceName: "Calendar Light"), #imageLiteral(resourceName: "logo-small")] #endif } } From 72c36084d351c032f28956dc0ab45386e9188f18 Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Mon, 18 Oct 2021 00:07:21 -0400 Subject: [PATCH 11/14] removed print statement --- PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift index f315f2297..8248ddd52 100644 --- a/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift +++ b/PennMobile/GSR-Booking/Networking/GSRNetworkManager.swift @@ -134,7 +134,6 @@ extension GSRNetworkManager { func getReservations(_ completion: @escaping (_ reservations: Result<[GSRReservation], NetworkingError>) -> Void) { OAuth2NetworkManager.instance.getAccessToken { token in guard let token = token else { - print(token) completion(.failure(.authenticationError)) return } From e446b78fc8e6a3ea044a3fcfa1df5dbec9bde39d Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Mon, 18 Oct 2021 00:22:26 -0400 Subject: [PATCH 12/14] Fixed Kingfisher + incremented build # --- PennMobile.xcodeproj/project.pbxproj | 34 +++++++------------ .../Detail View/DiningVenueDetailView.swift | 2 +- .../SwiftUI/Views/Venue/DiningVenueRow.swift | 2 +- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index 1b2aeb188..9183d6c42 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -152,6 +152,7 @@ 6C6035FC26E723240025FBC7 /* EmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C6035FB26E723240025FBC7 /* EmptyView.swift */; }; 6C84D9E526293E680039C57F /* UIKit Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C84D9E426293E680039C57F /* UIKit Views.swift */; }; 6C88FE9425337476006F4587 /* DiningViewControllerSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C88FE9325337476006F4587 /* DiningViewControllerSwiftUI.swift */; }; + 6CA1ACDB271D2D5000EDB967 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 6CA1ACDA271D2D5000EDB967 /* Kingfisher */; }; 6CAE4351253370B300BD0200 /* FadingScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAE434E253370B200BD0200 /* FadingScrollView.swift */; }; 6CAE4352253370B300BD0200 /* AlertModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAE434F253370B200BD0200 /* AlertModifier.swift */; }; 6CAE437D253370E500BD0200 /* DiningViewModelSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAE435A253370E500BD0200 /* DiningViewModelSwiftUI.swift */; }; @@ -269,8 +270,6 @@ F212BE8823B71C7100ED46A1 /* NotificationsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F212BE8723B71C7100ED46A1 /* NotificationsTableViewController.swift */; }; F212BE8A23B71C8500ED46A1 /* NotificationsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F212BE8923B71C8500ED46A1 /* NotificationsTableViewCell.swift */; }; F213CCE223C3EE3E000AD90F /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = F213CCE123C3EE3E000AD90F /* SwiftSoup */; }; - F213CCE523C3F240000AD90F /* KingfisherSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = F213CCE423C3F240000AD90F /* KingfisherSwiftUI */; }; - F213CCE723C3F240000AD90F /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = F213CCE623C3F240000AD90F /* Kingfisher */; }; F230FB11225809E900760499 /* AutomatedScreenshotUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F230FB10225809E900760499 /* AutomatedScreenshotUITests.swift */; }; F230FB1A22580ACA00760499 /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = F230FB1922580ACA00760499 /* SnapshotHelper.swift */; }; F23CC0BB235E3EF10007317A /* DiningVenue.swift in Sources */ = {isa = PBXBuildFile; fileRef = F23CC0BA235E3EF10007317A /* DiningVenue.swift */; }; @@ -651,9 +650,8 @@ files = ( 6CE12F9026E82DC600284D9F /* FirebaseAnalytics in Frameworks */, F2568A762413534F00561295 /* SnapKit in Frameworks */, + 6CA1ACDB271D2D5000EDB967 /* Kingfisher in Frameworks */, 6C4CC1FA26E6B1720000B4A8 /* SwiftyJSON in Frameworks */, - F213CCE723C3F240000AD90F /* Kingfisher in Frameworks */, - F213CCE523C3F240000AD90F /* KingfisherSwiftUI in Frameworks */, 6CE12F9226E82DC600284D9F /* FirebaseCrashlytics in Frameworks */, F213CCE223C3EE3E000AD90F /* SwiftSoup in Frameworks */, 56D74230B1B43DAF260BCCBE /* Pods_PennMobile.framework in Frameworks */, @@ -1704,12 +1702,11 @@ name = PennMobile; packageProductDependencies = ( F213CCE123C3EE3E000AD90F /* SwiftSoup */, - F213CCE423C3F240000AD90F /* KingfisherSwiftUI */, - F213CCE623C3F240000AD90F /* Kingfisher */, F2568A752413534F00561295 /* SnapKit */, 6C4CC1F926E6B1720000B4A8 /* SwiftyJSON */, 6CE12F8F26E82DC600284D9F /* FirebaseAnalytics */, 6CE12F9126E82DC600284D9F /* FirebaseCrashlytics */, + 6CA1ACDA271D2D5000EDB967 /* Kingfisher */, ); productName = PennMobile; productReference = 216640601EBADADA00746B8E /* PennMobile.app */; @@ -2290,7 +2287,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6612; + CF_BUNDLE_LONG_VERSION_STRING = 6613; CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; @@ -2352,7 +2349,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6612; + CF_BUNDLE_LONG_VERSION_STRING = 6613; CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; @@ -2416,7 +2413,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(CF_BUNDLE_LONG_VERSION_STRING"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = VU59R57FGM; EXCLUDED_ARCHS = ""; GCC_PREFIX_HEADER = PennMobile/Supporting_Files/PrefixHeader.pch; INFOPLIST_FILE = PennMobile/Supporting_Files/Info.plist; @@ -2449,7 +2446,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(CF_BUNDLE_LONG_VERSION_STRING"; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = VU59R57FGM; EXCLUDED_ARCHS = ""; GCC_PREFIX_HEADER = PennMobile/Supporting_Files/PrefixHeader.pch; INFOPLIST_FILE = PennMobile/Supporting_Files/Info.plist; @@ -2652,7 +2649,7 @@ repositoryURL = "https://github.com/onevcat/Kingfisher"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 5.12.0; + minimumVersion = 7.0.0; }; }; F2568A742413534F00561295 /* XCRemoteSwiftPackageReference "SnapKit" */ = { @@ -2671,6 +2668,11 @@ package = 6C4CC1F826E6B1720000B4A8 /* XCRemoteSwiftPackageReference "SwiftyJSON" */; productName = SwiftyJSON; }; + 6CA1ACDA271D2D5000EDB967 /* Kingfisher */ = { + isa = XCSwiftPackageProductDependency; + package = F213CCE323C3F240000AD90F /* XCRemoteSwiftPackageReference "Kingfisher" */; + productName = Kingfisher; + }; 6CE12F8F26E82DC600284D9F /* FirebaseAnalytics */ = { isa = XCSwiftPackageProductDependency; package = 6CE12F8E26E82DC600284D9F /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; @@ -2686,16 +2688,6 @@ package = F213CCE023C3EE3E000AD90F /* XCRemoteSwiftPackageReference "SwiftSoup" */; productName = SwiftSoup; }; - F213CCE423C3F240000AD90F /* KingfisherSwiftUI */ = { - isa = XCSwiftPackageProductDependency; - package = F213CCE323C3F240000AD90F /* XCRemoteSwiftPackageReference "Kingfisher" */; - productName = KingfisherSwiftUI; - }; - F213CCE623C3F240000AD90F /* Kingfisher */ = { - isa = XCSwiftPackageProductDependency; - package = F213CCE323C3F240000AD90F /* XCRemoteSwiftPackageReference "Kingfisher" */; - productName = Kingfisher; - }; F2568A752413534F00561295 /* SnapKit */ = { isa = XCSwiftPackageProductDependency; package = F2568A742413534F00561295 /* XCRemoteSwiftPackageReference "SnapKit" */; diff --git a/PennMobile/Dining/SwiftUI/Views/Venue/Detail View/DiningVenueDetailView.swift b/PennMobile/Dining/SwiftUI/Views/Venue/Detail View/DiningVenueDetailView.swift index 9ce6f95e2..e08a51230 100644 --- a/PennMobile/Dining/SwiftUI/Views/Venue/Detail View/DiningVenueDetailView.swift +++ b/PennMobile/Dining/SwiftUI/Views/Venue/Detail View/DiningVenueDetailView.swift @@ -7,7 +7,7 @@ // import SwiftUI -import KingfisherSwiftUI +import Kingfisher import FirebaseAnalytics @available(iOS 14, *) diff --git a/PennMobile/Dining/SwiftUI/Views/Venue/DiningVenueRow.swift b/PennMobile/Dining/SwiftUI/Views/Venue/DiningVenueRow.swift index 8a1e9e1ab..82ec57c36 100644 --- a/PennMobile/Dining/SwiftUI/Views/Venue/DiningVenueRow.swift +++ b/PennMobile/Dining/SwiftUI/Views/Venue/DiningVenueRow.swift @@ -7,7 +7,7 @@ // import SwiftUI -import KingfisherSwiftUI +import Kingfisher @available(iOS 14, *) struct DiningVenueRow: View { From 9eaae0c553fa6a7f85b2cd685298b837a8491e23 Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Fri, 22 Oct 2021 17:15:37 -0400 Subject: [PATCH 13/14] Fixed disabled privacy toggle --- PennMobile/About/Privacy/PrivacyTableViewCell.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/PennMobile/About/Privacy/PrivacyTableViewCell.swift b/PennMobile/About/Privacy/PrivacyTableViewCell.swift index 4982a2c7d..e07a075c5 100644 --- a/PennMobile/About/Privacy/PrivacyTableViewCell.swift +++ b/PennMobile/About/Privacy/PrivacyTableViewCell.swift @@ -35,6 +35,7 @@ class PrivacyTableViewCell: UITableViewCell { self.optionSwitch.setOn(isEnabled, animated: false) // Disable option switch if the user is not logged in self.optionSwitch.isEnabled = Account.isLoggedIn + self.contentView.isUserInteractionEnabled = false } } From f6739154e943cda95d415f6a264b6db0b93fbe59 Mon Sep 17 00:00:00 2001 From: Jong Min Choi <01jongminchoi@gmail.com> Date: Fri, 22 Oct 2021 17:34:31 -0400 Subject: [PATCH 14/14] changed build # --- PennMobile.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PennMobile.xcodeproj/project.pbxproj b/PennMobile.xcodeproj/project.pbxproj index 9183d6c42..a96b7aa26 100644 --- a/PennMobile.xcodeproj/project.pbxproj +++ b/PennMobile.xcodeproj/project.pbxproj @@ -2287,8 +2287,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6613; - CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; + CF_BUNDLE_LONG_VERSION_STRING = 6620; + CF_BUNDLE_SHORT_VERSION_STRING = 6.6.2; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -2349,8 +2349,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_LONG_VERSION_STRING = 6613; - CF_BUNDLE_SHORT_VERSION_STRING = 6.6.1; + CF_BUNDLE_LONG_VERSION_STRING = 6620; + CF_BUNDLE_SHORT_VERSION_STRING = 6.6.2; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;