-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0793bfb
commit d2e3204
Showing
13 changed files
with
204 additions
and
21 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
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
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/hackathon/alddeul_babsang/core_ui/component/LoadingCircleIndicator.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,20 @@ | ||
package com.hackathon.alddeul_babsang.core_ui.component | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.CircularProgressIndicator | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import com.hackathon.alddeul_babsang.core_ui.theme.Orange900 | ||
|
||
@Composable | ||
fun LoadingCircleIndicator() { | ||
Box(modifier = Modifier.fillMaxSize()) { | ||
CircularProgressIndicator( | ||
modifier = Modifier | ||
.align(Alignment.Center), | ||
color = Orange900 | ||
) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/hackathon/alddeul_babsang/data/datasource/BabsangDataSource.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,8 @@ | ||
package com.hackathon.alddeul_babsang.data.datasource | ||
|
||
import com.hackathon.alddeul_babsang.data.dto.BaseResponse | ||
import com.hackathon.alddeul_babsang.data.dto.response.ResponseBabsangDto | ||
|
||
interface BabsangDataSource { | ||
suspend fun getStores(): BaseResponse<List<ResponseBabsangDto>> | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/hackathon/alddeul_babsang/data/datasourceimpl/BabsangDataSourceImpl.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,15 @@ | ||
package com.hackathon.alddeul_babsang.data.datasourceimpl | ||
|
||
import com.hackathon.alddeul_babsang.data.datasource.BabsangDataSource | ||
import com.hackathon.alddeul_babsang.data.dto.BaseResponse | ||
import com.hackathon.alddeul_babsang.data.dto.response.ResponseBabsangDto | ||
import com.hackathon.alddeul_babsang.data.service.BabsangApiService | ||
import javax.inject.Inject | ||
|
||
class BabsangDataSourceImpl @Inject constructor( | ||
private val babsangApiService: BabsangApiService | ||
) : BabsangDataSource { | ||
override suspend fun getStores(): BaseResponse<List<ResponseBabsangDto>> { | ||
return babsangApiService.getStores() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/hackathon/alddeul_babsang/data/dto/response/ResponseBabsangDto.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,16 @@ | ||
package com.hackathon.alddeul_babsang.data.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import java.io.Serial | ||
|
||
@Serializable | ||
data class ResponseBabsangDto ( | ||
@SerialName("id") val id: Long, | ||
@SerialName("name") val name: String, | ||
@SerialName("category") val category: String, | ||
@SerialName("address") val address: String, | ||
@SerialName("contact") val contact: String, | ||
@SerialName("imageUrl") val imageUrl: String? = null, | ||
@SerialName("favorite") val favorite: Boolean, | ||
) |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/hackathon/alddeul_babsang/data/repositoryimpl/BabsangRepositoryImpl.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,16 @@ | ||
package com.hackathon.alddeul_babsang.data.repositoryimpl | ||
|
||
import com.hackathon.alddeul_babsang.data.datasource.BabsangDataSource | ||
import com.hackathon.alddeul_babsang.data.dto.response.ResponseBabsangDto | ||
import com.hackathon.alddeul_babsang.domain.repository.BabsangRepository | ||
import javax.inject.Inject | ||
|
||
class BabsangRepositoryImpl @Inject constructor( | ||
private val babsangDataSource: BabsangDataSource | ||
) : BabsangRepository{ | ||
override suspend fun getStores(): Result<List<ResponseBabsangDto>> { | ||
return runCatching { | ||
babsangDataSource.getStores().result ?: emptyList() | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/hackathon/alddeul_babsang/data/service/BabsangApiService.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,11 @@ | ||
package com.hackathon.alddeul_babsang.data.service | ||
|
||
import com.hackathon.alddeul_babsang.data.dto.BaseResponse | ||
import com.hackathon.alddeul_babsang.data.dto.response.ResponseBabsangDto | ||
import com.sopt.data.service.ApiKeyStorage.STORES | ||
import retrofit2.http.GET | ||
|
||
interface BabsangApiService { | ||
@GET("/$STORES") | ||
suspend fun getStores(): BaseResponse<List<ResponseBabsangDto>> | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/hackathon/alddeul_babsang/domain/repository/BabsangRepository.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,7 @@ | ||
package com.hackathon.alddeul_babsang.domain.repository | ||
|
||
import com.hackathon.alddeul_babsang.data.dto.response.ResponseBabsangDto | ||
|
||
interface BabsangRepository { | ||
suspend fun getStores(): Result<List<ResponseBabsangDto>> | ||
} |
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
27 changes: 26 additions & 1 deletion
27
...c/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangViewModel.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