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

This commit is contained in:
Torsten Grote
2021-03-25 08:47:18 -03:00
parent 87799b743c
commit ecb31a4d32
3 changed files with 7 additions and 4 deletions

View File

@@ -51,15 +51,15 @@ class ReportData {
final boolean isOptional; final boolean isOptional;
boolean isIncluded = true; boolean isIncluded = true;
ReportItem(String name, int nameRes, ReportInfo info) { ReportItem(String name, @StringRes int nameRes, ReportInfo info) {
this(name, nameRes, info, true); 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); this(name, nameRes, new SingleReportInfo(info), true);
} }
ReportItem(String name, int nameRes, ReportInfo info, ReportItem(String name, @StringRes int nameRes, ReportInfo info,
boolean isOptional) { boolean isOptional) {
this.name = name; this.name = name;
this.nameRes = nameRes; 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.CachingLogHandler;
import org.briarproject.briar.android.logging.LogDecrypter; import org.briarproject.briar.android.logging.LogDecrypter;
import org.briarproject.briar.android.reporting.ReportData.MultiReportInfo; 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.LiveEvent;
import org.briarproject.briar.android.viewmodel.MutableLiveEvent; import org.briarproject.briar.android.viewmodel.MutableLiveEvent;
import org.json.JSONException; import org.json.JSONException;
@@ -156,7 +157,8 @@ class ReportViewModel extends AndroidViewModel {
MultiReportInfo userInfo = new MultiReportInfo(); MultiReportInfo userInfo = new MultiReportInfo();
if (!isNullOrEmpty(comment)) userInfo.add("Comment", comment); if (!isNullOrEmpty(comment)) userInfo.add("Comment", comment);
if (!isNullOrEmpty(email)) userInfo.add("Email", email); 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 // 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="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_crash">Include anonymous data about the crash</string>
<string name="include_debug_report_feedback">Include anonymous data about this device</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_basic_info">Basic information</string>
<string name="dev_report_device_info">Device information</string> <string name="dev_report_device_info">Device information</string>
<string name="dev_report_stacktrace">Stacktrace</string> <string name="dev_report_stacktrace">Stacktrace</string>