mirror of
https://github.com/thunderbird/thunderbird-android.git
synced 2024-09-20 04:02:14 +02:00
Merge pull request #7119 from thundernest/fix_toAccountOptionsState
Fix `AccountSetupState.toAccountOptionsState()`
This commit is contained in:
commit
6afee20873
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user