diff --git a/feature/troubleshooting/src/main/java/com/simprints/feature/troubleshooting/overview/OverviewFragment.kt b/feature/troubleshooting/src/main/java/com/simprints/feature/troubleshooting/overview/OverviewFragment.kt index 2dcd232bce..41c9961c12 100644 --- a/feature/troubleshooting/src/main/java/com/simprints/feature/troubleshooting/overview/OverviewFragment.kt +++ b/feature/troubleshooting/src/main/java/com/simprints/feature/troubleshooting/overview/OverviewFragment.kt @@ -1,9 +1,11 @@ package com.simprints.feature.troubleshooting.overview import android.content.Intent +import android.os.Build import android.os.Bundle import android.view.View import androidx.core.content.FileProvider +import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import com.simprints.feature.troubleshooting.R @@ -68,6 +70,9 @@ internal class OverviewFragment : Fragment(R.layout.fragment_troubleshooting_ove binding.troubleshootOverviewPing.setOnClickListener { viewModel.pingServer() } + + // Log export is only Available starting from Android 8 + binding.troubleshootOverviewExportLogsBlock.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O binding.troubleshootOverviewExportLogs.setOnClickListener { v -> viewModel.exportLogs() } diff --git a/feature/troubleshooting/src/main/res/layout/fragment_troubleshooting_overview.xml b/feature/troubleshooting/src/main/res/layout/fragment_troubleshooting_overview.xml index 6f15691b04..8b7dbcff5f 100644 --- a/feature/troubleshooting/src/main/res/layout/fragment_troubleshooting_overview.xml +++ b/feature/troubleshooting/src/main/res/layout/fragment_troubleshooting_overview.xml @@ -127,6 +127,7 @@ android:textIsSelectable="true" /> Logger.setLogWriters(LogcatWriter()) + + Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> Logger.setLogWriters( + AnalyticsPropertyLogWriter(FirebaseAnalytics.getInstance(context)), + CrashlyticsLogWriter(FirebaseCrashlytics.getInstance()), + // Skip file logger to avoid crashes on Android 6-7 - https://simprints.atlassian.net/browse/MS-1060 + ) + + else -> Logger.setLogWriters( AnalyticsPropertyLogWriter(FirebaseAnalytics.getInstance(context)), CrashlyticsLogWriter(FirebaseCrashlytics.getInstance()), FileLogWriter(context), ) - Logger.setMinSeverity(Severity.Info) } + + Logger.setMinSeverity(if (BuildConfig.DEBUG) Severity.Debug else Severity.Info) } }