fix false positive notifications

This commit is contained in:
Nicolas Constant 2019-11-08 00:56:44 -05:00
parent 7414539f09
commit 93947744be
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 13 additions and 8 deletions

View File

@ -87,9 +87,10 @@ export class StreamingWrapper {
}
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[]) => {
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) {
const update = new StatusUpdate();
update.notification = n;

View File

@ -110,19 +110,23 @@ export class UserNotificationService {
// });
}
private soundJustPlayed = false;
private playSoundNotification() {
if(this.soundJustPlayed) return;
console.warn('play audio');
// let audio = new Audio();
// audio.src = "assets/audio/exquisite.mp3";
// audio.load();
// audio.play();
this.sound.play();
}
private processNewUpdate(account: AccountInfo, notification: StatusUpdate) {
if(!notification && !notification.notification) return;
this.playSoundNotification();
console.warn(account);
console.warn(notification);
if (notification.notification.type === 'mention') {
this.processMentionsAndNotifications(account, [notification.notification], NotificationTypeEnum.UserMention);