Skip to content

Commit

Permalink
Show missing compass dialog on first use of navigation tool
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Nov 11, 2023
1 parent a79045d commit 90ee480
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.kylecorry.andromeda.core.sensors.Quality
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.diagnostics.DiagnosticCode
import com.kylecorry.trail_sense.navigation.ui.NavigatorFragment
import com.kylecorry.trail_sense.shared.CustomUiUtils
import com.kylecorry.trail_sense.shared.ErrorBannerReason
import com.kylecorry.trail_sense.shared.FormatService
import com.kylecorry.trail_sense.shared.requireMainActivity
Expand Down Expand Up @@ -121,6 +122,15 @@ class NavigatorUserErrors(private val fragment: NavigatorFragment) {
if (!isCompassErrorShown && codes.contains(DiagnosticCode.MagnetometerUnavailable)) {
show(DiagnosticCode.MagnetometerUnavailable)
isCompassErrorShown = true

// Show a one time dialog containing the missing compass text
CustomUiUtils.disclaimer(
fragment.requireContext(),
fragment.getString(R.string.no_compass_message),
fragment.getString(R.string.no_compass_description),
"no_compass_message_shown",
cancelText = null
)
} else if (!codes.contains(DiagnosticCode.MagnetometerUnavailable)) {
banner.dismiss(ErrorBannerReason.NoCompass)
// Do not reset isCompassErrorShown
Expand Down

0 comments on commit 90ee480

Please sign in to comment.