mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-16 03:49:33 -04:00
add a "report a bug" button
This commit is contained in:
@@ -27,6 +27,7 @@ import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.model.UIViewModel
|
||||
import com.geeksville.mesh.service.RadioInterfaceService
|
||||
import com.geeksville.util.exceptionReporter
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import kotlinx.android.synthetic.main.settings_fragment.*
|
||||
|
||||
|
||||
@@ -260,13 +261,32 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
requireActivity().hideKeyboard()
|
||||
}
|
||||
|
||||
val app = (requireContext().applicationContext as GeeksvilleApplication)
|
||||
|
||||
// Set analytics checkbox
|
||||
analyticsOkayCheckbox.isChecked =
|
||||
(requireContext().applicationContext as GeeksvilleApplication).isAnalyticsAllowed
|
||||
analyticsOkayCheckbox.isChecked = app.isAnalyticsAllowed
|
||||
|
||||
analyticsOkayCheckbox.setOnCheckedChangeListener { _, isChecked ->
|
||||
debug("User changed analytics to $isChecked")
|
||||
(requireContext().applicationContext as GeeksvilleApplication).isAnalyticsAllowed =
|
||||
isChecked
|
||||
app.isAnalyticsAllowed = isChecked
|
||||
reportBugButton.isEnabled = app.isAnalyticsAllowed
|
||||
}
|
||||
|
||||
// report bug button only enabled if analytics is allowed
|
||||
reportBugButton.isEnabled = app.isAnalyticsAllowed
|
||||
reportBugButton.setOnClickListener {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(R.string.report_a_bug)
|
||||
.setMessage(getString(R.string.report_bug_text))
|
||||
.setNeutralButton(R.string.cancel) { _, _ ->
|
||||
debug("Decided not to report a bug")
|
||||
}
|
||||
.setPositiveButton(getString(R.string.report)) { _, _ ->
|
||||
reportError("Clicked Report A Bug")
|
||||
}
|
||||
.show()
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
scanModel.errorText.observe(viewLifecycleOwner, Observer { errMsg ->
|
||||
|
||||
Reference in New Issue
Block a user