Loading legacy/core/src/main/java/com/fsck/k9/preferences/ServerSettingsDescriptions.kt +1 −7 Original line number Diff line number Diff line package com.fsck.k9.preferences import com.fsck.k9.preferences.Settings.IntegerRangeSetting import com.fsck.k9.preferences.Settings.SettingsDescription import com.fsck.k9.preferences.Settings.StringSetting import com.fsck.k9.preferences.upgrader.ServerSettingsUpgraderTo92 import com.fsck.k9.preferences.upgrader.ServerSettingsUpgraderTo94 import com.fsck.k9.preferences.upgrader.ServerSettingsUpgraderTo95 import java.util.TreeMap /** * Contains information to validate imported server settings with a given content version, and to upgrade those server Loading @@ -14,7 +12,7 @@ import java.util.TreeMap */ @Suppress("MagicNumber") internal class ServerSettingsDescriptions { val settings: Map<String, TreeMap<Int, SettingsDescription<*>?>> by lazy { val settings: SettingsDescriptions by lazy { mapOf( HOST to versions( 1 to StringSetting(null), Loading Loading @@ -100,7 +98,3 @@ internal class ServerSettingsDescriptions { const val CLIENT_CERTIFICATE_ALIAS = "clientCertificateAlias" } } private fun versions(vararg versions: Pair<Int, SettingsDescription<*>?>): TreeMap<Int, SettingsDescription<*>?> { return TreeMap(versions.toMap()) } legacy/core/src/main/java/com/fsck/k9/preferences/SettingDescriptionsHelper.kt 0 → 100644 +11 −0 Original line number Diff line number Diff line package com.fsck.k9.preferences import com.fsck.k9.preferences.Settings.SettingsDescription import java.util.TreeMap internal typealias SettingDescriptionVersions = TreeMap<Int, SettingsDescription<*>?> internal typealias SettingsDescriptions = Map<String, SettingDescriptionVersions> internal fun versions(vararg pairs: Pair<Int, SettingsDescription<*>?>): SettingDescriptionVersions { return pairs.toMap(TreeMap<Int, SettingsDescription<*>?>()) } legacy/core/src/main/java/com/fsck/k9/preferences/SettingsUpgradeHelper.kt +3 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ package com.fsck.k9.preferences import com.fsck.k9.K9 import com.fsck.k9.preferences.Settings.SettingsDescription import java.util.TreeMap import timber.log.Timber internal object SettingsUpgradeHelper { Loading @@ -24,7 +23,7 @@ internal object SettingsUpgradeHelper { fun upgrade( version: Int, upgraders: Map<Int, SettingsUpgrader>, settingsDescriptions: Map<String, TreeMap<Int, SettingsDescription<*>?>>, settingsDescriptions: SettingsDescriptions, settings: Map<String, Any?>, ): Map<String, Any?> { return upgradeToVersion(Settings.VERSION, version, upgraders, settingsDescriptions, settings) Loading @@ -34,7 +33,7 @@ internal object SettingsUpgradeHelper { targetVersion: Int, version: Int, upgraders: Map<Int, SettingsUpgrader>, settingsDescriptions: Map<String, TreeMap<Int, SettingsDescription<*>?>>, settingsDescriptions: SettingsDescriptions, settings: Map<String, Any?>, ): Map<String, Any?> { val upgradedSettings = settings.toMutableMap() Loading @@ -49,7 +48,7 @@ internal object SettingsUpgradeHelper { } private fun upgradeSettingsGeneric( settingsDescriptions: Map<String, TreeMap<Int, SettingsDescription<*>?>>, settingsDescriptions: SettingsDescriptions, mutableSettings: MutableMap<String, Any?>, toVersion: Int, ) { Loading legacy/core/src/test/java/com/fsck/k9/preferences/SettingsUpgradeHelperTest.kt +0 −6 Original line number Diff line number Diff line Loading @@ -245,10 +245,4 @@ class SettingsUpgradeHelperTest { ), ) } private fun versions( vararg pairs: Pair<Int, SettingsDescription<*>?>, ): TreeMap<Int, SettingsDescription<*>?> { return pairs.toMap(TreeMap<Int, SettingsDescription<*>?>()) } } Loading
legacy/core/src/main/java/com/fsck/k9/preferences/ServerSettingsDescriptions.kt +1 −7 Original line number Diff line number Diff line package com.fsck.k9.preferences import com.fsck.k9.preferences.Settings.IntegerRangeSetting import com.fsck.k9.preferences.Settings.SettingsDescription import com.fsck.k9.preferences.Settings.StringSetting import com.fsck.k9.preferences.upgrader.ServerSettingsUpgraderTo92 import com.fsck.k9.preferences.upgrader.ServerSettingsUpgraderTo94 import com.fsck.k9.preferences.upgrader.ServerSettingsUpgraderTo95 import java.util.TreeMap /** * Contains information to validate imported server settings with a given content version, and to upgrade those server Loading @@ -14,7 +12,7 @@ import java.util.TreeMap */ @Suppress("MagicNumber") internal class ServerSettingsDescriptions { val settings: Map<String, TreeMap<Int, SettingsDescription<*>?>> by lazy { val settings: SettingsDescriptions by lazy { mapOf( HOST to versions( 1 to StringSetting(null), Loading Loading @@ -100,7 +98,3 @@ internal class ServerSettingsDescriptions { const val CLIENT_CERTIFICATE_ALIAS = "clientCertificateAlias" } } private fun versions(vararg versions: Pair<Int, SettingsDescription<*>?>): TreeMap<Int, SettingsDescription<*>?> { return TreeMap(versions.toMap()) }
legacy/core/src/main/java/com/fsck/k9/preferences/SettingDescriptionsHelper.kt 0 → 100644 +11 −0 Original line number Diff line number Diff line package com.fsck.k9.preferences import com.fsck.k9.preferences.Settings.SettingsDescription import java.util.TreeMap internal typealias SettingDescriptionVersions = TreeMap<Int, SettingsDescription<*>?> internal typealias SettingsDescriptions = Map<String, SettingDescriptionVersions> internal fun versions(vararg pairs: Pair<Int, SettingsDescription<*>?>): SettingDescriptionVersions { return pairs.toMap(TreeMap<Int, SettingsDescription<*>?>()) }
legacy/core/src/main/java/com/fsck/k9/preferences/SettingsUpgradeHelper.kt +3 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ package com.fsck.k9.preferences import com.fsck.k9.K9 import com.fsck.k9.preferences.Settings.SettingsDescription import java.util.TreeMap import timber.log.Timber internal object SettingsUpgradeHelper { Loading @@ -24,7 +23,7 @@ internal object SettingsUpgradeHelper { fun upgrade( version: Int, upgraders: Map<Int, SettingsUpgrader>, settingsDescriptions: Map<String, TreeMap<Int, SettingsDescription<*>?>>, settingsDescriptions: SettingsDescriptions, settings: Map<String, Any?>, ): Map<String, Any?> { return upgradeToVersion(Settings.VERSION, version, upgraders, settingsDescriptions, settings) Loading @@ -34,7 +33,7 @@ internal object SettingsUpgradeHelper { targetVersion: Int, version: Int, upgraders: Map<Int, SettingsUpgrader>, settingsDescriptions: Map<String, TreeMap<Int, SettingsDescription<*>?>>, settingsDescriptions: SettingsDescriptions, settings: Map<String, Any?>, ): Map<String, Any?> { val upgradedSettings = settings.toMutableMap() Loading @@ -49,7 +48,7 @@ internal object SettingsUpgradeHelper { } private fun upgradeSettingsGeneric( settingsDescriptions: Map<String, TreeMap<Int, SettingsDescription<*>?>>, settingsDescriptions: SettingsDescriptions, mutableSettings: MutableMap<String, Any?>, toVersion: Int, ) { Loading
legacy/core/src/test/java/com/fsck/k9/preferences/SettingsUpgradeHelperTest.kt +0 −6 Original line number Diff line number Diff line Loading @@ -245,10 +245,4 @@ class SettingsUpgradeHelperTest { ), ) } private fun versions( vararg pairs: Pair<Int, SettingsDescription<*>?>, ): TreeMap<Int, SettingsDescription<*>?> { return pairs.toMap(TreeMap<Int, SettingsDescription<*>?>()) } }