Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.toyou.toyouandroid.data.home.dto.response.CardDetail
import com.toyou.toyouandroid.data.emotion.dto.EmotionRequest
import com.toyou.toyouandroid.data.emotion.dto.EmotionResponse
import com.toyou.toyouandroid.data.emotion.dto.YesterdayFriendsResponse
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
Expand All @@ -14,18 +13,13 @@ import retrofit2.http.Path
interface EmotionService {

@POST("users/emotions")
fun patchEmotion(
@Body emotion: EmotionRequest
): Call<EmotionResponse>

@POST("users/emotions")
suspend fun patchEmotionSuspend(
suspend fun patchEmotion(
@Body emotion: EmotionRequest
): Response<EmotionResponse>

@GET("diarycards/yesterday")
fun getYesterdayFriendCard(): Call<YesterdayFriendsResponse>
suspend fun getYesterdayFriendCard(): Response<YesterdayFriendsResponse>

@GET("diarycards/{cardId}")
fun getDiaryCardDetail(@Path("cardId") cardId : Int): Call<CardDetail>
}
suspend fun getDiaryCardDetail(@Path("cardId") cardId: Int): Response<CardDetail>
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.toyou.toyouandroid.data.mypage.service

import com.toyou.toyouandroid.data.mypage.dto.MypageResponse
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.GET

interface MypageService {

@GET("/users/mypage")
fun getMypage(): Call<MypageResponse>

@GET("/users/mypage")
suspend fun getMypageSuspend(): Response<MypageResponse>
}
suspend fun getMypage(): Response<MypageResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ package com.toyou.toyouandroid.data.notice.service
import com.toyou.toyouandroid.data.notice.dto.AlarmDeleteResponse
import com.toyou.toyouandroid.data.notice.dto.AlarmResponse
import com.toyou.toyouandroid.data.notice.dto.FriendsRequestResponse
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Path

interface NoticeService {
@GET("/alarms")
fun getAlarms(): Call<AlarmResponse>
suspend fun getAlarms(): Response<AlarmResponse>

@DELETE("alarms/{id}")
fun deleteAlarm(@Path("id") id: Int): Call<AlarmDeleteResponse>
suspend fun deleteAlarm(@Path("id") id: Int): Response<AlarmDeleteResponse>

@GET("/friends/requests")
fun getFriendsRequest(): Call<FriendsRequestResponse>
suspend fun getFriendsRequest(): Response<FriendsRequestResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.toyou.toyouandroid.data.onboarding.service

import com.toyou.toyouandroid.data.onboarding.dto.request.SignUpRequest
import com.toyou.toyouandroid.data.onboarding.dto.response.SignUpResponse
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.DELETE
Expand All @@ -11,38 +10,28 @@ import retrofit2.http.POST

interface AuthService {
@POST("auth/signup")
fun signUp(
suspend fun signUp(
@Header("oauthAccessToken") accessToken: String,
@Body request: SignUpRequest
): Call<SignUpResponse>
): Response<SignUpResponse>

@POST("auth/reissue")
fun reissue(
suspend fun reissue(
@Header("refreshToken") refreshToken: String
): Call<SignUpResponse>

@POST("auth/logout")
fun logout(
@Header("refreshToken") refreshToken: String
): Call<SignUpResponse>
): Response<SignUpResponse>

@POST("auth/logout")
suspend fun logoutSuspend(
suspend fun logout(
@Header("refreshToken") refreshToken: String
): Response<SignUpResponse>

@POST("auth/kakao")
fun kakaoLogin(
suspend fun kakaoLogin(
@Header("oauthAccessToken") accessToken: String
): Call<SignUpResponse>

@DELETE("auth/unlink")
fun signOut(
@Header("refreshToken") refreshToken: String
): Call<SignUpResponse>
): Response<SignUpResponse>

@DELETE("auth/unlink")
suspend fun signOutSuspend(
suspend fun signOut(
@Header("refreshToken") refreshToken: String
): Response<SignUpResponse>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ 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 retrofit2.Call
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
Expand All @@ -14,34 +13,18 @@ import retrofit2.http.Query
interface OnboardingService {

@GET("users/nickname/check")
fun getNicknameCheck(
@Query("nickname") nickname: String,
@Query("userId") userId: Int
): Call<NicknameCheckResponse>

@GET("users/nickname/check")
suspend fun getNicknameCheckSuspend(
suspend fun getNicknameCheck(
@Query("nickname") nickname: String,
@Query("userId") userId: Int
): Response<NicknameCheckResponse>

@PATCH("users/nickname")
fun patchNickname(
@Body request: PatchNicknameRequest
): Call<PatchNicknameResponse>

@PATCH("users/nickname")
suspend fun patchNicknameSuspend(
suspend fun patchNickname(
@Body request: PatchNicknameRequest
): Response<PatchNicknameResponse>

@PATCH("users/status")
fun patchStatus(
@Body request: PatchStatusRequest
): Call<PatchNicknameResponse>

@PATCH("users/status")
suspend fun patchStatusSuspend(
suspend fun patchStatus(
@Body request: PatchStatusRequest
): Response<PatchNicknameResponse>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.toyou.toyouandroid.data.record.dto.DiaryCardPerDayResponse
import com.toyou.toyouandroid.data.record.dto.DiaryCardResponse
import com.toyou.toyouandroid.data.record.dto.PatchDiaryCardResponse
import com.toyou.toyouandroid.network.BaseResponse
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.PATCH
Expand All @@ -16,33 +16,33 @@ import retrofit2.http.Query

interface RecordService {
@GET("diarycards/mine")
fun getDiarycardsMine(
suspend fun getDiarycardsMine(
@Query("year") year: Int,
@Query("month") month: Int
): Call<DiaryCardResponse>
): Response<DiaryCardResponse>

@GET("diarycards/friends")
fun getDiarycardsNumFriend(
suspend fun getDiarycardsNumFriend(
@Query("year") year: Int,
@Query("month") month: Int,
): Call<DiaryCardNumResponse>
): Response<DiaryCardNumResponse>

@GET("diarycards/friends")
fun getDiarycardsPerDayFriend(
suspend fun getDiarycardsPerDayFriend(
@Query("year") year: Int,
@Query("month") month: Int,
@Query("day") day: Int
): Call<DiaryCardPerDayResponse>
): Response<DiaryCardPerDayResponse>

@DELETE("diarycards/{cardId}")
fun deleteDiarycard(
suspend fun deleteDiarycard(
@Path("cardId") cardId: Int
): Call<DeleteDiaryCardResponse>
): Response<DeleteDiaryCardResponse>

@PATCH("diarycards/{cardId}/exposure")
fun patchDiarycardExposure(
suspend fun patchDiarycardExposure(
@Path("cardId") cardId: Int
): Call<PatchDiaryCardResponse>
): Response<PatchDiaryCardResponse>

@GET("/diarycards/{cardId}")
suspend fun getCardDetail(
Expand Down
12 changes: 2 additions & 10 deletions app/src/main/java/com/toyou/toyouandroid/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
package com.toyou.toyouandroid.di

import android.content.Context
import com.toyou.core.datastore.TokenStorage
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(
Expand Down
60 changes: 46 additions & 14 deletions app/src/main/java/com/toyou/toyouandroid/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
package com.toyou.toyouandroid.di

import com.toyou.toyouandroid.domain.create.repository.CreateRepositoryImpl
import com.toyou.toyouandroid.domain.create.repository.ICreateRepository
import com.toyou.toyouandroid.domain.home.repository.HomeRepositoryImpl
import com.toyou.toyouandroid.domain.home.repository.IHomeRepository
import com.toyou.toyouandroid.domain.notice.INoticeRepository
import com.toyou.toyouandroid.domain.notice.NoticeRepositoryImpl
import com.toyou.toyouandroid.domain.profile.repository.IProfileRepository
import com.toyou.toyouandroid.domain.profile.repository.ProfileRepositoryImpl
import com.toyou.toyouandroid.domain.record.IRecordRepository
import com.toyou.toyouandroid.domain.record.RecordRepositoryImpl
import com.toyou.toyouandroid.domain.social.repostitory.ISocialRepository
import com.toyou.toyouandroid.domain.social.repostitory.SocialRepositoryImpl
import com.toyou.toyouandroid.fcm.domain.FCMRepositoryImpl
import com.toyou.toyouandroid.fcm.domain.IFCMRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

/**
* Repository들은 @Inject constructor와 @Singleton 어노테이션을 통해
* Hilt가 자동으로 제공합니다.
*
* 적용된 Repository 목록:
* - HomeRepository
* - CreateRepository
* - SocialRepository
* - NoticeRepository
* - RecordRepository
* - ProfileRepository
* - FCMRepository
*/
@Module
@InstallIn(SingletonComponent::class)
object RepositoryModule
abstract class RepositoryModule {

@Binds
@Singleton
abstract fun bindHomeRepository(impl: HomeRepositoryImpl): IHomeRepository

@Binds
@Singleton
abstract fun bindCreateRepository(impl: CreateRepositoryImpl): ICreateRepository

@Binds
@Singleton
abstract fun bindSocialRepository(impl: SocialRepositoryImpl): ISocialRepository

@Binds
@Singleton
abstract fun bindNoticeRepository(impl: NoticeRepositoryImpl): INoticeRepository

@Binds
@Singleton
abstract fun bindRecordRepository(impl: RecordRepositoryImpl): IRecordRepository

@Binds
@Singleton
abstract fun bindProfileRepository(impl: ProfileRepositoryImpl): IProfileRepository

@Binds
@Singleton
abstract fun bindFCMRepository(impl: FCMRepositoryImpl): IFCMRepository
}
Loading
Loading