diff --git a/.gitignore b/.gitignore index 85e7c1d..d0038b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /.idea/ +/.vscode/ diff --git a/chrome/app/index.html b/chrome/app/index.html index 297c7f4..e093db1 100644 --- a/chrome/app/index.html +++ b/chrome/app/index.html @@ -14,8 +14,6 @@ {{content-for 'head-footer'}} - - diff --git a/chrome/app/pods/application/controller.js b/chrome/app/pods/application/controller.js index d1497ec..a117a59 100644 --- a/chrome/app/pods/application/controller.js +++ b/chrome/app/pods/application/controller.js @@ -13,16 +13,17 @@ export default Controller.extend({ init() { this._super(...arguments); - let dimmerOn = chrome.storage.local.get('huegasm.dimmerOn'), - lightsIconsOn = chrome.storage.local.get('huegasm.lightsIconsOn'); + chrome.storage.local.get('dimmerOn', ({dimmerOn}) => { + chrome.storage.local.get('lightsIconsOn', ({lightsIconsOn}) => { + if (!isEmpty(dimmerOn) && dimmerOn) { + this.send('toggleDimmer'); + } - if (!isEmpty(dimmerOn) && dimmerOn) { - this.send('toggleDimmer'); - } - - if (!isEmpty(lightsIconsOn)) { - this.set('lightsIconsOn', lightsIconsOn); - } + if (!isEmpty(lightsIconsOn)) { + this.set('lightsIconsOn', lightsIconsOn); + } + }) + }); }, actions: { @@ -31,7 +32,7 @@ export default Controller.extend({ let lightsIconsOn = this.get('lightsIconsOn'); - chrome.storage.local.set('huegasm.lightsIconsOn', lightsIconsOn); + chrome.storage.local.set({ 'lightsIconsOn': lightsIconsOn }); }, toggleDimmer() { this.toggleProperty('dimmerOn'); @@ -46,7 +47,7 @@ export default Controller.extend({ $('html').removeClass('dimmerOn'); } - chrome.storage.local.set('huegasm.dimmerOn', dimmerOn); + chrome.storage.local.set({ 'dimmerOn': dimmerOn }); } } }); diff --git a/chrome/app/pods/components/bridge-finder/component.js b/chrome/app/pods/components/bridge-finder/component.js index 603ceac..c36715b 100644 --- a/chrome/app/pods/components/bridge-finder/component.js +++ b/chrome/app/pods/components/bridge-finder/component.js @@ -61,7 +61,7 @@ export default Component.extend({ if (status === 'success' && result.length === 1) { this.set('bridgeIp', result[0].internalipaddress); - chrome.storage.local.set('huegasm.bridgeIp', result[0].internalipaddress); + chrome.storage.local.set({ 'bridgeIp': result[0].internalipaddress }); bridgeFindStatus = 'success'; } else if (result.length > 1) { let multipleBridgeIps = this.get('multipleBridgeIps'); @@ -99,7 +99,8 @@ export default Component.extend({ if (status === 'success' && !result[0].error) { this.clearBridgePingIntervalHandle(); - chrome.storage.local.set('huegasm.bridgeUsername', result[0].success.username); + debugger; + chrome.storage.local.set({ 'bridgeUsername': result[0].success.username }); this.set('bridgeUsername', result[0].success.username); } } @@ -120,9 +121,9 @@ export default Component.extend({ retry() { this.onBridgeIpChange(); }, - chooseBridge(bridge) { - this.set('bridgeIp', bridge); - chrome.storage.local.set('huegasm.bridgeIp', bridge); + chooseBridge(bridgeIp) { + this.set('bridgeIp', bridgeIp); + chrome.storage.local.set({ 'bridgeIp': bridgeIp }); }, findBridgeByIp() { let manualBridgeIp = this.get('manualBridgeIp'); diff --git a/chrome/app/pods/components/hue-controls/component.js b/chrome/app/pods/components/hue-controls/component.js index dd5c04d..0f20356 100644 --- a/chrome/app/pods/components/hue-controls/component.js +++ b/chrome/app/pods/components/hue-controls/component.js @@ -78,9 +78,11 @@ export default Component.extend({ setInterval(this.updateLightData.bind(this), 2000); } - if (!isNone(chrome.storage.local.get('huegasm.selectedTab'))) { - this.set('selectedTab', chrome.storage.local.get('huegasm.selectedTab')); - } + chrome.storage.local.get('selectedTab', ({selectedTab}) => { + if (!isNone(selectedTab)) { + this.set('selectedTab', selectedTab); + } + }); }, updateLightData() { @@ -112,11 +114,11 @@ export default Component.extend({ changeTab(tabName) { let index = this.get('tabList').indexOf(tabName); this.set('selectedTab', index); - chrome.storage.local.set('huegasm.selectedTab', index); + chrome.storage.local.set({ 'selectedTab': index }); }, clearBridge() { - chrome.storage.local.remove('huegasm.bridgeUsername'); - chrome.storage.local.remove('huegasm.bridgeIp'); + chrome.storage.local.remove('bridgeUsername'); + chrome.storage.local.remove('bridgeIp'); location.reload(); }, toggleDimmer() { diff --git a/chrome/app/pods/components/huegasm-app/component.js b/chrome/app/pods/components/huegasm-app/component.js index 6c951a1..fa2e451 100644 --- a/chrome/app/pods/components/huegasm-app/component.js +++ b/chrome/app/pods/components/huegasm-app/component.js @@ -15,12 +15,14 @@ export default Component.extend({ init() { this._super(...arguments); - if (!isEmpty(chrome.storage.local.get('huegasm.bridgeIp')) && !isEmpty(chrome.storage.local.get('huegasm.bridgeUsername'))) { - this.setProperties({ - bridgeIp: chrome.storage.local.get('huegasm.bridgeIp'), - bridgeUsername: chrome.storage.local.get('huegasm.bridgeUsername') + chrome.storage.local.get('bridgeIp', ({bridgeIp}) => { + chrome.storage.local.get('bridgeUsername', ({bridgeUsername}) => { + this.setProperties({ + bridgeIp, + bridgeUsername + }); }); - } + }); }, actions: { diff --git a/chrome/app/pods/components/light-group/component.js b/chrome/app/pods/components/light-group/component.js index 6def914..cb2679a 100644 --- a/chrome/app/pods/components/light-group/component.js +++ b/chrome/app/pods/components/light-group/component.js @@ -86,29 +86,30 @@ export default Component.extend({ }), onActiveLightsChange: observer('activeLights.[]', function () { - chrome.storage.local.set('huegasm.activeLights', this.get('activeLights')); + chrome.storage.local.set({ 'activeLights': this.get('activeLights') }); }), init() { this._super(...arguments); let lightsData = this.get('lightsData'), - activeLights = this.get('activeLights'), - activeLightsCache = chrome.storage.local.get('huegasm.activeLights'); + activeLights = this.get('activeLights'); - if (!isNone(activeLightsCache)) { - activeLightsCache.forEach(function (i) { - if (!isNone(lightsData) && lightsData.hasOwnProperty(i) && lightsData[i].state.reachable) { - activeLights.pushObject(i); - } - }); - } else { - for (let key in lightsData) { - if (lightsData.hasOwnProperty(key) && lightsData[key].state.reachable) { - activeLights.pushObject(key); + chrome.storage.local.get('activeLights', ({activeLightsCache}) => { + if (!isNone(activeLightsCache)) { + activeLightsCache.forEach(function (i) { + if (!isNone(lightsData) && lightsData.hasOwnProperty(i) && lightsData[i].state.reachable) { + activeLights.pushObject(i); + } + }); + } else { + for (let key in lightsData) { + if (lightsData.hasOwnProperty(key) && lightsData[key].state.reachable) { + activeLights.pushObject(key); + } } } - } + }); }, actions: { diff --git a/chrome/app/pods/components/music-tab/component.js b/chrome/app/pods/components/music-tab/component.js index cb62fa5..1672cd1 100644 --- a/chrome/app/pods/components/music-tab/component.js +++ b/chrome/app/pods/components/music-tab/component.js @@ -122,7 +122,9 @@ export default Component.extend({ this.get('kick').set({ threshold: value }); } - chrome.storage.local.set('huegasm.' + name, value); + let toSave = {}; + toSave[name] = value; + chrome.storage.local.set(toSave); }, simulateKick(/*mag, ratioKickMag*/) { @@ -223,15 +225,15 @@ export default Component.extend({ }); ['threshold', 'playerBottomDisplayed', 'flashingTransitions', 'colorloopMode', 'hueRange', 'brightnessRange'].forEach((item) => { - if (!isNone(chrome.storage.local.get('huegasm.' + item))) { - let itemVal = chrome.storage.local.get('huegasm.' + item); - - if (isNone(this.actions[item + 'Changed'])) { - this.set(item, itemVal); - } else { - this.send(item + 'Changed', itemVal); + chrome.storage.local.get(item, ({itemVal}) => { + if (!isNone(itemVal)) { + if (isNone(this.actions[item + 'Changed'])) { + this.set(item, itemVal); + } else { + this.send(item + 'Changed', itemVal); + } } - } + }); }); }, diff --git a/chrome/app/styles/hue-controls.scss b/chrome/app/styles/hue-controls.scss index e517619..90baa9c 100644 --- a/chrome/app/styles/hue-controls.scss +++ b/chrome/app/styles/hue-controls.scss @@ -31,7 +31,7 @@ // preload images #hue-controls:after, md-progress-circular:after { display: none; - content: url(images/colormap.png) url(images/missingArtwork.png) url(images/sc-white.png) url(images/huegasm.png) url(images/lights/a19.svg) url(images/lights/a19w.svg) url(images/lights/br30.svg) url(images/lights/br30w.svg) url(images/lights/gu10.svg) url(images/lights/gu10w.svg) url(images/lights/huego.svg) url(images/lights/huegow.svg) url(images/lights/lc_aura.svg) url(images/lights/lc_auraw.svg) url(images/lights/lc_bloom.svg) url(images/lights/lc_bloomw.svg) url(images/lights/lc_iris.svg) url(images/lights/lc_irisw.svg) url(images/lights/lightstrip.svg) url(images/lights/lightstripw.svg) url(images/lights/storylight.svg) url(images/lights/storylightw.svg); + content: url(images/colormap.png) url(images/huegasm.png) url(images/lights/a19.svg) url(images/lights/a19w.svg) url(images/lights/br30.svg) url(images/lights/br30w.svg) url(images/lights/gu10.svg) url(images/lights/gu10w.svg) url(images/lights/huego.svg) url(images/lights/huegow.svg) url(images/lights/lc_aura.svg) url(images/lights/lc_auraw.svg) url(images/lights/lc_bloom.svg) url(images/lights/lc_bloomw.svg) url(images/lights/lc_iris.svg) url(images/lights/lc_irisw.svg) url(images/lights/lightstrip.svg) url(images/lights/lightstripw.svg) url(images/lights/storylight.svg) url(images/lights/storylightw.svg); } #navigation { diff --git a/chrome/package.json b/chrome/package.json index b05c55d..c232c52 100644 --- a/chrome/package.json +++ b/chrome/package.json @@ -18,7 +18,6 @@ "license": "MIT", "devDependencies": { "broccoli-asset-rev": "^2.2.0", - "ember-ajax": "^2.0.1", "ember-cli": "^2.8.0", "ember-cli-app-version": "^2.0.0", "ember-cli-babel": "^5.1.5", diff --git a/chrome/public/assets/images/missingArtwork.png b/chrome/public/assets/images/missingArtwork.png deleted file mode 100644 index 3cf2548..0000000 Binary files a/chrome/public/assets/images/missingArtwork.png and /dev/null differ diff --git a/chrome/public/manifest.json b/chrome/public/manifest.json index 2208354..61634b0 100644 --- a/chrome/public/manifest.json +++ b/chrome/public/manifest.json @@ -9,11 +9,9 @@ "128": "128x128.png" }, "background": { - "background": { - "scripts": [ - "background.js" - ] - }, + "scripts": [ + "background.js" + ] }, "browser_action": { "default_icon": { diff --git a/mobile/package.json b/mobile/package.json index 4160019..dac321b 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -20,7 +20,6 @@ "license": "MIT", "devDependencies": { "broccoli-asset-rev": "^2.2.0", - "ember-ajax": "^2.0.1", "ember-cli": "^2.11.0", "ember-cli-app-version": "^2.0.0", "ember-cli-babel": "^5.1.5", diff --git a/web/package.json b/web/package.json index 7e5d052..3de24d9 100644 --- a/web/package.json +++ b/web/package.json @@ -18,7 +18,6 @@ "license": "MIT", "devDependencies": { "broccoli-asset-rev": "^2.2.0", - "ember-ajax": "^2.0.1", "ember-cli": "^2.8.0", "ember-cli-app-version": "^2.0.0", "ember-cli-babel": "^5.1.5",