Merge branch '1979-feedback-crash' into 'master'

Don't crash when pressing SHOW with user information when sending feedback

Closes #1979

See merge request briar/briar!1418
This commit is contained in:
akwizgran
2021-03-25 13:29:43 +00:00
3 changed files with 7 additions and 4 deletions

View File

@@ -51,15 +51,15 @@ class ReportData {
final boolean isOptional;
boolean isIncluded = true;
ReportItem(String name, int nameRes, ReportInfo info) {
ReportItem(String name, @StringRes int nameRes, ReportInfo info) {
this(name, nameRes, info, true);
}
ReportItem(String name, int nameRes, String info) {
ReportItem(String name, @StringRes int nameRes, String info) {
this(name, nameRes, new SingleReportInfo(info), true);
}
ReportItem(String name, int nameRes, ReportInfo info,
ReportItem(String name, @StringRes int nameRes, ReportInfo info,
boolean isOptional) {
this.name = name;
this.nameRes = nameRes;

View File

@@ -15,6 +15,7 @@ import org.briarproject.briar.android.logging.BriefLogFormatter;
import org.briarproject.briar.android.logging.CachingLogHandler;
import org.briarproject.briar.android.logging.LogDecrypter;
import org.briarproject.briar.android.reporting.ReportData.MultiReportInfo;
import org.briarproject.briar.android.reporting.ReportData.ReportItem;
import org.briarproject.briar.android.viewmodel.LiveEvent;
import org.briarproject.briar.android.viewmodel.MutableLiveEvent;
import org.json.JSONException;
@@ -156,7 +157,8 @@ class ReportViewModel extends AndroidViewModel {
MultiReportInfo userInfo = new MultiReportInfo();
if (!isNullOrEmpty(comment)) userInfo.add("Comment", comment);
if (!isNullOrEmpty(email)) userInfo.add("Email", email);
data.add(new ReportData.ReportItem("UserInfo", 0, userInfo, false));
data.add(new ReportItem("UserInfo", R.string.dev_report_user_info,
userInfo, false));
}
// check the state of the TorPlugin, if this is feedback

View File

@@ -573,6 +573,7 @@
<string name="optional_contact_email">Your email address (optional)</string>
<string name="include_debug_report_crash">Include anonymous data about the crash</string>
<string name="include_debug_report_feedback">Include anonymous data about this device</string>
<string name="dev_report_user_info">User information</string>
<string name="dev_report_basic_info">Basic information</string>
<string name="dev_report_device_info">Device information</string>
<string name="dev_report_stacktrace">Stacktrace</string>