Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 703af5ea authored by Romain Hunault's avatar Romain Hunault 🚴🏻
Browse files

Merge branch 'dont-add-mail-when-no-mail-available' into 'dev'

Don't add mail when no mail available

See merge request e/apps/Mail!9
parents 2eec75fd 649d94c6
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -621,10 +621,11 @@ public class Account implements BaseAccount, AccountConfig {
        // TODO: Remove preference settings that may exist for individual
        // folders in the account.
        editor.commit();

        if(getEmail() != null) {
            Globals.getOAuth2TokenProvider().invalidateToken(getEmail());
            Globals.getOAuth2TokenProvider().disconnectEmailWithK9(getEmail());
        }
    }

    private static int findNewAccountNumber(List<Integer> accountNumbers) {
        int newAccountNumber = -1;
+20 −15
Original line number Diff line number Diff line
@@ -652,6 +652,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
            for (android.accounts.Account eeloAccount : eeloAccounts) {
                String emailId = accountManager.getUserData(eeloAccount,
                        ACCOUNT_EMAIL_ADDRESS_KEY);
                if(!emailId.contains("@"))
                    continue;
                boolean accountIsSignedIn = false;
                for (Account account : accounts) {
                    if (emailId.equals(account.getEmail())) {
@@ -705,6 +707,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
            for (Account account : accounts) {
                if (account.isDeviceAccount()) {
                    boolean accountIsSignedInOnDevice = false;
                    // because of a now fixed bug, accounts with empty mails coming from custom nextcloud server could have been added: we need to remove them
                    if(account.getEmail() != null) {
                        for (android.accounts.Account eeloAccount : eeloAccounts) {
                            String emailId = accountManager.getUserData(eeloAccount,
                                    ACCOUNT_EMAIL_ADDRESS_KEY);
@@ -722,11 +726,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
                                break;
                            }
                        }
                    }

                    if (!accountIsSignedInOnDevice) {
                        selectedContextAccount = account;

                        Account realAccount = (Account) selectedContextAccount;
                        Account realAccount = account;
                        try
                        {
                            realAccount.getLocalStore().delete();