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

Unverified Commit d7a2fbbc authored by Wolf-Martell Montwé's avatar Wolf-Martell Montwé
Browse files

refactor(core): move DEFAULT_VISIBLE_LIMIT from K9 to AccountDefaultProvider

parent 81178141
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
package net.thunderbird.app.common.account

import com.fsck.k9.CoreResourceProvider
import com.fsck.k9.K9
import net.thunderbird.core.android.account.AccountDefaultsProvider
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_MAXIMUM_AUTO_DOWNLOAD_MESSAGE_SIZE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_MESSAGE_FORMAT
@@ -17,6 +16,7 @@ import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_SORT_TYPE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_STRIP_SIGNATURE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_SYNC_INTERVAL
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_VISIBLE_LIMIT
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.NO_OPENPGP_KEY
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.UNASSIGNED_ACCOUNT_NUMBER
import net.thunderbird.core.android.account.Expunge
@@ -67,7 +67,7 @@ internal class DefaultAccountDefaultsProvider(
    private fun LegacyAccount.applyLegacyDefaults() {
        automaticCheckIntervalMinutes = DEFAULT_SYNC_INTERVAL
        idleRefreshMinutes = 24
        displayCount = K9.DEFAULT_VISIBLE_LIMIT
        displayCount = DEFAULT_VISIBLE_LIMIT
        accountNumber = UNASSIGNED_ACCOUNT_NUMBER
        isNotifyNewMail = true
        folderNotifyNewMailMode = FolderMode.ALL
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ import assertk.assertions.isFalse
import assertk.assertions.isNull
import assertk.assertions.isTrue
import com.fsck.k9.CoreResourceProvider
import com.fsck.k9.K9
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_MAXIMUM_AUTO_DOWNLOAD_MESSAGE_SIZE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_MESSAGE_FORMAT
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_MESSAGE_FORMAT_AUTO
@@ -21,6 +20,7 @@ import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_SORT_TYPE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_STRIP_SIGNATURE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_SYNC_INTERVAL
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_VISIBLE_LIMIT
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.NO_OPENPGP_KEY
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.UNASSIGNED_ACCOUNT_NUMBER
import net.thunderbird.core.android.account.Expunge
@@ -77,7 +77,7 @@ class DefaultAccountDefaultsProviderTest {
        // assert
        assertThat(account.automaticCheckIntervalMinutes).isEqualTo(DEFAULT_SYNC_INTERVAL)
        assertThat(account.idleRefreshMinutes).isEqualTo(24)
        assertThat(account.displayCount).isEqualTo(K9.DEFAULT_VISIBLE_LIMIT)
        assertThat(account.displayCount).isEqualTo(DEFAULT_VISIBLE_LIMIT)
        assertThat(account.accountNumber).isEqualTo(UNASSIGNED_ACCOUNT_NUMBER)
        assertThat(account.isNotifyNewMail).isTrue()
        assertThat(account.folderNotifyNewMailMode).isEqualTo(FolderMode.ALL)
+7 −0
Original line number Diff line number Diff line
@@ -43,6 +43,13 @@ interface AccountDefaultsProvider {

        const val DEFAULT_SYNC_INTERVAL = 60

        /**
         * Specifies how many messages will be shown in a folder by default. This number is set
         * on each new folder and can be incremented with "Load more messages..." by the
         * VISIBLE_LIMIT_INCREMENT
         */
        const val DEFAULT_VISIBLE_LIMIT = 25

        const val NO_OPENPGP_KEY: Long = 0

        const val UNASSIGNED_ACCOUNT_NUMBER = -1
+3 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_RINGTONE_URI
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_STRIP_SIGNATURE
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_SYNC_INTERVAL
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.DEFAULT_VISIBLE_LIMIT
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.NO_OPENPGP_KEY
import net.thunderbird.core.android.account.AccountDefaultsProvider.Companion.UNASSIGNED_ACCOUNT_NUMBER
import net.thunderbird.core.android.account.DeletePolicy
@@ -59,9 +60,9 @@ class AccountPreferenceSerializer(
                DEFAULT_SYNC_INTERVAL,
            )
            idleRefreshMinutes = storage.getInt("$accountUuid.idleRefreshMinutes", 24)
            displayCount = storage.getInt("$accountUuid.displayCount", K9.DEFAULT_VISIBLE_LIMIT)
            displayCount = storage.getInt("$accountUuid.displayCount", DEFAULT_VISIBLE_LIMIT)
            if (displayCount < 0) {
                displayCount = K9.DEFAULT_VISIBLE_LIMIT
                displayCount = DEFAULT_VISIBLE_LIMIT
            }
            isNotifyNewMail = storage.getBoolean("$accountUuid.notifyNewMail", false)
            folderNotifyNewMailMode = getEnumStringPref<FolderMode>(
+0 −7
Original line number Diff line number Diff line
@@ -516,13 +516,6 @@ object K9 : KoinComponent {

    const val IDENTITY_HEADER = K9MailLib.IDENTITY_HEADER

    /**
     * Specifies how many messages will be shown in a folder by default. This number is set
     * on each new folder and can be incremented with "Load more messages..." by the
     * VISIBLE_LIMIT_INCREMENT
     */
    const val DEFAULT_VISIBLE_LIMIT = 25

    /**
     * The maximum size of an attachment we're willing to download (either View or Save)
     * Attachments that are base64 encoded (most) will be about 1.375x their actual size
Loading