Skip to content

[IDLE-000] 메인화면 위치표시및 공고 카드 변경된 디자인 적용 #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class WorkerRecruitmentBoardCoordinator: WorkerRecruitmentBoardCoordinatable {
let vc = WorkerRecruitmentPostBoardVC()
let vm = WorkerRecruitmentPostBoardVM(
coordinator: self,
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self)
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self),
workerProfileUseCase: injector.resolve(WorkerProfileUseCase.self)
)
vc.bind(viewModel: vm)
viewControllerRef = vc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public class DefaultCenterProfileUseCase: CenterProfileUseCase {
}

public func getProfile(mode: ProfileMode) -> Single<Result<CenterProfileVO, DomainError>> {
convert(task: userProfileRepository.getCenterProfile(mode: mode))

if let cachedProfile = userInfoLocalRepository.getCurrentCenterData() {
// 캐쉬된 데이터 전송
return .just(.success(cachedProfile))
}

return convert(task: userProfileRepository.getCenterProfile(mode: mode))
}

public func updateProfile(phoneNumber: String?, introduction: String?, imageInfo: ImageUploadInfo?) -> Single<Result<Void, DomainError>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public class DefaultWorkerProfileUseCase: WorkerProfileUseCase {
}

public func getProfile(mode: ProfileMode) -> Single<Result<WorkerProfileVO, DomainError>> {
convert(task: userProfileRepository.getWorkerProfile(mode: mode))

if let cachedProfile = userInfoLocalRepository.getCurrentWorkerData() {
// Cache된 정보가 있는 경우 해당 값을 전달
return .just(.success(cachedProfile))
}

return convert(task: userProfileRepository.getWorkerProfile(mode: mode))
}

public func updateProfile(stateObject: WorkerProfileStateObject, imageInfo: ImageUploadInfo?) -> Single<Result<Void, DomainError>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

