From 7183439a5eb827d088f619132d298af4821cec63 Mon Sep 17 00:00:00 2001 From: b1urrrr Date: Sat, 22 Apr 2023 11:41:10 +0900 Subject: [PATCH] =?UTF-8?q?[CHORE/#3]=20fake=20repo=20list=20json=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EC=83=81=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/android/go/sopt/data/source/RepoDataSource.kt | 6 +++++- .../android/go/sopt/presentation/main/home/HomeViewModel.kt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/android/go/sopt/data/source/RepoDataSource.kt b/app/src/main/java/org/android/go/sopt/data/source/RepoDataSource.kt index 5156ff4..0da411f 100644 --- a/app/src/main/java/org/android/go/sopt/data/source/RepoDataSource.kt +++ b/app/src/main/java/org/android/go/sopt/data/source/RepoDataSource.kt @@ -10,8 +10,12 @@ class RepoDataSource @Inject constructor( private val assetLoader: AssetLoader, ) { fun getRepoList(): Array { - return assetLoader.getJsonString("fake_repo_list.json")?.let { jsonString -> + return assetLoader.getJsonString(FILE_FAKE_REPO_LIST)?.let { jsonString -> Json.decodeFromString>(jsonString) } ?: emptyArray() } + + companion object { + private const val FILE_FAKE_REPO_LIST = "fake_repo_list.json" + } } diff --git a/app/src/main/java/org/android/go/sopt/presentation/main/home/HomeViewModel.kt b/app/src/main/java/org/android/go/sopt/presentation/main/home/HomeViewModel.kt index 8fa06a6..20f2dbc 100644 --- a/app/src/main/java/org/android/go/sopt/presentation/main/home/HomeViewModel.kt +++ b/app/src/main/java/org/android/go/sopt/presentation/main/home/HomeViewModel.kt @@ -40,8 +40,8 @@ class HomeViewModel @Inject constructor( Timber.d("GET REPO LIST SUCCESS : $repoList") } .onFailure { t -> - Timber.e("GET REPO LIST FAIL : ${t.message}") _getRepoListState.value = Failure(null) + Timber.e("GET REPO LIST FAIL : ${t.message}") } } }