diff options
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java index f70b50679..1a5fe7034 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java @@ -31,8 +31,20 @@ public abstract class AbstractSyncDataProvider<T extends IRemoteEntity> { } protected List<T> findDelta(List<T> entitiesFromServer, List<T> localEntities){ - //TODO implement - return null; + List<T> delta = new ArrayList<>(); + for (T localEntity : localEntities) { + boolean found = false; + for (T remoteEntity : entitiesFromServer) { + if (remoteEntity.getId().equals(localEntity.getId())) { + found = true; + break; + } + } + if (!found){ + delta.add(localEntity); + } + } + return delta; } public void addChild(AbstractSyncDataProvider<?> child) { |