Skip to content
Merged
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: 0 additions & 1 deletion Koin/Core/Logger/EventParameter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ enum EventParameter {
case swapDestination = "swap_destination"
case searchBus = "search_bus"
case searchResultBack = "search_result_back"
case searchResultClose = "search_result_close"
case searchResultDepartureTime = "search_result_departure_time"
case departureNow = "departure_now"
case departureTimeSettingDone = "departure_time_setting_done"
Expand Down
11 changes: 0 additions & 11 deletions Koin/Domain/Model/Bus/BusType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,4 @@ enum BusType: String, Decodable, CaseIterable {
return "전체 차종"
}
}

func returnBusTypeColor() -> String {
switch self {
case .shuttleBus:
return "D7FBEB"
case .expressBus:
return "D7E6FB"
default:
return "FBEBD7"
}
}
}
15 changes: 2 additions & 13 deletions Koin/Domain/Model/Bus/ShuttleRouteType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,13 @@ import Foundation

enum ShuttleRouteType: String, Decodable, CaseIterable {
case overall = "전체"
case circular = "순환"
case weekend = "주말"
case weekday = "주중"
case weekend = "주말"
case circular = "순환"

init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let rawValue = try? container.decode(String.self)
self = ShuttleRouteType(rawValue: rawValue ?? "") ?? .circular
}

