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