Allow refreshing unified system folders

This commit is contained in:
M66B 2019-07-22 14:42:03 +02:00
parent ed92a999f0
commit 958982481d
3 changed files with 7 additions and 6 deletions

View File

@ -53,8 +53,9 @@ public interface DaoFolder {
@Query("SELECT folder.* FROM folder" + @Query("SELECT folder.* FROM folder" +
" JOIN account ON account.id = folder.account" + " JOIN account ON account.id = folder.account" +
" WHERE account.synchronize" + " WHERE account.synchronize" +
" AND folder.synchronize AND unified") " AND folder.synchronize" +
List<EntityFolder> getFoldersSynchronizingUnified(); " AND ((:type IS NULL AND folder.unified) OR folder.type = :type)")
List<EntityFolder> getFoldersSynchronizingUnified(String type);
@Query("SELECT folder.* FROM folder" + @Query("SELECT folder.* FROM folder" +
" JOIN account ON account.id = folder.account" + " JOIN account ON account.id = folder.account" +

View File

@ -317,7 +317,7 @@ public class FragmentFolders extends FragmentBase {
if (aid < 0) { if (aid < 0) {
// Unified inbox // Unified inbox
List<EntityFolder> folders = db.folder().getFoldersSynchronizingUnified(); List<EntityFolder> folders = db.folder().getFoldersSynchronizingUnified(null);
for (EntityFolder folder : folders) { for (EntityFolder folder : folders) {
EntityOperation.sync(context, folder.id, true); EntityOperation.sync(context, folder.id, true);

View File

@ -903,8 +903,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
swipeRefresh.setOnChildScrollUpCallback(new SwipeRefreshLayout.OnChildScrollUpCallback() { swipeRefresh.setOnChildScrollUpCallback(new SwipeRefreshLayout.OnChildScrollUpCallback() {
@Override @Override
public boolean canChildScrollUp(@NonNull SwipeRefreshLayout parent, @Nullable View child) { public boolean canChildScrollUp(@NonNull SwipeRefreshLayout parent, @Nullable View child) {
if (type != null)
return true;
if (viewType != AdapterMessage.ViewType.UNIFIED && viewType != AdapterMessage.ViewType.FOLDER) if (viewType != AdapterMessage.ViewType.UNIFIED && viewType != AdapterMessage.ViewType.FOLDER)
return true; return true;
if (!prefs.getBoolean("pull", true)) if (!prefs.getBoolean("pull", true))
@ -988,6 +986,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void onSwipeRefresh() { private void onSwipeRefresh() {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("folder", folder); args.putLong("folder", folder);
args.putString("type", type);
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
@ -998,6 +997,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override @Override
protected Void onExecute(Context context, Bundle args) { protected Void onExecute(Context context, Bundle args) {
long fid = args.getLong("folder"); long fid = args.getLong("folder");
String type = args.getString("type");
if (!ConnectionHelper.getNetworkState(context).isSuitable()) if (!ConnectionHelper.getNetworkState(context).isSuitable())
throw new IllegalStateException(context.getString(R.string.title_no_internet)); throw new IllegalStateException(context.getString(R.string.title_no_internet));
@ -1010,7 +1010,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
List<EntityFolder> folders = new ArrayList<>(); List<EntityFolder> folders = new ArrayList<>();
if (fid < 0) if (fid < 0)
folders.addAll(db.folder().getFoldersSynchronizingUnified()); folders.addAll(db.folder().getFoldersSynchronizingUnified(type));
else { else {
EntityFolder folder = db.folder().getFolder(fid); EntityFolder folder = db.folder().getFolder(fid);
if (folder != null) if (folder != null)