Fix account folder layout is not updated if there is a change after the synchronization.

This commit is contained in:
Burak Kaan Köse
2024-08-24 17:22:47 +02:00
parent 2a1f748469
commit d30c15464b
8 changed files with 37 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Google.Apis.Gmail.v1;
using Google.Apis.Gmail.v1.Data;
using Google.Apis.Http;
@@ -27,6 +28,7 @@ using Wino.Core.Extensions;
using Wino.Core.Http;
using Wino.Core.Integration.Processors;
using Wino.Core.Requests;
using Wino.Messaging.UI;
namespace Wino.Core.Synchronizers
{
@@ -365,6 +367,11 @@ namespace Wino.Core.Synchronizers
{
await _gmailChangeProcessor.UpdateFolderAsync(folder).ConfigureAwait(false);
}
if (insertedFolders.Any() || deletedFolders.Any() || updatedFolders.Any())
{
WeakReferenceMessenger.Default.Send(new AccountFolderConfigurationUpdated(Account.Id));
}
}
catch (Exception)
{
@@ -374,7 +381,10 @@ namespace Wino.Core.Synchronizers
private bool ShouldUpdateFolder(Label remoteFolder, MailItemFolder existingLocalFolder)
{
bool isNameChanged = !existingLocalFolder.FolderName.Equals(GoogleIntegratorExtensions.GetFolderName(remoteFolder), StringComparison.OrdinalIgnoreCase);
var remoteFolderName = GoogleIntegratorExtensions.GetFolderName(remoteFolder.Name);
var localFolderName = GoogleIntegratorExtensions.GetFolderName(existingLocalFolder.FolderName);
bool isNameChanged = !localFolderName.Equals(remoteFolderName, StringComparison.OrdinalIgnoreCase);
bool isColorChanged = existingLocalFolder.BackgroundColorHex != remoteFolder.Color?.BackgroundColor ||
existingLocalFolder.TextColorHex != remoteFolder.Color?.TextColor;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using MailKit;
using MailKit.Net.Imap;
using MailKit.Search;
@@ -21,6 +22,7 @@ using Wino.Core.Integration.Processors;
using Wino.Core.Mime;
using Wino.Core.Requests;
using Wino.Core.Requests.Bundles;
using Wino.Messaging.UI;
namespace Wino.Core.Synchronizers
{
@@ -717,6 +719,11 @@ namespace Wino.Core.Synchronizers
{
await _imapChangeProcessor.UpdateFolderAsync(folder).ConfigureAwait(false);
}
if (insertedFolders.Any() || deletedFolders.Any() || updatedFolders.Any())
{
WeakReferenceMessenger.Default.Send(new AccountFolderConfigurationUpdated(Account.Id));
}
}
catch (Exception ex)
{