Skip to content

Commit 65f1c96

Browse files
authored
Merge pull request #56 from YAPP-Github/refactor/calendar
[ Fix ] : 기록화면 코드리뷰 반영
2 parents 4158ae7 + 74f2882 commit 65f1c96

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

data/src/main/java/com/yapp/android2/data/repository/RecordRepositoryImpl.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import com.yapp.android2.domain.entity.Product
55
import com.yapp.android2.domain.entity.User
66
import com.yapp.android2.domain.repository.record.Item
77
import com.yapp.android2.domain.repository.record.RecordRepository
8-
import kotlinx.coroutines.CoroutineScope
98
import kotlinx.coroutines.Dispatchers
109
import kotlinx.coroutines.withContext
1110
import 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

presentation/record/src/main/java/com/yapp/android2/record/RecordViewModel.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)