Skip to content

Commit

Permalink
Merge branch 'develop' into Application/486_outing-pass-refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
juyeong525 authored May 13, 2023
2 parents adb577c + 2c1932f commit 9afc974
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 17 deletions.
12 changes: 9 additions & 3 deletions Application/Sources/Scene/Home/Meal/MealListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ struct MealListCell: View {
HStack(spacing: 0) {
Text(entity.mealTime.toString())
.sdText(
type: .body2,
textColor: .GrayScale.gray800
type: .body1,
textColor: entity.mealTime.checkIsNow() ? .Primary.purple300 : .GrayScale.gray800
)
.padding(.trailing, 10)
Spacer()
Text(entity.kcal ?? "")
.sdText(type: .body4)
.sdText(type: .caption)
}
Spacer().frame(height: 8)
ForEach(
Expand All @@ -31,6 +32,11 @@ struct MealListCell: View {
}
.padding(EdgeInsets(top: 12, leading: 16, bottom: 0, trailing: 16))
.frame(width: 148, height: 198, alignment: .leading)
.overlay {
RoundedRectangle(cornerRadius: 8)
.stroke(lineWidth: 3)
.foregroundColor(entity.mealTime.checkIsNow() ? .Primary.purple100 : .clear)
}
.background(Color.GrayScale.gray50)
.cornerRadius(8)
}
Expand Down
18 changes: 8 additions & 10 deletions Application/Sources/Scene/Home/Meal/MealMenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,30 @@ struct MealMenuView: View {
Spacer().frame(width: 12)
Text("오늘의 메뉴").sdText(type: .body1)
Spacer()
Button {
self.xquareRouter.navigateTo(.mealDetail)
} label: {
Image.viewMoreIcon
.resizable()
.frame(width: 24, height: 24)
.tint(.GrayScale.gray200)
}
Image.viewMoreIcon
.resizable()
.frame(width: 24, height: 24)
.tint(.GrayScale.gray200)
Spacer().frame(width: 16)
}
Spacer().frame(height: 14)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 8) {
Spacer().frame(width: 8)
ForEach(menu, id: \.mealTime) {
MealListCell(
entity: $0
)
}
Spacer().frame(width: 8)
}
}
.padding(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16))
Spacer().frame(height: 16)
}
.background(Color.GrayScale.gray0)
.cornerRadius(16)
.onTapGesture {
self.xquareRouter.navigateTo(.mealDetail)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ struct MealMenuPerMealTimeView: View {
type: .body2,
textColor: .GrayScale.gray800
)
Spacer()
Text(entity.kcal ?? "")
.sdText(type: .body4)
.sdText(type: .body2)
}
.padding(.bottom, 4)
Text(entity.menu?.joined(separator: ", ") ?? "")
Expand All @@ -29,6 +30,7 @@ struct MealMenuPerMealTimeView: View {
)
}
.padding(.leading, 16)
.padding(.trailing, 14)
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Modules/XDateUtil/Sources/DateFormat.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import Foundation

public enum DateFormat: String {
/// yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS
case fullDateWithMilliSecondTime = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS"
/// yyyy-MM-dd'T'HH:mm:ss
case fullDateWithTime = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS"
case fullDateWithTime = "yyyy-MM-dd'T'HH:mm:ss"
/// yyyy-MM-dd
case fullDate = "yyyy-MM-dd"
/// yyyy
Expand Down
1 change: 1 addition & 0 deletions Modules/XDateUtil/Sources/StringToDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public extension String {
func toDate(format: DateFormat) -> Date {
XDateFormatter.shared.dateFormat = format.rawValue
guard let returnDate = XDateFormatter.shared.date(from: self) else {
print("toDate Error: Date로 format하려는 데이터의 형식이 DateFormat과 일치하지 않습니다.")
return Date()
}
return returnDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LoaclTokenDataSourceImpl: LoaclTokenDataSource {
}

func fetchExpiredDate() -> Date? {
self.keychain.get(.expiredAt)?.toDate(format: .fullDateWithTime)
self.keychain.get(.expiredAt)?.toDate(format: .fullDateWithMilliSecondTime)
}

func resetToken() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class LocalDataSourceImpl: LocalDataSource {
} catch {
print("Error inserting meal menu: \(error.localizedDescription)")
}

}
}
}
Expand Down
13 changes: 13 additions & 0 deletions Services/MealDataService/Sources/Domain/Enum/MealTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@ public extension MealTime {
return "저녁"
}
}

func checkIsNow() -> Bool {
let nowTime = Date()
var nowMeal: MealTime = .breakfast
if Int(nowTime.toString(format: "HH")) ?? 0 >= 13 && Int(nowTime.toString(format: "mm")) ?? 0 >= 30 {
nowMeal = .dinner
} else if Int(nowTime.toString(format: "HH")) ?? 0 >= 9 && Int(nowTime.toString(format: "mm")) ?? 0 >= 40 {
nowMeal = .lunch
} else {
nowMeal = .breakfast
}
return nowMeal == self
}
}

0 comments on commit 9afc974

Please sign in to comment.