From e6ca6257d529af50fd476e27418419829b911c16 Mon Sep 17 00:00:00 2001 From: Elvis Marcelo Date: Wed, 18 Oct 2023 18:22:06 -0400 Subject: [PATCH 1/2] final button changes --- .../dropdown.imageset/Contents.json | 21 ++++++++++++++++++ .../dropdown.imageset/dropdown.png | Bin 0 -> 2434 bytes .../Views/Headers/CircularProgressView.swift | 9 ++++++++ 3 files changed, 30 insertions(+) create mode 100644 Uplift/Assets.xcassets/dropdown.imageset/Contents.json create mode 100644 Uplift/Assets.xcassets/dropdown.imageset/dropdown.png create mode 100644 Uplift/Views/Headers/CircularProgressView.swift diff --git a/Uplift/Assets.xcassets/dropdown.imageset/Contents.json b/Uplift/Assets.xcassets/dropdown.imageset/Contents.json new file mode 100644 index 00000000..16b63a0d --- /dev/null +++ b/Uplift/Assets.xcassets/dropdown.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "dropdown.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Uplift/Assets.xcassets/dropdown.imageset/dropdown.png b/Uplift/Assets.xcassets/dropdown.imageset/dropdown.png new file mode 100644 index 0000000000000000000000000000000000000000..00956348d19d8e65f9d3401b5b8e1e1a9bdc1637 GIT binary patch literal 2434 zcmY*b3pkVQ8-M3eET=R=<**J$F=M3`V>2>r%pvDR!z^c}QHUs6*A$BKsb(c?UqnTG z4y6)*AFYF^PkgH!+BJuYNs<4%>ht~o&wD-Z{k!kyzJK?9KiBT0Jm&8gIlKml=582zl>bD6>lb2eg)HHVW~4xBq)^Qo&A#lV9h$& zh5)5yIv|@r!`qMPM{>i^;$qB0!{QExo2SIY%c20A6buMs!kM9lDKXKpNthH{_zw>Z zh-GFZ-0+7BGs+h3NAfUqh)WDN++}WIZUM(a4Gj%#62l@eo&={~;h<&AsS52`wXP=ZxFLmNevt%Tphbw&kW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>dvrm)}ep^mLAx+Jc;N3%#)ndAwdte_3 Date: Wed, 18 Oct 2023 18:22:12 -0400 Subject: [PATCH 2/2] final button changes --- Podfile | 1 + Podfile.lock | 4 +- Uplift.xcodeproj/project.pbxproj | 4 + Uplift/Controllers/HomeViewController.swift | 3 +- Uplift/Extensions/UIColor+Shared.swift | 1 + .../Views/Headers/CircularProgressView.swift | 44 +++++++++ .../Views/Headers/HomeScreenHeaderView.swift | 97 +++++++++++++++++-- 7 files changed, 141 insertions(+), 13 deletions(-) diff --git a/Podfile b/Podfile index 24283ce5..5906e621 100644 --- a/Podfile +++ b/Podfile @@ -30,6 +30,7 @@ post_install do |installer| xcconfig_path = config.base_configuration_reference.real_path xcconfig = File.read(xcconfig_path) xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR") + config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'x86_64' File.open(xcconfig_path, "w") { |file| file << xcconfig_mod } end end diff --git a/Podfile.lock b/Podfile.lock index baf7cb4d..16386bde 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -207,6 +207,6 @@ SPEC CHECKSUMS: SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25 SwiftLint: 1cc5cd61ba9bacb2194e340aeb47a2a37fda00b3 -PODFILE CHECKSUM: a48882babe3b6cede705469b8a2425e262eb6479 +PODFILE CHECKSUM: f04af501813f468ddb4af0bce4697167baf33621 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/Uplift.xcodeproj/project.pbxproj b/Uplift.xcodeproj/project.pbxproj index 048f31ad..da69855a 100644 --- a/Uplift.xcodeproj/project.pbxproj +++ b/Uplift.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 03C8013824106893009845E7 /* CalendarGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C8013724106893009845E7 /* CalendarGenerator.swift */; }; 0C97AC292276840F0086D699 /* FacilityHoursCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C97AC282276840F0086D699 /* FacilityHoursCell.swift */; }; 0C97AC2B2276841B0086D699 /* FacilityHoursHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C97AC2A2276841B0086D699 /* FacilityHoursHeaderView.swift */; }; + 14660D8B2AE08CE300ACBA7D /* CircularProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14660D8A2AE08CE300ACBA7D /* CircularProgressView.swift */; }; 1C1D283B2166E215003FE839 /* Keys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C1D283A2166E215003FE839 /* Keys.swift */; }; 1C7847C4216E77E30066E0DA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1C7847C3216E77E30066E0DA /* Assets.xcassets */; }; 1CCCEB97215058C5001B3551 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 1CCCEB96215058C5001B3551 /* .swiftlint.yml */; }; @@ -228,6 +229,7 @@ 047ECBBE65B2C216C70CB963 /* Pods-Uplift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Uplift.release.xcconfig"; path = "Target Support Files/Pods-Uplift/Pods-Uplift.release.xcconfig"; sourceTree = ""; }; 0C97AC282276840F0086D699 /* FacilityHoursCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityHoursCell.swift; sourceTree = ""; }; 0C97AC2A2276841B0086D699 /* FacilityHoursHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityHoursHeaderView.swift; sourceTree = ""; }; + 14660D8A2AE08CE300ACBA7D /* CircularProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularProgressView.swift; sourceTree = ""; }; 1C1D283A2166E215003FE839 /* Keys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Keys.swift; sourceTree = ""; }; 1C7847C3216E77E30066E0DA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 1CCCEB96215058C5001B3551 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = ""; }; @@ -785,6 +787,7 @@ E62565BC24078CAE00EF2D0D /* LoadingCollectionHeaderView.swift */, 8DD7C7722083E09A004EB196 /* OldDropdownHeaderView.swift */, E689381E240F69D00022B524 /* SportsFeedHeaderView.swift */, + 14660D8A2AE08CE300ACBA7D /* CircularProgressView.swift */, ); path = Headers; sourceTree = ""; @@ -1246,6 +1249,7 @@ 7E9D6DEF22961B860054F710 /* GymDetailViewController.swift in Sources */, 7E80876F229B70CA007D9EDD /* GymDetailViewController+Extensions.swift in Sources */, C7EBD5B32062FDEB00D76A8B /* SearchBar.swift in Sources */, + 14660D8B2AE08CE300ACBA7D /* CircularProgressView.swift in Sources */, 8D24AF962140B23F002D850C /* String+Shared.swift in Sources */, 8DB8D7692236BD7000809D4B /* HabitTrackingController.swift in Sources */, E69CE6BB23F4B41000CA83BF /* Comment.swift in Sources */, diff --git a/Uplift/Controllers/HomeViewController.swift b/Uplift/Controllers/HomeViewController.swift index 6ff597dd..922284ba 100644 --- a/Uplift/Controllers/HomeViewController.swift +++ b/Uplift/Controllers/HomeViewController.swift @@ -62,7 +62,8 @@ class HomeViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - navigationController?.tabBarController?.tabBar.isHidden = false +// navigationController?.tabBarController?.tabBar.isHidden = true + navigationController?.isNavigationBarHidden = true } @objc func reloadUpliftData() { diff --git a/Uplift/Extensions/UIColor+Shared.swift b/Uplift/Extensions/UIColor+Shared.swift index 4df0e715..7e29c8be 100644 --- a/Uplift/Extensions/UIColor+Shared.swift +++ b/Uplift/Extensions/UIColor+Shared.swift @@ -26,6 +26,7 @@ extension UIColor { // MARK: - Grays // Used for old designs, to be replaced when views are re-implemented @nonobjc static let upliftMediumGrey = UIColor(red: 206/255, green: 206/255, blue: 206/255, alpha: 1.0) + @nonobjc static let gray00 = colorFromCode(0xEFF1F4) @nonobjc static let gray01 = colorFromCode(0xE5ECED) @nonobjc static let gray02 = colorFromCode(0xA1A5A6) @nonobjc static let gray03 = colorFromCode(0xA5A5A5) diff --git a/Uplift/Views/Headers/CircularProgressView.swift b/Uplift/Views/Headers/CircularProgressView.swift index a091713a..eb4281cd 100644 --- a/Uplift/Views/Headers/CircularProgressView.swift +++ b/Uplift/Views/Headers/CircularProgressView.swift @@ -7,3 +7,47 @@ // import Foundation +import UIKit +import SnapKit + +class CircularProgressView: UIView { + + private var progressLayer = CAShapeLayer() + private var trackLayer = CAShapeLayer() + + private var progressColor: UIColor! + private var width: CGFloat! + + init(progressColor: UIColor, width: CGFloat) { + super.init(frame: .zero) + + self.progressColor = progressColor + self.width = width + + createCircularPath() + } + + private func createCircularPath() { + self.layer.cornerRadius = width!/2 + let circularPath = UIBezierPath(arcCenter: CGPoint(x: width/2, y: width/2) , radius: (width - 1.5)/2, startAngle: CGFloat(-0.5 * .pi), endAngle: CGFloat(2.0 * .pi), clockwise: true) + + trackLayer.path = circularPath.cgPath + trackLayer.fillColor = UIColor.clear.cgColor + trackLayer.strokeColor = UIColor.gray.cgColor + trackLayer.lineWidth = 5 + trackLayer.strokeEnd = 1.0 + layer.addSublayer(trackLayer) + + progressLayer.path = circularPath.cgPath + progressLayer.fillColor = UIColor.clear.cgColor + progressLayer.strokeColor = progressColor?.cgColor + progressLayer.lineWidth = 5 + progressLayer.strokeEnd = 0.5 + layer.addSublayer(progressLayer) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} diff --git a/Uplift/Views/Headers/HomeScreenHeaderView.swift b/Uplift/Views/Headers/HomeScreenHeaderView.swift index db5bc883..0a80d57a 100644 --- a/Uplift/Views/Headers/HomeScreenHeaderView.swift +++ b/Uplift/Views/Headers/HomeScreenHeaderView.swift @@ -9,17 +9,18 @@ import SnapKit import UIKit class HomeScreenHeaderView: UIView { - + var welcomeMessage: UILabel! - + var statusButton: StatusButton! + var didSetupShadow = false - + override init(frame: CGRect) { super.init(frame: frame) - + // BACKGROUND COLOR backgroundColor = .white - + // WELCOME MESSAGE welcomeMessage = UILabel() welcomeMessage.font = ._24MontserratBold @@ -28,29 +29,105 @@ class HomeScreenHeaderView: UIView { welcomeMessage.numberOfLines = 0 welcomeMessage.text = getGreeting() addSubview(welcomeMessage) - + + statusButton = StatusButton() + statusButton.layer.borderColor = UIColor.gray01.cgColor + statusButton.layer.borderWidth = 1 + statusButton.layer.cornerRadius = 12 + statusButton.addTarget(self, action: #selector(showCapacityView), for: .touchUpInside) + addSubview(statusButton) + setupLayout() } - + required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } - + + @objc func showCapacityView() { + if (statusButton.tag == 0) { + statusButton.backgroundColor = .gray00 + statusButton.tag = 1 + } else { + statusButton.backgroundColor = .gray01 + statusButton.tag = 0 + } + + statusButton.flipDropDown() + } + private func getGreeting() -> String { let currDate = Date() let hour = Calendar.current.component(.hour, from: currDate) - + if hour < 12 { return ClientStrings.Home.greetingMorning } if hour < 17 { return ClientStrings.Home.greetingAfternoon} return ClientStrings.Home.greetingEvening } - + // MARK: - LAYOUT func setupLayout() { welcomeMessage.snp.makeConstraints { make in make.bottom.equalToSuperview().inset(20) make.leading.equalTo(24) make.trailing.lessThanOrEqualToSuperview().inset(24) + + } + + statusButton.snp.makeConstraints { make in + make.trailing.equalToSuperview().inset(24) + make.centerY.equalTo(welcomeMessage.snp.centerY) + make.width.equalTo(60) + make.height.equalTo(40) + } + } +} + + +class StatusButton: UIButton { + + var circularView: UIView! + + var dropDownImageView = UIImageView() + + override init(frame: CGRect) { + super.init(frame: .zero) + + circularView = CircularProgressView(progressColor: UIColor.accentOrange, width: 24) + circularView.isUserInteractionEnabled = false + addSubview(circularView) + + dropDownImageView.image = UIImage(named: "dropdown") + addSubview(dropDownImageView) + + setupConstraints() + } + + func flipDropDown() { + UIView.animate(withDuration: 0.3) { + self.circularView.transform = self.circularView.transform.rotated(by: .pi) + self.dropDownImageView.transform = self.dropDownImageView.transform.rotated(by: .pi) } } + + func setupConstraints() { + circularView.snp.makeConstraints { make in + make.width.equalTo(24) + make.height.equalTo(24) + make.centerY.equalToSuperview() + make.leading.equalToSuperview().offset(10) + } + + dropDownImageView.snp.makeConstraints { make in + make.width.equalTo(8) + make.height.equalTo(8) + make.centerY.equalTo(circularView) + make.trailing.equalToSuperview().inset(10) + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + }