mirror of
https://github.com/NicolasConstant/sengi
synced 2025-02-02 03:26:51 +01:00
fix false positive notifications
This commit is contained in:
parent
7414539f09
commit
93947744be
@ -87,9 +87,10 @@ export class StreamingWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private pullNewNotifications(){
|
private pullNewNotifications(){
|
||||||
this.mastodonService.getNotifications(this.account, null, null, this.since_id, 10)
|
this.mastodonService.getNotifications(this.account, null, this.since_id, null, 10)
|
||||||
.then((notifications: Notification[]) => {
|
.then((notifications: Notification[]) => {
|
||||||
notifications = notifications.sort((a, b) => a.id.localeCompare(b.id));
|
//notifications = notifications.sort((a, b) => a.id.localeCompare(b.id));
|
||||||
|
notifications = notifications.reverse();
|
||||||
for (const n of notifications) {
|
for (const n of notifications) {
|
||||||
const update = new StatusUpdate();
|
const update = new StatusUpdate();
|
||||||
update.notification = n;
|
update.notification = n;
|
||||||
|
@ -110,19 +110,23 @@ export class UserNotificationService {
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private soundJustPlayed = false;
|
||||||
private playSoundNotification() {
|
private playSoundNotification() {
|
||||||
|
if(this.soundJustPlayed) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.warn('play audio');
|
console.warn('play audio');
|
||||||
|
|
||||||
// let audio = new Audio();
|
|
||||||
// audio.src = "assets/audio/exquisite.mp3";
|
|
||||||
// audio.load();
|
|
||||||
// audio.play();
|
|
||||||
|
|
||||||
this.sound.play();
|
this.sound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
private processNewUpdate(account: AccountInfo, notification: StatusUpdate) {
|
private processNewUpdate(account: AccountInfo, notification: StatusUpdate) {
|
||||||
|
if(!notification && !notification.notification) return;
|
||||||
|
|
||||||
this.playSoundNotification();
|
this.playSoundNotification();
|
||||||
|
console.warn(account);
|
||||||
|
console.warn(notification);
|
||||||
|
|
||||||
|
|
||||||
if (notification.notification.type === 'mention') {
|
if (notification.notification.type === 'mention') {
|
||||||
this.processMentionsAndNotifications(account, [notification.notification], NotificationTypeEnum.UserMention);
|
this.processMentionsAndNotifications(account, [notification.notification], NotificationTypeEnum.UserMention);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user