mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-20 00:35:47 +01:00
Fix media send scheduled times.
This commit is contained in:
+3
-3
@@ -65,8 +65,8 @@ sealed interface ScheduleSendOption {
|
||||
private val PRESET_HOURS = intArrayOf(8, 12, 18, 21)
|
||||
|
||||
/**
|
||||
* The options to offer at [currentTimeMs], ordered for a menu that opens above its trigger: the soonest suggestion
|
||||
* sits closest to the send button and [PickTime] furthest from it.
|
||||
* The options to offer at [currentTimeMs], in the order they are rendered top-to-bottom: the soonest suggestion
|
||||
* first, then the rest in chronological order, with [PickTime] last.
|
||||
*
|
||||
* Suggestions are the next three [PRESET_HOURS] on the clock, plus Monday morning when the week is already over.
|
||||
*/
|
||||
@@ -103,7 +103,7 @@ sealed interface ScheduleSendOption {
|
||||
.toEpochMillis(zoneId)
|
||||
}
|
||||
|
||||
return listOf(PickTime) + times.reversed().map { PresetTime(it) }
|
||||
return times.map { PresetTime(it) } + PickTime
|
||||
}
|
||||
|
||||
private fun Long.toLocalDateTime(zoneId: ZoneId): LocalDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(this), zoneId)
|
||||
|
||||
+18
-18
@@ -20,15 +20,15 @@ import java.time.ZoneOffset
|
||||
class ScheduleSendOptionTest {
|
||||
|
||||
@Test
|
||||
fun `Given a mid-morning weekday, when building options, then the rest of today is suggested soonest-last`() {
|
||||
fun `Given a mid-morning weekday, when building options, then the rest of today is suggested soonest-first`() {
|
||||
val options = optionsAt(WEDNESDAY.atTime(9, 30))
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ScheduleSendOption.PickTime,
|
||||
presetAt(WEDNESDAY.atTime(21, 0)),
|
||||
presetAt(WEDNESDAY.atTime(12, 0)),
|
||||
presetAt(WEDNESDAY.atTime(18, 0)),
|
||||
presetAt(WEDNESDAY.atTime(12, 0))
|
||||
presetAt(WEDNESDAY.atTime(21, 0)),
|
||||
ScheduleSendOption.PickTime
|
||||
),
|
||||
options
|
||||
)
|
||||
@@ -40,10 +40,10 @@ class ScheduleSendOptionTest {
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ScheduleSendOption.PickTime,
|
||||
presetAt(THURSDAY.atTime(18, 0)),
|
||||
presetAt(THURSDAY.atTime(8, 0)),
|
||||
presetAt(THURSDAY.atTime(12, 0)),
|
||||
presetAt(THURSDAY.atTime(8, 0))
|
||||
presetAt(THURSDAY.atTime(18, 0)),
|
||||
ScheduleSendOption.PickTime
|
||||
),
|
||||
options
|
||||
)
|
||||
@@ -55,10 +55,10 @@ class ScheduleSendOptionTest {
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ScheduleSendOption.PickTime,
|
||||
presetAt(THURSDAY.atTime(12, 0)),
|
||||
presetAt(WEDNESDAY.atTime(21, 0)),
|
||||
presetAt(THURSDAY.atTime(8, 0)),
|
||||
presetAt(WEDNESDAY.atTime(21, 0))
|
||||
presetAt(THURSDAY.atTime(12, 0)),
|
||||
ScheduleSendOption.PickTime
|
||||
),
|
||||
options
|
||||
)
|
||||
@@ -70,11 +70,11 @@ class ScheduleSendOptionTest {
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ScheduleSendOption.PickTime,
|
||||
presetAt(MONDAY.atTime(8, 0)),
|
||||
presetAt(FRIDAY.atTime(21, 0)),
|
||||
presetAt(FRIDAY.atTime(12, 0)),
|
||||
presetAt(FRIDAY.atTime(18, 0)),
|
||||
presetAt(FRIDAY.atTime(12, 0))
|
||||
presetAt(FRIDAY.atTime(21, 0)),
|
||||
presetAt(MONDAY.atTime(8, 0)),
|
||||
ScheduleSendOption.PickTime
|
||||
),
|
||||
options
|
||||
)
|
||||
@@ -86,11 +86,11 @@ class ScheduleSendOptionTest {
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ScheduleSendOption.PickTime,
|
||||
presetAt(MONDAY.atTime(8, 0)),
|
||||
presetAt(SATURDAY.atTime(21, 0)),
|
||||
presetAt(SATURDAY.atTime(12, 0)),
|
||||
presetAt(SATURDAY.atTime(18, 0)),
|
||||
presetAt(SATURDAY.atTime(12, 0))
|
||||
presetAt(SATURDAY.atTime(21, 0)),
|
||||
presetAt(MONDAY.atTime(8, 0)),
|
||||
ScheduleSendOption.PickTime
|
||||
),
|
||||
options
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user