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.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/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..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( @@ -137,7 +138,7 @@ struct StudyContentControllerView: View { if studySession.isStudying { VStack(spacing: 32.adjustToScreenHeight) { StudyPeriodView( - startTime: studySession.startTime, + startTime: studySession.firstStartTime, endTime: studySession.endTime ) StudyTimerView( 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..e18b4a7 100644 --- a/HongikYeolgong2/Presentation/Record/RecordView.swift +++ b/HongikYeolgong2/Presentation/Record/RecordView.swift @@ -14,7 +14,7 @@ struct RecordView: View { var body: some View { VStack(spacing: 13.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("로그아웃")