mirror of https://github.com/M66B/FairEmail.git
Update unique accounts only
This commit is contained in:
parent
b6a4704383
commit
8c993e9b02
|
@ -151,7 +151,7 @@ public interface DaoAccount {
|
|||
@Query("SELECT * FROM account" +
|
||||
" WHERE user = :user" +
|
||||
" AND auth_type = :auth_type")
|
||||
EntityAccount getAccount(String user, int auth_type);
|
||||
List<EntityAccount> getAccounts(String user, int auth_type);
|
||||
|
||||
@Query("SELECT * FROM account WHERE `primary`")
|
||||
EntityAccount getPrimaryAccount();
|
||||
|
|
|
@ -451,8 +451,13 @@ public class FragmentGmail extends FragmentBase {
|
|||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
if (args.getBoolean("update"))
|
||||
update = db.account().getAccount(user, AUTH_TYPE_GMAIL);
|
||||
if (args.getBoolean("update")) {
|
||||
List<EntityAccount> accounts =
|
||||
db.account().getAccounts(user, AUTH_TYPE_GMAIL);
|
||||
if (accounts != null && accounts.size() == 1)
|
||||
update = accounts.get(0);
|
||||
}
|
||||
|
||||
if (update == null) {
|
||||
EntityAccount primary = db.account().getPrimaryAccount();
|
||||
|
||||
|
|
|
@ -770,8 +770,13 @@ public class FragmentOAuth extends FragmentBase {
|
|||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
if (args.getBoolean("update"))
|
||||
update = db.account().getAccount(username, AUTH_TYPE_OAUTH);
|
||||
if (args.getBoolean("update")) {
|
||||
List<EntityAccount> accounts =
|
||||
db.account().getAccounts(username, AUTH_TYPE_OAUTH);
|
||||
if (accounts != null && accounts.size() == 1)
|
||||
update = accounts.get(0);
|
||||
}
|
||||
|
||||
if (update == null) {
|
||||
EntityAccount primary = db.account().getPrimaryAccount();
|
||||
|
||||
|
|
Loading…
Reference in New Issue