From f40d2d7424f73fff73770ca933b802b123329544 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 3 Mar 2023 11:58:17 +0100 Subject: [PATCH] Fix issue #819 - Lists are removed when failing to sync --- .../java/app/fedilab/android/BaseMainActivity.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java index daa98015..6eaffef7 100644 --- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java @@ -243,6 +243,9 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt if (b != null) { if (b.getBoolean(Helper.RECEIVE_REDRAW_TOPBAR, false)) { List mastodonLists = (List) b.getSerializable(Helper.RECEIVE_MASTODON_LIST); + if (mastodonLists.size() == 0) { + mastodonLists = null; + } redrawPinned(mastodonLists); } if (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { @@ -1224,8 +1227,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt PinnedTimelineHelper.redrawTopBarPinned(BaseMainActivity.this, binding, pinned, bottomMenu, null); //Fetch remote lists for the authenticated account and update them new ViewModelProvider(BaseMainActivity.this).get(TimelinesVM.class).getLists(currentInstance, currentToken) - .observe(this, mastodonLists -> - PinnedTimelineHelper.redrawTopBarPinned(BaseMainActivity.this, binding, pinned, bottomMenu, mastodonLists) + .observe(this, mastodonLists -> { + if (mastodonLists.size() == 0) { + mastodonLists = null; + } + PinnedTimelineHelper.redrawTopBarPinned(BaseMainActivity.this, binding, pinned, bottomMenu, mastodonLists); + } ); });