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

Commit f8f78773 authored by Michael Enoma's avatar Michael Enoma
Browse files

Setup folders when auto adding account

parent e0f43b58
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -15,17 +15,20 @@ import com.fsck.k9.autodiscovery.api.DiscoveryTarget;
import com.fsck.k9.autodiscovery.providersxml.ProvidersXmlDiscovery;
import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.ui.ConnectionSettings;
import com.fsck.k9.mailstore.SpecialLocalFoldersCreator;
import timber.log.Timber;


public class EeloAccountCreator {
    private static final ProvidersXmlDiscovery providersXmlDiscovery = DI.get(ProvidersXmlDiscovery.class);
    private static final AccountCreator accountCreator = DI.get(AccountCreator.class);
    private static final SpecialLocalFoldersCreator localFoldersCreator = DI.get(SpecialLocalFoldersCreator.class);

    public static void createAccount(Context context, String emailId, String password) {
        Preferences preferences = Preferences.getPreferences(context);

        Account account = preferences.newAccount();
        account.setChipColor(accountCreator.pickColor());
        account.setEmail(emailId);
        account.setDescription(emailId);

@@ -44,6 +47,9 @@ public class EeloAccountCreator {
        DeletePolicy deletePolicy = accountCreator.getDefaultDeletePolicy(incomingSettings.type);
        account.setDeletePolicy(deletePolicy);

        localFoldersCreator.createSpecialLocalFolders(account);


        preferences.saveAccount(account);
        Core.setServicesEnabled(context);
    }