Skip to content

Commit cae25d5

Browse files
committed
fix change running record inconsistent state, when stopping timer and fast open records tab and click on timer
1 parent fd0f5ae commit cae25d5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • features/feature_records/src/main/java/com/example/util/simpletimetracker/feature_records/viewModel

features/feature_records/src/main/java/com/example/util/simpletimetracker/feature_records/viewModel/RecordsViewModel.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.example.util.simpletimetracker.domain.prefs.interactor.PrefsInteracto
1717
import com.example.util.simpletimetracker.domain.record.interactor.RecordsContainerMultiselectInteractor
1818
import com.example.util.simpletimetracker.domain.record.interactor.RecordsShareUpdateInteractor
1919
import com.example.util.simpletimetracker.domain.record.interactor.RecordsUpdateInteractor
20+
import com.example.util.simpletimetracker.domain.record.interactor.RunningRecordInteractor
2021
import com.example.util.simpletimetracker.domain.record.interactor.UpdateRunningRecordsInteractor
2122
import com.example.util.simpletimetracker.domain.record.model.MultiSelectedRecordId
2223
import com.example.util.simpletimetracker.domain.statistics.model.ChartFilterType
@@ -48,6 +49,7 @@ class RecordsViewModel @Inject constructor(
4849
private val router: Router,
4950
private val recordsViewDataInteractor: RecordsViewDataInteractor,
5051
private val prefsInteractor: PrefsInteractor,
52+
private val runningRecordInteractor: RunningRecordInteractor,
5153
private val recordsUpdateInteractor: RecordsUpdateInteractor,
5254
private val recordsShareUpdateInteractor: RecordsShareUpdateInteractor,
5355
private val sharingInteractor: SharingInteractor,
@@ -98,6 +100,7 @@ class RecordsViewModel @Inject constructor(
98100
item: RunningRecordViewData,
99101
sharedElements: Pair<Any, String>? = null,
100102
) = viewModelScope.launch {
103+
if (runningRecordInteractor.get(item.id) == null) return@launch
101104
if (recordsContainerMultiselectInteractor.isEnabled) {
102105
onMultiselectRunningRecordClick(item)
103106
return@launch

0 commit comments

Comments
 (0)