From 08c99a6ac21909437f014958b0ca8e50b9a7a7c2 Mon Sep 17 00:00:00 2001 From: HyeS00 Date: Thu, 15 Aug 2024 22:16:48 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=E2=9E=95=20::=20=EC=9D=B8=EB=B0=94?= =?UTF-8?q?=EB=94=94=20=EC=B6=94=EA=B0=80=ED=95=98=EA=B8=B0=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Onboarding/Views/InbodyFixView.swift | 35 ++++++++++++++++++- .../Onboarding/Views/InbodyInputView.swift | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift index d59a8eb1..8a8f7ba4 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift @@ -10,6 +10,7 @@ import SwiftUI struct InbodyFixView: View { @EnvironmentObject var navigationPathFinder: NavigationPathFinder @EnvironmentObject var viewModel: AzureInbodyViewModel + @EnvironmentObject var inbodyViewModel: InbodyViewModel @State private var weight: String = "" @State private var height: String = "" @@ -41,10 +42,42 @@ struct InbodyFixView: View { .padding(.top, 40) CustomButtonView(title: "저장하기") { - // TODO: 백엔드에 회원 정보 저장 + saveInbodyData() navigationPathFinder.addPath(option: .eyeBodyView) } } .navigationBarBackButtonHidden() } + + private func saveInbodyData() { + + guard let weightValue = Float(weight), + let heightValue = Float(height) else { + return + } + + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd" + let inbodyDateString = dateFormatter.string(from: Date()) + + let createInbodyDto = CreateInbodyDto( + height: heightValue, + weight: weightValue, + inbodyDate: inbodyDateString, + bmr: Float(bmr), + bodyfat: Double(bodyfat), + bmi: Double(bmi), + memberID: 27) + + Task { + do { + let response = try await NetworkManager.createInbody(createInbodyDto: createInbodyDto) + await MainActor.run { + inbodyViewModel.createdInbody = response + } + } catch { + print("Error creating inbody: \(error)") + } + } + } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift index 7552d640..55d10b6a 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift @@ -42,6 +42,7 @@ struct InbodyInputView: View { CustomButtonView(title: "저장하기") { saveInbodyData() + navigationPathFinder.addPath(option: .onboardingEndView) } CustomButtonView(title: "건너뛰기") { From dc3d30ac315e04c2e04914f705be875720d6fa79 Mon Sep 17 00:00:00 2001 From: HyeS00 Date: Thu, 15 Aug 2024 22:42:11 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=E2=9E=95=20::=20=EC=9D=B8=EB=B0=94?= =?UTF-8?q?=EB=94=94=20=EC=B0=A8=ED=8A=B8=20vm=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NetworkService/Chat/ChatViewModel.swift | 6 +++--- .../Member/MemberViewModel.swift | 6 +++--- .../Profile/ViewModels/InbodyViewModel.swift | 2 +- .../Views/Components/InbodyChartView.swift | 8 ++++---- .../Sources/Profile/Views/InbodyMainView.swift | 18 +++++++++--------- .../Profile/Views/ProfileMainView.swift | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Chat/ChatViewModel.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Chat/ChatViewModel.swift index ca45a510..82d8e18f 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Chat/ChatViewModel.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Chat/ChatViewModel.swift @@ -34,11 +34,11 @@ class ChatViewModel: ObservableObject { ["role": "user", "content": content] ] ] - + let request = AF.request(url, method: .post, parameters: body, encoding: JSONEncoding.default, headers: headers) - + let response = await request.serializingDecodable(ChatResponse.self).response - + switch response.result { case .success(let chatResponse): if let message = chatResponse.choices.first?.message { diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Member/MemberViewModel.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Member/MemberViewModel.swift index 8320aad9..725261d7 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Member/MemberViewModel.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Member/MemberViewModel.swift @@ -29,11 +29,11 @@ class MemberViewModel: ObservableObject { "Content-Type": "application/json", "appleID": appleID ] - + let request = AF.request(url, method: .post, headers: headers) - + let response = await request.serializingDecodable(LoginResponse.self).response - + switch response.result { case .success(let loginResponse): print("JWT 토큰: \(loginResponse.token)") diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/ViewModels/InbodyViewModel.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/ViewModels/InbodyViewModel.swift index 3a6b1429..a9a23673 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/ViewModels/InbodyViewModel.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/ViewModels/InbodyViewModel.swift @@ -15,7 +15,7 @@ class InbodyViewModel: ObservableObject { @Published var createdInbody: InbodyResponse? @Published var errorMessage: String? - func analyzeTrend(for inbodys: [InbodyModel], getValue: (InbodyModel) -> T?) -> String { + func analyzeTrend(for inbodys: [Inbody], getValue: (Inbody) -> T?) -> String { let filteredInbodys = inbodys.filter { getValue($0) != nil }.sorted { $0.inbodyDate < $1.inbodyDate } guard filteredInbodys.count >= 2 else { diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/Components/InbodyChartView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/Components/InbodyChartView.swift index 955b820f..753b0c89 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/Components/InbodyChartView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/Components/InbodyChartView.swift @@ -9,20 +9,20 @@ import SwiftUI import Charts struct InbodyChartView: View { - let inbodys: [InbodyModel] + let inbodys: [Inbody] let title: String let xAxisTitle: String let yAxisTitle: String let color: Color - let getValue: (InbodyModel) -> T? + let getValue: (Inbody) -> T? @StateObject private var inbodyViewModel = InbodyViewModel() - private var sortedInbodys: [InbodyModel] { + private var sortedInbodys: [Inbody] { return inbodys.sorted { $0.inbodyDate < $1.inbodyDate} } - private var filteredInbodys: [InbodyModel] { + private var filteredInbodys: [Inbody] { return sortedInbodys.filter { getValue($0) != nil } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift index 2392e57d..cd5f5427 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift @@ -11,15 +11,14 @@ struct InbodyMainView: View { @EnvironmentObject var navigationPathFinder: NavigationPathFinder @EnvironmentObject var inbodyViewModel: InbodyViewModel @State private var isShowModal = false - let inbodys: [InbodyModel] var body: some View { VStack { ScrollView { - InbodyChartView(inbodys: inbodys, title: "체중", xAxisTitle: "날짜", yAxisTitle: "체중", color: .red) { $0.weight } - InbodyChartView(inbodys: inbodys, title: "기초 대사량", xAxisTitle: "날짜", yAxisTitle: "기초 대사량", color: .orange) { $0.bmr } - InbodyChartView(inbodys: inbodys, title: "체지방량", xAxisTitle: "날짜", yAxisTitle: "체지방량", color: .green) { $0.bodyfat } - InbodyChartView(inbodys: inbodys, title: "BMI", xAxisTitle: "날짜", yAxisTitle: "BMI", color: .blue) { $0.bmi } + InbodyChartView(inbodys: inbodyViewModel.inbodies, title: "체중", xAxisTitle: "날짜", yAxisTitle: "체중", color: .red) { $0.weight } + InbodyChartView(inbodys: inbodyViewModel.inbodies, title: "기초 대사량", xAxisTitle: "날짜", yAxisTitle: "기초 대사량", color: .orange) { $0.bmr } + InbodyChartView(inbodys: inbodyViewModel.inbodies, title: "체지방량", xAxisTitle: "날짜", yAxisTitle: "체지방량", color: .green) { $0.bodyfat } + InbodyChartView(inbodys: inbodyViewModel.inbodies, title: "BMI", xAxisTitle: "날짜", yAxisTitle: "BMI", color: .blue) { $0.bmi } } CustomButtonView(title: "인바디 추가하기", style: .black) { @@ -31,9 +30,10 @@ struct InbodyMainView: View { } .ignoresSafeArea() .preferredColorScheme(.light) + .onAppear { + Task { + await inbodyViewModel.findAllInbodies(memberId: 27) + } + } } } - -#Preview { - InbodyMainView(inbodys: inbodyDummyData) -} diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/ProfileMainView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/ProfileMainView.swift index 41e5b1e1..9bc9d633 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/ProfileMainView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/ProfileMainView.swift @@ -25,7 +25,7 @@ struct ProfileMainView: View { case .album: AlbumMainView() case .inbody: - InbodyMainView(inbodys: inbodyDummyData) + InbodyMainView() case .eyeBody: EyeBodyMainView() } From c115711f5d44234e165374051aae07f61e116644 Mon Sep 17 00:00:00 2001 From: HyeS00 Date: Thu, 15 Aug 2024 22:57:08 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=E2=9E=95=20::=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=EC=9D=B8=EB=B0=94=EB=94=94=20=EB=B7=B0=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Profile/Views/InbodyInputSelectView.swift | 8 ++++---- .../FebirdApp/Sources/Profile/Views/InbodyMainView.swift | 6 +----- .../Sources/Utils/NavigationComponents/ViewOptions.swift | 6 ++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift index c3a1d399..87156482 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift @@ -8,7 +8,7 @@ import SwiftUI struct InbodyInputSelectView: View { - @Binding var isPresented: Bool + @EnvironmentObject var navigationPathFinder: NavigationPathFinder var body: some View { @@ -39,11 +39,11 @@ struct InbodyInputSelectView: View { Spacer() CustomButtonView(title: "사진찍기") { - + navigationPathFinder.addPath(option: .inbodyAddView) }.padding(.bottom, 10) CustomButtonView(title: "수기입력") { - + navigationPathFinder.addPath(option: .inbodyInputView) } } .background(.white) @@ -51,5 +51,5 @@ struct InbodyInputSelectView: View { } #Preview { - InbodyInputSelectView(isPresented: .constant(true)) + InbodyInputSelectView() } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift index cd5f5427..b9291682 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyMainView.swift @@ -10,7 +10,6 @@ import SwiftUI struct InbodyMainView: View { @EnvironmentObject var navigationPathFinder: NavigationPathFinder @EnvironmentObject var inbodyViewModel: InbodyViewModel - @State private var isShowModal = false var body: some View { VStack { @@ -22,11 +21,8 @@ struct InbodyMainView: View { } CustomButtonView(title: "인바디 추가하기", style: .black) { - isShowModal = true + navigationPathFinder.addPath(option: .inbodyInputSelectView) } - .sheet(isPresented: $isShowModal, content: { - InbodyInputSelectView(isPresented: $isShowModal) - }) } .ignoresSafeArea() .preferredColorScheme(.light) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift index 5ff37866..cef94575 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift @@ -64,6 +64,8 @@ enum ProfileViewOptions: Hashable, ViewOptions { case profileSettingView case eyeBodyView(isOnboarding: Bool) case inbodyInputView + case inbodyInputSelectView + case inbodyAddView @ViewBuilder func view() -> some View { switch self { @@ -78,6 +80,10 @@ enum ProfileViewOptions: Hashable, ViewOptions { EyeBodyView(isOnboarding: isOnboarding) case .inbodyInputView: InbodyInputView() + case .inbodyInputSelectView: + InbodyInputSelectView() + case .inbodyAddView: + InbodyAddView() } } } From efa9e227256801488cd58446eedf380e0c462aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9C=A0=EA=B2=BD?= Date: Fri, 16 Aug 2024 05:24:37 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=F0=9F=94=80=20::=20profileView=EC=99=80=20?= =?UTF-8?q?InbodyView=20=EC=97=B0=EA=B2=B0=20#KAN-336?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Onboarding/Views/EyeBodyView.swift | 7 ++ .../Onboarding/Views/InbodyAddView.swift | 66 +++++++++++++------ .../Onboarding/Views/InbodyFixView.swift | 51 +++++++++++--- .../Onboarding/Views/InbodyInputView.swift | 61 +++++++++++++---- .../NavigationComponents/ViewOptions.swift | 3 + 5 files changed, 145 insertions(+), 43 deletions(-) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/EyeBodyView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/EyeBodyView.swift index 2cebfd16..72ba66c3 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/EyeBodyView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/EyeBodyView.swift @@ -11,6 +11,7 @@ struct EyeBodyView: View { @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder @EnvironmentObject var profileNavigationPathFinder: NavigationPathFinder @StateObject private var viewModel = EyeBodyPhotoViewModel() + @EnvironmentObject var tabViewModel: TabViewModel @Environment(\.modelContext) private var modelContext var isOnboarding: Bool = true @@ -107,6 +108,12 @@ struct EyeBodyView: View { .padding(.top, 30) } .navigationBarBackButtonHidden() + .onAppear { + tabViewModel.isHidden = true + } + .onDisappear { + tabViewModel.isHidden = false + } } func getPlaceholder(for index: Int) -> String { diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift index bed1c85e..ef411526 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift @@ -8,10 +8,10 @@ import SwiftUI struct InbodyAddView: View { - @EnvironmentObject var navigationPathFinder: NavigationPathFinder + @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder + @EnvironmentObject var profileNavigationPathFinder: NavigationPathFinder @EnvironmentObject var viewModel: AzureInbodyViewModel - - @State private var showOnboardingGaugeView = true + @EnvironmentObject var tabViewModel: TabViewModel @State private var showSkipButton = true @State private var showActionSheet = false @State private var showImagePicker = false @@ -19,18 +19,37 @@ struct InbodyAddView: View { @State private var isImageSelected = false @State private var image: UIImage? = UIImage(named: "InbodyDefault") @State private var showCamera = false - + var body: some View { VStack { - if showOnboardingGaugeView { + if !profileNavigationPathFinder.isFirstEnteredApp { OnboardingGaugeView(progress: 3) } - + else { + HStack { + Button { + profileNavigationPathFinder.popPath() + tabViewModel.isHidden = false + } label: { + Image("Chevron-left") + } + + Spacer() + + Text("인바디 수정") + .font(.customFont(size: 22, weight: .bold)) + .foregroundStyle(.gray100) + + Spacer() + } + .padding(.horizontal, 20) + } + VStack { Text("인바디 사진은 아래와 같이 등록해주세요!") .font(.customFont(size: 20, weight: .bold)) .padding(.bottom, 36) - + ZStack { Image(uiImage: image ?? UIImage(named: "InbodyDefault")!) .resizable() @@ -38,18 +57,18 @@ struct InbodyAddView: View { .frame(width: 300, height: 400) .padding() .clipShape(RoundedRectangle(cornerRadius: 10)) - + if !isImageSelected { RoundedRectangle(cornerRadius: 10) .fill(.black.opacity(0.7)) .frame(width: 345, height: 434) - + VStack { Text("민감 정보는 서버에 저장되지 않아요!") .foregroundStyle(Color(white: 1.0)) .font(.customFont(size: 18, weight: .bold)) .padding(.bottom, 26) - + Text("건강 정보는 개인 기기에만 저장되며\n 그래프로 기록을 보여드리기 위함이니 안심하세요 😔") .foregroundStyle(Color(white: 1.0)) .font(.customFont(size: 14, weight: .medium)) @@ -58,26 +77,32 @@ struct InbodyAddView: View { } } Spacer() - + if !isImageSelected { CustomButtonView(title: "등록하기") { showActionSheet = true } .padding(.top, 40) - - CustomButtonView(title: "건너뛰기") { - navigationPathFinder.addPath(option: .inbodyInputView) + if !profileNavigationPathFinder.isFirstEnteredApp { + CustomButtonView(title: "건너뛰기") { + onboardingNavigationPathFinder.addPath(option: .inbodyInputView) + } } } else { CustomButtonView(title: "다시찍기") { showActionSheet = true } .padding(.top, 40) - + CustomButtonView(title: "분석하기") { viewModel.analyzeImage(image!) if viewModel.isLoading && viewModel.error == nil { - navigationPathFinder.addPath(option: .onboardingLoadingView) + if !profileNavigationPathFinder.isFirstEnteredApp { + onboardingNavigationPathFinder.addPath(option: .onboardingLoadingView) + } else { + profileNavigationPathFinder.addPath(option: .inbodyFixView) + } + } } } @@ -105,10 +130,9 @@ struct InbodyAddView: View { }) .navigationBarBackButtonHidden() } - + .onAppear { + tabViewModel.isHidden = true + } + } } - -#Preview { - InbodyAddView() -} diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift index 8a8f7ba4..13f399fa 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift @@ -8,9 +8,11 @@ import SwiftUI struct InbodyFixView: View { - @EnvironmentObject var navigationPathFinder: NavigationPathFinder + @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder + @EnvironmentObject var profileNavigationPathFinder: NavigationPathFinder @EnvironmentObject var viewModel: AzureInbodyViewModel @EnvironmentObject var inbodyViewModel: InbodyViewModel + @EnvironmentObject var tabViewModel: TabViewModel @State private var weight: String = "" @State private var height: String = "" @@ -21,7 +23,27 @@ struct InbodyFixView: View { var body: some View { ScrollView { - OnboardingGaugeView(progress: 4) + if !onboardingNavigationPathFinder.isFirstEnteredApp { + OnboardingGaugeView(progress: 4) + } + else { + HStack { + Button { + profileNavigationPathFinder.popPath() + } label: { + Image("Chevron-left") + } + + Spacer() + + Text("인바디 수정") + .font(.customFont(size: 22, weight: .bold)) + .foregroundStyle(.gray100) + + Spacer() + } + .padding(.horizontal, 20) + } Text("정보가 다르게 인식됐나요? \n여기에서 수정할 수 있어요 😉") .font(.customFont(size: 20, weight: .bold)) @@ -29,11 +51,11 @@ struct InbodyFixView: View { .padding(.bottom, 46) VStack(spacing: 20) { - OnboardingTextField(question: "체중 *", placeholder: viewModel.weight?.content ?? "45.3", unit: "kg", inputValue: weight, keyboardType: .numberPad, autoFocus: false, text: $weight) - OnboardingTextField(question: "키 *", placeholder: "160.3", unit: "cm", inputValue: height, keyboardType: .numberPad, autoFocus: false, text: $height) - OnboardingTextField(question: "BMI", placeholder: viewModel.bmi?.content ?? "17.6", unit: "%", inputValue: bmi, keyboardType: .numberPad, autoFocus: false, text: $bmi) - OnboardingTextField(question: "체지방량", placeholder: viewModel.bodyFat?.content ?? "9.6", unit: "%", inputValue: bodyfat, keyboardType: .numberPad, autoFocus: false, text: $bodyfat) - OnboardingTextField(question: "기초대사량", placeholder: viewModel.bmr?.content ?? "kcal", unit: "kg", inputValue: bmr, keyboardType: .numberPad, autoFocus: false, text: $bmr) + OnboardingTextField(question: "체중 *", placeholder: viewModel.weight?.content.extractNumbers() ?? "45.3", unit: "kg", inputValue: weight, keyboardType: .numberPad, autoFocus: false, text: $weight) + OnboardingTextField(question: "키 *", placeholder: "160", unit: "cm", inputValue: height, keyboardType: .numberPad, autoFocus: false, text: $height) + OnboardingTextField(question: "BMI", placeholder: viewModel.bmi?.content.extractNumbers() ?? "17.6", unit: "%", inputValue: bmi, keyboardType: .numberPad, autoFocus: false, text: $bmi) + OnboardingTextField(question: "체지방량", placeholder: viewModel.bodyFat?.content.extractNumbers() ?? "9.6", unit: "%", inputValue: bodyfat, keyboardType: .numberPad, autoFocus: false, text: $bodyfat) + OnboardingTextField(question: "기초대사량", placeholder: viewModel.bmr?.content.extractNumbers() ?? "kcal", unit: "kg", inputValue: bmr, keyboardType: .numberPad, autoFocus: false, text: $bmr) }.padding(.horizontal, 20) CustomButtonView(title: "다시찍기") { @@ -43,7 +65,13 @@ struct InbodyFixView: View { CustomButtonView(title: "저장하기") { saveInbodyData() - navigationPathFinder.addPath(option: .eyeBodyView) + if !onboardingNavigationPathFinder.isFirstEnteredApp { + onboardingNavigationPathFinder.addPath(option: .eyeBodyView) + } + else { + profileNavigationPathFinder.popToRoot() + tabViewModel.isHidden = false + } } } .navigationBarBackButtonHidden() @@ -81,3 +109,10 @@ struct InbodyFixView: View { } } } +// MARK: 문자열 숫자 추출 +extension String { + func extractNumbers() -> String { + let numberSet = CharacterSet.decimalDigits + return self.unicodeScalars.filter { numberSet.contains($0) }.map { String($0) }.joined() + } +} diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift index 55d10b6a..4e279879 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift @@ -8,9 +8,11 @@ import SwiftUI struct InbodyInputView: View { - @EnvironmentObject var navigationPathFinder: NavigationPathFinder + @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder + @EnvironmentObject var profileNavigationPathFinder: NavigationPathFinder @EnvironmentObject var inbodyViewModel: InbodyViewModel - + @EnvironmentObject var tabViewModel: TabViewModel + @State private var weight: String = "" @State private var height: String = "" @State private var bmi: String = "" @@ -18,18 +20,39 @@ struct InbodyInputView: View { @State private var bmr: String = "" @State private var showAlert = false @State private var alertMessage = "" - + var body: some View { VStack { - OnboardingGaugeView(progress: 5) + if !profileNavigationPathFinder.isFirstEnteredApp { + OnboardingGaugeView(progress: 5) + } + else { + HStack { + Button { + profileNavigationPathFinder.popToRoot() + tabViewModel.isHidden = false + } label: { + Image("Chevron-left") + } + + Spacer() + Text("인바디 추가") + .font(.customFont(size: 22, weight: .bold)) + .foregroundStyle(.gray100) + + Spacer() + } + .padding(.horizontal, 20) + } + VStack { ScrollView { Text("체중과 키를 기록하면 변화를 그래프로 보여드릴게요 😉") .font(.customFont(size: 20, weight: .bold)) .foregroundStyle(Color(red: 0.07, green: 0.07, blue: 0.08)) .padding(.bottom, 46) - + VStack(spacing: 20) { OnboardingTextField(question: "체중 *", placeholder: "70", unit: "kg", inputValue: nil, keyboardType: .numberPad, autoFocus: false, text: $weight) OnboardingTextField(question: "키 *", placeholder: "170", unit: "cm", inputValue: nil, keyboardType: .numberPad, autoFocus: false, text: $height) @@ -39,36 +62,46 @@ struct InbodyInputView: View { } .padding(.horizontal, 30) } - + CustomButtonView(title: "저장하기") { saveInbodyData() - navigationPathFinder.addPath(option: .onboardingEndView) + if !profileNavigationPathFinder.isFirstEnteredApp { + onboardingNavigationPathFinder.addPath(option: .onboardingEndView) + } else { + profileNavigationPathFinder.popToRoot() + tabViewModel.isHidden = false + } } - - CustomButtonView(title: "건너뛰기") { - navigationPathFinder.addPath(option: .onboardingEndView) + if !profileNavigationPathFinder.isFirstEnteredApp { + CustomButtonView(title: "건너뛰기") { + onboardingNavigationPathFinder.addPath(option: .onboardingEndView) + } } } } .navigationBarBackButtonHidden() + .gesture( TapGesture() .onEnded { _ in UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) } ) + .onAppear { + tabViewModel.isHidden = true + } } - + private func saveInbodyData() { guard let weightValue = Float(weight), let heightValue = Float(height) else { return } - + let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd" let inbodyDateString = dateFormatter.string(from: Date()) - + let createInbodyDto = CreateInbodyDto( height: heightValue, weight: weightValue, @@ -77,7 +110,7 @@ struct InbodyInputView: View { bodyfat: Double(bodyfat), bmi: Double(bmi), memberID: 27) - + Task { do { let response = try await NetworkManager.createInbody(createInbodyDto: createInbodyDto) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift index cef94575..9796ec83 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift @@ -66,6 +66,7 @@ enum ProfileViewOptions: Hashable, ViewOptions { case inbodyInputView case inbodyInputSelectView case inbodyAddView + case inbodyFixView @ViewBuilder func view() -> some View { switch self { @@ -84,6 +85,8 @@ enum ProfileViewOptions: Hashable, ViewOptions { InbodyInputSelectView() case .inbodyAddView: InbodyAddView() + case .inbodyFixView: + InbodyFixView() } } } From 7a094e5c470dbcfd4d45547f8f3a3d40dde48beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9C=A0=EA=B2=BD?= Date: Fri, 16 Aug 2024 05:28:26 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=F0=9F=8E=A8=20::=20=20=ED=8C=A8=EB=94=A9?= =?UTF-8?q?=EA=B0=92=20=EC=A1=B0=EC=A0=88=20#KAN-336?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift index 4e279879..a7afc9a8 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift @@ -52,6 +52,7 @@ struct InbodyInputView: View { .font(.customFont(size: 20, weight: .bold)) .foregroundStyle(Color(red: 0.07, green: 0.07, blue: 0.08)) .padding(.bottom, 46) + .padding(.horizontal, 20) VStack(spacing: 20) { OnboardingTextField(question: "체중 *", placeholder: "70", unit: "kg", inputValue: nil, keyboardType: .numberPad, autoFocus: false, text: $weight) From 5bd99ed030f29c8b4d9ddffad3b2ca9c881967de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9C=A0=EA=B2=BD?= Date: Wed, 21 Aug 2024 02:56:10 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=F0=9F=8E=A8=20::=20profile=ED=83=AD?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=9D=B8=EB=B0=94=EB=94=94=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EB=B7=B0=20=EC=88=98=EC=A0=95=20#KAN-336=20-=20profil?= =?UTF-8?q?eViewOption=20=EA=B2=BD=EB=A1=9C=20=EC=9D=BC=EB=B6=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20-=20inbodyAddView,=20inbodyInputView,=20in?= =?UTF-8?q?bodyFixView=20padding=EA=B0=92=20=EC=A1=B0=EC=A0=88=20=EB=B0=8F?= =?UTF-8?q?=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95=20-=20LoadingView?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=84=98=EC=96=B4=EA=B0=80=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=20-=20profile=ED=83=AD=20=EC=9D=B8=EB=B0=94?= =?UTF-8?q?=EB=94=94=20=EC=88=98=EC=A0=95=EB=B7=B0=20=EB=8B=A4=ED=81=AC?= =?UTF-8?q?=EB=AA=A8=EB=93=9C=20=EC=88=98=EC=A0=95=20=ED=95=84=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Inbody/AzureInbodyViewModel.swift | 1 + .../Onboarding/Views/InbodyAddView.swift | 43 ++++++++++++------- .../Onboarding/Views/InbodyFixView.swift | 38 ++++++++-------- .../Onboarding/Views/InbodyInputView.swift | 38 ++++++++++------ .../Views/OnboardingLoadingView.swift | 28 ++++++++---- .../Views/OnboardingSelectUserInfoView.swift | 4 +- .../Profile/Views/InbodyInputSelectView.swift | 33 +++++++++++--- .../NavigationComponents/ViewOptions.swift | 3 ++ 8 files changed, 127 insertions(+), 61 deletions(-) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Inbody/AzureInbodyViewModel.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Inbody/AzureInbodyViewModel.swift index e2b98869..e2cd9d44 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Inbody/AzureInbodyViewModel.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/Inbody/AzureInbodyViewModel.swift @@ -90,6 +90,7 @@ class AzureInbodyViewModel: ObservableObject { DispatchQueue.main.async { self?.isLoading = false self?.error = .dataParsingError + print("data parsing error") } } case .failure(let error): diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift index ef411526..964ccf55 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift @@ -22,8 +22,9 @@ struct InbodyAddView: View { var body: some View { VStack { - if !profileNavigationPathFinder.isFirstEnteredApp { + if onboardingNavigationPathFinder.isFirstEnteredApp { OnboardingGaugeView(progress: 3) + .padding(.top, 40) } else { HStack { @@ -36,7 +37,7 @@ struct InbodyAddView: View { Spacer() - Text("인바디 수정") + Text("인바디 사진 추가") .font(.customFont(size: 22, weight: .bold)) .foregroundStyle(.gray100) @@ -48,6 +49,7 @@ struct InbodyAddView: View { VStack { Text("인바디 사진은 아래와 같이 등록해주세요!") .font(.customFont(size: 20, weight: .bold)) + .foregroundStyle(.gray100) .padding(.bottom, 36) ZStack { @@ -79,28 +81,36 @@ struct InbodyAddView: View { Spacer() if !isImageSelected { - CustomButtonView(title: "등록하기") { - showActionSheet = true - } - .padding(.top, 40) - if !profileNavigationPathFinder.isFirstEnteredApp { + if onboardingNavigationPathFinder.isFirstEnteredApp { // 온보딩일 때만 건너뛰깇 + CustomButtonView(title: "등록하기") { + showActionSheet = true + }.padding(.top, 10) + CustomButtonView(title: "건너뛰기") { onboardingNavigationPathFinder.addPath(option: .inbodyInputView) } + .padding(.bottom, 20) } - } else { + else { + CustomButtonView(title: "등록하기") { + showActionSheet = true + } + } + } + else { CustomButtonView(title: "다시찍기") { showActionSheet = true } .padding(.top, 40) CustomButtonView(title: "분석하기") { - viewModel.analyzeImage(image!) + viewModel.analyzeImage(image!) // 분석하는 로직 if viewModel.isLoading && viewModel.error == nil { - if !profileNavigationPathFinder.isFirstEnteredApp { + if onboardingNavigationPathFinder.isFirstEnteredApp { onboardingNavigationPathFinder.addPath(option: .onboardingLoadingView) - } else { - profileNavigationPathFinder.addPath(option: .inbodyFixView) + } + else if !profileNavigationPathFinder.isFirstEnteredApp { + profileNavigationPathFinder.addPath(option: .onboardingLoadingView) } } @@ -128,11 +138,14 @@ struct InbodyAddView: View { isImageSelected = true } }) - .navigationBarBackButtonHidden() } + .background(Color.white.ignoresSafeArea()) + .preferredColorScheme(.light) + .navigationBarBackButtonHidden() .onAppear { - tabViewModel.isHidden = true + if !onboardingNavigationPathFinder.isFirstEnteredApp { + tabViewModel.isHidden = true + } } - } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift index 13f399fa..4af39c01 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift @@ -13,17 +13,17 @@ struct InbodyFixView: View { @EnvironmentObject var viewModel: AzureInbodyViewModel @EnvironmentObject var inbodyViewModel: InbodyViewModel @EnvironmentObject var tabViewModel: TabViewModel - + @State private var weight: String = "" @State private var height: String = "" @State private var bmi: String = "" @State private var bodyfat: String = "" @State private var bmr: String = "" @State private var showActionSheet = false - + var body: some View { ScrollView { - if !onboardingNavigationPathFinder.isFirstEnteredApp { + if onboardingNavigationPathFinder.isFirstEnteredApp { OnboardingGaugeView(progress: 4) } else { @@ -33,39 +33,41 @@ struct InbodyFixView: View { } label: { Image("Chevron-left") } - + Spacer() - + Text("인바디 수정") .font(.customFont(size: 22, weight: .bold)) .foregroundStyle(.gray100) - + Spacer() } .padding(.horizontal, 20) } - + Text("정보가 다르게 인식됐나요? \n여기에서 수정할 수 있어요 😉") .font(.customFont(size: 20, weight: .bold)) .foregroundStyle(Color(red: 0.07, green: 0.07, blue: 0.08)) .padding(.bottom, 46) - + VStack(spacing: 20) { OnboardingTextField(question: "체중 *", placeholder: viewModel.weight?.content.extractNumbers() ?? "45.3", unit: "kg", inputValue: weight, keyboardType: .numberPad, autoFocus: false, text: $weight) OnboardingTextField(question: "키 *", placeholder: "160", unit: "cm", inputValue: height, keyboardType: .numberPad, autoFocus: false, text: $height) OnboardingTextField(question: "BMI", placeholder: viewModel.bmi?.content.extractNumbers() ?? "17.6", unit: "%", inputValue: bmi, keyboardType: .numberPad, autoFocus: false, text: $bmi) OnboardingTextField(question: "체지방량", placeholder: viewModel.bodyFat?.content.extractNumbers() ?? "9.6", unit: "%", inputValue: bodyfat, keyboardType: .numberPad, autoFocus: false, text: $bodyfat) OnboardingTextField(question: "기초대사량", placeholder: viewModel.bmr?.content.extractNumbers() ?? "kcal", unit: "kg", inputValue: bmr, keyboardType: .numberPad, autoFocus: false, text: $bmr) - }.padding(.horizontal, 20) - + } + .padding(.horizontal, 20) + .foregroundStyle(.gray100) + CustomButtonView(title: "다시찍기") { showActionSheet = true } .padding(.top, 40) - + CustomButtonView(title: "저장하기") { saveInbodyData() - if !onboardingNavigationPathFinder.isFirstEnteredApp { + if onboardingNavigationPathFinder.isFirstEnteredApp { onboardingNavigationPathFinder.addPath(option: .eyeBodyView) } else { @@ -75,19 +77,20 @@ struct InbodyFixView: View { } } .navigationBarBackButtonHidden() + .preferredColorScheme(.light) } - + private func saveInbodyData() { - + guard let weightValue = Float(weight), let heightValue = Float(height) else { return } - + let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd" let inbodyDateString = dateFormatter.string(from: Date()) - + let createInbodyDto = CreateInbodyDto( height: heightValue, weight: weightValue, @@ -96,9 +99,10 @@ struct InbodyFixView: View { bodyfat: Double(bodyfat), bmi: Double(bmi), memberID: 27) - + Task { do { + // TODO: isFirstEnteredApp가 false일 때 수정값 백엔드 연결 추가 let response = try await NetworkManager.createInbody(createInbodyDto: createInbodyDto) await MainActor.run { inbodyViewModel.createdInbody = response diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift index a7afc9a8..d3e14cfe 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift @@ -23,13 +23,14 @@ struct InbodyInputView: View { var body: some View { VStack { - if !profileNavigationPathFinder.isFirstEnteredApp { + if onboardingNavigationPathFinder.isFirstEnteredApp { OnboardingGaugeView(progress: 5) + .padding(.top, 50) } else { HStack { Button { - profileNavigationPathFinder.popToRoot() + profileNavigationPathFinder.popPath() tabViewModel.isHidden = false } label: { Image("Chevron-left") @@ -37,13 +38,14 @@ struct InbodyInputView: View { Spacer() - Text("인바디 추가") + Text("인바디 직접 추가") .font(.customFont(size: 22, weight: .bold)) .foregroundStyle(.gray100) Spacer() } .padding(.horizontal, 20) + .padding(.top, 50) } VStack { @@ -62,26 +64,34 @@ struct InbodyInputView: View { OnboardingTextField(question: "기초대사량", placeholder: "1500", unit: "kcal", inputValue: nil, keyboardType: .numberPad, autoFocus: false, text: $bmr) } .padding(.horizontal, 30) + .foregroundStyle(.gray100) } - CustomButtonView(title: "저장하기") { - saveInbodyData() - if !profileNavigationPathFinder.isFirstEnteredApp { + if onboardingNavigationPathFinder.isFirstEnteredApp { + CustomButtonView(title: "저장하기") { + saveInbodyData() onboardingNavigationPathFinder.addPath(option: .onboardingEndView) - } else { - profileNavigationPathFinder.popToRoot() - tabViewModel.isHidden = false } - } - if !profileNavigationPathFinder.isFirstEnteredApp { + CustomButtonView(title: "건너뛰기") { onboardingNavigationPathFinder.addPath(option: .onboardingEndView) + }.padding(.bottom, 20) + } else { + CustomButtonView(title: "저장하기") { + saveInbodyData() + profileNavigationPathFinder.popToRoot() + tabViewModel.isHidden = false } + .padding(.bottom, 20) } } } .navigationBarBackButtonHidden() - + .background( + Rectangle() + .foregroundStyle(.white) + ) + .ignoresSafeArea() .gesture( TapGesture() .onEnded { _ in @@ -89,7 +99,9 @@ struct InbodyInputView: View { } ) .onAppear { - tabViewModel.isHidden = true + if !onboardingNavigationPathFinder.isFirstEnteredApp { + tabViewModel.isHidden = true + } } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift index 2bf4bef9..ecbb525b 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift @@ -8,23 +8,33 @@ import SwiftUI struct OnboardingLoadingView: View { - @EnvironmentObject var navigationPathFinder: NavigationPathFinder + @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder + @EnvironmentObject var profileNavigationPathFinder: NavigationPathFinder @EnvironmentObject var viewModel: AzureInbodyViewModel var body: some View { - VStack { - OnboardingGaugeView(progress: 6) + ZStack { + Color.white.ignoresSafeArea() + VStack { + if onboardingNavigationPathFinder.isFirstEnteredApp { + OnboardingGaugeView(progress: 6) + } + Text("🧐") + .font(.customFont(size: 200, weight: .bold)) - Text("🧐") - .font(.customFont(size: 200, weight: .bold)) - - Text("분석중...") - .font(.customFont(size: 20, weight: .bold)) + Text("분석중...") + .font(.customFont(size: 20, weight: .bold)) + } } .onReceive(viewModel.$isLoading) { isLoading in if !isLoading { print("-------------로딩 완료----------------") - navigationPathFinder.addPath(option: .inbodyFixView) + if onboardingNavigationPathFinder.isFirstEnteredApp { + onboardingNavigationPathFinder.addPath(option: .inbodyFixView) + } + else if !profileNavigationPathFinder.isFirstEnteredApp { + profileNavigationPathFinder.addPath(option: .inbodyFixView) + } } } .navigationBarBackButtonHidden() diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift index 415a9da4..b613ab0c 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift @@ -8,7 +8,7 @@ import SwiftUI struct OnboardingSelectUserInfoView: View { - @EnvironmentObject var navigationPathFinder: NavigationPathFinder + @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder @EnvironmentObject var memberViewModel : MemberViewModel @EnvironmentObject var profilleSettingViewModel : ProfileSettingViewModel @@ -86,7 +86,7 @@ struct OnboardingSelectUserInfoView: View { CustomButtonView(title: "입력하기") { // TODO: API POST 로직 추가 - navigationPathFinder.addPath(option: .inbodyAddView) + onboardingNavigationPathFinder.addPath(option: .inbodyAddView) } .navigationBarBackButtonHidden() } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift index 87156482..814565b3 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift @@ -9,18 +9,35 @@ import SwiftUI struct InbodyInputSelectView: View { @EnvironmentObject var navigationPathFinder: NavigationPathFinder + @EnvironmentObject var tabViewModel: TabViewModel var body: some View { - VStack { HStack { + Button { + navigationPathFinder.popPath() + tabViewModel.isHidden = false + } label: { + Image("Chevron-left") + } + + Spacer() + + Text("인바디 수정") + .font(.customFont(size: 22, weight: .bold)) + .foregroundStyle(.gray100) + Spacer() + } + .padding(.horizontal, 20) + + Spacer() + + HStack { Text("인바디를 등록하세요") .font(.customFont(size: 20, weight: .bold)) .foregroundStyle(.gray100) - Spacer() } - .padding(.top, 32) .padding(.bottom, 56) ZStack { @@ -40,16 +57,22 @@ struct InbodyInputSelectView: View { CustomButtonView(title: "사진찍기") { navigationPathFinder.addPath(option: .inbodyAddView) - }.padding(.bottom, 10) + } + .padding(.vertical, 10) CustomButtonView(title: "수기입력") { navigationPathFinder.addPath(option: .inbodyInputView) } } - .background(.white) + .background(.white) + .navigationBarBackButtonHidden() + .onAppear { + tabViewModel.isHidden = true + } } } #Preview { InbodyInputSelectView() + .environmentObject(TabViewModel()) } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift index 9796ec83..a9d577f3 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/ViewOptions.swift @@ -66,6 +66,7 @@ enum ProfileViewOptions: Hashable, ViewOptions { case inbodyInputView case inbodyInputSelectView case inbodyAddView + case onboardingLoadingView case inbodyFixView @ViewBuilder func view() -> some View { @@ -85,6 +86,8 @@ enum ProfileViewOptions: Hashable, ViewOptions { InbodyInputSelectView() case .inbodyAddView: InbodyAddView() + case .onboardingLoadingView: + OnboardingLoadingView() case .inbodyFixView: InbodyFixView() } From 4360b9487ee5fe323140e7d80a67977f8038b567 Mon Sep 17 00:00:00 2001 From: uk10105 Date: Fri, 23 Aug 2024 08:40:32 +0900 Subject: [PATCH 7/9] . --- .../Sources/Onboarding/Views/OnboardingWelcomView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingWelcomView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingWelcomView.swift index d30e587b..e5a01b14 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingWelcomView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingWelcomView.swift @@ -13,7 +13,6 @@ struct OnboardingWelcomView: View { var body: some View { VStack { OnboardingGaugeView(progress: 1) - // .padding(.bottom, 44) VStack(alignment: .center, content: { Text("반가워요 핑! \n 저는 운동 교관 피오에요 핑! \n 오늘부터 운동 습관을 잡아줄게요 핑!") From 8e7a3da8b6108539af14091208fa883aefa68212 Mon Sep 17 00:00:00 2001 From: doyeonjeong Date: Mon, 14 Apr 2025 23:08:50 +0900 Subject: [PATCH 8/9] =?UTF-8?q?=F0=9F=90=9B=20::=20=EB=AD=94=EA=B0=80=20?= =?UTF-8?q?=EA=B3=A0=EC=B9=9C=20=EA=B2=83=20=EA=B0=99=EC=9D=80=EB=8D=B0=20?= =?UTF-8?q?=EA=B8=B0=EC=96=B5=20=EB=82=98=EC=A7=80=20=EC=95=8A=EC=9D=8C=20?= =?UTF-8?q?...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/exercise/exercise.controller.ts | 2 +- .../src/exercise/exercise.entity.ts | 2 +- .../FebirdApp.xcodeproj/project.pbxproj | 14 ++--- .../ViewModels/ExerciseDetector.swift | 54 +++++++++++-------- .../ViewModels/ExerciseGuideViewModel.swift | 3 +- .../ViewModels/ExerciseTimerViewModel.swift | 27 ++++++---- .../NetworkService/NetworkManager.swift | 19 ++++--- .../Onboarding/Views/InbodyAddView.swift | 28 ++++++++++ .../Onboarding/Views/InbodyFixView.swift | 12 +++++ .../Onboarding/Views/InbodyInputView.swift | 11 ++++ .../Onboarding/Views/OnboardingEndView.swift | 3 +- .../Views/OnboardingLoadingView.swift | 8 +++ .../Views/OnboardingSelectUserInfoView.swift | 16 ++++-- .../Profile/Views/InbodyInputSelectView.swift | 9 ++++ .../NavigationPathFinder.swift | 2 +- 15 files changed, 155 insertions(+), 55 deletions(-) diff --git a/Backend/febird-api/src/exercise/exercise.controller.ts b/Backend/febird-api/src/exercise/exercise.controller.ts index f0e3f889..46a06f4f 100644 --- a/Backend/febird-api/src/exercise/exercise.controller.ts +++ b/Backend/febird-api/src/exercise/exercise.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Param } from '@nestjs/common'; +99999999import { Controller, Get, Param } from '@nestjs/common'; import { ExerciseService } from './exercise.service'; @Controller('exercise') diff --git a/Backend/febird-api/src/exercise/exercise.entity.ts b/Backend/febird-api/src/exercise/exercise.entity.ts index 5b267ca7..81cf8376 100644 --- a/Backend/febird-api/src/exercise/exercise.entity.ts +++ b/Backend/febird-api/src/exercise/exercise.entity.ts @@ -20,4 +20,4 @@ export class Exercise { @OneToMany(() => Routine, (routine) => routine.exercise) routines: Routine[]; -} \ No newline at end of file +} diff --git a/Frontend-iOS/FebirdApp/FebirdApp.xcodeproj/project.pbxproj b/Frontend-iOS/FebirdApp/FebirdApp.xcodeproj/project.pbxproj index c0c05fe8..812b3279 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp.xcodeproj/project.pbxproj +++ b/Frontend-iOS/FebirdApp/FebirdApp.xcodeproj/project.pbxproj @@ -59,7 +59,6 @@ 8F0F48062C63723F004E3B86 /* RoutineViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F0F48052C63723F004E3B86 /* RoutineViewModel.swift */; }; 8F0F48082C637261004E3B86 /* LevelViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F0F48072C637261004E3B86 /* LevelViewModel.swift */; }; 8F0F480A2C6372EA004E3B86 /* ExerciseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F0F48092C6372EA004E3B86 /* ExerciseViewModel.swift */; }; - 8F0F48132C637905004E3B86 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 8F0F48122C637905004E3B86 /* Alamofire */; }; 8F0F48152C63795A004E3B86 /* HistoryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F0F48142C63795A004E3B86 /* HistoryViewModel.swift */; }; 8F0F48172C637985004E3B86 /* MemberViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F0F48162C637985004E3B86 /* MemberViewModel.swift */; }; 8F8A77E72C5E7AF9008E61D7 /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F8A77E62C5E7AF9008E61D7 /* SettingsViewModel.swift */; }; @@ -67,6 +66,7 @@ 8F8A77EC2C5F554F008E61D7 /* UserProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F8A77EB2C5F554F008E61D7 /* UserProfile.swift */; }; 8F8A77EE2C5F56BD008E61D7 /* ProfileSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F8A77ED2C5F56BD008E61D7 /* ProfileSettingViewModel.swift */; }; 8F8A77F02C5F734B008E61D7 /* SettingHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F8A77EF2C5F734B008E61D7 /* SettingHeaderView.swift */; }; + 8F910D7E2CB7926600FCDB6A /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 8F910D7D2CB7926600FCDB6A /* Alamofire */; }; 8F92DF7A2C4B93730071F336 /* ExerciseGuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F92DF792C4B93730071F336 /* ExerciseGuideView.swift */; }; 8F92DF7C2C4B9A390071F336 /* CustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F92DF7B2C4B9A390071F336 /* CustomNavigationBar.swift */; }; 8F92DF7E2C4BA9750071F336 /* ExerciseGuideListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F92DF7D2C4BA9750071F336 /* ExerciseGuideListView.swift */; }; @@ -341,7 +341,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8F0F48132C637905004E3B86 /* Alamofire in Frameworks */, + 8F910D7E2CB7926600FCDB6A /* Alamofire in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -918,7 +918,7 @@ ); name = FebirdApp; packageProductDependencies = ( - 8F0F48122C637905004E3B86 /* Alamofire */, + 8F910D7D2CB7926600FCDB6A /* Alamofire */, ); productName = FebirdApp; productReference = 3EF6F0492C36937E00EEF18F /* FebirdApp.app */; @@ -994,7 +994,7 @@ mainGroup = 3EF6F0402C36937D00EEF18F; packageReferences = ( 8F0F48102C6375A9004E3B86 /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */, - 8F0F48112C637905004E3B86 /* XCRemoteSwiftPackageReference "Alamofire" */, + 8F910D7C2CB7926600FCDB6A /* XCRemoteSwiftPackageReference "Alamofire" */, ); productRefGroup = 3EF6F04A2C36937E00EEF18F /* Products */; projectDirPath = ""; @@ -1561,7 +1561,7 @@ minimumVersion = 0.56.1; }; }; - 8F0F48112C637905004E3B86 /* XCRemoteSwiftPackageReference "Alamofire" */ = { + 8F910D7C2CB7926600FCDB6A /* XCRemoteSwiftPackageReference "Alamofire" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/Alamofire/Alamofire.git"; requirement = { @@ -1572,9 +1572,9 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 8F0F48122C637905004E3B86 /* Alamofire */ = { + 8F910D7D2CB7926600FCDB6A /* Alamofire */ = { isa = XCSwiftPackageProductDependency; - package = 8F0F48112C637905004E3B86 /* XCRemoteSwiftPackageReference "Alamofire" */; + package = 8F910D7C2CB7926600FCDB6A /* XCRemoteSwiftPackageReference "Alamofire" */; productName = Alamofire; }; /* End XCSwiftPackageProductDependency section */ diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseDetector.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseDetector.swift index 3bfccef6..175403bf 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseDetector.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseDetector.swift @@ -9,24 +9,30 @@ import SwiftUI import Vision import AVFoundation +/** + - Vision: 머신 비전 프레임워크로, 이미지 분석 및 비디오 처리에 사용할 수 있습니다. 이 코드는 사람의 신체 포즈를 인식하는 데 사용됩니다. + - AVFoundation: 비디오와 오디오 캡처 및 처리를 위한 프레임워크입니다. 카메라 세션을 설정하고 비디오 데이터를 캡처합니다. + - Combine: @Published 속성을 사용하여 데이터의 변화를 관찰하고, UI와의 바인딩을 쉽게 관리합니다. + */ + class ExerciseDetector: NSObject, ObservableObject { - @Published var currentExercise: ExerciseType = .overheadClap - @Published var count: Int = 0 - @Published var cameraPermissionStatus: AVAuthorizationStatus = .notDetermined - @Published var isDetecting: Bool = false - @Published var currentJoints: [VNHumanBodyPoseObservation.JointName] = [] - @Published var lastObservation: VNHumanBodyPoseObservation? + @Published var currentExercise: ExerciseType = .overheadClap // 현재 운동 종류 + @Published var count: Int = 0 // 운동 동작 카운트 + @Published var cameraPermissionStatus: AVAuthorizationStatus = .notDetermined // 카메라 권한 상태 + @Published var isDetecting: Bool = false // 현재 동작 인식 여부 + @Published var currentJoints: [VNHumanBodyPoseObservation.JointName] = [] // 현재 인식된 관절 목록 + @Published var lastObservation: VNHumanBodyPoseObservation? // 마지막 관절 관측 결과 - var captureSession: AVCaptureSession? - var videoDataOutput: AVCaptureVideoDataOutput? - var previewLayer: AVCaptureVideoPreviewLayer? + var captureSession: AVCaptureSession? // 비디오 캡처 세션 + var videoDataOutput: AVCaptureVideoDataOutput? // 비디오 데이터 출력 + var previewLayer: AVCaptureVideoPreviewLayer? // 비디오 미리보기 레이어 - private var lastPlayedSound: SystemSoundID? + private var lastPlayedSound: SystemSoundID? // 마지막으로 재생된 소리의 ID var exerciseStateString: String { switch currentExercise { case .overheadClap: - return clappingState.rawValue + return clappingState.rawValue // 현재 운동 상태 문자열 반환 case .downwardPunch: return downwardPunchState.rawValue case .sumoSquat: @@ -34,10 +40,11 @@ class ExerciseDetector: NSObject, ObservableObject { } } - var clappingState: ClappingState = .start - var downwardPunchState: DownwardPunchState = .standing - var sumoSquatState: SumoSquatState = .standing + var clappingState: ClappingState = .start // 박수 운동 상태 + var downwardPunchState: DownwardPunchState = .standing // 아래로 주먹치기 운동 상태 + var sumoSquatState: SumoSquatState = .standing // 스모 스쿼트 운동 상태 + /// 운동 상태를 초기화하는 메서드 func resetExerciseState() { switch currentExercise { case .overheadClap: @@ -49,29 +56,32 @@ class ExerciseDetector: NSObject, ObservableObject { } } + /// 동작 인식을 시작하거나 중지하는 메서드 func toggleDetection() { - isDetecting.toggle() + isDetecting.toggle() // 인식 상태 전환 if isDetecting { - startDetecting() + startDetecting() // 인식 시작 } else { - stopDetecting() + stopDetecting() // 인식 중지 } } + /// 동작 인식을 시작하는 메서드 func startDetecting() { - isDetecting = true + isDetecting = true // 인식 상태 설정 if captureSession == nil { - setupCaptureSession() + setupCaptureSession() // 캡처 세션 설정 } DispatchQueue.global(qos: .userInitiated).async { [weak self] in - self?.captureSession?.startRunning() + self?.captureSession?.startRunning() // 비디오 캡처 세션 시작 } } + /// 동작 인식을 중지하는 메서드 func stopDetecting() { - isDetecting = false + isDetecting = false // 인식 상태 해제 DispatchQueue.global(qos: .userInitiated).async { [weak self] in - self?.captureSession?.stopRunning() + self?.captureSession?.stopRunning() // 비디오 캡처 세션 중지 } } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseGuideViewModel.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseGuideViewModel.swift index 37b99635..cab7ae7b 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseGuideViewModel.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseGuideViewModel.swift @@ -15,10 +15,11 @@ class ExerciseGuideViewModel: ObservableObject { "팔을 천천히 내리면서 시작 자세로 돌아옵니다." ] + /// 비디오를 로드하여 재생합니다. func loadVideo() { guard let url = URL(string: "https://strfeo.blob.core.windows.net/exercise-video/466512^Overhead_Clap^Shoulders.mp4") else { return } let player = AVPlayer(url: url) self.player = player - player.play() + player.play() // 비디오 재생 } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseTimerViewModel.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseTimerViewModel.swift index c8ded677..4bb8c75a 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseTimerViewModel.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Exercise/ViewModels/ExerciseTimerViewModel.swift @@ -16,45 +16,50 @@ class ExerciseTimerViewModel: ObservableObject { private var timer: Timer? init(initialSeconds: Int = 10) { - self.timerSeconds = initialSeconds + self.timerSeconds = initialSeconds // 초기 타이머 설정 } + /// 시간을 감소시킵니다. func decreaseTime() { if timerSeconds > 5 { - timerSeconds -= 5 + timerSeconds -= 5 // 최소 5초로 유지 } } + /// 시간을 증가시킵니다. func increaseTime() { - timerSeconds += 5 + timerSeconds += 5 // 5초 증가 } + /// 시간을 문자열 형태로 변환합니다. func timeString() -> String { let minutes = timerSeconds / 60 let remainingSeconds = timerSeconds % 60 - return String(format: "%02d:%02d", minutes, remainingSeconds) + return String(format: "%02d:%02d", minutes, remainingSeconds) // "MM:SS" 형식 } + /// 타이머를 시작합니다. func startTimer(completion: @escaping () -> Void) { - isTimerRunning = true + isTimerRunning = true // 타이머 실행 중 설정 timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] _ in guard let self = self else { return } if self.timerSeconds > 0 { - self.timerSeconds -= 1 + self.timerSeconds -= 1 // 1초마다 감소 } else { - self.stopTimer() - completion() + self.stopTimer() // 타이머 중지 + completion() // 완료 핸들러 호출 } } } + /// 타이머를 중지합니다. func stopTimer() { - timer?.invalidate() + timer?.invalidate() // 타이머 무효화 timer = nil - isTimerRunning = false + isTimerRunning = false // 타이머 실행 중 설정 해제 } deinit { - stopTimer() + stopTimer() // 메모리 해제 시 타이머 중지 } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/NetworkManager.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/NetworkManager.swift index 54a64a40..f7fd26b5 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/NetworkManager.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/NetworkService/NetworkManager.swift @@ -25,15 +25,20 @@ enum NetworkError: Error, LocalizedError { } } -enum HTTPMethod: String { - case get = "GET" - case post = "POST" - case patch = "PATCH" - case delete = "DELETE" -} +//enum HTTPMethod: String { +// case get = "GET" +// case post = "POST" +// case patch = "PATCH" +// case delete = "DELETE" +//} class NetworkManager { - static func fetch(_ endpoint: String, method: HTTPMethod = .get, body: T? = nil, multipartData: [String: Data]? = nil) async throws -> T { + static func fetch( + _ endpoint: String, + method: HTTPMethod = .get, + body: T? = nil, + multipartData: [String: Data]? = nil + ) async throws -> T { let requestURL = URL(string: Config.baseURL + endpoint)! return try await withCheckedThrowingContinuation { continuation in diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift index 964ccf55..f8a34480 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyAddView.swift @@ -11,7 +11,14 @@ struct InbodyAddView: View { @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder @EnvironmentObject var profileNavigationPathFinder: NavigationPathFinder @EnvironmentObject var viewModel: AzureInbodyViewModel +<<<<<<< HEAD @EnvironmentObject var tabViewModel: TabViewModel +======= + @EnvironmentObject var onboardingNavigationPathFinder: NavigationPathFinder + @EnvironmentObject var profileNavigationPathFinder: NavigationPathFinder + + @State private var showOnboardingGaugeView = true +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) @State private var showSkipButton = true @State private var showActionSheet = false @State private var showImagePicker = false @@ -22,7 +29,11 @@ struct InbodyAddView: View { var body: some View { VStack { +<<<<<<< HEAD if onboardingNavigationPathFinder.isFirstEnteredApp { +======= + if !navigationPathFinder.isFirstEnteredApp { +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) OnboardingGaugeView(progress: 3) .padding(.top, 40) } @@ -91,10 +102,17 @@ struct InbodyAddView: View { } .padding(.bottom, 20) } +<<<<<<< HEAD else { CustomButtonView(title: "등록하기") { showActionSheet = true } +======= + .padding(.top, 40) + + CustomButtonView(title: "건너뛰기") { + onboardingNavigationPathFinder.addPath(option: .inbodyInputView) +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) } } else { @@ -106,6 +124,7 @@ struct InbodyAddView: View { CustomButtonView(title: "분석하기") { viewModel.analyzeImage(image!) // 분석하는 로직 if viewModel.isLoading && viewModel.error == nil { +<<<<<<< HEAD if onboardingNavigationPathFinder.isFirstEnteredApp { onboardingNavigationPathFinder.addPath(option: .onboardingLoadingView) } @@ -113,6 +132,9 @@ struct InbodyAddView: View { profileNavigationPathFinder.addPath(option: .onboardingLoadingView) } +======= + onboardingNavigationPathFinder.addPath(option: .onboardingLoadingView) +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) } } } @@ -138,6 +160,7 @@ struct InbodyAddView: View { isImageSelected = true } }) +<<<<<<< HEAD } .background(Color.white.ignoresSafeArea()) .preferredColorScheme(.light) @@ -147,5 +170,10 @@ struct InbodyAddView: View { tabViewModel.isHidden = true } } +======= + .background(Color.gray10.ignoresSafeArea()) + .navigationBarBackButtonHidden() + } +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift index 4af39c01..39fb8a1a 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyFixView.swift @@ -23,6 +23,7 @@ struct InbodyFixView: View { var body: some View { ScrollView { +<<<<<<< HEAD if onboardingNavigationPathFinder.isFirstEnteredApp { OnboardingGaugeView(progress: 4) } @@ -45,6 +46,12 @@ struct InbodyFixView: View { .padding(.horizontal, 20) } +======= + if !navigationPathFinder.isFirstEnteredApp { + OnboardingGaugeView(progress: 4) + } + +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) Text("정보가 다르게 인식됐나요? \n여기에서 수정할 수 있어요 😉") .font(.customFont(size: 20, weight: .bold)) .foregroundStyle(Color(red: 0.07, green: 0.07, blue: 0.08)) @@ -76,8 +83,13 @@ struct InbodyFixView: View { } } } + .background(Color.gray10.ignoresSafeArea()) .navigationBarBackButtonHidden() +<<<<<<< HEAD .preferredColorScheme(.light) +======= + .padding(.vertical, 60) +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) } private func saveInbodyData() { diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift index d3e14cfe..f7e4bcdf 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/InbodyInputView.swift @@ -23,6 +23,7 @@ struct InbodyInputView: View { var body: some View { VStack { +<<<<<<< HEAD if onboardingNavigationPathFinder.isFirstEnteredApp { OnboardingGaugeView(progress: 5) .padding(.top, 50) @@ -35,6 +36,11 @@ struct InbodyInputView: View { } label: { Image("Chevron-left") } +======= + if !navigationPathFinder.isFirstEnteredApp { + OnboardingGaugeView(progress: 5) + } +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) Spacer() @@ -98,11 +104,16 @@ struct InbodyInputView: View { UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) } ) +<<<<<<< HEAD .onAppear { if !onboardingNavigationPathFinder.isFirstEnteredApp { tabViewModel.isHidden = true } } +======= + .background(Color.gray10.ignoresSafeArea()) + .padding(.vertical, 60) +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) } private func saveInbodyData() { diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingEndView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingEndView.swift index 46b2d9c6..474ab409 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingEndView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingEndView.swift @@ -27,7 +27,7 @@ struct OnboardingEndView: View { Spacer() Button(action: { - navigationPathFinder.isFirstEnteredApp = false + navigationPathFinder.setIsFirstenteredApp(false) navigationPathFinder.popToRoot() }, label: { Text("메인으로 이동하기") @@ -41,6 +41,7 @@ struct OnboardingEndView: View { }) .padding(.horizontal, 24) .navigationBarBackButtonHidden() + .padding(.vertical, 60) } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift index ecbb525b..6b8de964 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingLoadingView.swift @@ -13,6 +13,7 @@ struct OnboardingLoadingView: View { @EnvironmentObject var viewModel: AzureInbodyViewModel var body: some View { +<<<<<<< HEAD ZStack { Color.white.ignoresSafeArea() VStack { @@ -21,6 +22,12 @@ struct OnboardingLoadingView: View { } Text("🧐") .font(.customFont(size: 200, weight: .bold)) +======= + VStack { + if !navigationPathFinder.isFirstEnteredApp { + OnboardingGaugeView(progress: 6) + } +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) Text("분석중...") .font(.customFont(size: 20, weight: .bold)) @@ -38,6 +45,7 @@ struct OnboardingLoadingView: View { } } .navigationBarBackButtonHidden() + .padding(.vertical, 60) } } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift index b613ab0c..18da9fcd 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Onboarding/Views/OnboardingSelectUserInfoView.swift @@ -13,12 +13,14 @@ struct OnboardingSelectUserInfoView: View { @EnvironmentObject var profilleSettingViewModel : ProfileSettingViewModel @State private var name = "" - @State private var age = "" + @State private var age = "26" @State private var selectedGender: UserProfile.Gender = .female var body: some View { VStack { - OnboardingGaugeView(progress: 3) + if !navigationPathFinder.isFirstEnteredApp { + OnboardingGaugeView(progress: 3) + } ScrollView { VStack(spacing: 28) { HStack { @@ -28,7 +30,7 @@ struct OnboardingSelectUserInfoView: View { Spacer() } - OnboardingProfileSelectionView(selectedImageIndex: 1) + OnboardingProfileSelectionView(selectedImageIndex: 5) HStack { Text("어떻게 불러드릴까요?") @@ -86,7 +88,15 @@ struct OnboardingSelectUserInfoView: View { CustomButtonView(title: "입력하기") { // TODO: API POST 로직 추가 +<<<<<<< HEAD onboardingNavigationPathFinder.addPath(option: .inbodyAddView) +======= + if name.isEmpty { + Alert(title: Text("이름을 입력해주세요!")) + } else { + navigationPathFinder.addPath(option: .inbodyAddView) + } +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) } .navigationBarBackButtonHidden() } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift index 814565b3..8abeba7b 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Profile/Views/InbodyInputSelectView.swift @@ -64,8 +64,17 @@ struct InbodyInputSelectView: View { navigationPathFinder.addPath(option: .inbodyInputView) } } +<<<<<<< HEAD .background(.white) .navigationBarBackButtonHidden() +======= + .padding(.vertical, 50) + .background( + Rectangle() + .foregroundStyle(.white) + ) + .ignoresSafeArea() +>>>>>>> 6d4c919 (🐛 :: 뭔가 고친 것 같은데 기억 나지 않음 ...) .onAppear { tabViewModel.isHidden = true } diff --git a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/NavigationPathFinder.swift b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/NavigationPathFinder.swift index f53a3d91..0fb050a9 100644 --- a/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/NavigationPathFinder.swift +++ b/Frontend-iOS/FebirdApp/FebirdApp/Sources/Utils/NavigationComponents/NavigationPathFinder.swift @@ -9,7 +9,7 @@ import SwiftUI class NavigationPathFinder: ObservableObject { @Published var path: [Option] = [] - @Published var isFirstEnteredApp: Bool + @Published var isFirstEnteredApp: Bool = true init() { isFirstEnteredApp = UserDefaults.standard.bool(forKey: "IsFirstEnteredApp") From 4c6d9f3dbf8116586a43f04b16f896e49febf10a Mon Sep 17 00:00:00 2001 From: doyeonjeong Date: Mon, 14 Apr 2025 23:09:38 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=E2=9E=95=20::=20Data=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ColorChipsData.zip | Bin 0 -> 2904 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ColorChipsData.zip diff --git a/ColorChipsData.zip b/ColorChipsData.zip new file mode 100644 index 0000000000000000000000000000000000000000..ba5b67b5df7186ff4ec1e1910a1dc6330352ccd3 GIT binary patch literal 2904 zcmb7G3pAAL8XnA;kq|~MMJjUL5@~eO%3Tc8*s^sK#Z>gpT97NfEhq&i^~xnb~yKI=)$J-kJ6P>wUlH{hsIfUMyMwiiChG zQ4sFD@#D`gF^D3>gyKt~nq2Yr^EdSj@I2~ZF9LzrnU{GPPX5CSjDf+z5I*QE@YN#vQ^*@>Q-E|b7G+*w+>$na%oh8LAPxq5kjXA% zXMX8KDr>+@#^;&Lp3vcxi^{UT(;^r~9rmD+lV3;+~wwpM-)^ zeF975u9&8Vn^%b(Khj}%X;3hISkDjLI{jkb5a!-8QA4fngmRyCN$XP_9~KQqn4T>z zrvQxr_s&Jd+oBEu2xQ-OR8&e}fH#@I#Rax0@7wKq&~3A;QF{+;IPBc90FIfCH*VU2 z89SlLZ7q0zn)g=U4m|RpBmUEZC()HEt zm4X9bC^MNoZF$QQN8%og7<9`>w#*gLT~t|*9cM5dXA8|oF!}Cws@dIM&W=P9ChhXc zM=U*0g+M2}u^}OwMj|uSqcOS1s&FClK>oyDumRNMr?=9827oZR4M^ZQ)^Q;SL~eTn zNCXm&K;`1E0`MyU=L*Ix=USVBCco9*6TNgYY9vspGd^*$IwLDrb+;9hzpw25K;Ub5 zwJIY=dg|f$M>8uGa(d$@V-_O{Ix)^jPyCnPmqnb;a(ea)e6@9ldg0}H{V+Wv|7F#n zdD^QeLi<2KdDNtldtq@#NQT!up^7H6YN6UKE_Bhsf+&1-l##-64ZLvOF*ws=aV{jK zI<0p#CH={65^a}D;lRS!XZmmxNmRe>b5JdY)9Rc-w*9qhDd%Y8A=fjJ*WOnAHc;6i zd80zwuUy`^ExOQ*8b!mMe=UwUR*Y|H3TRDRRZ~&S7LgY^w|quyCF2x?-%s}be7zdY z#|Uai*hfl2IY9D^bD>AI6|xqqRa-<$&WGQeXF3IcNRWs)J=DTkU*d4OIO~ZVPVp;0 zp_T>~!>32u+(yge$yn&%(d?-Vq5|WDUUOYQ(}SM{_ZRHg^WtRdc#{u_T8jQ3xkmZ%qy^-$TYF&=erOE{b$w1N6*Y@y;~Oqi8W@% zJoXV#6-Xa0v7&j1RRlc!hO(}B`v*{{AzWrX1{k#qU=|p+FpKLL37zkg)_!jPuV;AR zsODZoXCj&CZW(HYvsA}gy=bd%GwrK)?Q6pd<*TFgP--kh{u`uvngIKbfRsQSduq6( zJ(lh$`=(1>GQ!b$LN3j-yuEFIjDu?_00EAe`{TYK5zq>_aW14-9!SlAiuP~U3L%(4 zz2xoB;})d=7SJugxCIj{>AcSyEV6ZINli3Ft4svN?pq$tFb*^3{z%w+eb+cp!FFq~DM*q%uBwDwvFWh~O+V#O#@^eYW~+Y3*fLso-4d8Ax*| zY2a7KH*8Il5U5x$3Uva#Y}G-WONhulcbG3gLir;S8=$>cKXJ~a{s$v!k3h}T2tKv5 z3tg{WcfeAi$x|Y6vg6vPJHaC+G#!lFx%Wz;62dFTYvB4{)PKj*)udn3lVds$WiEIl z*A-L@s(l5Xx*13WALAEo>N+#vVl{WWjhF&uhWL-QBB9J)JcTC_Q<1`$mv zf=w*QbQviA9XW4tnhFbP=(=e&DQ2V>Hk54K{*o@=UcA57K@pzn*~>Z|b3Ogi1?A)) z?UnNhzpOkb9%qe9`4qp_tYE!6UREz3)%wAzfJVLk{rA(w>4)M~FaG4>HB;;PkWxJy z;!H9ZiLeewHTlotCTwGDo}=0wt1SBm<;htJX+h0wk^VmnuoAKE~rc@IU)_6#4k(K$DAm8fG02Ym$4)O|KRH7?maNxg>XS;x2X; zC+sF*QWF2?bxKi?{3#Yt2#5-c=Ho{S{O_3qcx_|N7=dBO6Ucv(Z_XgR_c%C%Y%XTF z&GzK~|3tEh0W1R!1-!Q