Added send immediately to debug info

pull/213/head
M66B 1 year ago
parent 395aed2a98
commit 9ca6034855

@ -2271,12 +2271,52 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
@Override @Override
protected Long onExecute(Context context, Bundle args) throws IOException, JSONException { 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 @Override
protected void onExecuted(Bundle args, Long id) { protected void onExecuted(Bundle args, Long id) {
if (id != null) if (id == null)
return;
startActivity(new Intent(ActivityView.this, ActivityCompose.class) startActivity(new Intent(ActivityView.this, ActivityCompose.class)
.putExtra("action", "edit") .putExtra("action", "edit")
.putExtra("id", id)); .putExtra("id", id));

@ -57,6 +57,7 @@ public class FragmentDialogDebug extends FragmentDialogBase {
final EditText etIssue = view.findViewById(R.id.etIssue); final EditText etIssue = view.findViewById(R.id.etIssue);
final Spinner spAccount = view.findViewById(R.id.spAccount); final Spinner spAccount = view.findViewById(R.id.spAccount);
final CheckBox cbContact = view.findViewById(R.id.cbContact); final CheckBox cbContact = view.findViewById(R.id.cbContact);
final CheckBox cbSend = view.findViewById(R.id.cbSend);
final ArrayAdapter<EntityAccount> adapterAccount; final ArrayAdapter<EntityAccount> adapterAccount;
etIssue.addTextChangedListener(new TextWatcher() { etIssue.addTextChangedListener(new TextWatcher() {
@ -131,6 +132,7 @@ public class FragmentDialogDebug extends FragmentDialogBase {
Bundle args = getArguments(); Bundle args = getArguments();
args.putString("issue", etIssue.getText().toString()); args.putString("issue", etIssue.getText().toString());
args.putBoolean("contact", cbContact.isChecked()); args.putBoolean("contact", cbContact.isChecked());
args.putBoolean("send", cbSend.isChecked());
EntityAccount account = (EntityAccount) spAccount.getSelectedItem(); EntityAccount account = (EntityAccount) spAccount.getSelectedItem();
if (account != null) if (account != null)

@ -81,5 +81,14 @@
android:text="@string/title_debug_info_contact" android:text="@string/title_debug_info_contact"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spAccount" /> app:layout_constraintTop_toBottomOf="@+id/spAccount" />
<CheckBox
android:id="@+id/cbSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_debug_info_send"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cbContact" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>

@ -2279,6 +2279,7 @@
<string name="title_debug_info_issue">Problem description (required)</string> <string name="title_debug_info_issue">Problem description (required)</string>
<string name="title_debug_info_issue_remark">Details, such as the estimated time of the problem, the exact error message, etc., are important</string> <string name="title_debug_info_issue_remark">Details, such as the estimated time of the problem, the exact error message, etc., are important</string>
<string name="title_debug_info_contact">We recently had contact about this problem</string> <string name="title_debug_info_contact">We recently had contact about this problem</string>
<string name="title_debug_info_send">Send immediately</string>
<string name="title_unexpected_info_remark">Please describe what you were doing when you got the error:</string> <string name="title_unexpected_info_remark">Please describe what you were doing when you got the error:</string>
<string name="title_issue_subject" translatable="false">FairEmail %1$s issue</string> <string name="title_issue_subject" translatable="false">FairEmail %1$s issue</string>

Loading…
Cancel
Save