On disabling synchronization mark message seen until now

Fixes #26
This commit is contained in:
M66B 2018-08-08 07:29:21 +00:00
parent 70f64c896a
commit 3148e52cdc
1 changed files with 7 additions and 1 deletions

View File

@ -43,6 +43,7 @@ import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPStore;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -236,6 +237,7 @@ public class FragmentAccount extends FragmentEx {
String port = args.getString("port");
String user = args.getString("user");
String password = args.getString("password");
boolean synchronize = args.getBoolean("synchronize");
if (TextUtils.isEmpty(host))
throw new Throwable(getContext().getString(R.string.title_no_host));
@ -259,9 +261,13 @@ public class FragmentAccount extends FragmentEx {
account.port = Integer.parseInt(port);
account.user = user;
account.password = password;
account.synchronize = args.getBoolean("synchronize");
account.synchronize = synchronize;
account.primary = (account.synchronize && args.getBoolean("primary"));
// On disabling synchronization mark message seen until now
if (!account.synchronize && account.synchronize != synchronize)
account.seen_until = new Date().getTime();
// Check IMAP server
List<EntityFolder> folders = new ArrayList<>();
if (account.synchronize) {