Skip to content

Commit

Permalink
Merge pull request #527 from BCSDLab/hotfix/timetable_error_toast
Browse files Browse the repository at this point in the history
[Fix] 시간표 에러 메세지
  • Loading branch information
kongwoojin authored Jan 21, 2025
2 parents 31d96f4 + 0e04b37 commit a28b60e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ class TimetableViewModel @Inject constructor(
val semesters = getSemester(state.value.isAnonymous)
val semester = semesters.firstOrNull().orEmpty()

// 학기를 추가하지 않은 경우 데이터 로드 x
semester.ifEmpty {
updateLoading(false)
return@launch
}

_lectures.value = getLectures(semester)

when (state.value.isAnonymous) {
Expand Down Expand Up @@ -152,6 +158,13 @@ class TimetableViewModel @Inject constructor(
fun getRefreshData(frameId: Int, semester: String, frameName: String) {
viewModelScope.launch {
updateLoading(true)

// 학기를 추가하지 않은 경우 데이터 로드 x
semester.ifEmpty {
updateLoading(false)
return@launch
}

when (state.value.isAnonymous) {
true -> {
if (state.value.currentSemester == semester) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import `in`.koreatech.koin.ui.login.LoginActivity
import `in`.koreatech.koin.ui.navigation.KoinNavigationDrawerActivity
import `in`.koreatech.koin.ui.navigation.state.MenuState
import kotlinx.coroutines.launch
import timber.log.Timber

@AndroidEntryPoint
class TimetableActivity : KoinNavigationDrawerActivity() {
Expand Down Expand Up @@ -345,7 +346,9 @@ class TimetableActivity : KoinNavigationDrawerActivity() {
}

is TimetableSideEffect.Toast -> {
Toast.makeText(this@TimetableActivity, effect.message, Toast.LENGTH_SHORT).show()
// TODO::현재는 에러 메세지를 띄우는 용로도 토스트가 사용되기에 임시 메세지 사용, 배포 후 수정 필요
Timber.d("TimetableSideEffect.Toast| ${effect.message}")
Toast.makeText(this@TimetableActivity, "인터넷 연결을 확인하고 다시 시도해주세요.", Toast.LENGTH_SHORT).show()
}

is TimetableSideEffect.Nothing -> Unit
Expand Down

0 comments on commit a28b60e

Please sign in to comment.