use subscription topic short url for notification group name
This commit is contained in:
parent
b63e5e8bfc
commit
c18662dd1a
2 changed files with 7 additions and 4 deletions
|
@ -71,9 +71,8 @@ class NotificationService(val context: Context) {
|
||||||
fun createSubscriptionNotificationChannels(subscription: Subscription) {
|
fun createSubscriptionNotificationChannels(subscription: Subscription) {
|
||||||
val notificationScope = dedicatedNotificationScope(subscription)
|
val notificationScope = dedicatedNotificationScope(subscription)
|
||||||
val groupId = dedicatedGroupId(subscription)
|
val groupId = dedicatedGroupId(subscription)
|
||||||
val displayName = displayName(subscription)
|
|
||||||
|
|
||||||
maybeCreateNotificationGroup(groupId, displayName)
|
maybeCreateNotificationGroup(groupId, subscriptionTopicShortUrl(subscription))
|
||||||
|
|
||||||
(1..5).forEach { priority -> maybeCreateNotificationChannel(notificationScope, priority, groupId) }
|
(1..5).forEach { priority -> maybeCreateNotificationChannel(notificationScope, priority, groupId) }
|
||||||
}
|
}
|
||||||
|
@ -116,7 +115,7 @@ class NotificationService(val context: Context) {
|
||||||
maybeAddUserActions(builder, notification)
|
maybeAddUserActions(builder, notification)
|
||||||
|
|
||||||
if (groupId != null) {
|
if (groupId != null) {
|
||||||
maybeCreateNotificationGroup(groupId, displayName(subscription))
|
maybeCreateNotificationGroup(groupId, subscriptionTopicShortUrl(subscription))
|
||||||
}
|
}
|
||||||
|
|
||||||
maybeCreateNotificationChannel(scope, notification.priority, groupId)
|
maybeCreateNotificationChannel(scope, notification.priority, groupId)
|
||||||
|
|
|
@ -56,8 +56,12 @@ fun topicUrlAuth(baseUrl: String, topic: String) = "${topicUrl(baseUrl, topic)}/
|
||||||
fun topicUrlJsonPoll(baseUrl: String, topic: String, since: String) = "${topicUrl(baseUrl, topic)}/json?poll=1&since=$since"
|
fun topicUrlJsonPoll(baseUrl: String, topic: String, since: String) = "${topicUrl(baseUrl, topic)}/json?poll=1&since=$since"
|
||||||
fun topicShortUrl(baseUrl: String, topic: String) = shortUrl(topicUrl(baseUrl, topic))
|
fun topicShortUrl(baseUrl: String, topic: String) = shortUrl(topicUrl(baseUrl, topic))
|
||||||
|
|
||||||
|
fun subscriptionTopicShortUrl(subscription: Subscription) : String {
|
||||||
|
return topicShortUrl(subscription.baseUrl, subscription.topic)
|
||||||
|
}
|
||||||
|
|
||||||
fun displayName(subscription: Subscription) : String {
|
fun displayName(subscription: Subscription) : String {
|
||||||
return subscription.displayName ?: topicShortUrl(subscription.baseUrl, subscription.topic)
|
return subscription.displayName ?: subscriptionTopicShortUrl(subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun shortUrl(url: String) = url
|
fun shortUrl(url: String) = url
|
||||||
|
|
Loading…
Reference in a new issue