Improved local search

pull/147/head
M66B 6 years ago
parent 076cb96b90
commit 44212af438

@ -173,6 +173,13 @@ public interface DaoMessage {
" ORDER BY message.received DESC")
List<Long> getMessageByFolder(long folder);
@Query("SELECT id" +
" FROM message" +
" WHERE folder IN (:folders)" +
" AND NOT ui_hide" +
" ORDER BY message.received DESC")
List<Long> getMessageByFolders(List<Long> folders);
@Query("SELECT *" +
" FROM message" +
" WHERE account = :account" +

@ -105,9 +105,10 @@ public class ViewModelBrowse extends ViewModel {
db.beginTransaction();
if (state.messages == null) {
state.messages = new ArrayList<>();
List<Long> fids = new ArrayList<>();
for (EntityFolder folder : folders)
state.messages.addAll(db.message().getMessageByFolder(folder.id));
fids.add(folder.id);
state.messages = db.message().getMessageByFolders(fids);
Log.i("Messages=" + state.messages.size());
}

Loading…
Cancel
Save