func returnRouteColor() -> String {
switch self {
case .circular:
return "4ED927"
case .weekday:
return "FFB443"
default:
return "34ADFF"
}
}
}
2 changes: 1 addition & 1 deletion Koin/Domain/UseCase/Bus/GetBusFiltersUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protocol GetCityFiltersUseCase {

final class DefaultGetShuttleBusFilterUseCase: GetShuttleBusFilterUseCase {
func execute() -> [String] {
return ["전체", "순환노선", "주말노선", "주중노선"]
return ["전체", "주중노선", "주말노선", "순환노선"]
}
}

Expand Down
75 changes: 36 additions & 39 deletions Koin/Presentation/Bus/BusSearch/BusSearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ final class BusSearchViewController: UIViewController {
}

private let busNoticeWrappedView = UIView().then {
$0.backgroundColor = UIColor.appColor(.info100)
$0.backgroundColor = UIColor.appColor(.neutral0)
$0.layer.cornerRadius = 8
$0.layer.shadowColor = UIColor.black.cgColor
$0.layer.shadowOpacity = 0.08
$0.layer.shadowOffset = CGSize(width: 0, height: 4)
$0.layer.shadowRadius = 2.5
$0.isUserInteractionEnabled = true
$0.isHidden = true
}

private let busNoticeLabel = UILabel().then {
$0.textColor = UIColor.appColor(.primary500)
$0.textColor = UIColor.appColor(.new500)
$0.font = .appFont(.pretendardMedium, size: 14)
$0.textAlignment = .left
$0.numberOfLines = 0
$0.numberOfLines = 2
$0.lineBreakMode = .byTruncatingTail
}

private let deleteNoticeButton = UIButton().then {
Expand All @@ -53,6 +59,7 @@ final class BusSearchViewController: UIViewController {

private let swapAreaButton = UIButton().then {
$0.setImage(.appImage(asset: .swap), for: .normal)
$0.backgroundColor = .appColor(.neutral50)
$0.layer.cornerRadius = 16
$0.layer.borderWidth = 1
$0.layer.borderColor = UIColor.appColor(.neutral300).cgColor
Expand Down Expand Up @@ -186,7 +193,7 @@ extension BusSearchViewController {
departure: departure,
arrival: arrival
)
presentBottomSheet(contentView, configuration: .init(style: .modal(dimAlpha: 0.49), cornerRadius: 32))
presentBottomSheet(contentView)
}

private func selectedBusPlace(from button: UIButton) -> BusPlace? {
Expand Down Expand Up @@ -214,10 +221,9 @@ extension BusSearchViewController {

private func changeBusAreaButton(sender: UIButton, title: BusPlace) {
var configuration = UIButton.Configuration.plain()
configuration.attributedTitle = AttributedString(title.koreanDescription, attributes: AttributeContainer([.font: UIFont.appFont(.pretendardBold, size: 18), .foregroundColor: UIColor.appColor(.neutral800)]))
configuration.contentInsets = .init(top: 12, leading: 30, bottom: 12, trailing: 30)
configuration.attributedTitle = AttributedString(title.koreanDescription, attributes: AttributeContainer([.font: UIFont.appFont(.pretendardSemiBold, size: 14), .foregroundColor: UIColor.appColor(.neutral800)]))
configuration.contentInsets = .init(top: 12, leading: 16, bottom: 12, trailing: 16)
sender.configuration = configuration
sender.backgroundColor = .clear
sender.tag = (BusPlace.allCases.firstIndex(of: title) ?? 0) + 1
}

Expand All @@ -229,17 +235,18 @@ extension BusSearchViewController {
}
else {
busInfoSearchButton.isEnabled = true
busInfoSearchButton.backgroundColor = .appColor(.primary500)
busInfoSearchButton.backgroundColor = .appColor(.new500)
busInfoSearchButton.setTitleColor(.appColor(.neutral0), for: .normal)
}
}

private func updateEmergencyNotice(notice: BusNoticeDto) {
updateLayoutsByNotice(isDeleted: false)
busNoticeLabel.text = notice.title
busNoticeLabel.setLineHeight(lineHeight: 1.6, text: notice.title)
busNoticeLabel.lineBreakMode = .byTruncatingTail
busNoticeWrappedView.tag = notice.id
let noticeId = UserDefaults.standard.object(forKey: "busNoticeId") as? Int
if noticeId == notice.id || noticeId != nil {
if noticeId == notice.id {
updateLayoutsByNotice(isDeleted: true)
}
}
Expand All @@ -251,7 +258,7 @@ extension BusSearchViewController {
private func setUpLabels() {
[departGuideLabel, arriveGuideLabel].forEach {
$0.font = .appFont(.pretendardMedium, size: 16)
$0.textColor = .appColor(.primary500)
$0.textColor = .appColor(.new500)
$0.textAlignment = .center
}
}
Expand All @@ -261,12 +268,14 @@ extension BusSearchViewController {
let buttons = [departAreaSelectedButton, arrivedAreaSelectedButton]
for (index, value) in buttons.enumerated() {
var configuration = UIButton.Configuration.plain()
configuration.attributedTitle = AttributedString(buttonNames[index], attributes: AttributeContainer([.font: UIFont.appFont(.pretendardRegular, size: 14), .foregroundColor: UIColor.appColor(.gray)]))
configuration.contentInsets = .init(top: 12, leading: 30, bottom: 12, trailing: 30)
configuration.attributedTitle = AttributedString(buttonNames[index], attributes: AttributeContainer([.font: UIFont.appFont(.pretendardRegular, size: 14), .foregroundColor: UIColor.appColor(.neutral500)]))
configuration.contentInsets = .init(top: 12, leading: 16, bottom: 12, trailing: 16)
value.configuration = configuration
value.backgroundColor = .appColor(.neutral100)
value.backgroundColor = .appColor(.neutral0)
value.addTarget(self, action: #selector(tapBusAreaSelectedButtons), for: .touchUpInside)
value.layer.cornerRadius = 4
value.layer.cornerRadius = 16
value.layer.borderWidth = 1
value.layer.borderColor = UIColor.appColor(.neutral300).cgColor
}
}

Expand All @@ -283,47 +292,35 @@ extension BusSearchViewController {
private func updateLayoutsByNotice(isDeleted: Bool) {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
if isDeleted {
self.busNoticeWrappedView.isHidden = true
self.searchMainDescriptionLabel.snp.remakeConstraints {
$0.leading.equalToSuperview().offset(24)
$0.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(24)
}
}
else {
self.busNoticeWrappedView.isHidden = false
self.searchMainDescriptionLabel.snp.updateConstraints {
$0.top.equalTo(self.busNoticeWrappedView.snp.bottom).offset(18)
}
}
// 공지 카드는 출발/도착 행 아래에 있어 다른 요소 위치에 영향이 없다.
self.busNoticeWrappedView.isHidden = isDeleted
}
}

private func setUpConstraints() {
searchMainDescriptionLabel.snp.makeConstraints {
$0.leading.equalToSuperview().offset(24)
$0.top.equalTo(busNoticeWrappedView.snp.bottom).offset(18)
$0.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(16)
}
departGuideLabel.snp.makeConstraints {
$0.leading.equalToSuperview().offset(24)
$0.width.equalTo(127)
$0.top.equalTo(searchMainDescriptionLabel.snp.bottom).offset(65)
$0.centerX.equalTo(departAreaSelectedButton)
$0.top.equalTo(searchMainDescriptionLabel.snp.bottom).offset(49)
}
arriveGuideLabel.snp.makeConstraints {
$0.trailing.equalToSuperview().inset(24)
$0.width.equalTo(127)
$0.centerX.equalTo(arrivedAreaSelectedButton)
$0.top.equalTo(departGuideLabel)
}
// 출발 박스 | 스왑 영역 58 | 도착 박스, 좌우 24
departAreaSelectedButton.snp.makeConstraints {
$0.centerX.equalTo(departGuideLabel)
$0.leading.equalToSuperview().offset(24)
$0.trailing.equalTo(swapAreaButton.snp.leading).offset(-13)
$0.top.equalTo(departGuideLabel.snp.bottom).offset(8)
$0.width.equalTo(143)
$0.height.equalTo(46)
}
arrivedAreaSelectedButton.snp.makeConstraints {
$0.centerX.equalTo(arriveGuideLabel)
$0.leading.equalTo(swapAreaButton.snp.trailing).offset(13)
$0.trailing.equalToSuperview().inset(24)
$0.top.equalTo(departAreaSelectedButton)
$0.width.equalTo(143)
$0.height.equalTo(46)
}
swapAreaButton.snp.makeConstraints {
Expand All @@ -339,7 +336,7 @@ extension BusSearchViewController {
busNoticeWrappedView.snp.makeConstraints {
$0.leading.equalToSuperview().offset(24)
$0.trailing.equalToSuperview().inset(24)
$0.top.equalTo(view.safeAreaLayoutGuide.snp.top)
$0.top.equalTo(departAreaSelectedButton.snp.bottom).offset(38)
}
busNoticeLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ extension BusAreaSelectedCollectionView: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let label = UILabel()
label.text = busAreaLists[indexPath.row].0.koreanDescription
label.font = .appFont(.pretendardMedium, size: 15)
let size = label.sizeThatFits(CGSize(width: CGFloat.greatestFiniteMagnitude, height: 48))
return CGSize(width: size.width + 32, height: 48)
label.font = .appFont(.pretendardSemiBold, size: 14)
let size = label.sizeThatFits(CGSize(width: CGFloat.greatestFiniteMagnitude, height: 34))
return CGSize(width: size.width + 24, height: 34)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class BusAreaSelectedCollectionViewCell: UICollectionViewCell {
// MARK: - UI Components
private let busPlaceLabel = UILabel().then {
$0.textAlignment = .center
$0.font = .appFont(.pretendardMedium, size: 15)
$0.font = .appFont(.pretendardSemiBold, size: 14)
}

// MARK: - Initialization
Expand All @@ -26,19 +26,13 @@ final class BusAreaSelectedCollectionViewCell: UICollectionViewCell {

func configure(busPlace: String, isSelected: Bool) {
busPlaceLabel.text = busPlace
if isSelected {
busPlaceLabel.textColor = .appColor(.neutral0)
contentView.backgroundColor = .appColor(.primary500)
}
else {
busPlaceLabel.textColor = .appColor(.neutral600)
contentView.backgroundColor = .appColor(.neutral200)
}
busPlaceLabel.textColor = isSelected ? .appColor(.new500) : .appColor(.neutral500)
contentView.layer.borderColor = isSelected ? UIColor.appColor(.new500).cgColor : UIColor.appColor(.neutral300).cgColor
}

func disableCell() {
contentView.backgroundColor = .appColor(.neutral50)
busPlaceLabel.textColor = .appColor(.neutral300)
contentView.layer.borderColor = UIColor.appColor(.neutral300).cgColor
}
}

Expand All @@ -58,6 +52,7 @@ extension BusAreaSelectedCollectionViewCell {
private func configureView() {
setUpLayouts()
setUpConstraints()
contentView.layer.cornerRadius = 4
contentView.layer.cornerRadius = 17
contentView.layer.borderWidth = 1
}
}
Loading
Loading