-
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
[Init/#1] 프로젝트 기초세팅을 진행합니다. #2
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.
기초세팅 고생 많았으!👍🏻
즉시 반영해야할 수정사항은 아닌거 같아서 바로 어푸했습니다!)
(그치만 몇가지 질문 스윽 남겨봤는데 한번 확인해보는것도 좋을듯 합니다!)
추가로 몇몇 파일들 마지막 라인 개행정도? 만 확인해주면 완벽!
connectTimeout(10, TimeUnit.SECONDS) | ||
writeTimeout(10, TimeUnit.SECONDS) | ||
readTimeout(10, TimeUnit.SECONDS) |
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.
[3]: 개인취향이긴 한데, 타입을 명확하게 표시하는것도 좋은 방법이라 생각합니다~🙇🏻♂️
connectTimeout(10, TimeUnit.SECONDS) | |
writeTimeout(10, TimeUnit.SECONDS) | |
readTimeout(10, TimeUnit.SECONDS) | |
connectTimeout(10L, TimeUnit.SECONDS) | |
writeTimeout(10L, TimeUnit.SECONDS) | |
readTimeout(10L, TimeUnit.SECONDS) |
@Provides | ||
@Singleton | ||
fun providesJson(): Json = | ||
Json { | ||
isLenient = true | ||
prettyPrint = true | ||
explicitNulls = false | ||
ignoreUnknownKeys = true | ||
} |
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.
[2]: 현재 코드에서는 해당 부분이 사용이 안 되는 것으로 보이는데 의도한 건지 궁금합니다!
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.
헉 만들어놓고 다른 json 객체를 사용하고 있었네요. 수정했습니다!
@Auth | ||
fun provideAuthInterceptor(): Interceptor = Interceptor { chain -> | ||
val request = chain.request().newBuilder() | ||
.addHeader("Authorization", "Bearer <Your_Token_Here>") |
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.
[3]: 요 부분도 개인취향이긴 한데, 이런식으로 작성하면 좀 더 명시적으로 확인가능할거 같습니다!🙇🏻♂️
.addHeader("Authorization", "Bearer <Your_Token_Here>") | |
.addHeader( | |
name = "Authorization", | |
value = "Bearer <Your_Token_Here>" | |
) |
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.
앱잼 내에서 로그인 구현 계획이 없어 불필요한 기능같아 삭제했습니다. 추후 참고하겠습니다!
return Retrofit.Builder() | ||
.baseUrl(baseUrl) | ||
.client(okHttpClient) | ||
.addConverterFactory(json.asConverterFactory("application/json".toMediaType())) |
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.
[3]: ConverterFactory 를 주입 받는 방법은 어떤지 질문+1 남겨봅니다!
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.
좋은 것 같습니다! 반영하겠습니다!
@@ -0,0 +1,3 @@ | |||
package com.sopt.gongbaek.presentation.util.base | |||
|
|||
interface State |
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.
[3]: 이 부분만 UiState가 아니고 State인 이유가 있는지 궁금합니다!
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.
서버통신에 대한 UiState(Idle,Loading,Success,Failure) sealed class와 혼동될 수 있을 것 같아 이렇게 진행했는데, 여기를 일관성 있게 UiState로 가져가고 서버통신 State에 대한 클래스명을 변경하는게 나을 것 같네요! 반영하겠습니다~
private val _uiState = MutableStateFlow<State>(initialState) | ||
val uiState: StateFlow<State> | ||
get() = _uiState.asStateFlow() |
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.
[2]: 기존 방식과 아래 방식이 어떤 차이가 있는지 슬쩍 질문을 남겨봅니다!🙇🏻♂️
private val _uiState = MutableStateFlow<State>(initialState) | |
val uiState: StateFlow<State> | |
get() = _uiState.asStateFlow() | |
private val _uiState = MutableStateFlow<State>(initialState) | |
val uiState: StateFlow<State> = _uiState.asStateFlow() |
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.
직접 Assign( = ) , getter를 이용한 Assign 이 두 가지에 대한 차이점은 링크에서 확인해보실 수 있습니다.
요약하자면, 객체의 값을 복사해서 가져오느냐 객체 자체를 가져오느냐 차이인데 변경되는 값을 관찰하는 기능에 있어서 get()을 이용하는게 더 유리하다고 판단하였습니다!
(call by value, call by reference 개념과 닮아있는 거 같다고 느꼈는데 이 부분은 확실하게는 모르겠습니다 ,, ㅎㅎ)
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.
아함, 배워갑니다!(공부할거 +1,,)
get() = _event.asSharedFlow() | ||
|
||
private val _sideEffect: MutableSharedFlow<SideEffect> = MutableSharedFlow() | ||
val sideEffect: Flow<SideEffect> |
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.
[3]: 위 event과 달리 sideEffect는 Flow타입인 이유가 궁금합니다!
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.
위에는 MutableSharedFlow로 선언해놓고 방출할때는 Flow로 하고 있었네요..! sideEffect도 sharedFlow로 선언하는게 바람직한 것 같습니다. 반영하겠습니다!
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.
기초세팅 정말 너무 수고했음 .. !
더미데이터, 예시코드 모두 너무 잘작성해줘서 이해는 되는데, MVI, test 코드는 아직도 어렵다 . . ((개인적으로 공부 좀 더 해벌게요 ㅠ
나도 간단한 수정 요청과 질문사항들뿐이라 바로 어푸하겠습니당
app/build.gradle.kts
Outdated
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
buildConfigField("String", "GONGBAEK_BASE_URL", localProperties["gongbaek.base.url"].toString()) | ||
buildConfigField("String", "ANOTHER_BASE_URL", localProperties["another.base.url"].toString()) | ||
} |
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.
[3]: 여기서 base url을 2개를 받는 이유는 뭘까요 ??
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.
추후에 프로젝트 규모가 커지면 base.url이 분리되는 상황이 있을 수 있습니다! 그래서 이런 것도 있다하고 넣어놓은 것이였는데, 사실 앱잼 수준에서 base.url 분리를 고려하기에는 아직 많이 시기상조이기에 그냥 제거하는 방향으로 진행하겠습니다. 감사합니다!
app/build.gradle.kts
Outdated
hilt { | ||
enableAggregatingTask = false | ||
} |
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.
[2]: 요거 나도 지현이한테 받은 피드백인데 project 수준 gradle에서 hilt plugin을 추가해주지 않았기 때문에 발생하는 문제를 해결하려고 추가하는 코드라, hilt plugin 추가하고 이 코드는 지우는게 어떨까요 ?!
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.
헉 좋습니다. 반영하겠습니다!!
alias(libs.plugins.kotlin.compose) apply false | ||
alias(libs.plugins.ksp) apply false | ||
alias(libs.plugins.ktlint) apply false | ||
} |
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.
[2]: alias(libs.plugins.dagger.hilt) apply false
요거 !
Related issue 🛠
Work Description ✏️
Screenshot 📸
Uncompleted Tasks 😅
To Reviewers 📢
기초세팅 진행했습니다. 확인 후 궁금하신 부분, 추가하거나 수정하고 싶으신 부분 모두 리뷰 부탁드립니다!