File tree Expand file tree Collapse file tree 2 files changed +6
-17
lines changed
data/src/main/java/com/yapp/android2/data/repository
presentation/record/src/main/java/com/yapp/android2/record Expand file tree Collapse file tree 2 files changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import com.yapp.android2.domain.entity.Product
55import com.yapp.android2.domain.entity.User
66import com.yapp.android2.domain.repository.record.Item
77import com.yapp.android2.domain.repository.record.RecordRepository
8- import kotlinx.coroutines.CoroutineScope
98import kotlinx.coroutines.Dispatchers
109import kotlinx.coroutines.withContext
1110import javax.inject.Inject
@@ -18,11 +17,11 @@ class RecordRepositoryImpl @Inject constructor(
1817 val cacheDates = mutableMapOf<String , List <String >>()
1918
2019
21- val savingList = withContext(CoroutineScope ( Dispatchers .IO ).coroutineContext ) {
22- recordRemoteDataSource.fetchRecords(recordMM)
23- }
20+ val savingList = withContext(Dispatchers .IO ) {
21+ recordRemoteDataSource.fetchRecords(recordMM)
22+ }
2423
25- val summaryList = withContext(CoroutineScope ( Dispatchers .IO ).coroutineContext ) {
24+ val summaryList = withContext(Dispatchers .IO ) {
2625 recordRemoteDataSource.fetchSummaryRecord(recordMM)
2726 }
2827
Original file line number Diff line number Diff line change @@ -26,16 +26,12 @@ class RecordViewModel @Inject constructor(
2626 private val _action = MutableSharedFlow <Action >()
2727 val action: SharedFlow <Action >
2828 get() = _action .asSharedFlow()
29-
30- var recordJob: Job ? = null
31-
29+
3230 /* *
3331 * @param date format yyyyMM
3432 */
3533 fun fetchRecords () {
36- recordJob?.cancel()
37-
38- recordJob = viewModelScope.launch {
34+ viewModelScope.launch {
3935 try {
4036 val response = getRecordUseCase.execute(Unit )
4137
@@ -52,12 +48,6 @@ class RecordViewModel @Inject constructor(
5248 }
5349 }
5450
55-
56- override fun onCleared () {
57- recordJob?.cancel()
58- super .onCleared()
59- }
60-
6151 sealed class Action {
6252 object ItemClick : Action()
6353 }
You can’t perform that action at this time.
0 commit comments