Show more detail in error notifications

This commit is contained in:
Aidan Follestad 2019-01-08 16:30:18 -08:00
parent 8dc2112e2d
commit e3820fd7d3
3 changed files with 5 additions and 1 deletions

View file

@ -30,6 +30,8 @@ interface CanNotifyModel : Serializable {
fun notifyName(): String
fun notifyTag(): String
fun notifyDescription(): String?
}
/** @author Aidan Follestad (@afollestad) */

View file

@ -53,6 +53,8 @@ data class Site(
override fun notifyTag(): String = url
override fun notifyDescription() = lastResult?.reason
fun intervalText(): String {
requireNotNull(settings) { "Settings not queried." }
val lastCheck = lastResult?.timestampMs ?: -1

View file

@ -73,7 +73,7 @@ class RealNockNotificationManager(
val newNotification = notificationProvider.create(
channelId = CheckFailures.id,
title = model.notifyName(),
content = stringProvider.get(R.string.something_wrong),
content = model.notifyDescription() ?: stringProvider.get(R.string.something_wrong),
intent = intent,
smallIcon = R.drawable.ic_notification
)