mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-08 20:28:48 +00:00
ErrorReporter: Add versionName to bug report subjects too.
This commit is contained in:
parent
01a27f76b0
commit
88d50f088d
2 changed files with 11 additions and 4 deletions
|
@ -349,7 +349,7 @@ public abstract class OeffiMainActivity extends OeffiActivity {
|
|||
}
|
||||
|
||||
case R.id.global_options_report_bug: {
|
||||
ErrorReporter.sendBugMail(this);
|
||||
ErrorReporter.sendBugMail(this, application.packageInfo());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,11 +212,11 @@ public class ErrorReporter implements Thread.UncaughtExceptionHandler {
|
|||
private static void sendErrorMail(final Context context, final String errorContent) {
|
||||
final Matcher m = Pattern.compile("Version: (.+?) ").matcher(errorContent);
|
||||
final String versionName = m.find() ? m.group(1) : "";
|
||||
final String subject = context.getString(R.string.error_reporter_crash_mail_subject) + " " + versionName;
|
||||
final String subject = buildSubject(context, R.string.error_reporter_crash_mail_subject, versionName);
|
||||
send(context, subject, errorContent);
|
||||
}
|
||||
|
||||
public static void sendBugMail(final Context context) {
|
||||
public static void sendBugMail(final Context context, final PackageInfo packageInfo) {
|
||||
final StringBuilder report = new StringBuilder(context.getString(R.string.error_reporter_questions));
|
||||
report.append("\n=== collected at reporting time ===\n\n");
|
||||
appendReport(report, context);
|
||||
|
@ -228,10 +228,17 @@ public class ErrorReporter implements Thread.UncaughtExceptionHandler {
|
|||
report.append("\n\n");
|
||||
report.append(context.getString(R.string.error_reporter_footer));
|
||||
|
||||
final String subject = context.getString(R.string.error_reporter_bug_mail_subject);
|
||||
final String subject = buildSubject(context, R.string.error_reporter_bug_mail_subject, packageInfo.versionName);
|
||||
send(context, subject, report);
|
||||
}
|
||||
|
||||
private static String buildSubject(final Context context, final int prefixResId, final String versionName) {
|
||||
final StringBuilder subject = new StringBuilder(context.getString(prefixResId));
|
||||
subject.append(": ");
|
||||
subject.append(versionName);
|
||||
return subject.toString();
|
||||
}
|
||||
|
||||
private static void send(final Context context, final String subject, final CharSequence report) {
|
||||
final File logDir = new File(context.getFilesDir(), "log");
|
||||
final ArrayList<Uri> attachments = new ArrayList<>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue