|
|
@ -87,7 +87,7 @@ class NotificationTray @Inject constructor(
|
|
|
|
|
|
|
|
|
|
|
|
fun show(habit: Habit, timestamp: Timestamp, reminderTime: Long) {
|
|
|
|
fun show(habit: Habit, timestamp: Timestamp, reminderTime: Long) {
|
|
|
|
val data = NotificationData(timestamp, reminderTime)
|
|
|
|
val data = NotificationData(timestamp, reminderTime)
|
|
|
|
taskRunner.execute(ShowNotificationTask(habit, data, false))
|
|
|
|
taskRunner.execute(ShowNotificationTask(habit, data, silent = false))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun startListening() {
|
|
|
|
fun startListening() {
|
|
|
@ -107,7 +107,7 @@ class NotificationTray @Inject constructor(
|
|
|
|
|
|
|
|
|
|
|
|
fun reshowAll() {
|
|
|
|
fun reshowAll() {
|
|
|
|
for ((habit, data) in active.entries) {
|
|
|
|
for ((habit, data) in active.entries) {
|
|
|
|
taskRunner.execute(ShowNotificationTask(habit, data, true))
|
|
|
|
taskRunner.execute(ShowNotificationTask(habit, data, silent = true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -133,7 +133,7 @@ class NotificationTray @Inject constructor(
|
|
|
|
private inner class ShowNotificationTask(
|
|
|
|
private inner class ShowNotificationTask(
|
|
|
|
private val habit: Habit,
|
|
|
|
private val habit: Habit,
|
|
|
|
private val data: NotificationData,
|
|
|
|
private val data: NotificationData,
|
|
|
|
private val shown: Boolean
|
|
|
|
private val silent: Boolean
|
|
|
|
) :
|
|
|
|
) :
|
|
|
|
Task {
|
|
|
|
Task {
|
|
|
|
var isCompleted = false
|
|
|
|
var isCompleted = false
|
|
|
@ -193,9 +193,9 @@ class NotificationTray @Inject constructor(
|
|
|
|
getNotificationId(habit),
|
|
|
|
getNotificationId(habit),
|
|
|
|
data.timestamp,
|
|
|
|
data.timestamp,
|
|
|
|
data.reminderTime,
|
|
|
|
data.reminderTime,
|
|
|
|
silent = shown
|
|
|
|
silent = silent
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if (shown) {
|
|
|
|
if (silent) {
|
|
|
|
systemTray.log(
|
|
|
|
systemTray.log(
|
|
|
|
String.format(
|
|
|
|
String.format(
|
|
|
|
Locale.US,
|
|
|
|
Locale.US,
|
|
|
|