mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Update labels locally
This commit is contained in:
parent
59951425fc
commit
b04ce74069
2 changed files with 14 additions and 3 deletions
|
@ -708,9 +708,17 @@ class Core {
|
|||
((GmailMessage) imessage).setLabels(new String[]{label}, set);
|
||||
|
||||
// Gmail does not push label changes
|
||||
JSONArray fargs = new JSONArray();
|
||||
fargs.put(message.uid);
|
||||
onFetch(context, fargs, folder, istore, ifolder, state);
|
||||
|
||||
List<String> labels = new ArrayList<>();
|
||||
if (message.labels != null)
|
||||
labels.addAll(Arrays.asList(message.labels));
|
||||
labels.remove(label);
|
||||
if (set)
|
||||
labels.add(label);
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
db.message().setMessageLabels(message.id,
|
||||
DB.Converters.fromStringArray(labels.toArray(new String[0])));
|
||||
}
|
||||
|
||||
private static void onAdd(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPStore istore, IMAPFolder ifolder, State state) throws MessagingException, IOException {
|
||||
|
|
|
@ -634,6 +634,9 @@ public interface DaoMessage {
|
|||
@Query("UPDATE message SET keywords = :keywords WHERE id = :id")
|
||||
int setMessageKeywords(long id, String keywords);
|
||||
|
||||
@Query("UPDATE message SET labels = :labels WHERE id = :id")
|
||||
int setMessageLabels(long id, String labels);
|
||||
|
||||
@Query("UPDATE message SET ui_seen = :ui_seen WHERE id = :id")
|
||||
int setMessageUiSeen(long id, boolean ui_seen);
|
||||
|
||||
|
|
Loading…
Reference in a new issue