diff options
author | desperateCoder <admin@life-style-art.de> | 2019-05-06 11:42:23 +0300 |
---|---|---|
committer | desperateCoder <admin@life-style-art.de> | 2019-05-06 11:42:23 +0300 |
commit | e2d8fb4b7c4d010bcabbcd9dd4031439511d9303 (patch) | |
tree | e63735e59e1adaa5986a0576e98e4498be4debfa /app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters | |
parent | 89de2567055b5e2d46dcc2e1ab21dc451cf178ef (diff) |
hopefully fixed new account handling (lastsync)
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/ServerAdapter.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/ServerAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/ServerAdapter.java index 3903d0b49..e32332fea 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/ServerAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/ServerAdapter.java @@ -77,9 +77,9 @@ public class ServerAdapter { return cm.getActiveNetworkInfo().isConnected(); } - private String getLastSyncDateFormatted() { + private String getLastSyncDateFormatted(long accountId) { // return null; - String lastSyncHeader = API_FORMAT.format(getLastSync()); + String lastSyncHeader = API_FORMAT.format(getLastSync(accountId)); // omit Offset of timezone (e.g.: +01:00) if (lastSyncHeader.matches("^.*\\+[0-9]{2}:[0-9]{2}$")) { lastSyncHeader = lastSyncHeader.substring(0, lastSyncHeader.length()-6); @@ -88,15 +88,17 @@ public class ServerAdapter { return lastSyncHeader; } - private Date getLastSync() { + private Date getLastSync(long accountId) { Date lastSync = DateUtil.nowInGMT(); - lastSync.setTime(lastSyncPref.getLong(DeckConsts.LAST_SYNC_KEY, 0L)); + lastSync.setTime(lastSyncPref.getLong(DeckConsts.LAST_SYNC_KEY(accountId), 0L)); return lastSync; } public void getBoards(IResponseCallback<List<FullBoard>> responseCallback) { - RequestHelper.request(sourceActivity, provider, () -> provider.getAPI().getBoards(true, getLastSyncDateFormatted()), responseCallback); + RequestHelper.request(sourceActivity, provider, () -> + provider.getAPI().getBoards(true, getLastSyncDateFormatted(responseCallback.getAccount().getId())), + responseCallback); } public void createBoard(Board board, IResponseCallback<FullBoard> responseCallback) { @@ -117,11 +119,11 @@ public class ServerAdapter { public void getStacks(long boardId, IResponseCallback<List<FullStack>> responseCallback) { ensureInternetConnection(); - RequestHelper.request(sourceActivity, provider, () -> provider.getAPI().getStacks(boardId, getLastSyncDateFormatted()), responseCallback); + RequestHelper.request(sourceActivity, provider, () -> provider.getAPI().getStacks(boardId, getLastSyncDateFormatted(responseCallback.getAccount().getId())), responseCallback); } public void getStack(long boardId, long stackId, IResponseCallback<FullStack> responseCallback) { - RequestHelper.request(sourceActivity, provider, () -> provider.getAPI().getStack(boardId, stackId, getLastSyncDateFormatted()), responseCallback); + RequestHelper.request(sourceActivity, provider, () -> provider.getAPI().getStack(boardId, stackId, getLastSyncDateFormatted(responseCallback.getAccount().getId())), responseCallback); } public void createStack(Stack stack, IResponseCallback<FullStack> responseCallback) { @@ -143,7 +145,7 @@ public class ServerAdapter { public void getCard(long boardId, long stackId, long cardId, IResponseCallback<FullCard> responseCallback) { ensureInternetConnection(); - RequestHelper.request(sourceActivity, provider, () -> provider.getAPI().getCard(boardId, stackId, cardId, getLastSyncDateFormatted()), responseCallback); + RequestHelper.request(sourceActivity, provider, () -> provider.getAPI().getCard(boardId, stackId, cardId, getLastSyncDateFormatted(responseCallback.getAccount().getId())), responseCallback); } public void createCard(long boardId, long stackId, Card card, IResponseCallback<FullCard> responseCallback) { |