Gmail - Archive/Unarchive (#582)
* Disable timer back sync for debug builds. * Archive / unarchive feature for Gmail. * Archive folder name override for Gmail. * Possible crash fix when the next item is being selected after a mail is removed. * Restore proper account selection after pin/unpin of folder. * Making sure that incorrect arcive folder id is not saved in Gmailsynchronizer due to migration.
This commit is contained in:
@@ -1059,4 +1059,16 @@ public class MailService : BaseDatabaseService, IMailService
|
||||
|
||||
public Task<bool> IsMailExistsAsync(string mailCopyId, Guid folderId)
|
||||
=> Connection.ExecuteScalarAsync<bool>("SELECT EXISTS(SELECT 1 FROM MailCopy WHERE Id = ? AND FolderId = ?)", mailCopyId, folderId);
|
||||
|
||||
public async Task<GmailArchiveComparisonResult> GetGmailArchiveComparisonResultAsync(Guid archiveFolderId, List<string> onlineArchiveMailIds)
|
||||
{
|
||||
var localArchiveMails = await Connection.Table<MailCopy>()
|
||||
.Where(a => a.FolderId == archiveFolderId)
|
||||
.ToListAsync().ConfigureAwait(false);
|
||||
|
||||
var removedMails = localArchiveMails.Where(a => !onlineArchiveMailIds.Contains(a.Id)).Select(a => a.Id).Distinct().ToArray();
|
||||
var addedMails = onlineArchiveMailIds.Where(a => !localArchiveMails.Select(b => b.Id).Contains(a)).Distinct().ToArray();
|
||||
|
||||
return new GmailArchiveComparisonResult(addedMails, removedMails);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public static class ServiceConstants
|
||||
public const string SPAM_LABEL_ID = "SPAM";
|
||||
public const string CHAT_LABEL_ID = "CHAT";
|
||||
public const string TRASH_LABEL_ID = "TRASH";
|
||||
public const string ARCHIVE_LABEL_ID = "ARCHIVE";
|
||||
|
||||
// Category labels.
|
||||
public const string FORUMS_LABEL_ID = "FORUMS";
|
||||
|
||||
Reference in New Issue
Block a user