From 1f0bf371094010f751f903937a600931ef7ea205 Mon Sep 17 00:00:00 2001 From: Renard Date: Mon, 30 Sep 2019 22:11:19 -0300 Subject: Añadidos: Settings ✨ --- src/Thread.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/Thread.js') diff --git a/src/Thread.js b/src/Thread.js index c79e7e0..b656b9f 100644 --- a/src/Thread.js +++ b/src/Thread.js @@ -28,8 +28,9 @@ class Thread extends Component { this.refreshCooldown = 15; this.cooldownCounter = 0; this.newPostCounter = 0; + let threadSound = JSON.parse(localStorage.getItem("settings")).threadSound; this.notificationSound = new Audio( - "https://bienvenidoainternet.org/msn.ogg" + `https://bienvenidoainternet.org/static/sfx/${threadSound}.ogg` ); } @@ -64,6 +65,10 @@ class Thread extends Component { } async updateReplies() { + if (!JSON.parse(localStorage.getItem("settings")).autoUpdateThreads) { + return; + } + this.cooldownCounter++; if (this.cooldownCounter < this.refreshCooldown) { return; @@ -87,7 +92,9 @@ class Thread extends Component { const newPosts = this.state.thread.posts.concat(resource.posts); this.refreshCooldown = 15; this.newPostCounter += resource.posts.length; - this.notificationSound.play(); + if (JSON.parse(localStorage.getItem("settings")).notifyOnThread) { + this.notificationSound.play(); + } this.setState(({ thread }) => ({ thread: { ...thread, -- cgit v1.2.1-18-gbd029