diff --git a/Project_Timer.xcodeproj/project.pbxproj b/Project_Timer.xcodeproj/project.pbxproj index 91278f55..815b3162 100644 --- a/Project_Timer.xcodeproj/project.pbxproj +++ b/Project_Timer.xcodeproj/project.pbxproj @@ -50,7 +50,7 @@ 870800522B2C3A0800830B39 /* ServerURLResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870800512B2C3A0800830B39 /* ServerURLResponse.swift */; }; 870800542B2C3A5400830B39 /* ServerURLRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870800532B2C3A5400830B39 /* ServerURLRepository.swift */; }; 870800562B2C3AC600830B39 /* ServerURLRepositoryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870800552B2C3AC600830B39 /* ServerURLRepositoryInterface.swift */; }; - 870800582B2C3B0C00830B39 /* GetServerURLUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870800572B2C3B0C00830B39 /* GetServerURLUseCase.swift */; }; + 870800582B2C3B0C00830B39 /* GetServerURLUseCase_lagacy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870800572B2C3B0C00830B39 /* GetServerURLUseCase_lagacy.swift */; }; 8708005A2B2C3B5800830B39 /* GetServerURLUseCaseInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870800592B2C3B5800830B39 /* GetServerURLUseCaseInterface.swift */; }; 8708005C2B2C4D2D00830B39 /* AuthNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8708005B2B2C4D2D00830B39 /* AuthNetwork.swift */; }; 8708005F2B2C5F5F00830B39 /* AuthResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8708005E2B2C5F5F00830B39 /* AuthResponse.swift */; }; @@ -120,7 +120,12 @@ 8722104B2C2FF6E7003B97AD /* UpdateHistoryInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8722104A2C2FF6E7003B97AD /* UpdateHistoryInfo.swift */; }; 8722104D2C2FFA66003B97AD /* TTResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8722104C2C2FFA66003B97AD /* TTResponse.swift */; }; 8722104F2C2FFD41003B97AD /* JSONDecoder+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8722104E2C2FFD41003B97AD /* JSONDecoder+Extension.swift */; }; - 872210522C3007FD003B97AD /* FirebaseUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872210512C3007FD003B97AD /* FirebaseUseCase.swift */; }; + 872210522C3007FD003B97AD /* GetAppVersionUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872210512C3007FD003B97AD /* GetAppVersionUseCase.swift */; }; + 872210552C30094F003B97AD /* GetServerURLUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872210542C30094F003B97AD /* GetServerURLUseCase.swift */; }; + 872210572C3009DA003B97AD /* GetTiTiFunctionsUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872210562C3009DA003B97AD /* GetTiTiFunctionsUseCase.swift */; }; + 872210592C300A08003B97AD /* GetUpdateHistorysUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872210582C300A08003B97AD /* GetUpdateHistorysUseCase.swift */; }; + 8722105B2C300A5C003B97AD /* GetYoutubeLinkUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8722105A2C300A5C003B97AD /* GetYoutubeLinkUseCase.swift */; }; + 8722105D2C300A8C003B97AD /* GetSurveysUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8722105C2C300A8C003B97AD /* GetSurveysUseCase.swift */; }; 872C0EDB284ADD8300E8E3F2 /* SettingUpdateHistoryVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872C0EDA284ADD8300E8E3F2 /* SettingUpdateHistoryVC.swift */; }; 872C0EDE284AE52800E8E3F2 /* SettingFunctionsListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872C0EDD284AE52800E8E3F2 /* SettingFunctionsListVC.swift */; }; 872C0EE1284AE57200E8E3F2 /* SettingTiTiLabVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 872C0EE0284AE57200E8E3F2 /* SettingTiTiLabVC.swift */; }; @@ -495,7 +500,7 @@ 870800512B2C3A0800830B39 /* ServerURLResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerURLResponse.swift; sourceTree = ""; }; 870800532B2C3A5400830B39 /* ServerURLRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerURLRepository.swift; sourceTree = ""; }; 870800552B2C3AC600830B39 /* ServerURLRepositoryInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerURLRepositoryInterface.swift; sourceTree = ""; }; - 870800572B2C3B0C00830B39 /* GetServerURLUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetServerURLUseCase.swift; sourceTree = ""; }; + 870800572B2C3B0C00830B39 /* GetServerURLUseCase_lagacy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetServerURLUseCase_lagacy.swift; sourceTree = ""; }; 870800592B2C3B5800830B39 /* GetServerURLUseCaseInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetServerURLUseCaseInterface.swift; sourceTree = ""; }; 8708005B2B2C4D2D00830B39 /* AuthNetwork.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthNetwork.swift; sourceTree = ""; }; 8708005E2B2C5F5F00830B39 /* AuthResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthResponse.swift; sourceTree = ""; }; @@ -562,7 +567,12 @@ 8722104A2C2FF6E7003B97AD /* UpdateHistoryInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateHistoryInfo.swift; sourceTree = ""; }; 8722104C2C2FFA66003B97AD /* TTResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TTResponse.swift; sourceTree = ""; }; 8722104E2C2FFD41003B97AD /* JSONDecoder+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JSONDecoder+Extension.swift"; sourceTree = ""; }; - 872210512C3007FD003B97AD /* FirebaseUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirebaseUseCase.swift; sourceTree = ""; }; + 872210512C3007FD003B97AD /* GetAppVersionUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetAppVersionUseCase.swift; sourceTree = ""; }; + 872210542C30094F003B97AD /* GetServerURLUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetServerURLUseCase.swift; sourceTree = ""; }; + 872210562C3009DA003B97AD /* GetTiTiFunctionsUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetTiTiFunctionsUseCase.swift; sourceTree = ""; }; + 872210582C300A08003B97AD /* GetUpdateHistorysUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetUpdateHistorysUseCase.swift; sourceTree = ""; }; + 8722105A2C300A5C003B97AD /* GetYoutubeLinkUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetYoutubeLinkUseCase.swift; sourceTree = ""; }; + 8722105C2C300A8C003B97AD /* GetSurveysUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetSurveysUseCase.swift; sourceTree = ""; }; 872B7552296A625B00D24394 /* production.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = production.xcconfig; sourceTree = ""; }; 872C0EDA284ADD8300E8E3F2 /* SettingUpdateHistoryVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingUpdateHistoryVC.swift; sourceTree = ""; }; 872C0EDD284AE52800E8E3F2 /* SettingFunctionsListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingFunctionsListVC.swift; sourceTree = ""; }; @@ -1061,7 +1071,7 @@ 8708008A2B2D5A4400830B39 /* SyncLogRepositoryInterface.swift */, 873731D62B2E97C100D7BD9F /* NotificationRepositoryInterface.swift */, 875FAE302B1C70C2008F19D2 /* GetLatestVersionUseCase_lagacy.swift */, - 870800572B2C3B0C00830B39 /* GetServerURLUseCase.swift */, + 870800572B2C3B0C00830B39 /* GetServerURLUseCase_lagacy.swift */, 870800662B2C67E900830B39 /* AuthUseCase.swift */, 870800742B2D3C9A00830B39 /* DailysUseCase.swift */, 8708007E2B2D543500830B39 /* RecordTimesUseCase.swift */, @@ -1072,6 +1082,19 @@ path = lagacy; sourceTree = ""; }; + 872210532C300922003B97AD /* Firebase */ = { + isa = PBXGroup; + children = ( + 872210512C3007FD003B97AD /* GetAppVersionUseCase.swift */, + 872210542C30094F003B97AD /* GetServerURLUseCase.swift */, + 872210562C3009DA003B97AD /* GetTiTiFunctionsUseCase.swift */, + 872210582C300A08003B97AD /* GetUpdateHistorysUseCase.swift */, + 8722105A2C300A5C003B97AD /* GetYoutubeLinkUseCase.swift */, + 8722105C2C300A8C003B97AD /* GetSurveysUseCase.swift */, + ); + path = Firebase; + sourceTree = ""; + }; 872C0ED9284ADD6800E8E3F2 /* UpdateHistory */ = { isa = PBXGroup; children = ( @@ -1961,7 +1984,7 @@ 87F778E02B196EDF00909511 /* UseCase */ = { isa = PBXGroup; children = ( - 872210512C3007FD003B97AD /* FirebaseUseCase.swift */, + 872210532C300922003B97AD /* Firebase */, ); path = UseCase; sourceTree = ""; @@ -2265,6 +2288,7 @@ 877911B22A188A3200F0A713 /* SettingSwitchListVC.swift in Sources */, 870800712B2CAD9900830B39 /* TaskHistory.swift in Sources */, 87163DC82ACAF2E8008D4072 /* NetworkError.swift in Sources */, + 872210572C3009DA003B97AD /* GetTiTiFunctionsUseCase.swift in Sources */, 87D5E65028C7460100D53F8D /* MonthSmallVM.swift in Sources */, 879D20742A190DE900D8A420 /* LogSettingVC.swift in Sources */, 8721C6DD296944EE00410D57 /* ChangePrevGraphButton.swift in Sources */, @@ -2457,7 +2481,7 @@ 878813E32A2084F5000ED2C1 /* CloseButton.swift in Sources */, 87A48BC727DEF0C200F46D0F /* Date+Extension.swift in Sources */, 871AB699296709C100AFED1C /* TimeTableDailyGraphView.swift in Sources */, - 872210522C3007FD003B97AD /* FirebaseUseCase.swift in Sources */, + 872210522C3007FD003B97AD /* GetAppVersionUseCase.swift in Sources */, 87DC6A4728D00DF400455A06 /* WeekView.swift in Sources */, 873731DF2B2EA2B000D7BD9F /* FirestoreValue.swift in Sources */, 8706C32E2AEF878D00F7C842 /* TTSignupTextFieldUnderlineView.swift in Sources */, @@ -2530,10 +2554,11 @@ 871AB69D2967C9D100AFED1C /* TimeTableVM.swift in Sources */, 8708006B2B2CA57C00830B39 /* DailysNetwork.swift in Sources */, 872210422C2FEE83003B97AD /* SyncLogRepository.swift in Sources */, - 870800582B2C3B0C00830B39 /* GetServerURLUseCase.swift in Sources */, + 870800582B2C3B0C00830B39 /* GetServerURLUseCase_lagacy.swift in Sources */, 87D4DCD22BA5A4C400BB5AAB /* ResetPasswordEmailView.swift in Sources */, 878813E52A209BA0000ED2C1 /* HowToAddWidgetVC.swift in Sources */, 8708007B2B2D4F0800830B39 /* RecordTimesRepository_lagacy.swift in Sources */, + 8722105D2C300A8C003B97AD /* GetSurveysUseCase.swift in Sources */, 8765234C28C7948700487BFB /* TotalTime.swift in Sources */, 87A7F5D4267270F800F69EBA /* Todo.swift in Sources */, 879D207F2A19D40400D8A420 /* Updateable.swift in Sources */, @@ -2557,6 +2582,7 @@ 875FAE352B1C718D008F19D2 /* GetLatestVersionUseCaseInterface.swift in Sources */, 8769349727E1BBAF00D33F51 /* TodoCell.swift in Sources */, 0437062D2869EC2200A5D3AA /* TimerTimeLabelVM.swift in Sources */, + 872210592C300A08003B97AD /* GetUpdateHistorysUseCase.swift in Sources */, 878899882894F0B900B7F378 /* WeekTimelineVM.swift in Sources */, 875FAE252B1C6721008F19D2 /* AppVersionNetwork.swift in Sources */, 04F0D2B9286607A7007ED596 /* BaseSingleTimeLabelVM.swift in Sources */, @@ -2591,6 +2617,7 @@ 87D4DCE82BA6A8AA00BB5AAB /* TTBottomRoundButtonView.swift in Sources */, 875FAE2C2B1C6B57008F19D2 /* AppLatestVersionRepository.swift in Sources */, 04504C602864AC3C00CA4C69 /* BaseTimeLabelVM.swift in Sources */, + 8722105B2C300A5C003B97AD /* GetYoutubeLinkUseCase.swift in Sources */, 8772E91626705EE100A191BF /* TodolistVC.swift in Sources */, 87B539AB299BB710001E354C /* Versions.swift in Sources */, 87862E892B2DBBDA004ED313 /* PopupVC.swift in Sources */, @@ -2603,6 +2630,7 @@ 8708007F2B2D543500830B39 /* RecordTimesUseCase.swift in Sources */, 8708005F2B2C5F5F00830B39 /* AuthResponse.swift in Sources */, 8721C6D72969123E00410D57 /* IOUsecase.swift in Sources */, + 872210552C30094F003B97AD /* GetServerURLUseCase.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Project_Timer/Data/NetworkURL.swift b/Project_Timer/Data/NetworkURL.swift index 90ab13c0..55272242 100644 --- a/Project_Timer/Data/NetworkURL.swift +++ b/Project_Timer/Data/NetworkURL.swift @@ -18,7 +18,7 @@ class NetworkURL { } func updateServerURL(completion: @escaping () -> Void) { - let getServerURLUseCase = GetServerURLUseCase(repository: ServerURLRepository()) + let getServerURLUseCase = GetServerURLUseCase_lagacy(repository: ServerURLRepository()) getServerURLUseCase.getServerURL { [weak self] result in switch result { case .success(let url): diff --git a/Project_Timer/Domain/UseCase/Firebase/GetAppVersionUseCase.swift b/Project_Timer/Domain/UseCase/Firebase/GetAppVersionUseCase.swift new file mode 100644 index 00000000..f518c90b --- /dev/null +++ b/Project_Timer/Domain/UseCase/Firebase/GetAppVersionUseCase.swift @@ -0,0 +1,22 @@ +// +// GetAppVersionUseCase.swift +// Project_Timer +// +// Created by Kang Minsang on 2024/06/29. +// Copyright © 2024 FDEE. All rights reserved. +// + +import Foundation +import Combine + +final class GetAppVersionUseCase { + private let repository: FirebaseRepository // TODO: 프로토콜로 수정 + + init(repository: FirebaseRepository) { + self.repository = repository + } + + func execute() -> AnyPublisher { + return self.repository.getAppVersion() + } +} diff --git a/Project_Timer/Domain/UseCase/Firebase/GetServerURLUseCase.swift b/Project_Timer/Domain/UseCase/Firebase/GetServerURLUseCase.swift new file mode 100644 index 00000000..b7e80602 --- /dev/null +++ b/Project_Timer/Domain/UseCase/Firebase/GetServerURLUseCase.swift @@ -0,0 +1,22 @@ +// +// GetServerURLUseCase.swift +// Project_Timer +// +// Created by Kang Minsang on 2024/06/29. +// Copyright © 2024 FDEE. All rights reserved. +// + +import Foundation +import Combine + +final class GetServerURLUseCasee { + private let repository: FirebaseRepository // TODO: 프로토콜로 수정 + + init(repository: FirebaseRepository) { + self.repository = repository + } + + func execute() -> AnyPublisher { + return self.repository.getServerURL() + } +} diff --git a/Project_Timer/Domain/UseCase/Firebase/GetSurveysUseCase.swift b/Project_Timer/Domain/UseCase/Firebase/GetSurveysUseCase.swift new file mode 100644 index 00000000..d80ce932 --- /dev/null +++ b/Project_Timer/Domain/UseCase/Firebase/GetSurveysUseCase.swift @@ -0,0 +1,22 @@ +// +// GetSurveysUseCase.swift +// Project_Timer +// +// Created by Kang Minsang on 2024/06/29. +// Copyright © 2024 FDEE. All rights reserved. +// + +import Foundation +import Combine + +final class GetSurveysUseCase { + private let repository: FirebaseRepository // TODO: 프로토콜로 수정 + + init(repository: FirebaseRepository) { + self.repository = repository + } + + func execute() -> AnyPublisher<[SurveyInfo], NetworkError> { + return self.repository.getSurveys() + } +} diff --git a/Project_Timer/Domain/UseCase/Firebase/GetTiTiFunctionsUseCase.swift b/Project_Timer/Domain/UseCase/Firebase/GetTiTiFunctionsUseCase.swift new file mode 100644 index 00000000..334dbfb7 --- /dev/null +++ b/Project_Timer/Domain/UseCase/Firebase/GetTiTiFunctionsUseCase.swift @@ -0,0 +1,22 @@ +// +// GetTiTiFunctionsUseCase.swift +// Project_Timer +// +// Created by Kang Minsang on 2024/06/29. +// Copyright © 2024 FDEE. All rights reserved. +// + +import Foundation +import Combine + +final class GetTiTiFunctionsUseCase { + private let repository: FirebaseRepository // TODO: 프로토콜로 수정 + + init(repository: FirebaseRepository) { + self.repository = repository + } + + func execute() -> AnyPublisher<[FunctionInfo], NetworkError> { + return self.repository.getTiTiFunctions() + } +} diff --git a/Project_Timer/Domain/UseCase/Firebase/GetUpdateHistorysUseCase.swift b/Project_Timer/Domain/UseCase/Firebase/GetUpdateHistorysUseCase.swift new file mode 100644 index 00000000..1a44d996 --- /dev/null +++ b/Project_Timer/Domain/UseCase/Firebase/GetUpdateHistorysUseCase.swift @@ -0,0 +1,22 @@ +// +// GetUpdateHistorysUseCase.swift +// Project_Timer +// +// Created by Kang Minsang on 2024/06/29. +// Copyright © 2024 FDEE. All rights reserved. +// + +import Foundation +import Combine + +final class GetUpdateHistorysUseCase { + private let repository: FirebaseRepository // TODO: 프로토콜로 수정 + + init(repository: FirebaseRepository) { + self.repository = repository + } + + func execute() -> AnyPublisher<[UpdateHistoryInfo], NetworkError> { + return self.repository.getUpdateHistorys() + } +} diff --git a/Project_Timer/Domain/UseCase/Firebase/GetYoutubeLinkUseCase.swift b/Project_Timer/Domain/UseCase/Firebase/GetYoutubeLinkUseCase.swift new file mode 100644 index 00000000..0fad765d --- /dev/null +++ b/Project_Timer/Domain/UseCase/Firebase/GetYoutubeLinkUseCase.swift @@ -0,0 +1,22 @@ +// +// GetYoutubeLinkUseCase.swift +// Project_Timer +// +// Created by Kang Minsang on 2024/06/29. +// Copyright © 2024 FDEE. All rights reserved. +// + +import Foundation +import Combine + +final class GetYoutubeLinkUseCase { + private let repository: FirebaseRepository // TODO: 프로토콜로 수정 + + init(repository: FirebaseRepository) { + self.repository = repository + } + + func execute() -> AnyPublisher { + return self.repository.getYoutubeLink() + } +} diff --git a/Project_Timer/Domain/UseCase/FirebaseUseCase.swift b/Project_Timer/Domain/UseCase/FirebaseUseCase.swift deleted file mode 100644 index 3d491c42..00000000 --- a/Project_Timer/Domain/UseCase/FirebaseUseCase.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// FirebaseUseCase.swift -// Project_Timer -// -// Created by Kang Minsang on 2024/06/29. -// Copyright © 2024 FDEE. All rights reserved. -// - -import Foundation -import Combine - -final class FirebaseUseCase { - private let repository: FirebaseRepository // TODO: 프로토콜로 수정 - - init(repository: FirebaseRepository) { - self.repository = repository - } - - func getAppVersion() -> AnyPublisher { - return self.repository.getAppVersion() - } - - func getServerURL() -> AnyPublisher { - return self.repository.getServerURL() - } - - func getTiTiFunctions() -> AnyPublisher<[FunctionInfo], NetworkError> { - return self.repository.getTiTiFunctions() - } - - func getUpdateHistorys() -> AnyPublisher<[UpdateHistoryInfo], NetworkError> { - return self.repository.getUpdateHistorys() - } - - func getYoutubeLink() -> AnyPublisher { - return self.repository.getYoutubeLink() - } -} - diff --git a/Project_Timer/Domain/lagacy/GetServerURLUseCase.swift b/Project_Timer/Domain/lagacy/GetServerURLUseCase_lagacy.swift similarity index 81% rename from Project_Timer/Domain/lagacy/GetServerURLUseCase.swift rename to Project_Timer/Domain/lagacy/GetServerURLUseCase_lagacy.swift index 88f402a8..63d0c09c 100644 --- a/Project_Timer/Domain/lagacy/GetServerURLUseCase.swift +++ b/Project_Timer/Domain/lagacy/GetServerURLUseCase_lagacy.swift @@ -1,5 +1,5 @@ // -// GetServerURLUseCase.swift +// GetServerURLUseCase_lagacy.swift // Project_Timer // // Created by Kang Minsang on 2023/12/15. @@ -8,7 +8,7 @@ import Foundation -final class GetServerURLUseCase: GetServerURLUseCaseInterface { +final class GetServerURLUseCase_lagacy: GetServerURLUseCaseInterface { let repository: ServerURLRepositoryInterface init(repository: ServerURLRepositoryInterface) {