File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
domain/src/main/java/com/whyranoid/domain/usecase Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -4,19 +4,27 @@ import com.whyranoid.domain.model.RunningHistory
4
4
import com.whyranoid.domain.repository.AccountRepository
5
5
import com.whyranoid.domain.repository.GroupRepository
6
6
import com.whyranoid.domain.repository.RunnerRepository
7
+ import com.whyranoid.domain.repository.RunningHistoryRepository
7
8
import javax.inject.Inject
8
9
9
10
class FinishRunningUseCase @Inject constructor(
10
11
private val runnerRepository : RunnerRepository ,
11
12
private val accountRepository : AccountRepository ,
12
- private val groupRepository : GroupRepository
13
+ private val groupRepository : GroupRepository ,
14
+ private val runningHistoryRepository : RunningHistoryRepository
13
15
) {
14
16
suspend operator fun invoke (runningHistory : RunningHistory ? = null): Boolean {
15
17
val uid = accountRepository.getUid()
16
18
17
19
runnerRepository.finishRunning(uid)
18
20
19
21
if (runningHistory != null ) {
22
+ val uploadResult = runningHistoryRepository.uploadRunningHistory(runningHistory)
23
+
24
+ if (uploadResult.isFailure) {
25
+ return false
26
+ }
27
+
20
28
groupRepository.getMyGroupList(uid).onSuccess { groupInfos ->
21
29
groupRepository.notifyRunningFinish(
22
30
uid = uid,
You can’t perform that action at this time.
0 commit comments