From 2be46b6601e22a329885ff08936465b6ca3e2176 Mon Sep 17 00:00:00 2001 From: Byung jin Date: Thu, 11 May 2023 18:18:12 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=ED=98=84?= =?UTF-8?q?=EC=9E=AC=20=EA=B8=89=EC=8B=9D=EC=83=81=ED=83=9C=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Domain/Enum/MealTime.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift index 0a36a4cf..9337ea07 100644 --- a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift +++ b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift @@ -17,4 +17,17 @@ public extension MealTime { return "저녁" } } + + func isMealTime() -> Bool { + let nowTime = Date() + var nowMeal: MealTime = .breakfast + if Int(nowTime.toString(format: "HH")) ?? 0 >= 18 && Int(nowTime.toString(format: "mm")) ?? 0 >= 0 { + nowMeal = .dinner + } else if Int(nowTime.toString(format: "HH")) ?? 0 >= 13 && Int(nowTime.toString(format: "mm")) ?? 0 >= 0 { + nowMeal = .lunch + } else { + nowMeal = .breakfast + } + return nowMeal == self + } } From 8c8158ec01301b18a7de9494973ecddea6279ff9 Mon Sep 17 00:00:00 2001 From: Byung jin Date: Thu, 11 May 2023 18:18:37 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=EB=94=94?= =?UTF-8?q?=EC=9E=90=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sources/Scene/Home/Meal/MealListCell.swift | 10 ++++++++-- .../MealDetail/Cell/MealMenuPerMealTimeView.swift | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Application/Sources/Scene/Home/Meal/MealListCell.swift b/Application/Sources/Scene/Home/Meal/MealListCell.swift index 0b03560c..7d025516 100644 --- a/Application/Sources/Scene/Home/Meal/MealListCell.swift +++ b/Application/Sources/Scene/Home/Meal/MealListCell.swift @@ -13,11 +13,12 @@ struct MealListCell: View { Text(entity.mealTime.toString()) .sdText( type: .body2, - textColor: .GrayScale.gray800 + textColor: entity.mealTime.isMealTime() ? .Primary.purple300 : .GrayScale.gray800 ) .padding(.trailing, 10) + Spacer() Text(entity.kcal ?? "") - .sdText(type: .body4) + .sdText(type: .caption) } Spacer().frame(height: 8) ForEach( @@ -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.isMealTime() ? .Primary.purple100 : .clear) + } .background(Color.GrayScale.gray50) .cornerRadius(8) } diff --git a/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift b/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift index 6d606d87..b23d6e77 100644 --- a/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift +++ b/Application/Sources/Scene/MealDetail/Cell/MealMenuPerMealTimeView.swift @@ -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: ", ") ?? "") @@ -29,6 +30,7 @@ struct MealMenuPerMealTimeView: View { ) } .padding(.leading, 16) + .padding(.trailing, 14) } } } From a15461c6ee5d1f0720afb9b085d0d391fa87e25b Mon Sep 17 00:00:00 2001 From: Byung jin Date: Thu, 11 May 2023 18:19:12 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=EC=98=A4?= =?UTF-8?q?=EB=8A=98=EC=9D=98=20=EB=A9=94=EB=89=B4=20=ED=81=B4=EB=A6=AD?= =?UTF-8?q?=EB=B2=94=EC=9C=84=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Scene/Home/Meal/MealMenuView.swift | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Application/Sources/Scene/Home/Meal/MealMenuView.swift b/Application/Sources/Scene/Home/Meal/MealMenuView.swift index 9552aeb3..a713a02e 100644 --- a/Application/Sources/Scene/Home/Meal/MealMenuView.swift +++ b/Application/Sources/Scene/Home/Meal/MealMenuView.swift @@ -15,14 +15,10 @@ 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) @@ -41,6 +37,9 @@ struct MealMenuView: View { } .background(Color.GrayScale.gray0) .cornerRadius(16) + .onTapGesture { + self.xquareRouter.navigateTo(.mealDetail) + } } } From f73a110a890c52829dd790e2efeebbe3c6aa31b1 Mon Sep 17 00:00:00 2001 From: Byung jin Date: Thu, 11 May 2023 18:48:25 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=EA=B8=89?= =?UTF-8?q?=EC=8B=9D=20=EC=8B=9C=EA=B0=84=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Services/MealDataService/Sources/Domain/Enum/MealTime.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift index 9337ea07..39d911c4 100644 --- a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift +++ b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift @@ -21,9 +21,9 @@ public extension MealTime { func isMealTime() -> Bool { let nowTime = Date() var nowMeal: MealTime = .breakfast - if Int(nowTime.toString(format: "HH")) ?? 0 >= 18 && Int(nowTime.toString(format: "mm")) ?? 0 >= 0 { + 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 >= 13 && Int(nowTime.toString(format: "mm")) ?? 0 >= 0 { + } else if Int(nowTime.toString(format: "HH")) ?? 0 >= 9 && Int(nowTime.toString(format: "mm")) ?? 0 >= 40 { nowMeal = .lunch } else { nowMeal = .breakfast From 9dd7cc5435dabc2945f9f8dc644aafb2e8bfa8bf Mon Sep 17 00:00:00 2001 From: Byung jin Date: Thu, 11 May 2023 20:10:50 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=90=9B=20::=20swiftLint=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSource/LocalDataSourceImpl.swift | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift b/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift index 07e55e53..1465d197 100644 --- a/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift +++ b/Services/MealDataService/Sources/Data/Local/DataSource/LocalDataSourceImpl.swift @@ -13,38 +13,44 @@ class LocalDataSourceImpl: LocalDataSource { func registerMealMenuPerDay(menu: MealMenu) { Task { - let mealMenu = MealMenu( - day: menu.day, - breakfast: menu.breakfast, - lunch: menu.lunch, - dinner: menu.dinner, - breakfastKcal: menu.breakfastKcal, - lunchKcal: menu.lunchKcal, - dinnerKcal: menu.dinnerKcal - ) - - try await store - .insert(mealMenu) - .run() + do { + let mealMenu = MealMenu( + day: menu.day, + breakfast: menu.breakfast, + lunch: menu.lunch, + dinner: menu.dinner, + breakfastKcal: menu.breakfastKcal, + lunchKcal: menu.lunchKcal, + dinnerKcal: menu.dinnerKcal + ) + try await store + .insert(mealMenu) + .run() + } catch { + print("Error inserting meal menu: \(error.localizedDescription)") + } } } func registerMealMenuPerMonth(menu: [MealMenu]) { for item in menu { Task { - let mealMenu = MealMenu( - day: item.day, - breakfast: item.breakfast, - lunch: item.lunch, - dinner: item.dinner, - breakfastKcal: item.breakfastKcal, - lunchKcal: item.lunchKcal, - dinnerKcal: item.dinnerKcal - ) - - try await store - .insert(mealMenu) - .run() + do { + let mealMenu = MealMenu( + day: item.day, + breakfast: item.breakfast, + lunch: item.lunch, + dinner: item.dinner, + breakfastKcal: item.breakfastKcal, + lunchKcal: item.lunchKcal, + dinnerKcal: item.dinnerKcal + ) + try await store + .insert(mealMenu) + .run() + } catch { + print("Error inserting meal menu: \(error.localizedDescription)") + } } } } From befa73f63c6d4488975767aca601fed7fa680127 Mon Sep 17 00:00:00 2001 From: Byung jin Date: Fri, 12 May 2023 01:41:54 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=EC=85=80=20?= =?UTF-8?q?=ED=8F=B0=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sources/Scene/Home/Meal/MealListCell.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Sources/Scene/Home/Meal/MealListCell.swift b/Application/Sources/Scene/Home/Meal/MealListCell.swift index 7d025516..432bb50c 100644 --- a/Application/Sources/Scene/Home/Meal/MealListCell.swift +++ b/Application/Sources/Scene/Home/Meal/MealListCell.swift @@ -12,7 +12,7 @@ struct MealListCell: View { HStack(spacing: 0) { Text(entity.mealTime.toString()) .sdText( - type: .body2, + type: .body1, textColor: entity.mealTime.isMealTime() ? .Primary.purple300 : .GrayScale.gray800 ) .padding(.trailing, 10) From 66390693c4eaf6ea3a4459a308fb1c0f5418ca08 Mon Sep 17 00:00:00 2001 From: Byung jin Date: Fri, 12 May 2023 20:34:14 +0900 Subject: [PATCH 07/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=EA=B8=89?= =?UTF-8?q?=EC=8B=9D=EC=85=80=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sources/Scene/Home/Meal/MealMenuView.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Application/Sources/Scene/Home/Meal/MealMenuView.swift b/Application/Sources/Scene/Home/Meal/MealMenuView.swift index a713a02e..57c898de 100644 --- a/Application/Sources/Scene/Home/Meal/MealMenuView.swift +++ b/Application/Sources/Scene/Home/Meal/MealMenuView.swift @@ -24,15 +24,14 @@ struct MealMenuView: View { 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) From bf213ab7efbb8c19d1242902a2dcb64dc7ce98de Mon Sep 17 00:00:00 2001 From: Byung jin Date: Fri, 12 May 2023 23:02:43 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20DateFormat=20ca?= =?UTF-8?q?se=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/XDateUtil/Sources/DateFormat.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/XDateUtil/Sources/DateFormat.swift b/Modules/XDateUtil/Sources/DateFormat.swift index 913e24e7..3fd3a747 100644 --- a/Modules/XDateUtil/Sources/DateFormat.swift +++ b/Modules/XDateUtil/Sources/DateFormat.swift @@ -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 From 7ddab2ce4ed34a25f8037cd886834aeef3ffa41e Mon Sep 17 00:00:00 2001 From: Byung jin Date: Fri, 12 May 2023 23:03:10 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20toDate=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=98=A4=EB=A5=98=EC=8B=9C=20=EB=A1=9C=EA=B7=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/XDateUtil/Sources/StringToDate.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/XDateUtil/Sources/StringToDate.swift b/Modules/XDateUtil/Sources/StringToDate.swift index 5f0bfbfb..e25daf89 100644 --- a/Modules/XDateUtil/Sources/StringToDate.swift +++ b/Modules/XDateUtil/Sources/StringToDate.swift @@ -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 From b66cbedebd7e1c1b047ec8eef8f1a597214c9321 Mon Sep 17 00:00:00 2001 From: Byung jin Date: Fri, 12 May 2023 23:03:50 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20::=20=EB=B0=80?= =?UTF-8?q?=EB=A6=AC=EC=84=B8=EC=BB=A8=EB=93=9C=EB=A5=BC=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EB=8A=94=20ToDate=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Local/DataSource/LoaclTokenDataSourceImpl.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Services/AuthService/Sources/Data/Local/DataSource/LoaclTokenDataSourceImpl.swift b/Services/AuthService/Sources/Data/Local/DataSource/LoaclTokenDataSourceImpl.swift index 80d30428..d50a349d 100644 --- a/Services/AuthService/Sources/Data/Local/DataSource/LoaclTokenDataSourceImpl.swift +++ b/Services/AuthService/Sources/Data/Local/DataSource/LoaclTokenDataSourceImpl.swift @@ -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() { From 2b476666ffea26b2cc4dd2a97a7f5441ae90ded5 Mon Sep 17 00:00:00 2001 From: juyeong525 Date: Fri, 12 May 2023 23:26:29 +0900 Subject: [PATCH 11/11] =?UTF-8?q?=E2=99=BB=EF=B8=8F=C2=A0::=20isMealTime?= =?UTF-8?q?=20->=20checkIsNow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sources/Scene/Home/Meal/MealListCell.swift | 4 ++-- Services/MealDataService/Sources/Domain/Enum/MealTime.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Application/Sources/Scene/Home/Meal/MealListCell.swift b/Application/Sources/Scene/Home/Meal/MealListCell.swift index 432bb50c..7d8d0c26 100644 --- a/Application/Sources/Scene/Home/Meal/MealListCell.swift +++ b/Application/Sources/Scene/Home/Meal/MealListCell.swift @@ -13,7 +13,7 @@ struct MealListCell: View { Text(entity.mealTime.toString()) .sdText( type: .body1, - textColor: entity.mealTime.isMealTime() ? .Primary.purple300 : .GrayScale.gray800 + textColor: entity.mealTime.checkIsNow() ? .Primary.purple300 : .GrayScale.gray800 ) .padding(.trailing, 10) Spacer() @@ -35,7 +35,7 @@ struct MealListCell: View { .overlay { RoundedRectangle(cornerRadius: 8) .stroke(lineWidth: 3) - .foregroundColor(entity.mealTime.isMealTime() ? .Primary.purple100 : .clear) + .foregroundColor(entity.mealTime.checkIsNow() ? .Primary.purple100 : .clear) } .background(Color.GrayScale.gray50) .cornerRadius(8) diff --git a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift index 39d911c4..25308f00 100644 --- a/Services/MealDataService/Sources/Domain/Enum/MealTime.swift +++ b/Services/MealDataService/Sources/Domain/Enum/MealTime.swift @@ -18,7 +18,7 @@ public extension MealTime { } } - func isMealTime() -> Bool { + 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 {