mirror of https://github.com/tasks/tasks
Compare commits
148 Commits
Author | SHA1 | Date |
---|---|---|
renovate[bot] | f8bb045d76 | 3 days ago |
renovate[bot] | 4040a2379b | 3 days ago |
Alex Baker | c4ee7479ca | 3 days ago |
Alex Baker | be861597ef | 3 days ago |
Alex Baker | f27332595d | 3 days ago |
Alex Baker | ea7f051d85 | 3 days ago |
Alex Baker | 8be7fab033 | 3 days ago |
Alex Baker | d6e0c0bdcf | 3 days ago |
Alex Baker | 5ec02011f8 | 3 days ago |
Alex Baker | b35090cd43 | 3 days ago |
renovate[bot] | 92f62450ae | 3 days ago |
renovate[bot] | 3ca6912492 | 3 days ago |
renovate[bot] | 080b1428dd | 3 days ago |
Alex Baker | f67c3bc56c | 3 days ago |
renovate[bot] | 5d0e88a620 | 3 days ago |
renovate[bot] | c5d5795fe2 | 3 days ago |
renovate[bot] | 3bbc0e0ab0 | 3 days ago |
Alex Baker | 009a195580 | 3 days ago |
renovate[bot] | 772f69d8c0 | 4 days ago |
renovate[bot] | 4229bf7067 | 4 days ago |
Alex Baker | 212a4b0a3d | 4 days ago |
Alex Baker | 4ddfe937b0 | 5 days ago |
Alex Baker | 19de0e08a5 | 6 days ago |
Alex Baker | 60211355e0 | 7 days ago |
Alex Baker | 17d218aa4e | 7 days ago |
Alex Baker | 505c8c29d5 | 7 days ago |
Alex Baker | 7149308c97 | 7 days ago |
Alex Baker | 2c5a497007 | 1 week ago |
Alex Baker | 09f53fe1e5 | 1 week ago |
Alex Baker | 5da4183aed | 1 week ago |
Alex Baker | d35912e503 | 1 week ago |
renovate[bot] | 82fd99f83e | 1 week ago |
renovate[bot] | f944becea1 | 1 week ago |
Alex Baker | acd713dc5b | 1 week ago |
Alex Baker | 1a93c87ad9 | 1 week ago |
Alex Baker | c4e25b8b15 | 1 week ago |
Alex Baker | e11c0d2528 | 1 week ago |
Alex Baker | 2fc6833854 | 1 week ago |
Alex Baker | 4a2fb13d10 | 2 weeks ago |
Alex Baker | a2572e2dee | 2 weeks ago |
Alex Baker | 64e05c9f8f | 2 weeks ago |
Alex Baker | ad833b5f49 | 2 weeks ago |
Alex Baker | eea944cc7b | 2 weeks ago |
Alex Baker | c82dfc7d39 | 2 weeks ago |
Alex Baker | 8607f9556a | 2 weeks ago |
Alex Baker | f338e84d46 | 2 weeks ago |
Alex Baker | 9ee739627e | 2 weeks ago |
Alex Baker | a49c233584 | 2 weeks ago |
Alex Baker | 74fca07c1b | 2 weeks ago |
Alex Baker | 5bd0cef42e | 2 weeks ago |
Alex Baker | 4c245edbb4 | 2 weeks ago |
Alex Baker | 97a3f074d0 | 2 weeks ago |
Alex Baker | 86ecd3cf81 | 2 weeks ago |
Alex Baker | 07a2eda5ea | 2 weeks ago |
renovate[bot] | 09ffbdd036 | 2 weeks ago |
renovate[bot] | 60f22146ca | 2 weeks ago |
renovate[bot] | c11225abaf | 2 weeks ago |
dependabot[bot] | 133ea493e3 | 2 weeks ago |
Alex Baker | 0ba901be69 | 3 weeks ago |
Alex Baker | ebe5e5c009 | 3 weeks ago |
Alex Baker | d556863fda | 3 weeks ago |
Alex Baker | 55adbc2025 | 3 weeks ago |
Alex Baker | 06c4255886 | 3 weeks ago |
renovate[bot] | 4734a99bae | 3 weeks ago |
Alex Baker | a6a8cac8e4 | 3 weeks ago |
Alex Baker | c3fc9a57cc | 3 weeks ago |
Alex Baker | 6e14d07d0c | 3 weeks ago |
Alex Baker | 6118121698 | 3 weeks ago |
Alex Baker | 6bf3bd4d08 | 3 weeks ago |
Alex Baker | 065be79355 | 3 weeks ago |
Alex Baker | f8f8ba3c51 | 3 weeks ago |
Alex Baker | 89465f36b3 | 3 weeks ago |
Alex Baker | 1380a34ffa | 3 weeks ago |
Alex Baker | 10af5280a3 | 3 weeks ago |
Alex Baker | 8c0f7b952d | 3 weeks ago |
Alex Baker | 65362b203f | 3 weeks ago |
Alex Baker | 3327f97a17 | 4 weeks ago |
Alex Baker | c9fc02a42e | 4 weeks ago |
renovate[bot] | 93670bb9e4 | 4 weeks ago |
Alex Baker | 1fc6a50d0b | 4 weeks ago |
Alex Baker | e1ef924909 | 4 weeks ago |
Alex Baker | 686cb5d346 | 4 weeks ago |
renovate[bot] | ebec25c4cb | 4 weeks ago |
renovate[bot] | c140f7e673 | 4 weeks ago |
renovate[bot] | efbcf11a4a | 4 weeks ago |
renovate[bot] | 6adee85a37 | 4 weeks ago |
Alex Baker | 5c8643110b | 4 weeks ago |
Alex Baker | abd13aeb75 | 4 weeks ago |
Alex Baker | c210fe1893 | 4 weeks ago |
Alex Baker | 26aa916c20 | 4 weeks ago |
renovate[bot] | 1eff2d1cd5 | 4 weeks ago |
islam2hamy | c90e683ea3 | 4 weeks ago |
Alex Baker | 3cd0295b71 | 4 weeks ago |
Alex Baker | 95c351e9fd | 4 weeks ago |
renovate[bot] | 4ddb7816f1 | 4 weeks ago |
renovate[bot] | 91c30f7bbf | 1 month ago |
renovate[bot] | 3f4398b6e0 | 1 month ago |
renovate[bot] | c822e989a3 | 1 month ago |
renovate[bot] | da146723e5 | 1 month ago |
109247019824 | 931626c84a | 1 month ago |
Alex Baker | c534632c52 | 1 month ago |
Alex Baker | c1347a7455 | 1 month ago |
renovate[bot] | 9544909a58 | 1 month ago |
Yurt Page | 5c10dce2b9 | 1 month ago |
Alex Baker | 584d4a5cbb | 1 month ago |
Alex Baker | 7c68a7fa59 | 1 month ago |
purushottamyadavbattula | 215cc838ef | 1 month ago |
Alex Baker | d60472d1bc | 1 month ago |
Alex Baker | f84a37a60a | 1 month ago |
Alex Baker | 7fb85b6da1 | 1 month ago |
Alex Baker | dc90e583e4 | 1 month ago |
Don Zouras | 0eac5f61eb | 1 month ago |
Milo Ivir | c686ce883d | 1 month ago |
大王叫我来巡山 | ab25398cd0 | 1 month ago |
renovate[bot] | 3b1c133d22 | 1 month ago |
renovate[bot] | 3bfd0ab4f8 | 1 month ago |
Liz de Sartiges | ffc0113d7f | 1 month ago |
Don Zouras | 9de9718ad5 | 1 month ago |
Oğuz Ersen | a7d2c9c406 | 1 month ago |
gallegonovato | b3006b9ac2 | 1 month ago |
Don Zouras | de3ef1f9c9 | 1 month ago |
Alex Baker | ce9e722a3f | 1 month ago |
Alex Baker | 4b892a0eb1 | 1 month ago |
Hady | e6e275834a | 1 month ago |
Alex Baker | 782f4d6d7c | 1 month ago |
elmuffo | a1da71d3e1 | 1 month ago |
Alex Baker | c793a300cc | 1 month ago |
Ilya Bizyaev | bf84bf9e82 | 1 month ago |
SC | 363b29babb | 2 months ago |
min7-i | c1ff953f5c | 2 months ago |
Alex Baker | 63482e5db9 | 2 months ago |
Emin Tufan Çetin | 2f7dc0c7f1 | 2 months ago |
Lionel HANNEQUIN | d672507fae | 2 months ago |
Jonatan Nyberg | ce2a3c8a3f | 2 months ago |
sorifukobexomajepasiricupuva33 | 9cd114d68b | 2 months ago |
Patrick V. Leguizamon | 0e663f0e08 | 2 months ago |
Mayhm | 1d1efd008d | 2 months ago |
Alex Baker | 26ab3d5866 | 2 months ago |
Mayhm | 9a4fcbbd39 | 2 months ago |
Alex Baker | 72bfda9224 | 2 months ago |
Alex Baker | 1067de4183 | 2 months ago |
Alex Baker | d686b8c7e0 | 2 months ago |
Alex Baker | b2efb42d55 | 2 months ago |
Fabio Parri | 3448808c94 | 2 months ago |
Alex Baker | 06a9626052 | 2 months ago |
Alex Baker | e92ab7f7e1 | 2 months ago |
Alex Baker | 4ff7b18c0f | 2 months ago |
Alex Baker | 91887f6b17 | 2 months ago |
@ -1 +1 @@
|
|||||||
3.3.0
|
3.3.1
|
||||||
|
@ -1,106 +1,255 @@
|
|||||||
package com.todoroo.astrid.alarms
|
package com.todoroo.astrid.alarms
|
||||||
|
|
||||||
import com.natpryce.makeiteasy.MakeItEasy.with
|
|
||||||
import com.todoroo.andlib.utility.DateUtilities
|
|
||||||
import dagger.hilt.android.testing.HiltAndroidTest
|
import dagger.hilt.android.testing.HiltAndroidTest
|
||||||
import dagger.hilt.android.testing.UninstallModules
|
import dagger.hilt.android.testing.UninstallModules
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.tasks.data.Alarm
|
import org.tasks.SuspendFreeze.Companion.freezeAt
|
||||||
import org.tasks.data.Alarm.Companion.TYPE_DATE_TIME
|
import org.tasks.data.createDueDate
|
||||||
import org.tasks.data.Alarm.Companion.TYPE_RANDOM
|
import org.tasks.data.dao.TaskDao
|
||||||
import org.tasks.data.Alarm.Companion.TYPE_SNOOZE
|
import org.tasks.data.entity.Alarm
|
||||||
import org.tasks.data.Alarm.Companion.whenDue
|
import org.tasks.data.entity.Notification
|
||||||
import org.tasks.data.Alarm.Companion.whenOverdue
|
import org.tasks.data.entity.Task
|
||||||
import org.tasks.data.AlarmDao
|
|
||||||
import org.tasks.data.TaskDao
|
|
||||||
import org.tasks.date.DateTimeUtils.newDateTime
|
|
||||||
import org.tasks.injection.InjectingTestCase
|
import org.tasks.injection.InjectingTestCase
|
||||||
import org.tasks.injection.ProductionModule
|
import org.tasks.injection.ProductionModule
|
||||||
import org.tasks.jobs.AlarmEntry
|
|
||||||
import org.tasks.jobs.NotificationQueue
|
|
||||||
import org.tasks.makers.TaskMaker.COMPLETION_TIME
|
|
||||||
import org.tasks.makers.TaskMaker.DELETION_TIME
|
|
||||||
import org.tasks.makers.TaskMaker.DUE_DATE
|
|
||||||
import org.tasks.makers.TaskMaker.DUE_TIME
|
|
||||||
import org.tasks.makers.TaskMaker.REMINDER_LAST
|
|
||||||
import org.tasks.makers.TaskMaker.newTask
|
|
||||||
import org.tasks.time.DateTime
|
import org.tasks.time.DateTime
|
||||||
|
import org.tasks.time.DateTimeUtils2
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@UninstallModules(ProductionModule::class)
|
@UninstallModules(ProductionModule::class)
|
||||||
@HiltAndroidTest
|
@HiltAndroidTest
|
||||||
class AlarmJobServiceTest : InjectingTestCase() {
|
class AlarmJobServiceTest : InjectingTestCase() {
|
||||||
@Inject lateinit var alarmDao: AlarmDao
|
|
||||||
@Inject lateinit var taskDao: TaskDao
|
@Inject lateinit var taskDao: TaskDao
|
||||||
@Inject lateinit var jobs: NotificationQueue
|
|
||||||
@Inject lateinit var alarmService: AlarmService
|
@Inject lateinit var alarmService: AlarmService
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun scheduleAlarm() = runBlocking {
|
fun testNoAlarms() = runBlocking {
|
||||||
val task = taskDao.createNew(newTask())
|
testResults(emptyList(), 0)
|
||||||
val alarm = insertAlarm(Alarm(task, DateTime(2017, 9, 24, 19, 57).millis, TYPE_DATE_TIME))
|
|
||||||
|
|
||||||
verify(AlarmEntry(alarm, task, DateTime(2017, 9, 24, 19, 57).millis, TYPE_DATE_TIME))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun ignoreStaleAlarm() = runBlocking {
|
fun futureAlarmWithNoPastAlarm() = runBlocking {
|
||||||
val alarmTime = DateTime(2017, 9, 24, 19, 57)
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
val task = taskDao.createNew(newTask(with(REMINDER_LAST, alarmTime.endOfMinute())))
|
taskDao.insert(
|
||||||
alarmDao.insert(Alarm(task, alarmTime.millis, TYPE_DATE_TIME))
|
Task(
|
||||||
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 18).millis
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(1, mutableSetOf(Alarm(type = Alarm.TYPE_REL_END)))
|
||||||
|
|
||||||
verify()
|
testResults(emptyList(), DateTime(2024, 5, 18, 18, 0).millis)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun dontScheduleReminderForCompletedTask() = runBlocking {
|
fun pastAlarmWithNoFutureAlarm() = runBlocking {
|
||||||
val task = taskDao.insert(
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
newTask(
|
taskDao.insert(
|
||||||
with(DUE_DATE, newDateTime()),
|
Task(
|
||||||
with(COMPLETION_TIME, newDateTime())
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 17).millis
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(1, mutableSetOf(Alarm(type = Alarm.TYPE_REL_END)))
|
||||||
|
|
||||||
|
testResults(
|
||||||
|
listOf(
|
||||||
|
Notification(
|
||||||
|
taskId = 1L,
|
||||||
|
timestamp = DateTimeUtils2.currentTimeMillis(),
|
||||||
|
type = Alarm.TYPE_REL_END
|
||||||
|
)
|
||||||
|
),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun pastRecurringAlarmWithFutureRecurrence() = runBlocking {
|
||||||
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
|
taskDao.insert(
|
||||||
|
Task(
|
||||||
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 17).millis
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(
|
||||||
|
1,
|
||||||
|
mutableSetOf(
|
||||||
|
Alarm(
|
||||||
|
type = Alarm.TYPE_REL_END,
|
||||||
|
repeat = 1,
|
||||||
|
interval = TimeUnit.HOURS.toMillis(6)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
alarmDao.insert(whenDue(task))
|
|
||||||
|
|
||||||
verify()
|
testResults(
|
||||||
|
listOf(
|
||||||
|
Notification(
|
||||||
|
taskId = 1L,
|
||||||
|
timestamp = DateTimeUtils2.currentTimeMillis(),
|
||||||
|
type = Alarm.TYPE_REL_END
|
||||||
|
)
|
||||||
|
),
|
||||||
|
DateTime(2024, 5, 18, 0, 0).millis
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun dontScheduleReminderForDeletedTask() = runBlocking {
|
fun pastAlarmsRemoveSnoozed() = runBlocking {
|
||||||
val task = taskDao.insert(
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
newTask(
|
taskDao.insert(
|
||||||
with(DUE_DATE, newDateTime()),
|
Task(
|
||||||
with(DELETION_TIME, newDateTime())
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 17).millis
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(
|
||||||
|
1,
|
||||||
|
mutableSetOf(
|
||||||
|
Alarm(type = Alarm.TYPE_REL_END),
|
||||||
|
Alarm(time = DateTimeUtils2.currentTimeMillis(), type = Alarm.TYPE_SNOOZE)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
alarmDao.insert(whenDue(task))
|
|
||||||
|
|
||||||
verify()
|
testResults(
|
||||||
|
listOf(
|
||||||
|
Notification(
|
||||||
|
taskId = 1L,
|
||||||
|
timestamp = DateTimeUtils2.currentTimeMillis(),
|
||||||
|
type = Alarm.TYPE_REL_END
|
||||||
|
)
|
||||||
|
),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
listOf(Alarm(id = 1, task = 1, time = 0, type = Alarm.TYPE_REL_END)),
|
||||||
|
alarmService.getAlarms(1)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun snoozeOverridesAll() = runBlocking {
|
fun futureSnoozeOverrideOverdue() = runBlocking {
|
||||||
val now = newDateTime()
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
val task = taskDao.insert(newTask(with(DUE_TIME, now)))
|
taskDao.insert(
|
||||||
|
Task(
|
||||||
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 17).millis
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(
|
||||||
|
1,
|
||||||
|
mutableSetOf(
|
||||||
|
Alarm(type = Alarm.TYPE_REL_END),
|
||||||
|
Alarm(
|
||||||
|
time = DateTimeUtils2.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5),
|
||||||
|
type = Alarm.TYPE_SNOOZE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
alarmDao.insert(whenDue(task))
|
testResults(
|
||||||
alarmDao.insert(whenOverdue(task))
|
emptyList(),
|
||||||
alarmDao.insert(Alarm(task, DateUtilities.ONE_HOUR, TYPE_RANDOM))
|
DateTimeUtils2.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5)
|
||||||
val alarm = alarmDao.insert(Alarm(task, now.plusMonths(12).millis, TYPE_SNOOZE))
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
verify(AlarmEntry(alarm, task, now.plusMonths(12).millis, TYPE_SNOOZE))
|
@Test
|
||||||
|
fun ignoreStaleAlarm() = runBlocking {
|
||||||
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
|
taskDao.insert(
|
||||||
|
Task(
|
||||||
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 17).millis
|
||||||
|
),
|
||||||
|
reminderLast = DateTime(2024, 5, 17, 18, 0).millis,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(
|
||||||
|
1,
|
||||||
|
mutableSetOf(Alarm(type = Alarm.TYPE_REL_END))
|
||||||
|
)
|
||||||
|
|
||||||
|
testResults(
|
||||||
|
emptyList(),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun insertAlarm(alarm: Alarm): Long {
|
@Test
|
||||||
alarm.id = alarmDao.insert(alarm)
|
fun dontScheduleForCompletedTask() = runBlocking {
|
||||||
return alarm.id
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
|
taskDao.insert(
|
||||||
|
Task(
|
||||||
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 17).millis
|
||||||
|
),
|
||||||
|
completionDate = DateTime(2024, 5, 17, 14, 0).millis,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(
|
||||||
|
1,
|
||||||
|
mutableSetOf(Alarm(type = Alarm.TYPE_REL_END))
|
||||||
|
)
|
||||||
|
|
||||||
|
testResults(
|
||||||
|
emptyList(),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun verify(vararg alarms: AlarmEntry) {
|
@Test
|
||||||
alarmService.scheduleAllAlarms()
|
fun dontScheduleForDeletedTask() = runBlocking {
|
||||||
|
freezeAt(DateTime(2024, 5, 17, 23, 20)) {
|
||||||
|
taskDao.insert(
|
||||||
|
Task(
|
||||||
|
dueDate = createDueDate(
|
||||||
|
Task.URGENCY_SPECIFIC_DAY,
|
||||||
|
DateTime(2024, 5, 17).millis
|
||||||
|
),
|
||||||
|
deletionDate = DateTime(2024, 5, 17, 14, 0).millis,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
alarmService.synchronizeAlarms(
|
||||||
|
1,
|
||||||
|
mutableSetOf(Alarm(type = Alarm.TYPE_REL_END))
|
||||||
|
)
|
||||||
|
|
||||||
|
testResults(
|
||||||
|
emptyList(),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assertEquals(alarms.toList(), jobs.getJobs())
|
private suspend fun testResults(notifications: List<Notification>, nextAlarm: Long) {
|
||||||
|
val actualNextAlarm = alarmService.triggerAlarms {
|
||||||
|
assertEquals(notifications, it)
|
||||||
|
it.forEach { taskDao.setLastNotified(it.taskId, DateTimeUtils2.currentTimeMillis()) }
|
||||||
|
}
|
||||||
|
assertEquals(nextAlarm, actualNextAlarm)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.todoroo.astrid.api
|
||||||
|
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
class EmptyFilter(override val sql: String? = "WHERE 0", override val title: String? = null) : Filter {
|
||||||
|
override fun areItemsTheSame(other: FilterListItem): Boolean = false
|
||||||
|
}
|
@ -1,69 +0,0 @@
|
|||||||
package com.todoroo.astrid.dao
|
|
||||||
|
|
||||||
import androidx.room.AutoMigration
|
|
||||||
import androidx.room.Database
|
|
||||||
import androidx.room.RoomDatabase
|
|
||||||
import com.todoroo.astrid.data.Task
|
|
||||||
import org.tasks.data.*
|
|
||||||
import org.tasks.data.TaskDao
|
|
||||||
import org.tasks.db.Migrations
|
|
||||||
import org.tasks.notifications.Notification
|
|
||||||
import org.tasks.notifications.NotificationDao
|
|
||||||
|
|
||||||
@Database(
|
|
||||||
entities = [
|
|
||||||
Notification::class,
|
|
||||||
TagData::class,
|
|
||||||
UserActivity::class,
|
|
||||||
TaskAttachment::class,
|
|
||||||
TaskListMetadata::class,
|
|
||||||
Task::class,
|
|
||||||
Alarm::class,
|
|
||||||
Place::class,
|
|
||||||
Geofence::class,
|
|
||||||
Tag::class,
|
|
||||||
Filter::class,
|
|
||||||
CaldavCalendar::class,
|
|
||||||
CaldavTask::class,
|
|
||||||
CaldavAccount::class,
|
|
||||||
Principal::class,
|
|
||||||
PrincipalAccess::class,
|
|
||||||
Attachment::class,
|
|
||||||
],
|
|
||||||
autoMigrations = [
|
|
||||||
AutoMigration(from = 83, to = 84, spec = Migrations.AutoMigrate83to84::class),
|
|
||||||
],
|
|
||||||
version = 88
|
|
||||||
)
|
|
||||||
abstract class Database : RoomDatabase() {
|
|
||||||
abstract fun notificationDao(): NotificationDao
|
|
||||||
abstract val tagDataDao: TagDataDao
|
|
||||||
abstract val userActivityDao: UserActivityDao
|
|
||||||
abstract val taskAttachmentDao: TaskAttachmentDao
|
|
||||||
abstract val taskListMetadataDao: TaskListMetadataDao
|
|
||||||
abstract val alarmDao: AlarmDao
|
|
||||||
abstract val locationDao: LocationDao
|
|
||||||
abstract val tagDao: TagDao
|
|
||||||
abstract val googleTaskDao: GoogleTaskDao
|
|
||||||
abstract val filterDao: FilterDao
|
|
||||||
abstract val googleTaskListDao: GoogleTaskListDao
|
|
||||||
abstract val taskDao: TaskDao
|
|
||||||
abstract val caldavDao: CaldavDao
|
|
||||||
abstract val deletionDao: DeletionDao
|
|
||||||
abstract val contentProviderDao: ContentProviderDao
|
|
||||||
abstract val upgraderDao: UpgraderDao
|
|
||||||
abstract val principalDao: PrincipalDao
|
|
||||||
|
|
||||||
/** @return human-readable database name for debugging
|
|
||||||
*/
|
|
||||||
override fun toString(): String {
|
|
||||||
return "DB:$name"
|
|
||||||
}
|
|
||||||
|
|
||||||
val name: String
|
|
||||||
get() = NAME
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val NAME = "database"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012 Todoroo Inc
|
|
||||||
*
|
|
||||||
* See the file "LICENSE" for the full license governing this code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.todoroo.astrid.data;
|
|
||||||
|
|
||||||
public class SyncFlags {
|
|
||||||
public static final String SUPPRESS_SYNC = "suppress_sync";
|
|
||||||
public static final String FORCE_CALDAV_SYNC = "force_caldav_sync";
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue