mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
@@ -183,6 +183,13 @@ open class Preferences(private val storage: Storage) {
|
||||
for (l in listeners) l.onCheckmarkSequenceChanged()
|
||||
}
|
||||
|
||||
open var isMidnightDelayEnabled: Boolean
|
||||
get() = storage.getBoolean("pref_midnight_delay", false)
|
||||
set(enabled) {
|
||||
storage.putBoolean("pref_midnight_delay", enabled)
|
||||
for (l in listeners) l.onCheckmarkSequenceChanged()
|
||||
}
|
||||
|
||||
fun updateLastHint(number: Int, timestamp: Timestamp) {
|
||||
storage.putInt("last_hint_number", number)
|
||||
storage.putLong("last_hint_timestamp", timestamp.unixTime)
|
||||
|
||||
@@ -167,4 +167,12 @@ class PreferencesTest : BaseUnitTest() {
|
||||
assertTrue(prefs.showArchived)
|
||||
assertFalse(prefs.showCompleted)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testMidnightDelay() {
|
||||
assertFalse(prefs.isMidnightDelayEnabled)
|
||||
prefs.isMidnightDelayEnabled = true
|
||||
assertTrue(prefs.isMidnightDelayEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user