From 445cc13890cbbfb8d11062f5b750c70276b48a8d Mon Sep 17 00:00:00 2001 From: Seokki-Kwon Date: Wed, 13 Nov 2024 14:42:39 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=EC=97=B4=EB=9E=8C=EC=8B=A4=20?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=EC=97=B0=EC=9E=A5=EC=8B=9C=20=EB=8B=A4?= =?UTF-8?q?=EA=B1=B4=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HongikYeolgong2.xcodeproj/project.pbxproj | 4 +-- .../Interactors/StudySessionInteractor.swift | 32 +++++++++++++++---- HongikYeolgong2/Injected/AppState.swift | 1 + .../Presentation/Home/HomeView.swift | 2 +- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/HongikYeolgong2.xcodeproj/project.pbxproj b/HongikYeolgong2.xcodeproj/project.pbxproj index 86c15fa..a476fa9 100644 --- a/HongikYeolgong2.xcodeproj/project.pbxproj +++ b/HongikYeolgong2.xcodeproj/project.pbxproj @@ -1463,7 +1463,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"HongikYeolgong2/Resources/Preview Content\""; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = P4D4ZQC4YF; @@ -1510,7 +1510,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"HongikYeolgong2/Resources/Preview Content\""; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = P4D4ZQC4YF; diff --git a/HongikYeolgong2/Domain/Interactors/StudySessionInteractor.swift b/HongikYeolgong2/Domain/Interactors/StudySessionInteractor.swift index caf404e..bf01325 100644 --- a/HongikYeolgong2/Domain/Interactors/StudySessionInteractor.swift +++ b/HongikYeolgong2/Domain/Interactors/StudySessionInteractor.swift @@ -14,6 +14,7 @@ protocol StudySessionInteractor { func pauseStudy() func resumeStudy() func addTime() + func uploadStudySession(startTime: Date, endTime: Date) func setStartTime(_ startTime: Date) } @@ -73,12 +74,7 @@ final class StudySessionInteractorImpl: StudySessionInteractor { let startTime: Date = appState.value.studySession.startTime let endTime: Date = .now - studySessionRepository - .uploadStudyRecord(startTime: startTime, endTime: endTime) - .sink { _ in - } receiveValue: { _ in - } - .store(in: cancleBag) + uploadStudySession(startTime: startTime, endTime: endTime) } /// 스터디 일시중지 @@ -102,7 +98,13 @@ final class StudySessionInteractorImpl: StudySessionInteractor { /// 열람실 이용시간을 연장합니다. func addTime() { + let startTime: Date = appState.value.studySession.startTime + let endTime: Date = .now + + uploadStudySession(startTime: startTime, endTime: endTime) + appState.bulkUpdate { appState in + appState.studySession.startTime = .now appState.studySession.endTime += addedTime appState.studySession.remainingTime += addedTime } @@ -113,11 +115,27 @@ final class StudySessionInteractorImpl: StudySessionInteractor { registerNotification(for: .extensionAvailable, endTimeInMinute: remainingTime) registerNotification(for: .urgent, endTimeInMinute: remainingTime) } + + /// 서버에 스터디세션을 업로드 합니다. + /// - Parameters: + /// - startTime: 시작시간 + /// - endTime: 종료시간 + func uploadStudySession(startTime: Date, endTime: Date) { + studySessionRepository + .uploadStudyRecord(startTime: startTime, endTime: endTime) + .sink { _ in + } receiveValue: { _ in + } + .store(in: cancleBag) + } /// 열람실 이용 시작시간을 설정합니다. /// - Parameter startTime: 시작시간 func setStartTime(_ startTime: Date) { - appState[\.studySession.startTime] = startTime + appState.bulkUpdate { appState in + appState.studySession.startTime = startTime + appState.studySession.firstStartTime = startTime + } } /// 열람실 이용종료 Notification을 등록합니다. diff --git a/HongikYeolgong2/Injected/AppState.swift b/HongikYeolgong2/Injected/AppState.swift index c1278d8..0306d2f 100644 --- a/HongikYeolgong2/Injected/AppState.swift +++ b/HongikYeolgong2/Injected/AppState.swift @@ -36,6 +36,7 @@ extension AppState { /// 열람실 이용상태를 관리하는 구조체 입니다. struct StudySession: Equatable { var isStudying = false + var firstStartTime: Date = .now var startTime: Date = .now var endTime: Date = .now var remainingTime: TimeInterval = 0 diff --git a/HongikYeolgong2/Presentation/Home/HomeView.swift b/HongikYeolgong2/Presentation/Home/HomeView.swift index eb2fded..d9bf840 100644 --- a/HongikYeolgong2/Presentation/Home/HomeView.swift +++ b/HongikYeolgong2/Presentation/Home/HomeView.swift @@ -137,7 +137,7 @@ struct StudyContentControllerView: View { if studySession.isStudying { VStack(spacing: 32.adjustToScreenHeight) { StudyPeriodView( - startTime: studySession.startTime, + startTime: studySession.firstStartTime, endTime: studySession.endTime ) StudyTimerView( From d622312f7a84dd9962001cecbc547df868d8bb0a Mon Sep 17 00:00:00 2001 From: Seokki-Kwon Date: Wed, 13 Nov 2024 16:15:58 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EA=B0=81=EB=A9=94=EB=89=B4=20?= =?UTF-8?q?=EC=83=81=EB=8B=A8=20=EC=97=AC=EB=B0=B1=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 7 ++++--- HongikYeolgong2/Presentation/Home/HomeView.swift | 13 +++++++------ .../Home/WeeklyStudy/WeeklyStudyView.swift | 2 +- .../Presentation/Ranking/RankingView.swift | 4 ++-- .../Record/Component/CalendarView.swift | 2 +- .../Presentation/Record/RecordView.swift | 4 ++-- .../Presentation/Setting/SettingView.swift | 13 +++++++++---- 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/HongikYeolgong2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/HongikYeolgong2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 158393f..3602ef9 100644 --- a/HongikYeolgong2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/HongikYeolgong2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "37f87f153a7df0e69f7682478910cd31cbff8c536dc79a044414e38ba896c24f", "pins" : [ { "identity" : "abseil-cpp-binary", @@ -50,8 +51,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/firebase/firebase-ios-sdk.git", "state" : { - "revision" : "8328630971a8fdd8072b36bb22bef732eb15e1f0", - "version" : "11.4.0" + "revision" : "dbdfdc44bee8b8e4eaa5ec27eb12b9338f3f2bc1", + "version" : "11.5.0" } }, { @@ -181,5 +182,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/HongikYeolgong2/Presentation/Home/HomeView.swift b/HongikYeolgong2/Presentation/Home/HomeView.swift index d9bf840..9da7e56 100644 --- a/HongikYeolgong2/Presentation/Home/HomeView.swift +++ b/HongikYeolgong2/Presentation/Home/HomeView.swift @@ -24,12 +24,7 @@ struct HomeView: View { @State private var shouldShowWebView = false var body: some View { - VStack { - NavigationLink("", - destination: WebViewWithNavigation(url: SecretKeys.roomStatusUrl, title: "좌석") - .edgesIgnoringSafeArea(.bottom), - isActive: $shouldShowWebView) - + VStack(spacing: 0) { WeeklyStudyView(studyRecords: studyRecords) StudyContentControllerView( @@ -48,6 +43,12 @@ struct HomeView: View { addButtonTapped: { shouldShowAddTimeModal.toggle() } ) ) + + NavigationLink("", + destination: WebViewWithNavigation(url: SecretKeys.roomStatusUrl, title: "좌석") + .edgesIgnoringSafeArea(.bottom), + isActive: $shouldShowWebView) + .frame(width: 0, height: 0) } .systemOverlay(isPresented: $shouldShowTimePicker) { TimePickerView( diff --git a/HongikYeolgong2/Presentation/Home/WeeklyStudy/WeeklyStudyView.swift b/HongikYeolgong2/Presentation/Home/WeeklyStudy/WeeklyStudyView.swift index ed8312e..5dcf87d 100644 --- a/HongikYeolgong2/Presentation/Home/WeeklyStudy/WeeklyStudyView.swift +++ b/HongikYeolgong2/Presentation/Home/WeeklyStudy/WeeklyStudyView.swift @@ -22,6 +22,6 @@ struct WeeklyStudyView: View { ) } } - .padding(.top, 33.adjustToScreenHeight) + .padding(.top, 32.adjustToScreenHeight) } } diff --git a/HongikYeolgong2/Presentation/Ranking/RankingView.swift b/HongikYeolgong2/Presentation/Ranking/RankingView.swift index e840345..3ef3a85 100644 --- a/HongikYeolgong2/Presentation/Ranking/RankingView.swift +++ b/HongikYeolgong2/Presentation/Ranking/RankingView.swift @@ -36,8 +36,8 @@ struct RankingView: View { }) .frame(width: 36.adjustToScreenWidth, height: 36.adjustToScreenHeight) } - } - .padding(EdgeInsets(top: 33.adjustToScreenHeight, + } + .padding(EdgeInsets(top: 32.adjustToScreenHeight, leading: 32.adjustToScreenWidth, bottom: 17.adjustToScreenHeight, trailing: 32.adjustToScreenWidth)) diff --git a/HongikYeolgong2/Presentation/Record/Component/CalendarView.swift b/HongikYeolgong2/Presentation/Record/Component/CalendarView.swift index 41c8339..78f2df2 100644 --- a/HongikYeolgong2/Presentation/Record/Component/CalendarView.swift +++ b/HongikYeolgong2/Presentation/Record/Component/CalendarView.swift @@ -43,7 +43,6 @@ struct CaledarView: View { .font(.suite(size: 24, weight: .bold)) .foregroundStyle(Color.gray100) - Spacer().frame(width: 8.adjustToScreenWidth) Text(seletedDate.getYearString()) @@ -68,6 +67,7 @@ struct CaledarView: View { } } + Spacer().frame(height: 12.adjustToScreenHeight) // weakday diff --git a/HongikYeolgong2/Presentation/Record/RecordView.swift b/HongikYeolgong2/Presentation/Record/RecordView.swift index d7c0293..bd0afd2 100644 --- a/HongikYeolgong2/Presentation/Record/RecordView.swift +++ b/HongikYeolgong2/Presentation/Record/RecordView.swift @@ -12,9 +12,9 @@ struct RecordView: View { @State var studyTime = StudyTime() var body: some View { - VStack(spacing: 13.adjustToScreenHeight) { + VStack(spacing: 0.adjustToScreenHeight) { - CaledarView() + CaledarView() Spacer() // 기록 정보 출력부분 diff --git a/HongikYeolgong2/Presentation/Setting/SettingView.swift b/HongikYeolgong2/Presentation/Setting/SettingView.swift index ce0655c..542e2c4 100644 --- a/HongikYeolgong2/Presentation/Setting/SettingView.swift +++ b/HongikYeolgong2/Presentation/Setting/SettingView.swift @@ -6,29 +6,34 @@ struct SettingView: View { @Environment(\.injected) var injected: DIContainer @Environment(\.injected.interactors.userDataInteractor) var userDataInteractor @State private var userProfile = UserProfile() - + @State private var shouldShowWithdrawModal = false @State private var shouldShowLogoutModal = false @State private var shouldShowNotice = false @State private var shouldShowQna = false + var body: some View { VStack(alignment:.leading, spacing: 0){ NavigationLink("", destination: WebViewWithNavigation(url: SecretKeys.noticeUrl, title: "공지사항") - .edgesIgnoringSafeArea(.bottom), + .edgesIgnoringSafeArea(.bottom), isActive: $shouldShowNotice) + .frame(width: 0, height: 0) NavigationLink("", destination: WebViewWithNavigation(url: SecretKeys.qnaUrl, title: "문의사항") - .edgesIgnoringSafeArea(.bottom), + .edgesIgnoringSafeArea(.bottom), isActive: $shouldShowQna) + .frame(width: 0, height: 0) + VStack(alignment: .leading, spacing: 0) { HStack(spacing: 0) { Image(.settingIcon) .resizable() .frame(width: 55.adjustToScreenWidth, height: 55.adjustToScreenHeight) .padding(.trailing, 19) + Text(userProfile.nickname) .font(.pretendard(size: 16, weight: .regular), lineHeight: 26.adjustToScreenHeight) .padding(.trailing, 8) @@ -41,6 +46,7 @@ struct SettingView: View { .font(.pretendard(size: 16, weight: .regular), lineHeight: 26.adjustToScreenHeight) .foregroundStyle(.gray200) } + .padding(.top, 32.adjustToScreenHeight) .padding(.bottom, 20.adjustToScreenHeight) Button(action: { @@ -117,7 +123,6 @@ struct SettingView: View { HStack(alignment: .center, spacing: 0) { Spacer() Button(action: { -// injected.interactors.userDataInteractor.logout() shouldShowLogoutModal.toggle() }, label: { Text("로그아웃") From 40828207bd2e9e55b8b228b920565d2da1f9e691 Mon Sep 17 00:00:00 2001 From: Seokki-Kwon Date: Wed, 13 Nov 2024 16:19:36 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=EA=B8=B0=EB=A1=9D=ED=99=94=EB=A9=B4?= =?UTF-8?q?=20=EA=B0=84=EA=B2=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HongikYeolgong2/Presentation/Record/RecordView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HongikYeolgong2/Presentation/Record/RecordView.swift b/HongikYeolgong2/Presentation/Record/RecordView.swift index bd0afd2..e18b4a7 100644 --- a/HongikYeolgong2/Presentation/Record/RecordView.swift +++ b/HongikYeolgong2/Presentation/Record/RecordView.swift @@ -12,7 +12,7 @@ struct RecordView: View { @State var studyTime = StudyTime() var body: some View { - VStack(spacing: 0.adjustToScreenHeight) { + VStack(spacing: 13.adjustToScreenHeight) { CaledarView()