From 5e19473e537184e4658cbc6c8cb96fe1cb721bed Mon Sep 17 00:00:00 2001 From: Jonas Weinz Date: Thu, 21 Mar 2019 16:06:18 +0100 Subject: [PATCH] fixing notifications again --- online_match_manager.js | 5 ----- sw.js | 2 +- websocket_connection.js | 4 ++++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/online_match_manager.js b/online_match_manager.js index d1f3c31..a9b5dc0 100644 --- a/online_match_manager.js +++ b/online_match_manager.js @@ -28,11 +28,6 @@ class OnlineMatchManager this.match_button.className = "infobar-button-active"; - if (this.match_state.active_player == this.local_player.get_name()) - { - this.game_server_connection.notify("your turn against " + this.online_opponent.get_name()); - } - this.is_closed = false; } diff --git a/sw.js b/sw.js index 40a393e..bfc5a46 100644 --- a/sw.js +++ b/sw.js @@ -39,5 +39,5 @@ self.addEventListener('fetch', function (event) { self.addEventListener('notificationclick', function (event) { event.notification.close(); - clients.openWindow(rel_home); + clients.openWindow(home); }); \ No newline at end of file diff --git a/websocket_connection.js b/websocket_connection.js index 002a0e4..0333062 100644 --- a/websocket_connection.js +++ b/websocket_connection.js @@ -182,6 +182,10 @@ class WebsocketConnection if (!match_state.game_over) { this.openmatches[id] = new OnlineMatchManager(this.grid, this.status_label, this.matches_container, this.control_container, this, id, match_state, this.player.get_name()); + if (match_state.last_move == null) + { + this.notify("new Game against " + this.openmatches[id].online_opponent.get_name()); + } } }