mirror of https://github.com/M66B/FairEmail.git
Notification account color
This commit is contained in:
parent
5e9bb1415d
commit
1e992c6741
|
@ -177,7 +177,14 @@ public interface DaoMessage {
|
|||
" WHERE message.id = :id")
|
||||
LiveData<TupleMessageEx> liveMessage(long id);
|
||||
|
||||
@Query("SELECT message.* FROM message" +
|
||||
@Query("SELECT message.*" +
|
||||
", account.name AS accountName, account.color AS accountColor" +
|
||||
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType" +
|
||||
", 1 AS count" +
|
||||
", 1 AS unseen" +
|
||||
", 0 AS unflagged" +
|
||||
", 0 AS attachments" +
|
||||
" FROM message" +
|
||||
" JOIN account ON account.id = message.account" +
|
||||
" JOIN folder ON folder.id = message.folder" +
|
||||
" WHERE account.`synchronize`" +
|
||||
|
@ -188,7 +195,7 @@ public interface DaoMessage {
|
|||
" AND NOT message.ui_found" +
|
||||
" AND NOT message.ui_ignored" +
|
||||
" ORDER BY message.received")
|
||||
LiveData<List<EntityMessage>> liveUnseenUnified();
|
||||
LiveData<List<TupleMessageEx>> liveUnseenUnified();
|
||||
|
||||
@Query("SELECT COUNT(message.id) FROM message" +
|
||||
" JOIN account ON account.id = message.account" +
|
||||
|
|
|
@ -169,11 +169,11 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
}
|
||||
});
|
||||
|
||||
db.message().liveUnseenUnified().observe(this, new Observer<List<EntityMessage>>() {
|
||||
db.message().liveUnseenUnified().observe(this, new Observer<List<TupleMessageEx>>() {
|
||||
private List<Integer> notifying = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onChanged(List<EntityMessage> messages) {
|
||||
public void onChanged(List<TupleMessageEx> messages) {
|
||||
NotificationManager nm = getSystemService(NotificationManager.class);
|
||||
List<Notification> notifications = getNotificationUnseen(messages);
|
||||
|
||||
|
@ -353,7 +353,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
return builder;
|
||||
}
|
||||
|
||||
private List<Notification> getNotificationUnseen(List<EntityMessage> messages) {
|
||||
private List<Notification> getNotificationUnseen(List<TupleMessageEx> messages) {
|
||||
// https://developer.android.com/training/notify-user/group
|
||||
List<Notification> notifications = new ArrayList<>();
|
||||
|
||||
|
@ -443,7 +443,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
|
||||
for (EntityMessage message : messages) {
|
||||
for (TupleMessageEx message : messages) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
||||
|
@ -538,6 +538,9 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
mbuilder.addPerson(message.avatar);
|
||||
}
|
||||
|
||||
if (message.accountColor != null)
|
||||
mbuilder.setColor(message.accountColor);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
mbuilder.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN);
|
||||
|
||||
|
|
Loading…
Reference in New Issue