forked from github/wulkanowy-mirror
Fix displaying errors in GradeDetailsPresenter (#1600)
This commit is contained in:
parent
7e0e2fbb67
commit
b098ac029b
@ -17,6 +17,7 @@ import io.github.wulkanowy.utils.AnalyticsHelper
|
||||
import io.github.wulkanowy.utils.afterLoading
|
||||
import io.github.wulkanowy.utils.flowWithResource
|
||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import timber.log.Timber
|
||||
@ -47,8 +48,8 @@ class GradeDetailsPresenter @Inject constructor(
|
||||
fun onParentViewLoadData(semesterId: Int, forceRefresh: Boolean) {
|
||||
currentSemesterId = semesterId
|
||||
|
||||
loadData(semesterId, forceRefresh)
|
||||
if (!forceRefresh) view?.showErrorView(false)
|
||||
loadData(semesterId, forceRefresh)
|
||||
}
|
||||
|
||||
fun onGradeItemSelected(grade: Grade, position: Int) {
|
||||
@ -198,6 +199,9 @@ class GradeDetailsPresenter @Inject constructor(
|
||||
enableSwipe(true)
|
||||
notifyParentDataLoaded(semesterId)
|
||||
}
|
||||
}.catch {
|
||||
errorHandler.dispatch(it)
|
||||
view?.notifyParentDataLoaded(semesterId)
|
||||
}.launch()
|
||||
}
|
||||
|
||||
@ -214,6 +218,7 @@ class GradeDetailsPresenter @Inject constructor(
|
||||
setErrorDetails(message)
|
||||
showErrorView(true)
|
||||
showEmpty(false)
|
||||
showProgress(false)
|
||||
} else showError(message, error)
|
||||
}
|
||||
}
|
||||
|
@ -161,6 +161,9 @@ class MessageTabPresenter @Inject constructor(
|
||||
enableSwipe(true)
|
||||
notifyParentDataLoaded()
|
||||
}
|
||||
}.catch {
|
||||
errorHandler.dispatch(it)
|
||||
view?.notifyParentDataLoaded()
|
||||
}.launch()
|
||||
}
|
||||
|
||||
@ -171,6 +174,7 @@ class MessageTabPresenter @Inject constructor(
|
||||
setErrorDetails(message)
|
||||
showErrorView(true)
|
||||
showEmpty(false)
|
||||
showProgress(false)
|
||||
} else showError(message, error)
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import io.github.wulkanowy.ui.base.ErrorHandler
|
||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||
import io.github.wulkanowy.utils.afterLoading
|
||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
@ -100,6 +101,9 @@ class SchoolPresenter @Inject constructor(
|
||||
enableSwipe(true)
|
||||
notifyParentDataLoaded()
|
||||
}
|
||||
}.catch {
|
||||
errorHandler.dispatch(it)
|
||||
view?.notifyParentDataLoaded()
|
||||
}.launch()
|
||||
}
|
||||
|
||||
@ -111,6 +115,7 @@ class SchoolPresenter @Inject constructor(
|
||||
showErrorView(true)
|
||||
showEmpty(false)
|
||||
showContent(false)
|
||||
showProgress(false)
|
||||
} else showError(message, error)
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import io.github.wulkanowy.ui.base.ErrorHandler
|
||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||
import io.github.wulkanowy.utils.afterLoading
|
||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
@ -85,6 +86,9 @@ class TeacherPresenter @Inject constructor(
|
||||
enableSwipe(true)
|
||||
notifyParentDataLoaded()
|
||||
}
|
||||
}.catch {
|
||||
errorHandler.dispatch(it)
|
||||
view?.notifyParentDataLoaded()
|
||||
}.launch()
|
||||
}
|
||||
|
||||
@ -95,6 +99,7 @@ class TeacherPresenter @Inject constructor(
|
||||
setErrorDetails(message)
|
||||
showErrorView(true)
|
||||
showEmpty(false)
|
||||
showProgress(false)
|
||||
} else showError(message, error)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user