-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat] 모듈 구조 변경 및 토큰 로직 #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c1a8ebb
Refactor: NetworkService, Persistence 모듈 DataSource 모듈 합치기
choijungp 3371781
Refactor: Then 외부 라이브러리 제거 및 사용 코드 제거
choijungp 759a002
Feat: TokenManager 구현
choijungp 393501c
Refactor: Endpoint에 isAuthorized 값 추가
choijungp 642a433
Refactor: UserDataRepository에 token 재발급 로직 추가
choijungp 56289a3
Feat: 로그인 시 소셜 로그인 타입, 프로필 이미지 저장
choijungp 96dbbd7
Fix: 온보딩 서버 Request Enum 값 변경
choijungp a89a7fd
Feat: UserDataRepository에서 토큰 재발급 가능 여부에 따라 앱 진입점 분기처리
choijungp 5deccb0
Fix: 토큰 재발급 로직 Response 타입 변경
choijungp 4857b56
Style: 불필요한 주석 제거
choijungp 4a56753
Style: UserDataRepository 오타 수정
choijungp 37bef52
Refactor: 코드 리뷰 반영
choijungp e00a90d
Refactor: import SnapKit 추가
choijungp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,6 @@ | |
|
|
||
| enum UserDefaultsKey: String { | ||
| case nickname | ||
| case socialLoginType | ||
| case profileImageUrl | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // | ||
| // TokenError.swift | ||
| // DataSource | ||
| // | ||
| // Created by 최정인 on 7/26/25. | ||
| // | ||
|
|
||
| enum TokenError: Error, CustomStringConvertible { | ||
| case tokenSaveFailed | ||
| case tokenLoadFailed | ||
| case tokenRemoveFailed | ||
|
|
||
| public var description: String { | ||
| switch self { | ||
| case .tokenSaveFailed: | ||
| return "토큰 저장에 실패했습니다." | ||
| case .tokenLoadFailed: | ||
| return "토큰 불러오기에 실패했습니다." | ||
| case .tokenRemoveFailed: | ||
| return "토큰 삭제에 실패했습니다." | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // | ||
| // TokenManager.swift | ||
| // DataSource | ||
| // | ||
| // Created by 최정인 on 7/26/25. | ||
| // | ||
|
|
||
| final class TokenManager { | ||
| static let shared = TokenManager() | ||
| private let keychainStorage = KeychainStorage.shared | ||
|
|
||
| private init() { } | ||
|
|
||
| func loadToken(tokenType: TokenType) throws -> String { | ||
| guard let token: String = keychainStorage.load(forKey: tokenType.rawValue) | ||
| else { throw TokenError.tokenLoadFailed } | ||
| return token | ||
| } | ||
|
|
||
| func saveToken(token: String, tokenType: TokenType) throws { | ||
| guard keychainStorage.save(token, forKey: tokenType.rawValue) | ||
| else { throw TokenError.tokenSaveFailed } | ||
| } | ||
|
|
||
| func removeToken() throws { | ||
| guard | ||
| keychainStorage.remove(forKey: TokenType.accessToken.rawValue), | ||
| keychainStorage.remove(forKey: TokenType.refreshToken.rawValue) | ||
| else { throw TokenError.tokenRemoveFailed } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // | ||
| // TokenResponseDTO.swift | ||
| // DataSource | ||
| // | ||
| // Created by 최정인 on 7/26/25. | ||
| // | ||
|
|
||
| struct TokenResponseDTO: Decodable { | ||
| let accessToken: String | ||
| let refreshToken: String | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| // Created by 최정인 on 6/21/25. | ||
| // | ||
|
|
||
| import DataSource | ||
| import Foundation | ||
|
|
||
| extension Endpoint { | ||
|
|
||
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
온보딩 등록 요청 시, 키 값으로 어떤 값들이 들어갈까요?.? 만약에 만약에 enum 과 같은 타입으로 범위를 정해둘 수 있다면, 타입을 강제하는 방법은 어떨까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엇 그 OnboardingUseCase에서 enum으로 받은 값들을 dictionary로 바꿔주는 로직을 수행하고 있습니다 !!
호옥시 이 부분을 말씀하신게 맞을까요 ?? 그렇다면 UseCase가 아닌 Repository에서 변경하는게 맞다고 생각하시나욤 ... ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
근데 또 이용약관 로직보면 ...
UseCase에서는 다음과 같이 repository 호출하고, DataSource 단에서 바꿔주고 있긴 하네요 ....
근데 그렇다 보니 TermsType의 위치가 애매하긴 해서 LoginEndpoint 파일 밑에 그냥 넣어둔 ㄹㅈㄷ 멋대로 짠 코드였습니다 ......
해당 로직 어디서 바꿔줄지 결정하면 하나로 통일하면서 수정하겠습니다 !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
말씀해주신 상황은 진짜 개발을 진행하면 많이 발생하는 문제인거 같아요.. 저도 하다보면 애매한 겅우가 많아서 일단 진행하는 경우가 많아서 왕 공감합니다 🥹
말씀해주신 내용이 맞아요!! 괜찮으시다면 변환은 repository에서 하는건 어떤가요? 가능하면 데이터 변환 로직은 reposiorty에서 진행하면 좋을 것 같다고 생각합니다. domain에 있는 usecase들은 데이터를 요청할 때나/데이터를 받을 때나 해당 데이터가 어떻게 가공해야할지 상관 쓰지 않고, 핵심 비즈니스 로직을 실행하기 위해 필요한 데이터 타입을 repository에게 주거나/받거나 할 수 있으면 좋을것 같다 생각하기 때문입니다!! 조이 의견은 어떠신가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하아 ......... 그것은 너무 고민되는 사항 .......
띵의 의견 뭔말인지 너무 이해가고 ... 동의하지만 그럼 UseCase에서 어떤 것을 할 수 있을까요 ......
넘 passthrough 되는 기분이 들기도 합니다 ㅠ !!!!!!!!!!!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
참고할 수 있을만한 다른 레포나 다른 분들의 조언도 정말 절실하네요 🥹
이후 시니어 개발자 분의 피드백도 한 번 듣고 고민해볼까요.?.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오키 조아요 !!!!!!! 그럼 일단 현상 유지 하고 돌아오는 토요일에 조언을 구해볼까요 ??
그 외의 코드 리뷰 사항은 37bef52에서 반영했습니다 !!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 그래주시면 압도적 감사입니다!!!!