add a "report a bug" button

pull/28/head
geeksville 2020-04-15 14:10:40 -07:00
rodzic f2f7c630c3
commit 18248bd86a
3 zmienionych plików z 43 dodań i 10 usunięć

Wyświetl plik

@ -27,6 +27,7 @@ import com.geeksville.mesh.R
import com.geeksville.mesh.model.UIViewModel import com.geeksville.mesh.model.UIViewModel
import com.geeksville.mesh.service.RadioInterfaceService import com.geeksville.mesh.service.RadioInterfaceService
import com.geeksville.util.exceptionReporter import com.geeksville.util.exceptionReporter
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.android.synthetic.main.settings_fragment.* import kotlinx.android.synthetic.main.settings_fragment.*
@ -260,13 +261,32 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
requireActivity().hideKeyboard() requireActivity().hideKeyboard()
} }
val app = (requireContext().applicationContext as GeeksvilleApplication)
// Set analytics checkbox // Set analytics checkbox
analyticsOkayCheckbox.isChecked = analyticsOkayCheckbox.isChecked = app.isAnalyticsAllowed
(requireContext().applicationContext as GeeksvilleApplication).isAnalyticsAllowed
analyticsOkayCheckbox.setOnCheckedChangeListener { _, isChecked -> analyticsOkayCheckbox.setOnCheckedChangeListener { _, isChecked ->
debug("User changed analytics to $isChecked") debug("User changed analytics to $isChecked")
(requireContext().applicationContext as GeeksvilleApplication).isAnalyticsAllowed = app.isAnalyticsAllowed = isChecked
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 -> scanModel.errorText.observe(viewLifecycleOwner, Observer { errMsg ->

Wyświetl plik

@ -44,7 +44,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="32dp" android:layout_marginTop="16dp"
android:text="@string/looking_for_meshtastic_devices" android:text="@string/looking_for_meshtastic_devices"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInputLayout2" /> app:layout_constraintTop_toBottomOf="@+id/textInputLayout2" />
@ -85,15 +85,25 @@
android:id="@+id/analyticsOkayCheckbox" android:id="@+id/analyticsOkayCheckbox"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="8dp"
android:layout_marginEnd="16dp" android:layout_marginBottom="8dp"
android:checked="true" android:checked="true"
android:text="@string/analytics_okay" android:text="@string/analytics_okay"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toStartOf="@+id/reportBugButton"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/deviceRadioGroup" app:layout_constraintTop_toBottomOf="@+id/deviceRadioGroup"
app:layout_constraintVertical_bias="1.0" /> app:layout_constraintVertical_bias="1.0" />
<Button
android:id="@+id/reportBugButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:text="@string/report_bug"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -14,8 +14,7 @@
<string name="sample_message">hey I found the cache, it is over here next to the big tiger. I\'m kinda scared.</string> <string name="sample_message">hey I found the cache, it is over here next to the big tiger. I\'m kinda scared.</string>
<string name="some_username" translatable="false">SKH</string> <string name="some_username" translatable="false">SKH</string>
<string name="send_text">Send Text</string> <string name="send_text">Send Text</string>
<string name="warning_not_paired">You haven\'t yet paired a Meshtastic compatible radio with this phone. Please pair a device and set your username.\n\n <string name="warning_not_paired">You haven\'t yet paired a Meshtastic compatible radio with this phone. Please pair a device and set your username.\n\nThis open-source application is in alpha-testing, if you find problems please post on our forum: meshtastic.discourse.group.\n\nFor more information see our web page - www.meshtastic.org.</string>
This open-source application is in alpha-testing, if you find problems please post on our forum: meshtastic.discourse.group.\n\nFor more information see our web page - www.meshtastic.org.</string>
<string name="username_unset">Username unset</string> <string name="username_unset">Username unset</string>
<string name="your_name">Your Name</string> <string name="your_name">Your Name</string>
<string name="analytics_okay">Anonymous usage statistics and crash reports.</string> <string name="analytics_okay">Anonymous usage statistics and crash reports.</string>
@ -38,4 +37,8 @@
If you are interested in us paying for mapbox (or switching to a different map provider), please post in meshtastic.discourse.group</string> If you are interested in us paying for mapbox (or switching to a different map provider), please post in meshtastic.discourse.group</string>
<string name="permission_missing">A required permission is missing, Meshtastic won\'t be able to work properly. Please enable in application settings.</string> <string name="permission_missing">A required permission is missing, Meshtastic won\'t be able to work properly. Please enable in application settings.</string>
<string name="radio_sleeping">Radio was sleeping, could not change channel</string> <string name="radio_sleeping">Radio was sleeping, could not change channel</string>
<string name="report_bug">Report Bug</string>
<string name="report_a_bug">Report a bug</string>
<string name="report_bug_text">Are you sure you want to report a bug? After reporting, please post in meshtastic.discourse.group so we can match up the report with what you found.</string>
<string name="report">Report</string>
</resources> </resources>