Skip to content

Commit 014a278

Browse files
committed
Refactor: ServiceModule 내 Retrofit 서비스 생성 로직 간소화
1 parent b37f90f commit 014a278

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

app/src/main/java/com/threegap/bitnagil/di/data/ServiceModule.kt

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import dagger.Provides
2020
import dagger.hilt.InstallIn
2121
import dagger.hilt.components.SingletonComponent
2222
import retrofit2.Retrofit
23+
import retrofit2.create
2324
import javax.inject.Singleton
2425

2526
@Module
@@ -28,61 +29,49 @@ object ServiceModule {
2829

2930
@Provides
3031
@Singleton
31-
fun provideAuthService(@Auth retrofit: Retrofit): AuthService =
32-
retrofit.create(AuthService::class.java)
32+
fun provideAuthService(@Auth retrofit: Retrofit): AuthService = retrofit.create()
3333

3434
@Provides
3535
@Singleton
36-
fun provideLoginService(@NoneAuth retrofit: Retrofit): LoginService =
37-
retrofit.create(LoginService::class.java)
36+
fun provideLoginService(@NoneAuth retrofit: Retrofit): LoginService = retrofit.create()
3837

3938
@Provides
4039
@Singleton
41-
fun providerOnBoardingService(@Auth retrofit: Retrofit): OnBoardingService =
42-
retrofit.create(OnBoardingService::class.java)
40+
fun providerOnBoardingService(@Auth retrofit: Retrofit): OnBoardingService = retrofit.create()
4341

4442
@Provides
4543
@Singleton
46-
fun provideRoutineService(@Auth retrofit: Retrofit): RoutineService =
47-
retrofit.create(RoutineService::class.java)
44+
fun provideRoutineService(@Auth retrofit: Retrofit): RoutineService = retrofit.create()
4845

4946
@Provides
5047
@Singleton
51-
fun providerEmotionService(@Auth retrofit: Retrofit): EmotionService =
52-
retrofit.create(EmotionService::class.java)
48+
fun providerEmotionService(@Auth retrofit: Retrofit): EmotionService = retrofit.create()
5349

5450
@Provides
5551
@Singleton
56-
fun provideReissueService(@NoneAuth retrofit: Retrofit): ReissueService =
57-
retrofit.create(ReissueService::class.java)
52+
fun provideReissueService(@NoneAuth retrofit: Retrofit): ReissueService = retrofit.create()
5853

5954
@Provides
6055
@Singleton
61-
fun provideUserService(@Auth retrofit: Retrofit): UserService =
62-
retrofit.create(UserService::class.java)
56+
fun provideUserService(@Auth retrofit: Retrofit): UserService = retrofit.create()
6357

6458
@Provides
6559
@Singleton
66-
fun provideRecommendRoutineService(@Auth retrofit: Retrofit): RecommendRoutineService =
67-
retrofit.create(RecommendRoutineService::class.java)
60+
fun provideRecommendRoutineService(@Auth retrofit: Retrofit): RecommendRoutineService = retrofit.create()
6861

6962
@Provides
7063
@Singleton
71-
fun provideVersionService(@NoneAuth retrofit: Retrofit): VersionService =
72-
retrofit.create(VersionService::class.java)
64+
fun provideVersionService(@NoneAuth retrofit: Retrofit): VersionService = retrofit.create()
7365

7466
@Provides
7567
@Singleton
76-
fun provideAddressService(@Kakao retrofit: Retrofit): AddressService =
77-
retrofit.create(AddressService::class.java)
68+
fun provideAddressService(@Kakao retrofit: Retrofit): AddressService = retrofit.create()
7869

7970
@Provides
8071
@Singleton
81-
fun provideFileService(@Auth retrofit: Retrofit): FileService =
82-
retrofit.create(FileService::class.java)
72+
fun provideFileService(@Auth retrofit: Retrofit): FileService = retrofit.create()
8373

8474
@Provides
8575
@Singleton
86-
fun provideReportService(@Auth retrofit: Retrofit): ReportService =
87-
retrofit.create(ReportService::class.java)
76+
fun provideReportService(@Auth retrofit: Retrofit): ReportService = retrofit.create()
8877
}

0 commit comments

Comments
 (0)