diff options
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java | 93 | ||||
-rw-r--r-- | fastlane/metadata/android/en-US/changelogs/1004002.txt | 1 |
2 files changed, 50 insertions, 44 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java index ee4a3119b..265015d57 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java @@ -158,59 +158,64 @@ public class SyncManager { doAsync(() -> refreshCapabilities(new IResponseCallback<Capabilities>(responseCallback.getAccount()) { @Override public void onResponse(Capabilities response) { - if (!response.isMaintenanceEnabled() && response.getDeckVersion().isSupported(appContext)) { - long accountId = responseCallback.getAccount().getId(); - Date lastSyncDate = LastSyncUtil.getLastSyncDate(responseCallback.getAccount().getId()); - Date now = DateUtil.nowInGMT(); + if (!response.isMaintenanceEnabled()) { + if (response.getDeckVersion().isSupported(appContext)) { + long accountId = responseCallback.getAccount().getId(); + Date lastSyncDate = LastSyncUtil.getLastSyncDate(responseCallback.getAccount().getId()); + Date now = DateUtil.nowInGMT(); - final SyncHelper syncHelper = new SyncHelper(serverAdapter, dataBaseAdapter, lastSyncDate); + final SyncHelper syncHelper = new SyncHelper(serverAdapter, dataBaseAdapter, lastSyncDate); - IResponseCallback<Boolean> callback = new IResponseCallback<Boolean>(responseCallback.getAccount()) { - @Override - public void onResponse(Boolean response) { - syncHelper.setResponseCallback(new IResponseCallback<Boolean>(account) { - @Override - public void onResponse(Boolean response) { - // TODO deactivate for dev - LastSyncUtil.setLastSyncDate(accountId, now); - responseCallback.onResponse(response); - } - - @Override - public void onError(Throwable throwable) { - super.onError(throwable); - responseCallback.onError(throwable); - } - }); - doAsync(() -> { - try { - syncHelper.doUpSyncFor(new BoardDataProvider()); - } catch (Throwable e) { - DeckLog.logError(e); - responseCallback.onError(e); - } - }); + IResponseCallback<Boolean> callback = new IResponseCallback<Boolean>(responseCallback.getAccount()) { + @Override + public void onResponse(Boolean response) { + syncHelper.setResponseCallback(new IResponseCallback<Boolean>(account) { + @Override + public void onResponse(Boolean response) { + // TODO deactivate for dev + LastSyncUtil.setLastSyncDate(accountId, now); + responseCallback.onResponse(response); + } + + @Override + public void onError(Throwable throwable) { + super.onError(throwable); + responseCallback.onError(throwable); + } + }); + doAsync(() -> { + try { + syncHelper.doUpSyncFor(new BoardDataProvider()); + } catch (Throwable e) { + DeckLog.logError(e); + responseCallback.onError(e); + } + }); - } + } - @Override - public void onError(Throwable throwable) { - super.onError(throwable); - responseCallback.onError(throwable); - } - }; + @Override + public void onError(Throwable throwable) { + super.onError(throwable); + responseCallback.onError(throwable); + } + }; - syncHelper.setResponseCallback(callback); + syncHelper.setResponseCallback(callback); - try { - syncHelper.doSyncFor(new BoardDataProvider()); - } catch (Throwable e) { - DeckLog.logError(e); - responseCallback.onError(e); + try { + syncHelper.doSyncFor(new BoardDataProvider()); + } catch (Throwable e) { + DeckLog.logError(e); + responseCallback.onError(e); + } + } else { + responseCallback.onResponse(false); + DeckLog.warn("No sync. Server version not supported: " + response.getDeckVersion().getOriginalVersion()); } } else { responseCallback.onResponse(false); - DeckLog.warn("No sync. Status maintenance mode: " + response.isMaintenanceEnabled() + ". Server version : " + response.getDeckVersion().getOriginalVersion()); + DeckLog.warn("No sync. Status maintenance mode: " + response.isMaintenanceEnabled()); } } })); diff --git a/fastlane/metadata/android/en-US/changelogs/1004002.txt b/fastlane/metadata/android/en-US/changelogs/1004002.txt index 40b375693..580ee2742 100644 --- a/fastlane/metadata/android/en-US/changelogs/1004002.txt +++ b/fastlane/metadata/android/en-US/changelogs/1004002.txt @@ -1,6 +1,7 @@ 1.4.2 - 🕒 Fix due time AM / PM issues with server version 1.0.0 (#505) +- 🐞 Fix maintenance mode crash 1.4.1 |