Respect folder download setting on inline download

pull/158/head
M66B 6 years ago
parent 317adf4f02
commit 0b10c17b0b

@ -416,7 +416,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
message = Core.synchronizeMessage(context,
account, browsable,
ifolder, (IMAPMessage) isub[j],
true,
true, true,
rules, null);
found++;
}

@ -1197,7 +1197,7 @@ class Core {
context,
account, folder,
ifolder, (IMAPMessage) isub[j],
false,
false, download,
rules, state);
ids[from + j] = message.id;
} catch (MessageRemovedException ex) {
@ -1304,7 +1304,7 @@ class Core {
Context context,
EntityAccount account, EntityFolder folder,
IMAPFolder ifolder, IMAPMessage imessage,
boolean browsed,
boolean browsed, boolean download,
List<EntityRule> rules, State state) throws MessagingException, IOException {
long uid = ifolder.getUID(imessage);
@ -1468,16 +1468,16 @@ class Core {
updateContactInfo(context, folder, message);
// Download small messages inline
if (message.size != null) {
if (download && message.size != null) {
long maxSize;
if (state == null || state.networkState.isUnmetered())
maxSize = MessageHelper.SMALL_MESSAGE_SIZE;
else {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int download = prefs.getInt("download", 0);
maxSize = (download == 0
int downloadSize = prefs.getInt("download", 0);
maxSize = (downloadSize == 0
? MessageHelper.SMALL_MESSAGE_SIZE
: Math.min(download, MessageHelper.SMALL_MESSAGE_SIZE));
: Math.min(downloadSize, MessageHelper.SMALL_MESSAGE_SIZE));
}
if (message.size < maxSize) {

@ -825,17 +825,19 @@ public class ServiceSynchronize extends LifecycleService {
fp.add(IMAPFolder.FetchProfileItem.INTERNALDATE);
ifolder.fetch(e.getMessages(), fp);
boolean download = db.folder().getFolderDownload(folder.id);
for (Message imessage : e.getMessages())
try {
EntityMessage message = Core.synchronizeMessage(
ServiceSynchronize.this,
account, folder,
ifolder, (IMAPMessage) imessage,
false,
false, download,
db.rule().getEnabledRules(folder.id),
state);
if (db.folder().getFolderDownload(folder.id))
if (download)
Core.downloadMessage(ServiceSynchronize.this,
folder, ifolder,
(IMAPMessage) imessage, message.id, state);
@ -920,15 +922,17 @@ public class ServiceSynchronize extends LifecycleService {
fp.add(IMAPFolder.FetchProfileItem.FLAGS);
ifolder.fetch(new Message[]{e.getMessage()}, fp);
boolean download = db.folder().getFolderDownload(folder.id);
EntityMessage message = Core.synchronizeMessage(
ServiceSynchronize.this,
account, folder,
ifolder, (IMAPMessage) e.getMessage(),
false,
false, download,
db.rule().getEnabledRules(folder.id),
state);
if (db.folder().getFolderDownload(folder.id))
if (download)
Core.downloadMessage(ServiceSynchronize.this,
folder, ifolder,
(IMAPMessage) e.getMessage(), message.id, state);

Loading…
Cancel
Save