Remove mui/styles, Settings page, make minPriority functional, ahh so ugly
This commit is contained in:
parent
f23c7a2dbf
commit
8036aa2942
9 changed files with 265 additions and 60 deletions
|
@ -1,7 +1,11 @@
|
|||
import {formatMessage, formatTitleWithFallback, topicShortUrl} from "./utils";
|
||||
import repository from "./Repository";
|
||||
|
||||
class NotificationManager {
|
||||
notify(subscription, notification, onClickFallback) {
|
||||
if (!this.shouldNotify(subscription, notification)) {
|
||||
return;
|
||||
}
|
||||
const message = formatMessage(notification);
|
||||
const title = formatTitleWithFallback(notification, topicShortUrl(subscription.baseUrl, subscription.topic));
|
||||
const n = new Notification(title, {
|
||||
|
@ -27,6 +31,14 @@ class NotificationManager {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
shouldNotify(subscription, notification) {
|
||||
const priority = (notification.priority) ? notification.priority : 3;
|
||||
if (priority < repository.getMinPriority()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const notificationManager = new NotificationManager();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue