-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor/#117 mypage #118
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
Refactor/#117 mypage #118
Changes from all commits
195e576
ad3f434
3643f9e
4bc39b7
fe181d7
d13e226
0733af2
6f76de0
8952bf8
a8f6cd2
a7fc58f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.toyou.toyouandroid.di | ||
|
|
||
| import android.content.Context | ||
| import com.toyou.toyouandroid.data.onboarding.service.AuthService | ||
| import com.toyou.toyouandroid.utils.TokenManager | ||
| import com.toyou.toyouandroid.utils.TokenStorage | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| object AppModule { | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideTokenStorage(@ApplicationContext context: Context): TokenStorage { | ||
| return TokenStorage(context) | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideTokenManager( | ||
| authService: AuthService, | ||
| tokenStorage: TokenStorage | ||
| ): TokenManager { | ||
| return TokenManager(authService, tokenStorage) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package com.toyou.toyouandroid.di | ||
|
|
||
| import com.toyou.toyouandroid.data.onboarding.service.AuthService | ||
| import com.toyou.toyouandroid.data.onboarding.service.OnboardingService | ||
| import com.toyou.toyouandroid.data.emotion.service.EmotionService | ||
| import com.toyou.toyouandroid.data.mypage.service.MypageService | ||
| import com.toyou.toyouandroid.data.home.service.HomeService | ||
| import com.toyou.toyouandroid.network.AuthNetworkModule | ||
| import com.toyou.toyouandroid.network.NetworkModule | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.components.SingletonComponent | ||
| import retrofit2.Retrofit | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| object NetworkModule { | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| @AuthRetrofit | ||
| fun provideRetrofit(): Retrofit { | ||
| return AuthNetworkModule.getClient() | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| @NonAuthRetrofit | ||
| fun provideNonAuthRetrofit(): Retrofit { | ||
| return NetworkModule.getClient() | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideOnboardingService(@NonAuthRetrofit retrofit: Retrofit): OnboardingService { | ||
| return retrofit.create(OnboardingService::class.java) | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideAuthService(@AuthRetrofit retrofit: Retrofit): AuthService { | ||
| return retrofit.create(AuthService::class.java) | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideEmotionService(@AuthRetrofit retrofit: Retrofit): EmotionService { | ||
| return retrofit.create(EmotionService::class.java) | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideMypageService(@AuthRetrofit retrofit: Retrofit): MypageService { | ||
| return retrofit.create(MypageService::class.java) | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideHomeService(@AuthRetrofit retrofit: Retrofit): HomeService { | ||
| return retrofit.create(HomeService::class.java) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.toyou.toyouandroid.di | ||
|
|
||
| import javax.inject.Qualifier | ||
|
|
||
| @Qualifier | ||
| @Retention(AnnotationRetention.BINARY) | ||
| annotation class AuthRetrofit | ||
|
|
||
| @Qualifier | ||
| @Retention(AnnotationRetention.BINARY) | ||
| annotation class NonAuthRetrofit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package com.toyou.toyouandroid.di | ||
|
|
||
| import com.toyou.toyouandroid.data.onboarding.service.OnboardingService | ||
| import com.toyou.toyouandroid.domain.profile.repository.ProfileRepository | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| object RepositoryModule { | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideProfileRepository( | ||
| onboardingService: OnboardingService | ||
| ): ProfileRepository { | ||
| return ProfileRepository(onboardingService) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| package com.toyou.toyouandroid.domain.home.repository | ||
|
|
||
| import com.toyou.toyouandroid.data.home.dto.response.YesterdayCardResponse | ||
| import com.toyou.toyouandroid.data.home.service.HomeService | ||
| import com.toyou.toyouandroid.network.AuthNetworkModule | ||
| import com.toyou.toyouandroid.network.BaseResponse | ||
| import javax.inject.Inject | ||
| import javax.inject.Singleton | ||
|
|
||
| class HomeRepository { | ||
| private val client = AuthNetworkModule.getClient().create(HomeService::class.java) | ||
| @Singleton | ||
| class HomeRepository @Inject constructor( | ||
| private val homeService: HomeService | ||
| ) { | ||
| suspend fun getCardDetail(id: Long) = homeService.getCardDetail(id) | ||
|
|
||
| suspend fun getCardDetail(id : Long)=client.getCardDetail(id) | ||
|
|
||
| suspend fun getYesterdayCard() = client.getCardYesterday() | ||
| suspend fun getYesterdayCard() = homeService.getCardYesterday() | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||||||
| package com.toyou.toyouandroid.domain.profile.repository | ||||||||||||||
|
|
||||||||||||||
| import com.toyou.toyouandroid.data.onboarding.dto.NicknameCheckResponse | ||||||||||||||
| import com.toyou.toyouandroid.data.onboarding.dto.PatchNicknameRequest | ||||||||||||||
| import com.toyou.toyouandroid.data.onboarding.dto.PatchNicknameResponse | ||||||||||||||
| import com.toyou.toyouandroid.data.onboarding.dto.PatchStatusRequest | ||||||||||||||
| import com.toyou.toyouandroid.data.onboarding.service.OnboardingService | ||||||||||||||
| import retrofit2.Response | ||||||||||||||
|
|
||||||||||||||
| class ProfileRepository( | ||||||||||||||
| private val onboardingService: OnboardingService | ||||||||||||||
| ) { | ||||||||||||||
| suspend fun checkNickname(nickname: String, userId: Int): Response<NicknameCheckResponse> { | ||||||||||||||
| return onboardingService.getNicknameCheckSuspend(nickname, userId) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| suspend fun updateNickname(nickname: String): Response<PatchNicknameResponse> { | ||||||||||||||
| return onboardingService.patchNicknameSuspend(PatchNicknameRequest(nickname)) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| suspend fun updateStatus(status: String): Response<PatchNicknameResponse> { | ||||||||||||||
| return onboardingService.patchStatusSuspend(PatchStatusRequest(status)) | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 반환 타입 오류: 상태 수정 API가 닉네임 응답 타입을 반환
-import com.toyou.toyouandroid.data.onboarding.dto.PatchNicknameResponse
+import com.toyou.toyouandroid.data.onboarding.dto.PatchNicknameResponse
+import com.toyou.toyouandroid.data.onboarding.dto.PatchStatusResponse
@@
- suspend fun updateStatus(status: String): Response<PatchNicknameResponse> {
+ suspend fun updateStatus(status: String): Response<PatchStatusResponse> {
return onboardingService.patchStatusSuspend(PatchStatusRequest(status))
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| } | ||||||||||||||
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.
동일 이름 충돌로 인한 컴파일 오류: NetworkModule 참조가 자기 자신으로 바인딩됩니다
DI 모듈 객체명(NetworkModule)과 import된 네트워크 유틸(NetworkModule)이 이름이 동일해,
return NetworkModule.getClient()가 현재 파일의 객체 자신을 가리켜 컴파일 에러가 발생합니다. alias로 즉시 수정하세요.적용 diff:
🤖 Prompt for AI Agents