From 428b599be04652cd1aa8948873252ad8cc05deab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sun, 24 May 2020 19:48:14 +0200 Subject: [PATCH] Improve firebase logging (#832) --- .../github/wulkanowy/utils/CrashlyticsUtils.kt | 2 -- .../wulkanowy/utils/FirebaseAnalyticsHelper.kt | 7 ++++++- .../modules/attendance/AttendancePresenter.kt | 7 ++++++- .../summary/AttendanceSummaryPresenter.kt | 8 +++++++- .../wulkanowy/ui/modules/exam/ExamPresenter.kt | 7 ++++++- .../grade/details/GradeDetailsPresenter.kt | 7 ++++++- .../statistics/GradeStatisticsPresenter.kt | 7 ++++++- .../grade/summary/GradeSummaryPresenter.kt | 7 ++++++- .../ui/modules/homework/HomeworkPresenter.kt | 7 ++++++- .../luckynumber/LuckyNumberPresenter.kt | 7 ++++++- .../wulkanowy/ui/modules/main/MainActivity.kt | 8 ++++++++ .../wulkanowy/ui/modules/main/MainPresenter.kt | 3 ++- .../wulkanowy/ui/modules/main/MainView.kt | 2 ++ .../message/preview/MessagePreviewPresenter.kt | 6 +++++- .../modules/message/tab/MessageTabPresenter.kt | 7 ++++++- .../mobiledevice/MobileDevicePresenter.kt | 7 ++++++- .../wulkanowy/ui/modules/note/NotePresenter.kt | 7 ++++++- .../school/SchoolPresenter.kt | 6 +++++- .../teacher/TeacherPresenter.kt | 7 ++++++- .../ui/modules/timetable/TimetablePresenter.kt | 7 ++++++- .../completed/CompletedLessonsPresenter.kt | 7 ++++++- .../utils/FragNavControlerExtension.kt | 6 +++--- .../github/wulkanowy/utils/CrashlyticsUtils.kt | 18 ++++++++++-------- .../wulkanowy/utils/FirebaseAnalyticsHelper.kt | 5 +++++ 24 files changed, 131 insertions(+), 31 deletions(-) diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt index 60dc6b56..6351997d 100644 --- a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt +++ b/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt @@ -5,8 +5,6 @@ package io.github.wulkanowy.utils import android.content.Context import timber.log.Timber -fun initCrashlytics(context: Context, appInfo: AppInfo) {} - open class TimberTreeNoOp : Timber.Tree() { override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {} } diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt index 0b1274f1..f23645bc 100644 --- a/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt +++ b/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt @@ -1,13 +1,18 @@ package io.github.wulkanowy.utils +import android.app.Activity import javax.inject.Inject import javax.inject.Singleton @Singleton +@Suppress("UNUSED_PARAMETER") class FirebaseAnalyticsHelper @Inject constructor() { - @Suppress("UNUSED_PARAMETER") fun logEvent(name: String, vararg params: Pair) { // do nothing } + + fun setCurrentScreen(activity: Activity, name: String?) { + // do nothing + } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt index 3a1fb0ce..437e06c9 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt @@ -215,7 +215,12 @@ class AttendancePresenter @Inject constructor( showContent(it.isNotEmpty()) showExcuseButton(it.any { item -> item.excusable }) } - analytics.logEvent("load_attendance", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "attendance", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading attendance result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt index 72dfc327..33e18c2e 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt @@ -99,7 +99,13 @@ class AttendanceSummaryPresenter @Inject constructor( showContent(it.isNotEmpty()) updateDataSet(it) } - analytics.logEvent("load_attendance_summary", "items" to it.size, "force_refresh" to forceRefresh, "item_id" to subjectId) + analytics.logEvent( + "load_data", + "type" to "attendance_summary", + "items" to it.size, + "force_refresh" to forceRefresh, + "item_id" to subjectId + ) }) { Timber.i("Loading attendance summary result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt index 495602fc..1c47cc7d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt @@ -131,7 +131,12 @@ class ExamPresenter @Inject constructor( showErrorView(false) showContent(it.isNotEmpty()) } - analytics.logEvent("load_exam", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "exam", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading exam result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt index b674bf77..37f2c935 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt @@ -152,7 +152,12 @@ class GradeDetailsPresenter @Inject constructor( gradeColorTheme = preferencesRepository.gradeColorTheme ) } - analytics.logEvent("load_grade_details", "items" to grades.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "grade_details", + "items" to grades.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading grade details result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt index 5cc733cd..590e9ce1 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt @@ -174,7 +174,12 @@ class GradeStatisticsPresenter @Inject constructor( updateData(it, preferencesRepository.gradeColorTheme, preferencesRepository.showAllSubjectsOnStatisticsList) showSubjects(!preferencesRepository.showAllSubjectsOnStatisticsList) } - analytics.logEvent("load_grade_statistics", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "grade_statistics", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading grade stats result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt index 26f922de..9b88689d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt @@ -49,7 +49,12 @@ class GradeSummaryPresenter @Inject constructor( showErrorView(false) updateData(it) } - analytics.logEvent("load_grade_summary", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "grade_summary", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading grade summary result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt index d39efde1..fafc3319 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt @@ -124,7 +124,12 @@ class HomeworkPresenter @Inject constructor( showErrorView(false) showContent(it.isNotEmpty()) } - analytics.logEvent("load_homework", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "homework", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading homework result: An exception occurred") 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 1d3a17bd..e932fedc 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 @@ -54,7 +54,12 @@ class LuckyNumberPresenter @Inject constructor( showEmpty(false) showErrorView(false) } - analytics.logEvent("load_lucky_number", "lucky_number" to it.luckyNumber, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_item", + "type" to "lucky_number", + "number" to it.luckyNumber, + "force_refresh" to forceRefresh + ) }, { Timber.i("Loading lucky number result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt index 9ce19079..f5b7c47c 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt @@ -31,6 +31,7 @@ import io.github.wulkanowy.ui.modules.message.MessageFragment import io.github.wulkanowy.ui.modules.more.MoreFragment import io.github.wulkanowy.ui.modules.note.NoteFragment import io.github.wulkanowy.ui.modules.timetable.TimetableFragment +import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.dpToPx import io.github.wulkanowy.utils.getThemeAttrColor import io.github.wulkanowy.utils.safelyPopFragments @@ -46,6 +47,9 @@ class MainActivity : BaseActivity(), MainVie @Inject lateinit var navController: FragNavController + @Inject + lateinit var analytics: FirebaseAnalyticsHelper + @Inject lateinit var overlayProvider: Lazy @@ -136,6 +140,10 @@ class MainActivity : BaseActivity(), MainVie } } + override fun setCurrentScreen(name: String?) { + analytics.setCurrentScreen(this, name) + } + override fun onOptionsItemSelected(item: MenuItem?): Boolean { return if (item?.itemId == R.id.mainMenuAccount) presenter.onAccountManagerSelected() else false diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt index f5a49004..233d4491 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt @@ -37,8 +37,9 @@ class MainPresenter @Inject constructor( analytics.logEvent("app_open", "destination" to initMenu?.name) } - fun onViewChange(section: MainView.Section?) { + fun onViewChange(section: MainView.Section?, name: String?) { view?.apply { + setCurrentScreen(name) showActionBarElevation(section != GRADE && section != MESSAGE && section != SCHOOL) currentViewTitle?.let { setViewTitle(it) } currentViewSubtitle?.let { setViewSubTitle(it.ifBlank { null }) } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt index 97b556e3..7e583147 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt @@ -24,6 +24,8 @@ interface MainView : BaseView { fun showAccountPicker() + fun setCurrentScreen(name: String?) + fun showActionBarElevation(show: Boolean) fun notifyMenuViewReselected() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt index 62ac5a53..24678c70 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt @@ -60,7 +60,11 @@ class MessagePreviewPresenter @Inject constructor( setMessageWithAttachment(message) initOptions() } - analytics.logEvent("load_message_preview", "length" to message.message.content.length) + analytics.logEvent( + "load_item", + "type" to "message_preview", + "length" to message.message.content.length + ) }) { Timber.i("Loading message ${message.messageId} preview result: An exception occurred ") retryCallback = { onMessageLoadRetry(message) } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt index 6513adcd..221762d1 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt @@ -97,7 +97,12 @@ class MessageTabPresenter @Inject constructor( Timber.i("Loading $folder message result: Success") messages = it onSearchQueryTextChange(lastSearchQuery) - analytics.logEvent("load_messages", "items" to it.size, "folder" to folder.name) + analytics.logEvent( + "load_data", + "type" to "messages", + "items" to it.size, + "folder" to folder.name + ) }) { Timber.i("Loading $folder message result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt index d8c99b22..459ca17e 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt @@ -70,7 +70,12 @@ class MobileDevicePresenter @Inject constructor( showEmpty(it.isEmpty()) showErrorView(false) } - analytics.logEvent("load_devices", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "devices", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading mobile devices result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt index 00df71b9..7d301c66 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt @@ -69,7 +69,12 @@ class NotePresenter @Inject constructor( showErrorView(false) showContent(it.isNotEmpty()) } - analytics.logEvent("load_note", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "note", + "items" to it.size, + "force_refresh" to forceRefresh + ) }, { Timber.i("Loading note result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt index e2eb614d..7beff922 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt @@ -88,7 +88,11 @@ class SchoolPresenter @Inject constructor( showEmpty(false) showErrorView(false) } - analytics.logEvent("load_school", "force_refresh" to forceRefresh) + analytics.logEvent( + "load_item", + "type" to "school", + "force_refresh" to forceRefresh + ) }, { Timber.i("Loading school result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt index e888308f..0d8eec6d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt @@ -75,7 +75,12 @@ class TeacherPresenter @Inject constructor( showEmpty(it.isEmpty()) showErrorView(false) } - analytics.logEvent("load_teachers", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "teachers", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading teachers result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt index 50c12364..e1ce005e 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt @@ -154,7 +154,12 @@ class TimetablePresenter @Inject constructor( showErrorView(false) showContent(it.isNotEmpty()) } - analytics.logEvent("load_timetable", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "timetable", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading timetable result: An exception occurred") errorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt index 355411eb..7243061d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt @@ -134,7 +134,12 @@ class CompletedLessonsPresenter @Inject constructor( showErrorView(false) showContent(it.isNotEmpty()) } - analytics.logEvent("load_completed_lessons", "items" to it.size, "force_refresh" to forceRefresh) + analytics.logEvent( + "load_data", + "type" to "completed_lessons", + "items" to it.size, + "force_refresh" to forceRefresh + ) }) { Timber.i("Loading completed lessons result: An exception occurred") completedLessonsErrorHandler.dispatch(it) diff --git a/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt index 9cec331f..9dc1e18a 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt @@ -4,14 +4,14 @@ import androidx.fragment.app.Fragment import com.ncapdevi.fragnav.FragNavController import io.github.wulkanowy.ui.modules.main.MainView -inline fun FragNavController.setOnViewChangeListener(crossinline listener: (section: MainView.Section?) -> Unit) { +inline fun FragNavController.setOnViewChangeListener(crossinline listener: (section: MainView.Section?, name: String?) -> Unit) { transactionListener = object : FragNavController.TransactionListener { override fun onFragmentTransaction(fragment: Fragment?, transactionType: FragNavController.TransactionType) { - listener(fragment?.toSection()) + listener(fragment?.toSection(), fragment?.let { it::class.java.simpleName }) } override fun onTabTransaction(fragment: Fragment?, index: Int) { - listener(fragment?.toSection()) + listener(fragment?.toSection(), fragment?.let { it::class.java.simpleName }) } } } diff --git a/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt b/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt index e374577d..e87177c1 100644 --- a/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt +++ b/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt @@ -6,20 +6,14 @@ import fr.bipi.tressence.base.FormatterPriorityTree import fr.bipi.tressence.common.StackTraceRecorder import io.github.wulkanowy.sdk.exception.FeatureDisabledException import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException +import java.io.InterruptedIOException +import java.net.SocketTimeoutException import java.net.UnknownHostException class CrashlyticsTree : FormatterPriorityTree(Log.VERBOSE) { private val crashlytics by lazy { FirebaseCrashlytics.getInstance() } - override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean { - if (t is FeatureDisabledException || t is FeatureNotAvailableException || t is UnknownHostException) { - return true - } - - return super.skipLog(priority, tag, message, t) - } - override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { if (skipLog(priority, tag, message, t)) return @@ -31,6 +25,14 @@ class CrashlyticsExceptionTree : FormatterPriorityTree(Log.ERROR) { private val crashlytics by lazy { FirebaseCrashlytics.getInstance() } + override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean { + if (t is FeatureDisabledException || t is FeatureNotAvailableException || t is UnknownHostException || t is SocketTimeoutException || t is InterruptedIOException) { + return true + } + + return super.skipLog(priority, tag, message, t) + } + override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { if (skipLog(priority, tag, message, t)) return diff --git a/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt b/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt index 6810e66a..b0b2fda4 100644 --- a/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt +++ b/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt @@ -1,5 +1,6 @@ package io.github.wulkanowy.utils +import android.app.Activity import android.content.Context import android.os.Bundle import com.google.firebase.analytics.FirebaseAnalytics @@ -24,4 +25,8 @@ class FirebaseAnalyticsHelper @Inject constructor(private val context: Context) analytics.logEvent(name, this) } } + + fun setCurrentScreen(activity: Activity, name: String?) { + analytics.setCurrentScreen(activity, name, null) + } }