From f8ee5cb06266db6c3835a72ad7fa1db22f767204 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sun, 24 Feb 2019 19:23:03 +0100 Subject: [PATCH] Add lucky number logging (#256) --- .../ui/modules/luckynumber/LuckyNumberPresenter.kt | 7 +++++++ .../ui/modules/message/send/SendMessagePresenter.kt | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt index d034723f4..56889012f 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt @@ -7,6 +7,7 @@ import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider +import timber.log.Timber import javax.inject.Inject class LuckyNumberPresenter @Inject constructor( @@ -20,11 +21,13 @@ class LuckyNumberPresenter @Inject constructor( override fun onAttachView(view: LuckyNumberView) { super.onAttachView(view) + Timber.i("Lucky number view is attached") view.initView() loadData() } private fun loadData(forceRefresh: Boolean = false) { + Timber.i("Loading lucky number started") disposable.apply { clear() add(studentRepository.getCurrentStudent() @@ -39,6 +42,7 @@ class LuckyNumberPresenter @Inject constructor( } } .subscribe({ + Timber.i("Loading lucky number result: Success") view?.apply { updateData(it) showContent(true) @@ -46,9 +50,11 @@ class LuckyNumberPresenter @Inject constructor( } 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()) } errorHandler.dispatch(it) }, { + Timber.i("Loading lucky number result: No lucky number found") view?.run { showContent(false) showEmpty(true) @@ -59,6 +65,7 @@ class LuckyNumberPresenter @Inject constructor( } fun onSwipeRefresh() { + Timber.i("Force refreshing the lucky number") loadData(true) } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/send/SendMessagePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/send/SendMessagePresenter.kt index bb8070b43..05cfc7a40 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/send/SendMessagePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/send/SendMessagePresenter.kt @@ -28,8 +28,8 @@ class SendMessagePresenter @Inject constructor( private lateinit var reportingUnit: ReportingUnit override fun onAttachView(view: SendMessageView) { - Timber.i("Send message view is attached") super.onAttachView(view) + Timber.i("Send message view is attached") view.run { initView() showBottomNav(false) @@ -60,13 +60,13 @@ class SendMessagePresenter @Inject constructor( } } .subscribe({ + Timber.i("Loading recipients result: Success, fetched %s recipients", it.size.toString()) view?.apply { setReportingUnit(reportingUnit) setRecipients(it) refreshRecipientsAdapter() showContent(true) } - Timber.i("Loading recipients result: Success, fetched %s recipients", it.size.toString()) }, { Timber.i("Loading recipients result: An exception occurred") view?.showContent(true)