-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issues #287 chore: data-remote 모듈로 분리 및 의존성 제거
- Loading branch information
Showing
16 changed files
with
148 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties | ||
|
||
@Suppress("DSL_SCOPE_VIOLATION") | ||
plugins { | ||
id("beep.android.library") | ||
id("beep.android.hilt") | ||
alias(libs.plugins.ksp) | ||
} | ||
|
||
android { | ||
namespace = "com.lighthouse.data.remote" | ||
|
||
defaultConfig { | ||
val kakaoSearchId = gradleLocalProperties(rootDir).getProperty("kakao_search_id") | ||
buildConfigField("String", "kakaoSearchId", kakaoSearchId) | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(projects.core) | ||
implementation(projects.coreAndroid) | ||
implementation(projects.model) | ||
implementation(projects.common) | ||
implementation(projects.commonAndroid) | ||
implementation(projects.data) | ||
|
||
implementation(libs.squareup.retrofit2) | ||
implementation(libs.squareup.retrofit2.converter.moshi) | ||
|
||
implementation(libs.timber) | ||
} |
6 changes: 3 additions & 3 deletions
6
...m/lighthouse/network/NetworkApiService.kt → ...thouse/data/remote/api/KakaoApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
data-remote/src/main/java/com/lighthouse/data/remote/di/ApiModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.lighthouse.data.remote.di | ||
|
||
import com.lighthouse.data.remote.api.KakaoApiService | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import retrofit2.Retrofit | ||
import javax.inject.Singleton | ||
|
||
@Suppress("unused") | ||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
internal object ApiModule { | ||
@Provides | ||
@Singleton | ||
fun provideApiService( | ||
retrofit: Retrofit | ||
): KakaoApiService { | ||
return retrofit.create(KakaoApiService::class.java) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
data-remote/src/main/java/com/lighthouse/data/remote/di/DataModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.lighthouse.data.remote.di | ||
|
||
import com.lighthouse.data.remote.repository.BrandRemoteRepositoryImpl | ||
import com.lighthouse.repository.brand.BrandRemoteRepository | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
|
||
@Suppress("unused") | ||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
internal abstract class DataModule { | ||
|
||
@Binds | ||
abstract fun bindsRemoteRepository( | ||
repository: BrandRemoteRepositoryImpl | ||
): BrandRemoteRepository | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
...pper/BrandPlaceInfoDataContainerMapper.kt → ...pper/BrandPlaceInfoDataContainerMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ouse/model/BrandPlaceInfoDataContainer.kt → ...mote/model/BrandPlaceInfoDataContainer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
data-remote/src/main/java/com/lighthouse/data/remote/repository/BrandRemoteRepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.lighthouse.data.remote.repository | ||
|
||
import com.lighthouse.beep.model.brand.BrandPlaceInfo | ||
import com.lighthouse.beep.model.error.BeepError | ||
import com.lighthouse.beep.model.location.Dms | ||
import com.lighthouse.common.utils.geography.LocationConverter | ||
import com.lighthouse.data.remote.api.KakaoApiService | ||
import com.lighthouse.data.remote.mapper.toDomain | ||
import com.lighthouse.repository.brand.BrandRemoteRepository | ||
import java.net.UnknownHostException | ||
import javax.inject.Inject | ||
|
||
internal class BrandRemoteRepositoryImpl @Inject constructor( | ||
private val kakaoApiService: KakaoApiService | ||
) : BrandRemoteRepository { | ||
|
||
override suspend fun getBrandPlaceInfo( | ||
brandName: String, | ||
x: Dms, | ||
y: Dms, | ||
size: Int | ||
): Result<List<BrandPlaceInfo>> { | ||
val vertex = LocationConverter.getVertex(x, y) | ||
|
||
return try { | ||
val list = kakaoApiService.getAllBrandPlaceInfo( | ||
brandName, | ||
vertex, | ||
size | ||
).documents.toDomain(brandName) | ||
Result.success(list) | ||
} catch (unknownHostException: UnknownHostException) { | ||
Result.failure(BeepError.NetworkFailure) | ||
} catch (e: Exception) { | ||
Result.failure(e) | ||
} | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...m/lighthouse/di/HTTPRequestInterceptor.kt → ...ta/remote/utils/HTTPRequestInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
data/src/main/java/com/lighthouse/datasource/brand/BrandRemoteDataSource.kt
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
data/src/main/java/com/lighthouse/datasource/brand/BrandRemoteDataSourceImpl.kt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
data/src/main/java/com/lighthouse/repository/brand/BrandRemoteRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.lighthouse.repository.brand | ||
|
||
import com.lighthouse.beep.model.brand.BrandPlaceInfo | ||
import com.lighthouse.beep.model.location.Dms | ||
|
||
interface BrandRemoteRepository { | ||
suspend fun getBrandPlaceInfo( | ||
brandName: String, | ||
x: Dms, | ||
y: Dms, | ||
size: Int | ||
): Result<List<BrandPlaceInfo>> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters