mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-115] Added lastsynctime to automatic resync check.
This commit is contained in:
parent
1efaa3e711
commit
30f460184f
@ -99,6 +99,7 @@ namespace Acacia.Features.SyncState
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private DateTime? _syncStallStarted;
|
private DateTime? _syncStallStarted;
|
||||||
private bool _syncStallAsked;
|
private bool _syncStallAsked;
|
||||||
|
private DateTime? _syncStallLastSyncTime;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -308,6 +309,11 @@ namespace Acacia.Features.SyncState
|
|||||||
{
|
{
|
||||||
get { return _data.data.contentdata; }
|
get { return _data.data.contentdata; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DateTime LastSyncTime
|
||||||
|
{
|
||||||
|
get { return _data.data.lastsynctime; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GetDeviceDetailsRequest : SoapRequest<DeviceDetails>
|
private class GetDeviceDetailsRequest : SoapRequest<DeviceDetails>
|
||||||
@ -322,6 +328,7 @@ namespace Acacia.Features.SyncState
|
|||||||
public long Total { get; private set; }
|
public long Total { get; private set; }
|
||||||
public long Done { get; private set; }
|
public long Done { get; private set; }
|
||||||
public bool IsSyncing { get; private set; }
|
public bool IsSyncing { get; private set; }
|
||||||
|
public DateTime? LastSyncTime { get; private set; }
|
||||||
|
|
||||||
private readonly FeatureSyncState _feature;
|
private readonly FeatureSyncState _feature;
|
||||||
private readonly ZPushAccount _account;
|
private readonly ZPushAccount _account;
|
||||||
@ -340,6 +347,8 @@ namespace Acacia.Features.SyncState
|
|||||||
{
|
{
|
||||||
StringBuilder debug = new StringBuilder();
|
StringBuilder debug = new StringBuilder();
|
||||||
|
|
||||||
|
LastSyncTime = details.LastSyncTime;
|
||||||
|
|
||||||
// If a folder is no longer reported as it's already synced, we don't necessarily get the
|
// If a folder is no longer reported as it's already synced, we don't necessarily get the
|
||||||
// last step where (done == total). This causes some folders to keep lingering. To clean these
|
// last step where (done == total). This causes some folders to keep lingering. To clean these
|
||||||
// up, keep a list of folders syncing in this iteration.
|
// up, keep a list of folders syncing in this iteration.
|
||||||
@ -495,16 +504,24 @@ namespace Acacia.Features.SyncState
|
|||||||
string syncId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
|
string syncId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
|
||||||
|
|
||||||
// If it's syncing, it's not stalled
|
// If it's syncing, it's not stalled
|
||||||
if (syncId != null && syncId != "0")
|
//if (syncId != null && syncId != "0")
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
// Check if the folder has synced. In that case, it's not stalled.
|
SyncSession sync = account.GetFeatureData<SyncSession>(this, null);
|
||||||
|
|
||||||
|
// If the last sync time hasn't changed, it hasn't actually synced yet
|
||||||
|
if (sync.LastSyncTime != null && _syncStallLastSyncTime == sync.LastSyncTime)
|
||||||
|
return;
|
||||||
|
_syncStallLastSyncTime = sync.LastSyncTime;
|
||||||
|
|
||||||
|
// Get the sync state
|
||||||
string folderId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_FOLDER_ID);
|
string folderId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_FOLDER_ID);
|
||||||
if (folderId != null)
|
if (folderId != null)
|
||||||
{
|
{
|
||||||
SyncSession sync = account.GetFeatureData<SyncSession>(this, null);
|
|
||||||
|
// Check if the folder has synced. In that case, it's not stalled.
|
||||||
if (sync.HasFolderSynced(folderId))
|
if (sync.HasFolderSynced(folderId))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user