reason is that ppl are pretty annoyed by the
permanant notification, that might have been expected and that would be okay.
but, more worse, for whatever reasons, this drains more battery on some systems
than having just "allow consuming battery" enabled,
maybe some system do not go to doze mode because of the permantent-notification.
anyway, to avoid initial annoyances, we switch back to
- asking the user to "allow consuming battery"
- having a 15 mintues or so polling interval (as on iOS)
but, in contrast to 1.3, we now still have the _option_ to
enable a permantent-notification that user can enabled if everything else
described at https://dontkillmyapp.com does not work.
the "smart" permantent notification from 1.3,
that are only shown under some circumstances, however, are gone.
they are not realiable, eg. we did not use them when "consume battery"
was enabled - which is not sufficient on various "modern" systems.
but the main reason is that _if_ the user enables a permantent notification,
this can also be regarded as a hint that things are up and running.
The problem was that the intent still had the share flag and data.
A draft is now initialized (and stays) so that the user can return to sending later.
the imap-/mvbox-/sentbox-/smtp-threads needs to be terminated
before dc_close() can be called successfully.
if this is not done, they are hanging around, and, even worse,
if an account is opened _again_, there are now two threads
working on the database which lead to duplicated messages.
note, that this issue is only related to duplicated messages
if ever an account was selected, which, however, might be the same as the current.
prevent switching accounts if the currently selected account was tapped,
just close the dialog in this case.
(ux wise, it is better to show the current account - to get some overview
and also to easily see what the current account is)
the foreground notification is an important element
that avoids the system from killing the app.
in the past, we added the foreground notification when the screen turns off
and removed it when the screen turns on again -
the reason was that the notification does not annoy users this way.
meanwhile, however, it seems that this approach is no longer as reliable
as in the past. might be that we are killed before the screen turns off -
or that some handlers are not executed by some systems.
also meanwhile, even the "allow to run in background" resp.
"allow battery consumption" seems to be unreliable on various systems,
there are several reports eg. on stackoverflow that apps are killed anyway -
but a foreground notification is not known to be killed yet -
also as the api contract is about to avoid exactly that.
finally, this notification is also a good methor for users
to notice if the app gets killed -
so that they can blame the system then.
therefore, the annoying of the permanent notification
is probably the smaller drawback compared to
received messages delayed.