-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Feat/#4] 4주차 필수과제 #9
base: develop
Are you sure you want to change the base?
Conversation
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.
저는 이번 과제하면서 DTO, Response, Request 들 네이밍 짓는게 너무 고민이 많이 되더라구요 그래서 아마 제 과제에서 관련된 네이밍이 좀 이상할 텐데 ..ㅋㅎ 민재오빠 코드 보고 많이 배웠숨돵 이번 주도 수고 하셨습니다 ㅎ
근데 궁금한겤ㅋㅋ 갑자기 왜 커밋메시지의 분위기가 바뀌었죠?
set(value) = sharedPreferences.edit().putString(TOKEN, value).apply() | ||
|
||
override fun clearInfo() { | ||
sharedPreferences.edit().clear().apply() |
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.
clear는 현재 모든 SharedPreferences 데이터를 지울 수 있으므로, 나중에 Token만 지우고 싶을 때는 clear() 대신 remove(Token)을 사용할 수 있다고 합니다!
data object Success : SignInState() | ||
data class Failure(val errorMessage: String) : SignInState() | ||
} |
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.
저는 아직 상태관리에 익숙치 않은 터라 ... 이렇게 sealed class를 사용함으로써 ui, viewmodel 코드 가독성을 높이는 것이 주요 목적인걸까요? 궁금합니다 ..!
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.
이번 주도 역시 너무 수고하셨습니다!! 그리고 저 역시 커밋 내용?방식?이 바뀐 이유가 궁금합니다ㅋㅋ
interface AuthService { | ||
@POST("user") | ||
fun registerUser( | ||
@Body requestUserRegistrationDto: RequestUserRegistrationDto | ||
): Call<ResponseUserRegistrationDto> | ||
|
||
@POST("login") | ||
fun login( | ||
@Body requestLoginDto: RequestLoginDto | ||
): Call<ResponseLoginDto> | ||
} |
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.
API 엔드포인트가 하드코딩되어 있는데 추후 변경 및 유지보수 할 때 BuildConfig를 활용하거나 별도로 상수화하면 편리하다고 합니다!!
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.
수고하셨어요 언제 이렇게 잘하게 됐나 뿌듯하고 행복하네요 ㅎㅎ
힐트 공부할때 참고할 만한 자료 남겨두어요
https://velog.io/@cacaocoffee/DI-with-Hilt#%EA%B7%B8%EB%83%A5-%EB%8B%A4-provides-%EC%93%B0%EB%A9%B4-%EC%95%88%EB%90%98%EB%82%98
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.
ApiResponse 는 @SerialName 과 변수 선언을 분리했는데 어떤 곳은 한줄로 어떤 곳은 여러 줄로 하신 이유가 궁금해요
data object PasswordInvalid: SignUpState() | ||
data object Success: SignUpState() | ||
data object Idle : SignUpState() | ||
data class Success(val response: ResponseUserRegistrationDto?) : SignUpState() |
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.
ResponseUserRegistrationDto 로 받으신 이유가 궁금합니다 userid 띄워주기 위함이면 string이나 Int로 해도되지않을까해서요
Screen쪽에 코드가 길어지는 걸 별로라고 생각해서
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.
컬러 상수값 -> ui/theme/color 이용
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.
깔끔하고 보기좋네요!
val userHobby = userHobbyState.hobby | ||
MyPageScreen(userHobby = userHobby) |
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.
val userHobby = userHobbyState.hobby | |
MyPageScreen(userHobby = userHobby) | |
MyPageScreen(userHobby = userHobbyState.hobby) |
이렇게 하면 객체 선언 안해도될거 같아요
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class RepositoryModule { | ||
@Binds | ||
@Singleton | ||
abstract fun bindTokenRepository( | ||
tokenRepositoryImpl: TokenRepositoryImpl | ||
): TokenRepository | ||
} |
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.
고생하셨습니다 합세도 파이팅구 ~
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.
사용하지 않는 친구인 것 같은데!
@Serializable | ||
data class ResponseGetMyHobbyDto( | ||
@SerialName("result") val result: GetMyHobbyResult | ||
) |
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.
이렇게 공통되는 부분에 대한 BaseResponse를 만들어두셔도 좋습니다. (ApiResponse의 형태를 이렇게 바꾸면 될 것 같네요!)
@@ -0,0 +1,7 @@ | |||
package org.sopt.and.data.repository | |||
|
|||
interface TokenRepository { |
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만 data에 위치시키신 이유가 뭔가요!
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.
아 지금 보니까 domain이 따로 없군요 ㅋㅋ
|
||
override fun setToken(token: String) { | ||
tokenLocalDataSource.token = token | ||
Log.d("TokenDataStore", "Token Saved: $token") |
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.
불필요한 로그는 지워줍시다
Related issue 🛠
Work Description ✏️
[ 3주차 과제 리팩토링 ]
[ 4주차 과제 명세 구현 ]
유저 등록 API 연동
로그인 API 연동
내 취미 조회 API 연동
Screenshot 📸
8-server-api.mp4
Uncompleted Tasks 😅
To Reviewers 📢
서버통신을 세미나 자료에 맞춰 Callback 함수로 구현했고, 따로 레포지토리 패턴이나 이외 기술들을 사용하지는 않았습니다.
retrofit 객체를 viewModel에서 그대로 가져와 사용하는 형식이고 추후 디벨롭할 예정입니다!
다만 나중에 적용할때 좀 편하려고 token 부분은 레포지토리 패턴이랑 hilt를 사용해봤습니다 ㅎㅎ
리팩토링을 생각보다 많이 못해서 ,, ㅎㅎ 계속 커밋하겠습니다!