Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,6 @@ SPEC CHECKSUMS:
SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25
SwiftLint: 1cc5cd61ba9bacb2194e340aeb47a2a37fda00b3

PODFILE CHECKSUM: a48882babe3b6cede705469b8a2425e262eb6479
PODFILE CHECKSUM: f04af501813f468ddb4af0bce4697167baf33621

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
4 changes: 4 additions & 0 deletions Uplift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 = "<group>"; };
0C97AC282276840F0086D699 /* FacilityHoursCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityHoursCell.swift; sourceTree = "<group>"; };
0C97AC2A2276841B0086D699 /* FacilityHoursHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityHoursHeaderView.swift; sourceTree = "<group>"; };
14660D8A2AE08CE300ACBA7D /* CircularProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularProgressView.swift; sourceTree = "<group>"; };
1C1D283A2166E215003FE839 /* Keys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Keys.swift; sourceTree = "<group>"; };
1C7847C3216E77E30066E0DA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
1CCCEB96215058C5001B3551 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = "<group>"; };
Expand Down Expand Up @@ -785,6 +787,7 @@
E62565BC24078CAE00EF2D0D /* LoadingCollectionHeaderView.swift */,
8DD7C7722083E09A004EB196 /* OldDropdownHeaderView.swift */,
E689381E240F69D00022B524 /* SportsFeedHeaderView.swift */,
14660D8A2AE08CE300ACBA7D /* CircularProgressView.swift */,
);
path = Headers;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down
21 changes: 21 additions & 0 deletions Uplift/Assets.xcassets/dropdown.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -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
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-check to see if this is not already in the assets folder. There is an asset titled "down-arrow-solid." Is this different than that?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Uplift/Controllers/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking, this is a temporary change right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup!

navigationController?.isNavigationBarHidden = true
}

@objc func reloadUpliftData() {
Expand Down
1 change: 1 addition & 0 deletions Uplift/Extensions/UIColor+Shared.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
53 changes: 53 additions & 0 deletions Uplift/Views/Headers/CircularProgressView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// CircularProgressView.swift
// Uplift
//
// Created by elvis on 10/18/23.
// Copyright © 2023 Cornell AppDev. All rights reserved.
//

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)

Comment on lines +30 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be used for the capacities? If so, I think it would be cool to make this more generic maybe with a percent, start angle, andlinewidth (and maybe animated??). Ofc that's something that could be done later as well.

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")
}

}
97 changes: 87 additions & 10 deletions Uplift/Views/Headers/HomeScreenHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ import SnapKit
import UIKit

class HomeScreenHeaderView: UIView {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace; you should turn on the swiftlint and make sure there's no styling related warnings before PR.

var welcomeMessage: UILabel!

var statusButton: StatusButton!

var didSetupShadow = false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

override init(frame: CGRect) {
super.init(frame: frame)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

// BACKGROUND COLOR
backgroundColor = .white

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

// WELCOME MESSAGE
welcomeMessage = UILabel()
welcomeMessage.font = ._24MontserratBold
Expand All @@ -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()
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}


@objc func showCapacityView() {
if (statusButton.tag == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it would enhance readability to use a boolean variable instead of the tag property. Maybe as a property of statusButton like statusButton.isDisclosed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add on, you could also do this in a way which moves a lot of functionality into the status button. This function could literally have two lines:
statusButton.toggleDisclosure()
delegate.didToggleDisclosure() // For communicating with the homeviewcontroller
and then everything else such as background color could stay in the status button

statusButton.backgroundColor = .gray00
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the design has it as white? imo based on the video having that extra contrast of white feels like it would make it more noticeable.

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

if hour < 12 { return ClientStrings.Home.greetingMorning }
if hour < 17 { return ClientStrings.Home.greetingAfternoon}
return ClientStrings.Home.greetingEvening
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

// 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)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert line after this }

}


class StatusButton: UIButton {

var circularView: UIView!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of type CircleProgressView instead of 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)
Comment on lines +115 to +125
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it could be good to separate out all the constants in an enum LayoutConstants at the top of the class.

}
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

}