Author Topic: When does a new message gets saved to [Drafts] (and synced)?  (Read 4100 times)

StR

  • Hero Member
  • *****
  • Posts: 1558
When does a new message gets saved to [Drafts] (and synced)?
« on: December 08, 2015, 01:19:27 am »
Kostya,

I am trying to find what events trigger Aquamail to save a draft (and therefore sync with the server) to [Drafts] folder?

Here is the scenario I am considering:
I am composing a message while on the road. I am getting interrupted along the way with various needs. E.g.:
1. I need to turn off the screen, or it switches off via the timeout.
2. I need to go into a different app (and I don't if all these options will produce the same results or not):
  (a) via "Recent apps", i.e. without going to the Home screen,
  (b) by going to the "Home" screen
  (c) by taking a phone call (you know, the app called "phone" ;-) )
  (d) by getting/using a pop-up screen from a different app, e.g. getting a Viber message that draws over the current app, and replying to that message.
  (e) adding an attachment
So, in each of these cases, will Aquamail save the draft?

And after a draft is saved, when will the next similar trigger this draft to be re-saved:
(i) Just looking without making any changes and then going to a different app again (I assume it should not, but...)
(ii) What is the threshold? (any changes, even a single symbol?)

The reason I am trying to understand this is to know how the mobile data is used in this situation (and how to minimize that).
Depending on the data plan, this may or may not be as important on domestic networks. But when you are in a foreign country (and for a short enough time that you don't buy the local sim-card, or that card doesn't work), - you have a very limited allowance and high costs per MB.

(As a mobile data saving tool, I actually would appreciate a setting for folders {do no sync on mobile}.)

Kostya Vasilyev

  • Hero Member
  • *****
  • Posts: 12740
Re: When does a new message gets saved to [Drafts] (and synced)?
« Reply #1 on: December 08, 2015, 01:21:41 am »
It's simple -- when the activity getting onPause callback ;)

http://developer.android.com/training/basics/activity-lifecycle/pausing.html

Android apps are full of "callbacks", function which are called by the system "as appropriate", this is one of them.
Creating debug logs for diagnostics: https://www.aqua-mail.com/troubleshooting/

The official FAQ: https://www.aqua-mail.com/faq/

Лог-файлы для диагностики: https://www.aqua-mail.com/ru/troubleshooting/

Вопросы и ответы: https://www.aqua-mail.com/ru/faq/

StR

  • Hero Member
  • *****
  • Posts: 1558
Re: When does a new message gets saved to [Drafts] (and synced)?
« Reply #2 on: December 08, 2015, 09:07:39 am »
Thank you, that helps.
Now the question is: during each sync (upon getting onPause callback):
(1) assuming the message has changed since the previous sync, does Aquamail re-save the entire message, or only the changes (i.e. some sort of "diff")?
(2) assuming the message has not changed since the previous sync, does Aquamail re-save the entire message?

Kostya Vasilyev

  • Hero Member
  • *****
  • Posts: 12740
Re: When does a new message gets saved to [Drafts] (and synced)?
« Reply #3 on: December 08, 2015, 10:37:54 pm »
By "saving" you really mean "network sync" (server upload)?

IMAP doesn't allow partial updates, so it's always a full upload.

EWS does (for message text vs. each attachment separately).

Network sync is *not* triggered from onPause (so it doesn't waste traffic every time you add an attachment, one by one) -- but if sync catches the app in the paused state, it will go on.

Network sync *is* triggered when you press Save button.
Creating debug logs for diagnostics: https://www.aqua-mail.com/troubleshooting/

The official FAQ: https://www.aqua-mail.com/faq/

Лог-файлы для диагностики: https://www.aqua-mail.com/ru/troubleshooting/

Вопросы и ответы: https://www.aqua-mail.com/ru/faq/

StR

  • Hero Member
  • *****
  • Posts: 1558
Re: When does a new message gets saved to [Drafts] (and synced)?
« Reply #4 on: December 08, 2015, 11:17:04 pm »
Thank you, that answers my questiona.