mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Notify new message in message view
This commit is contained in:
parent
917c02f46d
commit
fdd304add1
4 changed files with 13 additions and 12 deletions
|
@ -262,7 +262,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
|
||||
getSupportFragmentManager().addOnBackStackChangedListener(this);
|
||||
|
||||
DB.getInstance(this).account().liveAccountsEx().observe(this, new Observer<List<TupleAccountEx>>() {
|
||||
DB db = DB.getInstance(this);
|
||||
|
||||
db.account().liveAccountsEx().observe(this, new Observer<List<TupleAccountEx>>() {
|
||||
private List<TupleAccountEx> last = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
|
@ -351,6 +353,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
});
|
||||
|
||||
db.message().liveUnseenNotify().observe(this, new Observer<List<TupleMessageEx>>() {
|
||||
@Override
|
||||
public void onChanged(List<TupleMessageEx> messages) {
|
||||
Core.notify(ActivityView.this, messages);
|
||||
}
|
||||
});
|
||||
|
||||
if (getSupportFragmentManager().getFragments().size() == 0 && !getIntent().hasExtra(Intent.EXTRA_PROCESS_TEXT))
|
||||
init();
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ public interface DaoMessage {
|
|||
" WHERE message.id = :id")
|
||||
LiveData<TupleMessageEx> liveMessage(long id);
|
||||
|
||||
String notify = "SELECT message.*" +
|
||||
@Query("SELECT message.*" +
|
||||
", account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" +
|
||||
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType" +
|
||||
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
|
||||
|
@ -227,14 +227,9 @@ public interface DaoMessage {
|
|||
" AND NOT message.ui_seen" +
|
||||
" AND NOT message.ui_hide" +
|
||||
" AND NOT message.ui_ignored" +
|
||||
" ORDER BY message.received";
|
||||
|
||||
@Query(notify)
|
||||
" ORDER BY message.received")
|
||||
LiveData<List<TupleMessageEx>> liveUnseenNotify();
|
||||
|
||||
@Query(notify)
|
||||
List<TupleMessageEx> getUnseenNotify();
|
||||
|
||||
@Query("SELECT COUNT(message.id) FROM message" +
|
||||
" JOIN account ON account.id = message.account" +
|
||||
" JOIN folder ON folder.id = message.folder" +
|
||||
|
|
|
@ -126,7 +126,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
db.message().liveUnseenNotify().observe(this, new Observer<List<TupleMessageEx>>() {
|
||||
@Override
|
||||
public void onChanged(final List<TupleMessageEx> messages) {
|
||||
public void onChanged(List<TupleMessageEx> messages) {
|
||||
Core.notify(ServiceSynchronize.this, messages);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -281,9 +281,6 @@ public class ServiceUI extends IntentService {
|
|||
// Synchronize messages
|
||||
Core.onSynchronizeMessages(this, account, folder, (IMAPFolder) ifolder, folder.getSyncArgs(), new Core.State());
|
||||
|
||||
// Notify new messages
|
||||
Core.notify(this, db.message().getUnseenNotify());
|
||||
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
Core.reportError(this, account, folder, ex);
|
||||
|
|
Loading…
Reference in a new issue