Performance tuning of opening IMAP mailbox and Fix mailbox logic so it wont auto open first mail
This commit is contained in:
@@ -27,6 +27,7 @@ import javax.activation.DataHandler
|
||||
import javax.mail.Address
|
||||
import javax.mail.Authenticator
|
||||
import javax.mail.Flags
|
||||
import javax.mail.FetchProfile
|
||||
import javax.mail.Folder
|
||||
import javax.mail.Message
|
||||
import javax.mail.Multipart
|
||||
@@ -160,6 +161,13 @@ internal object AndroidMailService {
|
||||
val first = (end - 19).coerceAtLeast(1)
|
||||
val result = JSONArray()
|
||||
val batch = folder.getMessages(first, end).reversed()
|
||||
val profile = FetchProfile().apply {
|
||||
add(FetchProfile.Item.ENVELOPE)
|
||||
add(FetchProfile.Item.FLAGS)
|
||||
add(FetchProfile.Item.CONTENT_INFO)
|
||||
add(UIDFolder.FetchProfileItem.UID)
|
||||
}
|
||||
folder.fetch(batch.toTypedArray(), profile)
|
||||
val snoozed = account.optJSONArray("snoozedMessages") ?: JSONArray()
|
||||
val cached = JSONArray()
|
||||
for (message in batch) {
|
||||
|
||||
Reference in New Issue
Block a user