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

Unverified Commit 6afee208 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #7119 from thundernest/fix_toAccountOptionsState

Fix `AccountSetupState.toAccountOptionsState()`
parents fbc7dd55 c1726ebf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,10 @@ enum class EmailCheckFrequency(
    companion object {
        val DEFAULT = EVERY_HOUR
        fun all() = values().toList().toImmutableList()

        fun fromMinutes(minutes: Int): EmailCheckFrequency {
            return all().find { it.minutes == minutes } ?: DEFAULT
        }
    }
}

+4 −0
Original line number Diff line number Diff line
@@ -18,5 +18,9 @@ enum class EmailDisplayCount(
    companion object {
        val DEFAULT = MESSAGES_25
        fun all() = values().toList().toImmutableList()

        fun fromCount(count: Int): EmailDisplayCount {
            return all().find { it.count == count } ?: DEFAULT
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@ internal fun AccountSetupState.toAccountOptionsState(): State {
            accountName = StringInputField(options.accountName),
            displayName = StringInputField(options.displayName),
            emailSignature = StringInputField(options.emailSignature ?: ""),
            checkFrequency = EmailCheckFrequency.valueOf(options.checkFrequencyInMinutes.toString()),
            messageDisplayCount = EmailDisplayCount.valueOf(options.messageDisplayCount.toString()),
            checkFrequency = EmailCheckFrequency.fromMinutes(options.checkFrequencyInMinutes),
            messageDisplayCount = EmailDisplayCount.fromCount(options.messageDisplayCount),
            showNotification = options.showNotification,
        )
    }