public enum ProfileMode {
public enum ProfileMode: Equatable {
case myProfile
case otherProfile(id: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import Entity
public class WorkerNativeEmployCardRO {

let showBiginnerTag: Bool
let showDayLeftTag: Bool
let dayLeftTagText: String?
let titleText: String
let distanceFromWorkPlaceText: String
let timeDurationForWalkingText: String
let targetInfoText: String
let workDaysText: String
let workTimeText: String
Expand All @@ -25,21 +23,17 @@ public class WorkerNativeEmployCardRO {

init(
showBiginnerTag: Bool,
showDayLeftTag: Bool,
dayLeftTagText: String?,
titleText: String,
distanceFromWorkPlaceText: String,
timeDurationForWalkingText: String,
targetInfoText: String,
workDaysText: String,
workTimeText: String,
payText: String,
isFavorite: Bool
) {
self.showBiginnerTag = showBiginnerTag
self.showDayLeftTag = showDayLeftTag
self.dayLeftTagText = dayLeftTagText
self.titleText = titleText
self.distanceFromWorkPlaceText = distanceFromWorkPlaceText
self.timeDurationForWalkingText = timeDurationForWalkingText
self.targetInfoText = targetInfoText
self.workDaysText = workDaysText
self.workTimeText = workTimeText
Expand All @@ -49,13 +43,13 @@ public class WorkerNativeEmployCardRO {

public static func create(vo: WorkerNativeEmployCardVO) -> WorkerNativeEmployCardRO {

var dayLeftTagText: String? = nil
var showDayLeftTag: Bool = false

if (0...14).contains(vo.dayLeft) {
showDayLeftTag = true
dayLeftTagText = vo.dayLeft == 0 ? "D-Day" : "D-\(vo.dayLeft)"
}
// var dayLeftTagText: String? = nil
// var showDayLeftTag: Bool = false
//
// if (0...14).contains(vo.dayLeft) {
// showDayLeftTag = true
// dayLeftTagText = vo.dayLeft == 0 ? "D-Day" : "D-\(vo.dayLeft)"
// }

let targetInfoText = "\(vo.careGrade.textForCellBtn)등급 \(vo.targetAge)세 \(vo.targetGender.twoLetterKoreanWord)"

Expand Down Expand Up @@ -83,19 +77,12 @@ public class WorkerNativeEmployCardRO {
let addressTitle = splittedAddress.joined(separator: " ")

// distance는 미터단위입니다.
var distanceText: String = "\(vo.distanceFromWorkPlace)m"

if vo.distanceFromWorkPlace >= 1000 {
let kilometers = Double(vo.distanceFromWorkPlace)/1000.0
distanceText = String(format: "%.1fkm", kilometers)
}
let durationText = Self.timeForDistance(meter: vo.distanceFromWorkPlace)

return .init(
showBiginnerTag: vo.isBeginnerPossible,
showDayLeftTag: showDayLeftTag,
dayLeftTagText: dayLeftTagText,
titleText: addressTitle,
distanceFromWorkPlaceText: distanceText,
timeDurationForWalkingText: durationText,
targetInfoText: targetInfoText,
workDaysText: workDaysText,
workTimeText: workTimeText,
Expand All @@ -106,16 +93,38 @@ public class WorkerNativeEmployCardRO {

public static let `mock`: WorkerNativeEmployCardRO = .init(
showBiginnerTag: true,
showDayLeftTag: true,
dayLeftTagText: "D-14",
titleText: "사울시 강남동",
distanceFromWorkPlaceText: "1.1km",
timeDurationForWalkingText: "도보 15분 ~ 20분",
targetInfoText: "1등급 54세 여성",
workDaysText: "",
workTimeText: "월, 화, 수",
payText: "시급 5000원",
isFavorite: true
)

static func timeForDistance(meter: Int) -> String {
switch meter {
case 0..<200:
return "도보 5분 이내"
case 200..<400:
return "도보 5 ~ 10분"
case 400..<700:
return "도보 10 ~ 15분"
case 700..<1000:
return "도보 15 ~ 20분"
case 1000..<1250:
return "도보 20 ~ 25분"
case 1250..<1500:
return "도보 25 ~ 30분"
case 1500..<1750:
return "도보 30 ~ 35분"
case 1750..<2000:
return "도보 35 ~ 40분"
default:
return "도보 40분 ~"
}
}

}


Expand All @@ -140,12 +149,12 @@ public class WorkerEmployCard: UIView {
)
return tag
}()
let dayLeftTag: TagLabel = {
let timeDurationForWorkingTag: TagLabel = {
let tag = TagLabel(
text: "",
typography: .caption,
textColor: DSKitAsset.Colors.gray300.color,
backgroundColor: DSKitAsset.Colors.gray100.color
backgroundColor: DSKitAsset.Colors.gray050.color
)
return tag
}()
Expand All @@ -155,11 +164,6 @@ public class WorkerEmployCard: UIView {
let label = IdleLabel(typography: .Subtitle2)
return label
}()
let distanceFromWorkPlaceLabel: IdleLabel = {
let label = IdleLabel(typography: .Body3)
label.attrTextColor = DSKitAsset.Colors.gray500.color
return label
}()

let serviceTargetInfoLabel: IdleLabel = {
let label = IdleLabel(typography: .Body2)
Expand Down Expand Up @@ -199,7 +203,7 @@ public class WorkerEmployCard: UIView {
let tagStack = HStack(
[
beginnerTag,
dayLeftTag
timeDurationForWorkingTag
],
spacing: 4
)
Expand All @@ -220,16 +224,6 @@ public class WorkerEmployCard: UIView {
starButton.heightAnchor.constraint(equalTo: starButton.widthAnchor),
])

// MARK: Title & takenTimesForWalk
let titleStack = HStack(
[
titleLabel,
distanceFromWorkPlaceLabel
],
spacing: 8,
alignment: .bottom
)

let divider = UIView()
divider.backgroundColor = DSKitAsset.Colors.gray300.color

Expand Down Expand Up @@ -301,7 +295,9 @@ public class WorkerEmployCard: UIView {
tagStarStack,
Spacer(height: 8),
VStack(
[titleStack,serviceTargetInfoLabel],
[
titleLabel, serviceTargetInfoLabel
],
spacing: 2,
alignment: .leading
),
Expand Down Expand Up @@ -336,7 +332,6 @@ public class WorkerEmployCard: UIView {

public func setToPostAppearance() {
titleLabel.typography = .Subtitle1
distanceFromWorkPlaceLabel.isHidden = true
serviceTargetInfoLabel.typography = .Body3
workDaysLabel.typography = .Body2
workTimeLabel.typography = .Body2
Expand All @@ -345,10 +340,8 @@ public class WorkerEmployCard: UIView {

public func bind(ro: WorkerNativeEmployCardRO) {
beginnerTag.isHidden = !ro.showBiginnerTag
dayLeftTag.isHidden = !ro.showDayLeftTag
dayLeftTag.textString = ro.dayLeftTagText ?? ""
timeDurationForWorkingTag.textString = ro.timeDurationForWalkingText
titleLabel.textString = ro.titleText
distanceFromWorkPlaceLabel.textString = ro.distanceFromWorkPlaceText
serviceTargetInfoLabel.textString = ro.targetInfoText
workDaysLabel.textString = ro.workDaysText
workTimeLabel.textString = ro.workTimeText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ public class NativePostDetailForWorkerVM: BaseViewModel ,NativePostDetailForWork
}
.asObservable()
.subscribe(onNext: { [weak self] alertVO in
self?.alert.onNext(alertVO)
guard let self else { return }
alert.onNext(alertVO)
})


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ open class IdleBottomSheetVC: BaseViewController {
/// 뷰 디스플레이 관련
extension IdleBottomSheetVC {

open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

// 애니메이션 시작전에 해당뷰를 화면 밖으로 이동한다.
sheetView.transform = .init(translationX: 0, y: 1000)
}

/// viewDidAppear서브 뷰들의 레이아웃이 결정된 이후 시점(화면상에 나타난 시점)으로, frame, bounds에 근거있는 값들이 할당된 이후이다.
public override func viewDidAppear(_ animated: Bool) {

Expand Down
Loading
Loading