diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-07-25 15:33:35 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-07-25 15:33:35 +0300 |
commit | 6d5b071c2424da307c992137dffd0f4d5015cbd1 (patch) | |
tree | 7564d366da0d13f901a6a6b108a28cd031d13fc0 /app/src | |
parent | 0868f6d56aee63a8e91f93b665eadc16c5517cc7 (diff) |
Fix #611 New method for updating stack
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java | 12 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java | 13 |
2 files changed, 5 insertions, 20 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 3222fec4b..7d1432b4a 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 @@ -863,18 +863,6 @@ public class SyncManager { return liveData; } - @Deprecated - @AnyThread - public WrappedLiveData<FullStack> updateStack(@NonNull FullStack stack) { - WrappedLiveData<FullStack> liveData = new WrappedLiveData<>(); - doAsync(() -> { - Account account = dataBaseAdapter.getAccountByIdDirectly(stack.getAccountId()); - FullBoard board = dataBaseAdapter.getFullBoardByLocalIdDirectly(stack.getAccountId(), stack.getStack().getBoardId()); - updateStack(account, board, stack, liveData); - }); - return liveData; - } - @AnyThread public WrappedLiveData<FullStack> updateStackTitle(long localStackId, @NonNull String newTitle) { WrappedLiveData<FullStack> liveData = new WrappedLiveData<>(); diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java index a8d96e4ca..603e1132f 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java @@ -457,14 +457,11 @@ public class MainActivity extends BrandedActivity implements DeleteStackListener @Override public void onUpdateStack(long localStackId, String stackName) { - observeOnce(syncManager.getStack(mainViewModel.getCurrentAccount().getId(), localStackId), MainActivity.this, fullStack -> { - fullStack.getStack().setTitle(stackName); - final WrappedLiveData<FullStack> archiveLiveData = syncManager.updateStack(fullStack); - observeOnce(archiveLiveData, this, (v) -> { - if (archiveLiveData.hasError()) { - ExceptionDialogFragment.newInstance(archiveLiveData.getError(), mainViewModel.getCurrentAccount()).show(getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName()); - } - }); + final WrappedLiveData<FullStack> liveData = syncManager.updateStackTitle(localStackId, stackName); + observeOnce(liveData, this, (v) -> { + if (liveData.hasError()) { + ExceptionDialogFragment.newInstance(liveData.getError(), mainViewModel.getCurrentAccount()).show(getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName()); + } }); } |