diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 34f7fba89f..7b0cf712ee 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -2271,15 +2271,55 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB @Override protected Long onExecute(Context context, Bundle args) throws IOException, JSONException { - return Log.getDebugInfo(context, "main", R.string.title_debug_info_remark, null, null, args).id; + boolean send = args.getBoolean("send"); + + long id = Log.getDebugInfo(context, "main", R.string.title_debug_info_remark, null, null, args).id; + + if (send) { + boolean sent = false; + DB db = DB.getInstance(context); + try { + db.beginTransaction(); + + EntityMessage draft = db.message().getMessage(id); + if (draft != null) { + EntityFolder outbox = db.folder().getOutbox(); + if (outbox == null) { + Log.w("Outbox missing"); + outbox = EntityFolder.getOutbox(); + outbox.id = db.folder().insertFolder(outbox); + } + + draft.folder = outbox.id; + db.message().updateMessage(draft); + + EntityOperation.queue(context, draft, EntityOperation.SEND); + + db.setTransactionSuccessful(); + + sent = true; + } + } finally { + db.endTransaction(); + } + + if (sent) { + ToastEx.makeText(context, R.string.title_debug_info_send, Toast.LENGTH_LONG).show(); + ServiceSend.start(context); + return null; + } + } + + return id; } @Override protected void onExecuted(Bundle args, Long id) { - if (id != null) - startActivity(new Intent(ActivityView.this, ActivityCompose.class) - .putExtra("action", "edit") - .putExtra("id", id)); + if (id == null) + return; + startActivity(new Intent(ActivityView.this, ActivityCompose.class) + .putExtra("action", "edit") + .putExtra("id", id)); } @Override diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogDebug.java b/app/src/main/java/eu/faircode/email/FragmentDialogDebug.java index a70b2dcdbb..b7790026a6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogDebug.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogDebug.java @@ -57,6 +57,7 @@ public class FragmentDialogDebug extends FragmentDialogBase { final EditText etIssue = view.findViewById(R.id.etIssue); final Spinner spAccount = view.findViewById(R.id.spAccount); final CheckBox cbContact = view.findViewById(R.id.cbContact); + final CheckBox cbSend = view.findViewById(R.id.cbSend); final ArrayAdapter adapterAccount; etIssue.addTextChangedListener(new TextWatcher() { @@ -131,6 +132,7 @@ public class FragmentDialogDebug extends FragmentDialogBase { Bundle args = getArguments(); args.putString("issue", etIssue.getText().toString()); args.putBoolean("contact", cbContact.isChecked()); + args.putBoolean("send", cbSend.isChecked()); EntityAccount account = (EntityAccount) spAccount.getSelectedItem(); if (account != null) diff --git a/app/src/main/res/layout/dialog_debug.xml b/app/src/main/res/layout/dialog_debug.xml index 29052024c3..ce387b260e 100644 --- a/app/src/main/res/layout/dialog_debug.xml +++ b/app/src/main/res/layout/dialog_debug.xml @@ -81,5 +81,14 @@ android:text="@string/title_debug_info_contact" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/spAccount" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 544f5f02ff..0999890c4a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2279,6 +2279,7 @@ Problem description (required) Details, such as the estimated time of the problem, the exact error message, etc., are important We recently had contact about this problem + Send immediately Please describe what you were doing when you got the error: FairEmail %1$s issue