|
15 | 15 | import static it.niedermann.owncloud.notes.main.slots.SlotterUtil.fillListByCategory; |
16 | 16 | import static it.niedermann.owncloud.notes.main.slots.SlotterUtil.fillListByInitials; |
17 | 17 | import static it.niedermann.owncloud.notes.main.slots.SlotterUtil.fillListByTime; |
18 | | -import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_MODIFIED_DESC; |
19 | 18 | import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_LEXICOGRAPHICAL_DESC; |
| 19 | +import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_MODIFIED_DESC; |
20 | 20 | import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.DEFAULT_CATEGORY; |
21 | 21 | import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.FAVORITES; |
22 | 22 | import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.RECENT; |
|
44 | 44 | import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException; |
45 | 45 | import com.nextcloud.android.sso.exceptions.UnknownErrorException; |
46 | 46 | import com.nextcloud.android.sso.helper.SingleAccountHelper; |
| 47 | +import com.owncloud.android.lib.common.utils.Log_OC; |
47 | 48 |
|
48 | 49 | import java.util.ArrayList; |
49 | 50 | import java.util.Collection; |
@@ -379,13 +380,13 @@ private static List<NavigationItem> fromCategoriesWithNotesCount(@NonNull Contex |
379 | 380 | return items; |
380 | 381 | } |
381 | 382 |
|
382 | | - public void synchronizeCapabilitiesAndNotes(@NonNull Account localAccount, @NonNull IResponseCallback<Void> callback) { |
| 383 | + public void synchronizeCapabilitiesAndNotes(Context context, @NonNull Account localAccount, @NonNull IResponseCallback<Void> callback) { |
383 | 384 | Log.i(TAG, "[synchronizeCapabilitiesAndNotes] Synchronize capabilities for " + localAccount.getAccountName()); |
384 | 385 | synchronizeCapabilities(localAccount, new IResponseCallback<>() { |
385 | 386 | @Override |
386 | 387 | public void onSuccess(Void v) { |
387 | 388 | Log.i(TAG, "[synchronizeCapabilitiesAndNotes] Synchronize notes for " + localAccount.getAccountName()); |
388 | | - synchronizeNotes(localAccount, callback); |
| 389 | + synchronizeNotes(context, localAccount, callback); |
389 | 390 | } |
390 | 391 |
|
391 | 392 | @Override |
@@ -442,14 +443,22 @@ public void synchronizeCapabilities(@NonNull Account localAccount, @NonNull IRes |
442 | 443 | /** |
443 | 444 | * Updates the network status if necessary and pulls the latest notes of the given {@param localAccount} |
444 | 445 | */ |
445 | | - public void synchronizeNotes(@NonNull Account currentAccount, @NonNull IResponseCallback<Void> callback) { |
| 446 | + public void synchronizeNotes(Context context, @NonNull Account currentAccount, @NonNull IResponseCallback<Void> callback) { |
446 | 447 | executor.submit(() -> { |
447 | 448 | Log.v(TAG, "[synchronize] - currentAccount: " + currentAccount.getAccountName()); |
448 | 449 | if (!repo.isSyncPossible()) { |
449 | 450 | repo.updateNetworkStatus(); |
450 | 451 | } |
451 | 452 | if (repo.isSyncPossible()) { |
452 | 453 | repo.scheduleSync(currentAccount, false); |
| 454 | + |
| 455 | + try { |
| 456 | + final var ssoAccount = AccountImporter.getSingleSignOnAccount(context, currentAccount.getAccountName()); |
| 457 | + CapabilitiesClient.getCapabilities(context, ssoAccount, null, ApiProvider.getInstance()); |
| 458 | + } catch (Throwable t) { |
| 459 | + Log_OC.e(TAG, t.getMessage()); |
| 460 | + } |
| 461 | + |
453 | 462 | callback.onSuccess(null); |
454 | 463 | } else { // Sync is not possible |
455 | 464 | if (repo.isNetworkConnected() && repo.isSyncOnlyOnWifi()) { |
|
0 commit comments