mirror of
https://github.com/afollestad/nock-nock.git
synced 2025-08-07 16:38:43 +00:00
Show more detail in error notifications
This commit is contained in:
parent
8dc2112e2d
commit
e3820fd7d3
3 changed files with 5 additions and 1 deletions
|
@ -30,6 +30,8 @@ interface CanNotifyModel : Serializable {
|
||||||
fun notifyName(): String
|
fun notifyName(): String
|
||||||
|
|
||||||
fun notifyTag(): String
|
fun notifyTag(): String
|
||||||
|
|
||||||
|
fun notifyDescription(): String?
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @author Aidan Follestad (@afollestad) */
|
/** @author Aidan Follestad (@afollestad) */
|
||||||
|
|
|
@ -53,6 +53,8 @@ data class Site(
|
||||||
|
|
||||||
override fun notifyTag(): String = url
|
override fun notifyTag(): String = url
|
||||||
|
|
||||||
|
override fun notifyDescription() = lastResult?.reason
|
||||||
|
|
||||||
fun intervalText(): String {
|
fun intervalText(): String {
|
||||||
requireNotNull(settings) { "Settings not queried." }
|
requireNotNull(settings) { "Settings not queried." }
|
||||||
val lastCheck = lastResult?.timestampMs ?: -1
|
val lastCheck = lastResult?.timestampMs ?: -1
|
||||||
|
|
|
@ -73,7 +73,7 @@ class RealNockNotificationManager(
|
||||||
val newNotification = notificationProvider.create(
|
val newNotification = notificationProvider.create(
|
||||||
channelId = CheckFailures.id,
|
channelId = CheckFailures.id,
|
||||||
title = model.notifyName(),
|
title = model.notifyName(),
|
||||||
content = stringProvider.get(R.string.something_wrong),
|
content = model.notifyDescription() ?: stringProvider.get(R.string.something_wrong),
|
||||||
intent = intent,
|
intent = intent,
|
||||||
smallIcon = R.drawable.ic_notification
|
smallIcon = R.drawable.ic_notification
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue