Report new on compose is an experiment

This commit is contained in:
M66B 2021-10-15 07:35:48 +02:00
parent 928a9ed188
commit 9d21d210ed
6 changed files with 64 additions and 55 deletions

View File

@ -7,11 +7,13 @@
### Next version
* Added support for latin and roman numbered lists (view only)
* Report new messages in same thread when composing a new message
* Report new messages when composing a message [1]
* Use account categories for identities
* Small improvements and minor bug fixes
* Updated translations
[1] This is an experiment which needs to be enabled in the miscellaneous settings.
### 1.1763
* Small improvements and minor bug fixes

17
FAQ.md
View File

@ -3303,14 +3303,6 @@ Reformatting and displaying such messages will take too long. You can try to use
🌎 [Google Translate](https://translate.google.com/translate?sl=en&&u=https://github.com/M66B/FairEmail/blob/master/FAQ.md%23user-content-faq125)
*Message classification (version 1.1438+)*
Please see [this FAQ](#user-content-faq163) for details.
Since this is an experimental feature, my advice is to start with just one folder.
<br />
*Send hard bounce (version 1.1477+)*
Send a [Delivery Status Notification](https://tools.ietf.org/html/rfc3464) (=hard bounce) via the reply/answer menu.
@ -3322,9 +3314,14 @@ For some background, see for [this Wikipedia article](https://en.wikipedia.org/w
<br />
*Translate button (version 1.1600+)*
*Report new messages when composing a message*
Please see [this FAQ](#user-content-faq167) about how to configure DeepL.
A bottom notification will be shown if a new message arrives in the same conversation thread as a new message is being composed for.
There will be a *show* button to show the conversation and from there you can tap on the draft message to continue editting.
The notification can be swiped away.
This requires grouping of messages into conversations to be enabled.
<br />

View File

@ -7,11 +7,13 @@
### Next version
* Added support for latin and roman numbered lists (view only)
* Report new messages in same thread when composing a new message
* Report new messages when composing a message [1]
* Use account categories for identities
* Small improvements and minor bug fixes
* Updated translations
[1] This is an experiment which needs to be enabled in the miscellaneous settings.
### 1.1763
* Small improvements and minor bug fixes

View File

@ -281,6 +281,9 @@ public interface DaoMessage {
" JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE message.account = :account" +
" AND message.thread = :thread" +
" AND folder.type <> '" + EntityFolder.DRAFTS + "'" +
" AND folder.type <> '" + EntityFolder.OUTBOX + "'" +
" AND folder.type <> '" + EntityFolder.SENT + "'" +
" AND folder.type <> '" + EntityFolder.ARCHIVE + "'" +
" AND NOT ui_seen" +
" AND NOT ui_hide")

View File

@ -5198,51 +5198,54 @@ public class FragmentCompose extends FragmentBase {
}
});
db.message().liveUnreadThread(data.draft.account, data.draft.thread).observe(getViewLifecycleOwner(), new Observer<List<EntityMessage>>() {
private int lastDiff = 0;
private List<EntityMessage> base = null;
boolean experiments = prefs.getBoolean("experiments", false);
boolean threading = prefs.getBoolean("threading", true);
if (experiments && threading)
db.message().liveUnreadThread(data.draft.account, data.draft.thread).observe(getViewLifecycleOwner(), new Observer<List<EntityMessage>>() {
private int lastDiff = 0;
private List<EntityMessage> base = null;
@Override
public void onChanged(List<EntityMessage> messages) {
if (messages == null)
return;
@Override
public void onChanged(List<EntityMessage> messages) {
if (messages == null)
return;
if (base == null) {
base = messages;
return;
if (base == null) {
base = messages;
return;
}
int diff = (messages.size() - base.size());
if (diff > lastDiff) {
lastDiff = diff;
String msg = getResources().getQuantityString(
R.plurals.title_notification_unseen, diff, diff);
Snackbar snackbar = Snackbar.make(view, msg, Snackbar.LENGTH_INDEFINITE)
.setGestureInsetBottomIgnored(true);
snackbar.setAction(R.string.title_show, new View.OnClickListener() {
@Override
public void onClick(View v) {
EntityMessage message = messages.get(0);
boolean notify_remove = prefs.getBoolean("notify_remove", true);
Intent thread = new Intent(v.getContext(), ActivityView.class);
thread.setAction("thread:" + message.id);
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
thread.putExtra("account", message.account);
thread.putExtra("folder", message.folder);
thread.putExtra("thread", message.thread);
thread.putExtra("filter_archive", true);
thread.putExtra("ignore", notify_remove);
v.getContext().startActivity(thread);
getActivity().finish();
}
});
snackbar.show();
}
}
int diff = (messages.size() - base.size());
if (diff > lastDiff) {
lastDiff = diff;
String msg = getResources().getQuantityString(
R.plurals.title_notification_unseen, diff, diff);
Snackbar snackbar = Snackbar.make(view, msg, Snackbar.LENGTH_INDEFINITE)
.setGestureInsetBottomIgnored(true);
snackbar.setAction(R.string.title_show, new View.OnClickListener() {
@Override
public void onClick(View v) {
EntityMessage message = messages.get(0);
boolean notify_remove = prefs.getBoolean("notify_remove", true);
Intent thread = new Intent(v.getContext(), ActivityView.class);
thread.setAction("thread:" + message.id);
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
thread.putExtra("account", message.account);
thread.putExtra("folder", message.folder);
thread.putExtra("thread", message.thread);
thread.putExtra("filter_archive", true);
thread.putExtra("ignore", notify_remove);
v.getContext().startActivity(thread);
getActivity().finish();
}
});
snackbar.show();
}
}
});
});
}
@Override

View File

@ -7,11 +7,13 @@
### Next version
* Added support for latin and roman numbered lists (view only)
* Report new messages in same thread when composing a new message
* Report new messages when composing a message [1]
* Use account categories for identities
* Small improvements and minor bug fixes
* Updated translations
[1] This is an experiment which needs to be enabled in the miscellaneous settings.
### 1.1763
* Small improvements and minor bug fixes