From 32a1cbd71391932d6b12d77fccca48b3ce12802f Mon Sep 17 00:00:00 2001 From: cchanmi <113524@naver.com> Date: Sun, 8 Dec 2024 20:06:20 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[FEAT]=20#235=20-=20SwiftUI=20=EA=B8=B0?= =?UTF-8?q?=EC=A4=80=20=EB=A1=9C=EB=94=A9=EB=B7=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj | 2 +- .../SwiftUI}/HighlightModifier.swift | 0 .../DiaryComplete/CoachingStore.swift | 2 + .../DiaryComplete/CoachingView.swift | 160 +++++++++--------- .../DiaryComplete/SmemeLoadingView.swift | 26 +++ 5 files changed, 113 insertions(+), 77 deletions(-) rename Smeem-iOS/Smeem-iOS/Global/{ => Extensions/SwiftUI}/HighlightModifier.swift (100%) create mode 100644 Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift diff --git a/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj b/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj index 54476ff4..9eddff69 100644 --- a/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj +++ b/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj @@ -574,6 +574,7 @@ 373D29912CBFE16B00A559A3 /* SwiftUI */ = { isa = PBXGroup; children = ( + 377B3BEF2CF613710086E0BC /* HighlightModifier.swift */, 373D29922CBFE17B00A559A3 /* View+.swift */, ); path = SwiftUI; @@ -618,7 +619,6 @@ 37A574B929FE209F00312453 /* Resources */, 4AC4B82B2A2F9F5300E147AA /* Constants */, 37EB69E42A4B3B6B00075E4E /* Protocols */, - 377B3BEF2CF613710086E0BC /* HighlightModifier.swift */, ); path = Global; sourceTree = ""; diff --git a/Smeem-iOS/Smeem-iOS/Global/HighlightModifier.swift b/Smeem-iOS/Smeem-iOS/Global/Extensions/SwiftUI/HighlightModifier.swift similarity index 100% rename from Smeem-iOS/Smeem-iOS/Global/HighlightModifier.swift rename to Smeem-iOS/Smeem-iOS/Global/Extensions/SwiftUI/HighlightModifier.swift diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift index 959b925e..dffa541a 100644 --- a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift +++ b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift @@ -49,9 +49,11 @@ final class CoachingStore: Store, ObservableObject { do { state.detailDiaryResponse = try await service.detailDiaryAPI(diaryID: ID) state.isEnabled = state.detailDiaryResponse.correctionMaxCount-state.detailDiaryResponse.correctionCount == 0 ? false : true + state.isLoadingView = false } catch let error { let error = error as? SmeemError state.toastErrorMessage = error + state.isLoadingView = false } } case .coachingButton(let ID): diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift index 2e1f211e..85749905 100644 --- a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift +++ b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift @@ -13,88 +13,96 @@ struct CoachingView: View { @StateObject var store: CoachingStore var body: some View { - - if store.state.hiddenIndex != 1 { - HStack() { - Spacer() - Button(action: { - let homeVC = HomeViewController() - homeVC.handlePostDiaryAPI(with: store.state.diaryResponse) - changeRootViewController(homeVC) - }, - label: { - Text("닫기") - .tint(.black) - }) - .padding(.trailing, 18) - } - .frame(height: 66) - } - - // MARK: 일기 작성 완료 화면 - if store.state.hiddenIndex == 0 { - Button(action: { - if store.state.isEnabled { - store.send(action: .coachingButton(diaryID: store.state.diaryResponse.diaryID)) - } - }) { - HStack { - Image("icnCrownMono") - .frame(width: 24, height: 24) - Text("하루 한 번 무료 AI 코칭") - .font(Font.custom("Pretendard", size: 16).weight(.bold)) - .lineSpacing(0.19) - .foregroundColor(.white) + // MARK: 네비뷰 + VStack { + if store.state.hiddenIndex != 1 { + HStack() { + Spacer() + Button(action: { + let homeVC = HomeViewController() + homeVC.handlePostDiaryAPI(with: store.state.diaryResponse) + changeRootViewController(homeVC) + }, + label: { + Text("닫기") + .tint(.black) + }) + .padding(.trailing, 18) + } + .frame(height: 66) } - } - .disabled(!store.state.isEnabled) - .frame(width: screenWidth-32, height: 48, alignment: .center) - .background { - if store.state.isEnabled { - LinearGradient( - stops: [ - Gradient.Stop(color: Color(red: 1, green: 0, blue: 0.02).opacity(0.2), location: 0.00), - Gradient.Stop(color: .white.opacity(0.2), location: 0.28), - Gradient.Stop(color: .white.opacity(0.2), location: 0.83), - Gradient.Stop(color: Color(red: 1, green: 0, blue: 0.02).opacity(0.2), location: 1.00), - ], - startPoint: UnitPoint(x: 0.15, y: -1.24), - endPoint: UnitPoint(x: 0.72, y: 3.4) - ) + + // MARK: 일기 작성 완료 화면 + if store.state.hiddenIndex == 0 { + Button(action: { + if store.state.isEnabled { + store.send(action: .coachingButton(diaryID: store.state.diaryResponse.diaryID)) + } + }) { + HStack { + Image("icnCrownMono") + .frame(width: 24, height: 24) + Text("하루 한 번 무료 AI 코칭") + .font(Font.custom("Pretendard", size: 16).weight(.bold)) + .lineSpacing(0.19) + .foregroundColor(.white) + } + } + .disabled(!store.state.isEnabled) + .frame(width: screenWidth-32, height: 48, alignment: .center) + .background { + if store.state.isEnabled { + LinearGradient( + stops: [ + Gradient.Stop(color: Color(red: 1, green: 0, blue: 0.02).opacity(0.2), location: 0.00), + Gradient.Stop(color: .white.opacity(0.2), location: 0.28), + Gradient.Stop(color: .white.opacity(0.2), location: 0.83), + Gradient.Stop(color: Color(red: 1, green: 0, blue: 0.02).opacity(0.2), location: 1.00), + ], + startPoint: UnitPoint(x: 0.15, y: -1.24), + endPoint: UnitPoint(x: 0.72, y: 3.4) + ) + } + } + .background(store.state.isEnabled ? Color(UIColor.point) : Color(UIColor.gray400)) + .cornerRadius(5) + + DiaryDetailView(diaryInformation: $store.state.detailDiaryResponse) + + Spacer() + + // MARK: 로티 화면 + } else if store.state.hiddenIndex == 1 { + VStack { + LottieView("smeemLoading") + .loopMode(.loop) + .frame(width: screenWidth, height: 164, alignment: .center) + + Text("AI 코치가 내 일기를 분석하고 있어요\n잠시만 기다려주세요") + .font(Font.custom("Pretendard", size: 16)) + .multilineTextAlignment(.center) + .foregroundColor(.black) + } + + // MARK: 첨삭 화면 + } else { + CoachingCompleteView(diaryText: $store.state.detailDiaryResponse.content, + coachingAppData: $store.state.coachingAppData) } + + // MARK: 첫 진입시 토스트뷰 실행 + SmemeToastView(type: $store.state.toastMessage) + SmeemErrorToastView(type: $store.state.toastErrorMessage) } - .background(store.state.isEnabled ? Color(UIColor.point) : Color(UIColor.gray400)) - .cornerRadius(5) - - DiaryDetailView(diaryInformation: $store.state.detailDiaryResponse) - .onAppear { - store.send(action: .detailDiaryAPI(diaryID: store.state.diaryResponse.diaryID)) + .overlay(alignment: .center) { + // MARK: 최상단바에 로딩뷰 + if store.state.isLoadingView { + SmemeLoadingView() } - - Spacer() - - // MARK: 로티 화면 - } else if store.state.hiddenIndex == 1 { - VStack { - LottieView("smeemLoading") - .loopMode(.loop) - .frame(width: screenWidth, height: 164, alignment: .center) - - Text("AI 코치가 내 일기를 분석하고 있어요\n잠시만 기다려주세요") - .font(Font.custom("Pretendard", size: 16)) - .multilineTextAlignment(.center) - .foregroundColor(.black) } - - // MARK: 첨삭 화면 - } else { - CoachingCompleteView(diaryText: $store.state.detailDiaryResponse.content, - coachingAppData: $store.state.coachingAppData) + .onAppear() { + store.send(action: .detailDiaryAPI(diaryID: store.state.diaryResponse.diaryID)) } - - // MARK: 첫 진입시 토스트뷰 실행 - SmemeToastView(type: $store.state.toastMessage) - SmeemErrorToastView(type: $store.state.toastErrorMessage) } } diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift new file mode 100644 index 00000000..4fec1bae --- /dev/null +++ b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift @@ -0,0 +1,26 @@ +// +// SmemeLoadingView.swift +// Smeem-iOS +// +// Created by 황찬미 on 11/26/24. +// + +import SwiftUI + +struct SmemeLoadingView: View { + + var body: some View { + HStack { + Spacer() + VStack { + Spacer() + ProgressView() + Spacer() + } + Spacer() + } + .ignoresSafeArea() + .background(Color.white.opacity(0.1)) // 반투명 배경 + .allowsHitTesting(true) // 로딩 중 터치 차단 + } +} From 4105d0d4218b03441fda395c055dfcead1d46f3d Mon Sep 17 00:00:00 2001 From: cchanmi <113524@naver.com> Date: Sun, 8 Dec 2024 20:47:32 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[FEAT]=20#235=20-=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20=ED=9B=84=20=EB=B2=84=ED=8A=BC=EC=83=89=20?= =?UTF-8?q?=EB=B0=94=EB=80=8C=EB=8A=94=20=ED=98=84=EC=83=81=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 --- .../Presentation/DiaryComplete/CoachingView.swift | 3 ++- .../Presentation/DiaryComplete/SmemeLoadingView.swift | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift index 85749905..83745c89 100644 --- a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift +++ b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift @@ -97,12 +97,13 @@ struct CoachingView: View { .overlay(alignment: .center) { // MARK: 최상단바에 로딩뷰 if store.state.isLoadingView { + SmemeEmptyView() SmemeLoadingView() } } .onAppear() { store.send(action: .detailDiaryAPI(diaryID: store.state.diaryResponse.diaryID)) - } + } } } diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift index 4fec1bae..a59a2526 100644 --- a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift +++ b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift @@ -24,3 +24,13 @@ struct SmemeLoadingView: View { .allowsHitTesting(true) // 로딩 중 터치 차단 } } + +struct SmemeEmptyView: View { + + var body: some View { + ZStack { + Color.white.ignoresSafeArea() + } + .animation(.easeInOut(duration: 0.5), value: true) // 0.5초 뒤에 서서히 사라짐 + } +} From 2079066203ed1d12257513cfa3974858280011b7 Mon Sep 17 00:00:00 2001 From: cchanmi <113524@naver.com> Date: Sun, 8 Dec 2024 20:50:40 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[CHORE]=20#235=20-=20=EC=BD=94=EC=B9=AD=20?= =?UTF-8?q?=ED=9B=84=20=EB=B3=80=EA=B2=BD=EB=90=9C=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/DiaryComplete/CoachingStore.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift index dffa541a..4e9966d4 100644 --- a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift +++ b/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift @@ -76,13 +76,13 @@ final class CoachingStore: Store, ObservableObject { func correctTextResult(_ count: Int) -> String { switch count { case 0: - return "완벽한 일기예요! 문장이 자연스럽고 오류가 없어요" + return "완벽한 일기예요!👍\n문장이 자연스럽고 오류가 없어요" case 1: - return "잘 작성했어요! 작은 부분만 다듬으면 완벽해요" + return "잘 작성했어요!🙌\n작은 부분만 다듬으면 완벽해요" case 2...: - return "대단해요! 몇가지 피드백을 준비해봤어요." + return "대단해요!🥳🎉\n몇 가지 피드백을 준비해 봤어요." default: - return "대단해요! 몇가지 피드백을 준비해봤어요." + return "대단해요!🥳🎉\n몇 가지 피드백을 준비해 봤어요." } } } From 53c52a75178c2b7a016e8155cefdfebd4005b70b Mon Sep 17 00:00:00 2001 From: cchanmi <113524@naver.com> Date: Sun, 8 Dec 2024 20:54:42 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[CHORE]=20#235=20-=20=ED=8F=B4=EB=8D=94?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj | 15 ++++++++++++--- .../LoadingView}/SmemeLoadingView.swift | 0 .../SmeemComponent/Toast}/SmemeToastView.swift | 0 .../View}/CoachingView.swift | 2 +- .../CoachingCompleteView.swift | 0 .../DiaryDetailView.swift | 0 .../{DiaryComplete => Store}/CoachingStore.swift | 0 7 files changed, 13 insertions(+), 4 deletions(-) rename Smeem-iOS/Smeem-iOS/{Presentation/DiaryComplete => Global/UIComponents/SmeemComponent/LoadingView}/SmemeLoadingView.swift (100%) rename Smeem-iOS/Smeem-iOS/{Presentation/DiaryComplete => Global/UIComponents/SmeemComponent/Toast}/SmemeToastView.swift (100%) rename Smeem-iOS/Smeem-iOS/Presentation/{DiaryComplete => Coaching/View}/CoachingView.swift (99%) rename Smeem-iOS/Smeem-iOS/Presentation/{Coaching => Components}/CoachingCompleteView.swift (100%) rename Smeem-iOS/Smeem-iOS/Presentation/{DiaryComplete => Components}/DiaryDetailView.swift (100%) rename Smeem-iOS/Smeem-iOS/Presentation/{DiaryComplete => Store}/CoachingStore.swift (100%) diff --git a/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj b/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj index 9eddff69..8cfdedeb 100644 --- a/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj +++ b/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj @@ -462,6 +462,10 @@ /* Begin PBXFileSystemSynchronizedRootGroup section */ 377B3BF12CF618B90086E0BC /* SwiftUI */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SwiftUI; sourceTree = ""; }; + 4A17370E2D05C02E00B772C3 /* Toast */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Toast; sourceTree = ""; }; + 4A17370F2D05C03600B772C3 /* LoadingView */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = LoadingView; sourceTree = ""; }; + 4A1737152D05C06E00B772C3 /* Components */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Components; sourceTree = ""; }; + 4A1737192D05C07100B772C3 /* Store */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Store; sourceTree = ""; }; 4AB3494D2CF229D10047C484 /* UIViewConponent */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (370BD0B62CFB660C009560DB /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = UIViewConponent; sourceTree = ""; }; 4AB3494E2CF22A070047C484 /* Global */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Global; sourceTree = ""; }; 4AB3494F2CF22A250047C484 /* Button */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Button; sourceTree = ""; }; @@ -473,7 +477,6 @@ 4AB349BA2CF23B770047C484 /* Coaching */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Coaching; sourceTree = ""; }; 4AB349BC2CF23D210047C484 /* Coaching */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Coaching; sourceTree = ""; }; 4AF050CE2CE9DE010055BC3F /* Coaching */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Coaching; sourceTree = ""; }; - 4AF050D72CEA01E20055BC3F /* DiaryComplete */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = DiaryComplete; sourceTree = ""; }; 4AF050D82CEA01EA0055BC3F /* Coaching */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Coaching; sourceTree = ""; }; /* End PBXFileSystemSynchronizedRootGroup section */ @@ -627,7 +630,8 @@ isa = PBXGroup; children = ( 4AF050D82CEA01EA0055BC3F /* Coaching */, - 4AF050D72CEA01E20055BC3F /* DiaryComplete */, + 4A1737192D05C07100B772C3 /* Store */, + 4A1737152D05C06E00B772C3 /* Components */, 4AC047232A8FCA9700EBDC0E /* AuthManagement */, 4AA6FEE72C3ABD7C00E588E9 /* ResignSummray */, 4AA5E4B52BF24CEB00F308C8 /* BadgeBottomSheet */, @@ -1018,6 +1022,8 @@ 4A1EE9552A4DFB86007BFEF3 /* SmeemComponent */ = { isa = PBXGroup; children = ( + 4A17370F2D05C03600B772C3 /* LoadingView */, + 4A17370E2D05C02E00B772C3 /* Toast */, 4AB349502CF22A2E0047C484 /* TextView */, 4AB3494F2CF22A250047C484 /* Button */, 4AB3494E2CF22A070047C484 /* Global */, @@ -1752,6 +1758,10 @@ ); fileSystemSynchronizedGroups = ( 377B3BF12CF618B90086E0BC /* SwiftUI */, + 4A17370E2D05C02E00B772C3 /* Toast */, + 4A17370F2D05C03600B772C3 /* LoadingView */, + 4A1737152D05C06E00B772C3 /* Components */, + 4A1737192D05C07100B772C3 /* Store */, 4AB3494D2CF229D10047C484 /* UIViewConponent */, 4AB3494E2CF22A070047C484 /* Global */, 4AB3494F2CF22A250047C484 /* Button */, @@ -1762,7 +1772,6 @@ 4AB349562CF22BFF0047C484 /* EditUser */, 4AB349BA2CF23B770047C484 /* Coaching */, 4AF050CE2CE9DE010055BC3F /* Coaching */, - 4AF050D72CEA01E20055BC3F /* DiaryComplete */, 4AF050D82CEA01EA0055BC3F /* Coaching */, ); name = "Smeem-iOS"; diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift b/Smeem-iOS/Smeem-iOS/Global/UIComponents/SmeemComponent/LoadingView/SmemeLoadingView.swift similarity index 100% rename from Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeLoadingView.swift rename to Smeem-iOS/Smeem-iOS/Global/UIComponents/SmeemComponent/LoadingView/SmemeLoadingView.swift diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeToastView.swift b/Smeem-iOS/Smeem-iOS/Global/UIComponents/SmeemComponent/Toast/SmemeToastView.swift similarity index 100% rename from Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/SmemeToastView.swift rename to Smeem-iOS/Smeem-iOS/Global/UIComponents/SmeemComponent/Toast/SmemeToastView.swift diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift b/Smeem-iOS/Smeem-iOS/Presentation/Coaching/View/CoachingView.swift similarity index 99% rename from Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift rename to Smeem-iOS/Smeem-iOS/Presentation/Coaching/View/CoachingView.swift index 83745c89..28d4c25b 100644 --- a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingView.swift +++ b/Smeem-iOS/Smeem-iOS/Presentation/Coaching/View/CoachingView.swift @@ -103,7 +103,7 @@ struct CoachingView: View { } .onAppear() { store.send(action: .detailDiaryAPI(diaryID: store.state.diaryResponse.diaryID)) - } + } } } diff --git a/Smeem-iOS/Smeem-iOS/Presentation/Coaching/CoachingCompleteView.swift b/Smeem-iOS/Smeem-iOS/Presentation/Components/CoachingCompleteView.swift similarity index 100% rename from Smeem-iOS/Smeem-iOS/Presentation/Coaching/CoachingCompleteView.swift rename to Smeem-iOS/Smeem-iOS/Presentation/Components/CoachingCompleteView.swift diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/DiaryDetailView.swift b/Smeem-iOS/Smeem-iOS/Presentation/Components/DiaryDetailView.swift similarity index 100% rename from Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/DiaryDetailView.swift rename to Smeem-iOS/Smeem-iOS/Presentation/Components/DiaryDetailView.swift diff --git a/Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift b/Smeem-iOS/Smeem-iOS/Presentation/Store/CoachingStore.swift similarity index 100% rename from Smeem-iOS/Smeem-iOS/Presentation/DiaryComplete/CoachingStore.swift rename to Smeem-iOS/Smeem-iOS/Presentation/Store/CoachingStore.swift From 540f4c35e8f630fb5c30b5b77805f24ef496d097 Mon Sep 17 00:00:00 2001 From: cchanmi <113524@naver.com> Date: Sun, 8 Dec 2024 21:30:52 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[DELETE]=20#235=20-=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj | 17 ----- .../SwiftUI/CoachingComparisonView.swift | 48 ++++++------ .../CoachingCompletedView.swift | 38 ---------- .../CoachingExplanationView.swift | 38 ---------- .../CustomSegmentedControl.swift | 74 ------------------- .../SwiftUINavigationView.swift | 42 ----------- .../Components/CoachingCompleteView.swift | 33 ++++++--- 7 files changed, 43 insertions(+), 247 deletions(-) delete mode 100644 Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingCompletedView.swift delete mode 100644 Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingExplanationView.swift delete mode 100644 Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CustomSegmentedControl.swift delete mode 100644 Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/SwiftUINavigationView.swift diff --git a/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj b/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj index 8cfdedeb..0169dc70 100644 --- a/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj +++ b/Smeem-iOS/Smeem-iOS.xcodeproj/project.pbxproj @@ -446,27 +446,12 @@ A3D7ECB62A26566A009857D6 /* EditNicknameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditNicknameViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ -/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - 370BD0B62CFB660C009560DB /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - CoachingComparisonView.swift, - CoachingCompletedView.swift, - CoachingExplanationView.swift, - CustomSegmentedControl.swift, - SwiftUINavigationView.swift, - ); - target = 4A8FFA4B29C9E1FD00FB76C0 /* Smeem-iOS */; - }; -/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ - /* Begin PBXFileSystemSynchronizedRootGroup section */ 377B3BF12CF618B90086E0BC /* SwiftUI */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SwiftUI; sourceTree = ""; }; 4A17370E2D05C02E00B772C3 /* Toast */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Toast; sourceTree = ""; }; 4A17370F2D05C03600B772C3 /* LoadingView */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = LoadingView; sourceTree = ""; }; 4A1737152D05C06E00B772C3 /* Components */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Components; sourceTree = ""; }; 4A1737192D05C07100B772C3 /* Store */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Store; sourceTree = ""; }; - 4AB3494D2CF229D10047C484 /* UIViewConponent */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (370BD0B62CFB660C009560DB /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = UIViewConponent; sourceTree = ""; }; 4AB3494E2CF22A070047C484 /* Global */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Global; sourceTree = ""; }; 4AB3494F2CF22A250047C484 /* Button */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Button; sourceTree = ""; }; 4AB349502CF22A2E0047C484 /* TextView */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = TextView; sourceTree = ""; }; @@ -678,7 +663,6 @@ isa = PBXGroup; children = ( 377B3BF12CF618B90086E0BC /* SwiftUI */, - 4AB3494D2CF229D10047C484 /* UIViewConponent */, 371107DB2ACAB4E3007A4AC2 /* Base */, 4A1EE9552A4DFB86007BFEF3 /* SmeemComponent */, ); @@ -1762,7 +1746,6 @@ 4A17370F2D05C03600B772C3 /* LoadingView */, 4A1737152D05C06E00B772C3 /* Components */, 4A1737192D05C07100B772C3 /* Store */, - 4AB3494D2CF229D10047C484 /* UIViewConponent */, 4AB3494E2CF22A070047C484 /* Global */, 4AB3494F2CF22A250047C484 /* Button */, 4AB349502CF22A2E0047C484 /* TextView */, diff --git a/Smeem-iOS/Smeem-iOS/Global/UIComponents/SwiftUI/CoachingComparisonView.swift b/Smeem-iOS/Smeem-iOS/Global/UIComponents/SwiftUI/CoachingComparisonView.swift index 1de1dbdd..586d08df 100644 --- a/Smeem-iOS/Smeem-iOS/Global/UIComponents/SwiftUI/CoachingComparisonView.swift +++ b/Smeem-iOS/Smeem-iOS/Global/UIComponents/SwiftUI/CoachingComparisonView.swift @@ -7,28 +7,28 @@ import SwiftUI +import SwiftUI + struct CoachingComparisonView: View { @Binding var coachingResponse: CoachingResponse - @State private var textHeight: CGFloat = 0 // Text의 높이를 저장할 변수 var body: some View { VStack(spacing: 20) { VStack(alignment: .leading, spacing: 8) { - HStack { - Rectangle() - .frame(width: 2, height: textHeight) - .foregroundStyle(Color(UIColor.black)) + HStack(spacing: 8) { + + GeometryReader { geomerty in + Rectangle() + .frame(height: geomerty.size.height) + .foregroundStyle(Color(UIColor.black)) + } + .frame(width: 2) Text("나의 일기") .font(Font.custom("Pretendard", size: 16).weight(.medium)) .foregroundColor(Color(UIColor.black)) - .background(GeometryReader { geometry in - Color.clear - .preference(key: TextHeightPreferenceKey.self, value: geometry.size.height) - }) - } - .onPreferenceChange(TextHeightPreferenceKey.self) { value in - textHeight = value + + Spacer() } Text(coachingResponse.originalSentence) @@ -39,14 +39,19 @@ struct CoachingComparisonView: View { .padding(.trailing, 18) VStack(alignment: .leading, spacing: 8) { - HStack { - Rectangle() - .frame(width: 2, height: textHeight) - .foregroundStyle(Color(UIColor.point)) + HStack(spacing: 8) { + GeometryReader { geomerty in + Rectangle() + .frame(height: geomerty.size.height) + .foregroundStyle(Color(UIColor.point)) + } + .frame(width: 2) Text("고친 문장") .font(Font.custom("Pretendard", size: 16).weight(.medium)) .foregroundColor(Color(UIColor.point)) + + Spacer() } Text(coachingResponse.correctedSentence) @@ -59,14 +64,3 @@ struct CoachingComparisonView: View { } } } - -struct TextHeightPreferenceKey: PreferenceKey { - static var defaultValue: CGFloat = 0 - static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { - value = nextValue() - } -} - -//#Preview { -// CoachingComparisonView() -//} diff --git a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingCompletedView.swift b/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingCompletedView.swift deleted file mode 100644 index 55199b66..00000000 --- a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingCompletedView.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// CoachingTextView.swift -// Smeem-iOS -// -// Created by Joon Baek on 2024/10/16. -// - -import SwiftUI - -struct CoachingTextView: View { - @Binding var coachingText: String - - var body: some View { - - VStack(spacing: 16) { - Text("일기를 잘 작성하셨어요! \n내용이 명확하고 흥미로웠습니다.\n이제 몇 가지 문법적 오류를 수정해 볼까요?") - .font(Font.custom("Pretendard", size: 16)) - // Colors 상수 등록 필요 - .foregroundColor(Color(UIColor.smeemBlack)) - .frame(maxWidth: .infinity, alignment: .leading) - - ScrollView { - Text(coachingText) - .font(Font.custom("Pretendard", size: 16)) - .foregroundColor(Color(UIColor.gray400)) - .lineSpacing(0.375) - } - - Spacer() - } - .padding(.horizontal, screenWidth * 0.048) - } -} -// -//@available (iOS 17, *) -//#Preview { -// CoachingTextView(coachingText: "") -//} diff --git a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingExplanationView.swift b/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingExplanationView.swift deleted file mode 100644 index 8686a472..00000000 --- a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CoachingExplanationView.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// CoachingExplanationView.swift -// Smeem-iOS -// -// Created by 황찬미 on 11/16/24. -// - -import SwiftUI - -struct CoachingExplanationView: View { - @Binding var coachingResponse: CoachingResponse - - var body: some View { - HStack() { - - ZStack(alignment: .leading) { - GeometryReader { geomerty in - Rectangle() - .fill(Color(UIColor.gray100)) - .frame(height: geomerty.size.height) - .cornerRadius(3) - } - - Text(coachingResponse.reason) - .font(Font.custom("Pretendard", size: 14).weight(.regular)) - .foregroundStyle(.black) - .padding(12) - } - .fixedSize(horizontal: false, vertical: true) - .padding(.leading, 18) - .padding(.trailing, 18) - } - } -} - -//#Preview { -// CoachingExplanationView() -//} diff --git a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CustomSegmentedControl.swift b/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CustomSegmentedControl.swift deleted file mode 100644 index 9576441a..00000000 --- a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/CustomSegmentedControl.swift +++ /dev/null @@ -1,74 +0,0 @@ -// -// CustomSegmentedControl.swift -// Smeem-iOS -// -// Created by Joon Baek on 2024/10/22. -// - -import SwiftUI - -struct CustomSegmentedControl: View { - @Binding var selectedIndex: Int - let options: [String] - - var body: some View { - HStack(spacing: 0) { - ForEach(options.indices, id: \.self) { index in - SegmentButton( - title: options[index], - isSelected: selectedIndex == index, - action: { selectedIndex = index } - ) - } - } - .background(Color.gray.opacity(0.2)) - .cornerRadius(8) - } -} - -struct SegmentButton: View { - let title: String - let isSelected: Bool - let action: () -> Void - - var body: some View { - Button(action: action) { - Text(title) - .padding(.vertical, 8) - .padding(.horizontal, 11) - .frame(maxWidth: .infinity) - .background(backgroundColor) - .foregroundColor(foregroundColor) - .font(Font(UIFont.c5)) - } - } - - private var backgroundColor: Color { - isSelected ? (isCoachingOn ? Color(UIColor.point) : Color(UIColor.gray200)) : Color(UIColor.gray100) - } - - private var foregroundColor: Color { - isSelected ? .white : Color(UIColor.gray500) - } - - private var isCoachingOn: Bool { - title == "코칭 ON" - } -} - -struct PreviewWrapper: View { - @State private var selectedIndex = 0 - let options = ["코칭 OFF", "코칭 ON"] - - var body: some View { - CustomSegmentedControl(selectedIndex: $selectedIndex, options: options) - .frame(height: 40) - .padding(117) - } -} - -@available(iOS 17.0, *) -#Preview { - PreviewWrapper() -} - diff --git a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/SwiftUINavigationView.swift b/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/SwiftUINavigationView.swift deleted file mode 100644 index 0c80a744..00000000 --- a/Smeem-iOS/Smeem-iOS/Global/UIComponents/UIViewConponent/SwiftUINavigationView.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// SwiftUINavigationView.swift -// Smeem-iOS -// -// Created by Joon Baek on 2024/10/18. -// - -import SwiftUI - -struct SwiftUINavigationView: View { - @State private var selectedIndex = 0 - let options = ["코칭 OFF", "코칭 ON"] - - var body: some View { - HStack() { - Button(action: /*@START_MENU_TOKEN@*/{}/*@END_MENU_TOKEN@*/, - label: { - Image("icnBack") - .imageScale(.large) - }) - .padding(.leading, 10) - -// CustomSegmentedControl(selectedIndex: $selectedIndex, options: options) -// .frame(height: 32) -// .padding(65) - - Spacer() - - Button(action: /*@START_MENU_TOKEN@*/{}/*@END_MENU_TOKEN@*/, - label: { - Text("닫기") - .tint(.black) - }) - .padding(.trailing, 18) - } - .frame(height: 66) - } -} - -#Preview { - SwiftUINavigationView() -} diff --git a/Smeem-iOS/Smeem-iOS/Presentation/Components/CoachingCompleteView.swift b/Smeem-iOS/Smeem-iOS/Presentation/Components/CoachingCompleteView.swift index e22388f9..38e3bca9 100644 --- a/Smeem-iOS/Smeem-iOS/Presentation/Components/CoachingCompleteView.swift +++ b/Smeem-iOS/Smeem-iOS/Presentation/Components/CoachingCompleteView.swift @@ -18,23 +18,34 @@ struct CoachingCompleteView: View { VStack(spacing: 15) { VStack(spacing: 16) { ScrollView { - HStack { - Text(diaryText) - .modifier(HighlightModifier( - diaryText: diaryText, - corrections: coachingAppData.corrections, - highlightIndex: currentIndex - )) - .font(Font.custom("Pretendard", size: 16)) - .foregroundColor(Color(UIColor.gray400)) - .lineSpacing(0.375) + VStack(spacing: 16) { + HStack { + Text(coachingAppData.correctResultText) + .font(Font.custom("Pretendard", size: 16)) + .foregroundColor(Color(UIColor.black)) + .lineSpacing(0.375) + Spacer() + } - Spacer() + HStack { + Text(diaryText) + .modifier(HighlightModifier( + diaryText: diaryText, + corrections: coachingAppData.corrections, + highlightIndex: currentIndex + )) + .font(Font.custom("Pretendard", size: 16)) + .foregroundColor(Color(UIColor.gray400)) + .lineSpacing(0.375) + + Spacer() + } } } Spacer() } + .padding(.top) .padding(.horizontal, screenWidth * 0.048) VStack(spacing: 20) { From f7bdf5859e04590f49fc8d9a3fd34d4136f79fc4 Mon Sep 17 00:00:00 2001 From: cchanmi <113524@naver.com> Date: Sun, 8 Dec 2024 22:10:35 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[CHORE]=20#235=20-=20yml=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 --- .github/workflows/smeemDev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/smeemDev.yml b/.github/workflows/smeemDev.yml index e1d4a674..ca303b36 100644 --- a/.github/workflows/smeemDev.yml +++ b/.github/workflows/smeemDev.yml @@ -6,6 +6,8 @@ name: Swift on: push: branches: [ "develop" ] + pull_request: + branches: [ "develop" ] jobs: build: