1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-28 15:22:05 +03:00

correctly fix notif spam after logout/login: https://github.com/vector-im/vector-web/issues/809

This commit is contained in:
Matthew Hodgson
2016-03-17 02:06:47 +00:00
parent 87e1bc2f07
commit 380d466472

View File

@ -103,6 +103,7 @@ var Notifier = {
MatrixClientPeg.get().on('Room.timeline', this.boundOnRoomTimeline); MatrixClientPeg.get().on('Room.timeline', this.boundOnRoomTimeline);
MatrixClientPeg.get().on("sync", this.boundOnSyncStateChange); MatrixClientPeg.get().on("sync", this.boundOnSyncStateChange);
this.toolbarHidden = false; this.toolbarHidden = false;
this.isPrepared = false;
}, },
stop: function() { stop: function() {
@ -110,6 +111,7 @@ var Notifier = {
MatrixClientPeg.get().removeListener('Room.timeline', this.boundOnRoomTimeline); MatrixClientPeg.get().removeListener('Room.timeline', this.boundOnRoomTimeline);
MatrixClientPeg.get().removeListener('sync', this.boundOnSyncStateChange); MatrixClientPeg.get().removeListener('sync', this.boundOnSyncStateChange);
} }
this.isPrepared = false;
}, },
supportsDesktopNotifications: function() { supportsDesktopNotifications: function() {
@ -203,12 +205,10 @@ var Notifier = {
}, },
onSyncStateChange: function(state) { onSyncStateChange: function(state) {
console.log("sync state change: " + state);
if (state === "PREPARED" || state === "SYNCING") { if (state === "PREPARED" || state === "SYNCING") {
this.isPrepared = true; this.isPrepared = true;
} }
else if (state === "STOPPED" || state === "ERROR") {
this.isPrepared = false;
}
}, },
onRoomTimeline: function(ev, room, toStartOfTimeline) { onRoomTimeline: function(ev, room, toStartOfTimeline) {