mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 17:52:45 +01:00
Add lucky number logging (#256)
This commit is contained in:
parent
c72c301039
commit
f8ee5cb062
@ -7,6 +7,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
|
|||||||
import io.github.wulkanowy.ui.base.session.SessionErrorHandler
|
import io.github.wulkanowy.ui.base.session.SessionErrorHandler
|
||||||
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
|
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
|
||||||
import io.github.wulkanowy.utils.SchedulersProvider
|
import io.github.wulkanowy.utils.SchedulersProvider
|
||||||
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class LuckyNumberPresenter @Inject constructor(
|
class LuckyNumberPresenter @Inject constructor(
|
||||||
@ -20,11 +21,13 @@ class LuckyNumberPresenter @Inject constructor(
|
|||||||
|
|
||||||
override fun onAttachView(view: LuckyNumberView) {
|
override fun onAttachView(view: LuckyNumberView) {
|
||||||
super.onAttachView(view)
|
super.onAttachView(view)
|
||||||
|
Timber.i("Lucky number view is attached")
|
||||||
view.initView()
|
view.initView()
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadData(forceRefresh: Boolean = false) {
|
private fun loadData(forceRefresh: Boolean = false) {
|
||||||
|
Timber.i("Loading lucky number started")
|
||||||
disposable.apply {
|
disposable.apply {
|
||||||
clear()
|
clear()
|
||||||
add(studentRepository.getCurrentStudent()
|
add(studentRepository.getCurrentStudent()
|
||||||
@ -39,6 +42,7 @@ class LuckyNumberPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.subscribe({
|
.subscribe({
|
||||||
|
Timber.i("Loading lucky number result: Success")
|
||||||
view?.apply {
|
view?.apply {
|
||||||
updateData(it)
|
updateData(it)
|
||||||
showContent(true)
|
showContent(true)
|
||||||
@ -46,9 +50,11 @@ class LuckyNumberPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
analytics.logEvent("load_lucky_number", "lucky_number" to it.luckyNumber, "force_refresh" to forceRefresh)
|
analytics.logEvent("load_lucky_number", "lucky_number" to it.luckyNumber, "force_refresh" to forceRefresh)
|
||||||
}, {
|
}, {
|
||||||
|
Timber.i("Loading lucky number result: An exception occurred")
|
||||||
view?.run { showEmpty(isViewEmpty()) }
|
view?.run { showEmpty(isViewEmpty()) }
|
||||||
errorHandler.dispatch(it)
|
errorHandler.dispatch(it)
|
||||||
}, {
|
}, {
|
||||||
|
Timber.i("Loading lucky number result: No lucky number found")
|
||||||
view?.run {
|
view?.run {
|
||||||
showContent(false)
|
showContent(false)
|
||||||
showEmpty(true)
|
showEmpty(true)
|
||||||
@ -59,6 +65,7 @@ class LuckyNumberPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun onSwipeRefresh() {
|
fun onSwipeRefresh() {
|
||||||
|
Timber.i("Force refreshing the lucky number")
|
||||||
loadData(true)
|
loadData(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ class SendMessagePresenter @Inject constructor(
|
|||||||
private lateinit var reportingUnit: ReportingUnit
|
private lateinit var reportingUnit: ReportingUnit
|
||||||
|
|
||||||
override fun onAttachView(view: SendMessageView) {
|
override fun onAttachView(view: SendMessageView) {
|
||||||
Timber.i("Send message view is attached")
|
|
||||||
super.onAttachView(view)
|
super.onAttachView(view)
|
||||||
|
Timber.i("Send message view is attached")
|
||||||
view.run {
|
view.run {
|
||||||
initView()
|
initView()
|
||||||
showBottomNav(false)
|
showBottomNav(false)
|
||||||
@ -60,13 +60,13 @@ class SendMessagePresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.subscribe({
|
.subscribe({
|
||||||
|
Timber.i("Loading recipients result: Success, fetched %s recipients", it.size.toString())
|
||||||
view?.apply {
|
view?.apply {
|
||||||
setReportingUnit(reportingUnit)
|
setReportingUnit(reportingUnit)
|
||||||
setRecipients(it)
|
setRecipients(it)
|
||||||
refreshRecipientsAdapter()
|
refreshRecipientsAdapter()
|
||||||
showContent(true)
|
showContent(true)
|
||||||
}
|
}
|
||||||
Timber.i("Loading recipients result: Success, fetched %s recipients", it.size.toString())
|
|
||||||
}, {
|
}, {
|
||||||
Timber.i("Loading recipients result: An exception occurred")
|
Timber.i("Loading recipients result: An exception occurred")
|
||||||
view?.showContent(true)
|
view?.showContent(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user