migrate old settings for tiles and messages sound enablers
authorLaurent Mazet <mazet@softndesign.org>
Sun, 13 Sep 2020 20:38:40 +0000 (22:38 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Sun, 13 Sep 2020 20:38:40 +0000 (22:38 +0200)
public/trivabble.js

index 51ddbe4a4f12f7d06b3e01c31398391d6701ff20..1129c8888ee873c7dd8d74b82d8e65e03b8de317 100644 (file)
 
         const tilesSound = document.getElementById("tiles-sound");
         if (tilesSound) {
+
+            /* migration of old settings for tiles sound */
+            const oldSetting = getSetting("trivabbleTilesSound");
+            if (oldSetting) {
+                setSetting("ENABLE_TILE_SOUND", oldSetting === "true");
+                delete localStorage.trivabbleTilesSound;
+            }
+
             tilesSound.checked = getSetting("ENABLE_TILE_SOUND");
             tilesSound.onclick = function () {
                 setSetting("ENABLE_TILE_SOUND", this.checked);
 
         const msgSound = document.getElementById("msg-sound");
         if (msgSound) {
+
+            /* migration of old settings for message sound */
+            const oldSetting = getSetting("trivabbleMsgSound");
+            if (oldSetting) {
+                setSetting("ENABLE_MSG_SOUND", oldSetting === "true");
+                delete localStorage.trivabbleMsgSound;
+            }
+
             msgSound.checked = getSetting("ENABLE_MSG_SOUND");
             msgSound.onclick = function () {
                 setSetting("ENABLE_MSG_SOUND", this.checked);