-
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.
Merge pull request #227 from SWM-KAWAI-MANS/PAR-382
#PAR-382 : 싱글, 대결모드 조회 API Combine 처리 + Shimmer Effect 적용
- Loading branch information
Showing
19 changed files
with
199 additions
and
54 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
27 changes: 27 additions & 0 deletions
27
.../java/online/partyrun/partyrunapplication/core/domain/my_page/GetRunningHistoryUseCase.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,27 @@ | ||
package online.partyrun.partyrunapplication.core.domain.my_page | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.combine | ||
import online.partyrun.partyrunapplication.core.data.repository.ResultRepository | ||
import online.partyrun.partyrunapplication.core.model.my_page.CombinedRunningHistory | ||
import online.partyrun.partyrunapplication.core.common.result.Result | ||
import javax.inject.Inject | ||
|
||
class GetRunningHistoryUseCase @Inject constructor( | ||
private val resultRepository: ResultRepository | ||
) { | ||
suspend operator fun invoke(): Flow<Result<CombinedRunningHistory>> { | ||
return combine( | ||
resultRepository.getSingleHistory(), | ||
resultRepository.getBattleHistory() | ||
) { single, battle -> | ||
when { | ||
single is Result.Loading || battle is Result.Loading -> Result.Loading | ||
single is Result.Success && battle is Result.Success -> | ||
Result.Success(CombinedRunningHistory(single.data, battle.data)) | ||
|
||
else -> Result.Failure("Failed to fetch combined running history", code = -1) | ||
} | ||
} | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
...n/java/online/partyrun/partyrunapplication/core/domain/my_page/GetSingleHistoryUseCase.kt
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
.../main/java/online/partyrun/partyrunapplication/core/model/my_page/BattleRunningHistory.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,5 @@ | ||
package online.partyrun.partyrunapplication.core.model.my_page | ||
|
||
data class BattleRunningHistory( | ||
val history: List<RunningHistoryDetail> | ||
) |
6 changes: 6 additions & 0 deletions
6
...ain/java/online/partyrun/partyrunapplication/core/model/my_page/CombinedRunningHistory.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,6 @@ | ||
package online.partyrun.partyrunapplication.core.model.my_page | ||
|
||
data class CombinedRunningHistory( | ||
val singleRunningHistory: SingleRunningHistory = SingleRunningHistory(emptyList()), | ||
val battleRunningHistory: BattleRunningHistory = BattleRunningHistory(emptyList()) | ||
) |
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
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: 14 additions & 0 deletions
14
.../online/partyrun/partyrunapplication/core/network/model/response/BattleHistoryResponse.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,14 @@ | ||
package online.partyrun.partyrunapplication.core.network.model.response | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import online.partyrun.partyrunapplication.core.model.my_page.BattleRunningHistory | ||
|
||
data class BattleHistoryResponse( | ||
@SerializedName("history") | ||
val history: List<RunningHistoryDetailResponse>? | ||
) | ||
|
||
fun BattleHistoryResponse.toDomainModel(): BattleRunningHistory { | ||
val transformedHistory = history?.map { it.toDomainModel() }?.reversed() ?: emptyList() | ||
return BattleRunningHistory(history = transformedHistory) | ||
} |
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
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
Oops, something went wrong.