diff --git a/package.json b/package.json index f32b319..d2891a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "turn-off-the-lights-browser-extension", - "version": "4.5.2", + "version": "4.5.3", "description": "Browser extension", "homepage": "https://wwww.turnoffthelights.com", "author": "Stefan Van Damme", diff --git a/src/manifests/safari.json b/src/manifests/safari.json index 9c6b8d6..5eb4327 100644 --- a/src/manifests/safari.json +++ b/src/manifests/safari.json @@ -10,7 +10,7 @@ } }, "background": { - "service_worker": "scripts/background.js", + "scripts": ["scripts/constants.js", "scripts/background.js"], "persistent": false }, "commands": { diff --git a/src/scripts/background.js b/src/scripts/background.js index 8e946a8..c0e5936 100755 --- a/src/scripts/background.js +++ b/src/scripts/background.js @@ -28,8 +28,13 @@ To view a copy of this license, visit http://creativecommons.org/licenses/GPL/2. //================================================ // Importing the constants -// eslint-disable-next-line no-undef -importScripts("constants.js"); +// Check if the browser supports service workers +// Safari uses a background script because iOS service workers are quickly terminated +if(typeof importScripts === "function"){ + // Importing the constants only if importScripts is available + // eslint-disable-next-line no-undef + importScripts("constants.js"); +} chrome.runtime.onMessage.addListener(function request(request, sender){ // eye protection & autodim & shortcut diff --git a/xcode/Turn-Off-the-Lights-Safari-extension/Config.xcconfig b/xcode/Turn-Off-the-Lights-Safari-extension/Config.xcconfig index 1726e20..f0f5847 100644 --- a/xcode/Turn-Off-the-Lights-Safari-extension/Config.xcconfig +++ b/xcode/Turn-Off-the-Lights-Safari-extension/Config.xcconfig @@ -9,5 +9,5 @@ // https://help.apple.com/xcode/#/dev745c5c974 // Update the version number here for all platforms -VERSION = 4.5.2 -BUILD_NUMBER = 132 +VERSION = 4.5.3 +BUILD_NUMBER = 133 diff --git a/xcode/Turn-Off-the-Lights-Safari-extension/Turn Off the Lights for Safari.xcodeproj/project.xcworkspace/xcuserdata/stefanvandamme.xcuserdatad/UserInterfaceState.xcuserstate b/xcode/Turn-Off-the-Lights-Safari-extension/Turn Off the Lights for Safari.xcodeproj/project.xcworkspace/xcuserdata/stefanvandamme.xcuserdatad/UserInterfaceState.xcuserstate index 427eed2..0b9eecc 100644 Binary files a/xcode/Turn-Off-the-Lights-Safari-extension/Turn Off the Lights for Safari.xcodeproj/project.xcworkspace/xcuserdata/stefanvandamme.xcuserdatad/UserInterfaceState.xcuserstate and b/xcode/Turn-Off-the-Lights-Safari-extension/Turn Off the Lights for Safari.xcodeproj/project.xcworkspace/xcuserdata/stefanvandamme.xcuserdatad/UserInterfaceState.xcuserstate differ