diff --git a/mobile/app/pods/components/bridge-finder/component.js b/mobile/app/pods/components/bridge-finder/component.js index 551f846..04aba6c 100644 --- a/mobile/app/pods/components/bridge-finder/component.js +++ b/mobile/app/pods/components/bridge-finder/component.js @@ -46,6 +46,12 @@ export default Component.extend({ this.send('findBridgeByIp'); } }); + + document.addEventListener('resume', () => { + if(this.get('error') || this.get('trial') || this.get('bridgeFindFail')) { + this.send('tryAgain'); + } + }, false); }, // find the bridge ip here @@ -120,6 +126,10 @@ export default Component.extend({ }, actions: { + tryAgain() { + this.get('storage').clear(); + location.reload(); + }, retry(){ this.onBridgeIpChange(); }, diff --git a/mobile/app/pods/components/bridge-finder/template.hbs b/mobile/app/pods/components/bridge-finder/template.hbs index 998a31c..af20754 100644 --- a/mobile/app/pods/components/bridge-finder/template.hbs +++ b/mobile/app/pods/components/bridge-finder/template.hbs @@ -2,9 +2,9 @@ {{#unless bridgeUsername}} {{#if bridgeIp}} {{#if error}} -
Huegasm encountered a critical error while trying to connect to your bridge.
- This likely happened because you're using an outdated browser and/or because your browser does not support CORS. Feel free to contact me through the link at the bottom of the page if you feel like this is not the case.
- For the best browsing experience on this site ( and every other one known to man ) please switch to Google Chrome or Firefox.
Huegasm encountered a critical error while trying to connect to your bridge.
+ TRY AGAIN
+
{{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
diff --git a/mobile/app/pods/components/hue-controls/component.js b/mobile/app/pods/components/hue-controls/component.js
index 87bec2d..d4c6dce 100644
--- a/mobile/app/pods/components/hue-controls/component.js
+++ b/mobile/app/pods/components/hue-controls/component.js
@@ -1,5 +1,4 @@
import Ember from 'ember';
-import ENV from 'huegasm_mobile/config/environment';
const {
A,
@@ -7,6 +6,7 @@ const {
computed,
isNone,
run,
+ inject,
$
} = Ember;
@@ -22,6 +22,11 @@ export default Component.extend({
lightsTabSelected: computed.equal('selectedTab', 0),
musicTabSelected: computed.equal('selectedTab', 1),
dimmerOn: false,
+ playing: false,
+
+ displayFailure: true,
+
+ notify: inject.service(),
dimmerOnClass: computed('dimmerOn', function(){
let dimmerOn = this.get('dimmerOn'),
@@ -83,13 +88,29 @@ export default Component.extend({
if (!isNone(this.get('storage').get('huegasm.selectedTab'))) {
this.set('selectedTab', this.get('storage').get('huegasm.selectedTab'));
}
+
+ document.addEventListener('backbutton', () => {
+ let index = (this.get('selectedTab') + 1) % this.tabList.length;
+ this.set('selectedTab', index);
+ this.get('storage').set('huegasm.selectedTab', index);
+ }, false);
+
+ document.addEventListener('pause', () => {
+ this.set('pauseLightUpdates', true);
+ }, false);
+
+ document.addEventListener('resume', () => {
+ this.set('pauseLightUpdates', false);
+ }, false);
},
updateLightData(){
let fail = ()=>{
- if(!ENV.ignoreFailures) {
- clearInterval(this.get('lightsDataIntervalHandle'));
- this.send('clearBridge');
+ if(this.get('displayFailure')){
+ this.get('notify').warning({html: 'Power
- {{paper-switch value=lightsOn onChange=(action (mut lightsOn)) disabled=trial skipProxy=trial label=lightsOnTxt}} + {{paper-switch value=lightsOn onChange=(action (mut lightsOn)) disabled=(or trial playing) skipProxy=trial label=lightsOnTxt}} {{/paper-item}} {{#paper-item}} @@ -17,7 +17,7 @@ {{#paper-menu offset="0 -100" as |menu|}} {{#menu.trigger}} {{#paper-button iconButton=false}} - {{paper-button raised=true class="color" disabled=trial}} + {{paper-button raised=true class="color" disabled=(or trial playing)}} {{/paper-button}} {{/menu.trigger}} {{#menu.content class="color-content" width=8 as |content|}} @@ -31,12 +31,12 @@ {{#paper-item}} {{paper-icon "flare" class=dimmerOnClass}}Strobe
- {{paper-switch value=strobeOn onChange=(action (mut strobeOn)) disabled=trial skipProxy=trial label=strobeOnTxt}} + {{paper-switch value=strobeOn onChange=(action (mut strobeOn)) disabled=(or trial playing) skipProxy=trial label=strobeOnTxt}} {{/paper-item}} {{#paper-item}} {{paper-icon "color-lens" class=dimmerOnClass}} {{paper-icon "loop" id="loop-addition" class=dimmerOnClass}}Colorloop
- {{paper-switch value=colorLoopOn onChange=(action (mut colorLoopOn)) disabled=trial skipProxy=trial label=colorloopOnTxt}} + {{paper-switch value=colorLoopOn onChange=(action (mut colorLoopOn)) disabled=(or trial playing) skipProxy=trial label=colorloopOnTxt}} {{/paper-item}} {{/paper-list}} \ No newline at end of file diff --git a/mobile/app/pods/components/music-tab/add-soundcloud-sound-modal/template.hbs b/mobile/app/pods/components/music-tab/add-soundcloud-sound-modal/template.hbs index 2d64f8b..f07e88e 100644 --- a/mobile/app/pods/components/music-tab/add-soundcloud-sound-modal/template.hbs +++ b/mobile/app/pods/components/music-tab/add-soundcloud-sound-modal/template.hbs @@ -1,7 +1,7 @@ {{#if isShowingModal}} {{#modal-dialog close="close" alignment="center" translucentOverlay=true attachment="center" targetAttachment="center"}} -Enter a SoundCloud track or playlist/set URL
+Enter a SoundCloud track or playlist/set URL
( ex. https://soundcloud.com/mrsuicidesheep/tracks )
{{paper-input label="SoundCloud URL" icon="search" value=url onChange=(action (mut url))}} diff --git a/mobile/app/pods/components/music-tab/component.js b/mobile/app/pods/components/music-tab/component.js index 6e7dfe5..a9ce776 100644 --- a/mobile/app/pods/components/music-tab/component.js +++ b/mobile/app/pods/components/music-tab/component.js @@ -168,46 +168,6 @@ export default Component.extend(helperMixin, visualizerMixin, { }); }, - startUsingMic() { - navigator.getUserMedia( - {audio: true}, - (stream) => { - this.changePlayerControl('audioMode', 1); - let dancer = this.get('dancer'); - - if(dancer.audio && dancer.audio.pause) { - dancer.pause(); - } - - this.setProperties({ - volumeCache: this.get('volume'), - playing: true, - audioStream: stream - }); - - document.title = 'Listening to Mic - Huegasm'; - - dancer.load(stream, this.get('micBoost'), true); - this.set('usingBeatPreferences', false); - - // much more sensitive beat preference settings are needed for mic mode - this.setProperties({ - oldThreshold: this.get('threshold'), - threshold: 0.1 - }); - - dancer.setVolume(0); - }, - (err) => { - if(err.name === 'DevicesNotFoundError'){ - this.get('notify').alert({html: this.get('notFoundHtml')}); - } - - console.log('Error during navigator.getUserMedia: ' + err.name + ', ' + err.message + ', ' + err.constraintName); - } - ); - }, - clearCurrentAudio(resetPointer) { let dancer = this.get('dancer'); @@ -327,11 +287,8 @@ export default Component.extend(helperMixin, visualizerMixin, { kick: kick }); - if(navigator.getUserMedia === undefined){ - this.set('usingMicSupported', false); - } - ['volume', 'shuffle', 'repeat', 'threshold', 'playerBottomDisplayed', 'audioMode', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost', 'flashingTransitions', 'colorloopMode', 'ambienceMode', 'hueRange'].forEach((item)=>{ + ['shuffle', 'repeat', 'threshold', 'playerBottomDisplayed', 'audioMode', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost', 'flashingTransitions', 'colorloopMode', 'ambienceMode', 'hueRange'].forEach((item)=>{ if (!isNone(storage.get('huegasm.' + item))) { let itemVal = storage.get('huegasm.' + item); @@ -346,6 +303,26 @@ export default Component.extend(helperMixin, visualizerMixin, { SC.initialize({ client_id: this.get('SC_CLIENT_ID') }); + + document.addEventListener('volumedownbutton', () => { + let volume = this.get('volume') - 5; + volume = volume < 0 ? 0 : volume; + this.set('volume', volume); + + window.system.setSystemVolume(volume/100); + }, false); + + document.addEventListener('volumeupbutton', () => { + let volume = this.get('volume') + 5; + volume = volume > 100 ? 100 : volume; + this.set('volume', volume); + + window.system.setSystemVolume(volume/100); + }, false); + + document.addEventListener('pause', () => { + this.get('dancer').pause(); + }, false); }, didInsertElement() { @@ -498,7 +475,6 @@ export default Component.extend(helperMixin, visualizerMixin, { if(this.get('playQueuePointer') !== -1) { this.send('goToSong', this.get('playQueuePointer')); - this.send('volumeChanged', this.get('volume')); } // restore the old beat preferences ( before the user went into mic mode ) @@ -508,13 +484,6 @@ export default Component.extend(helperMixin, visualizerMixin, { document.title = 'Huegasm'; }, - useMicAudio() { - if(this.get('usingMicAudio')) { - this.send('useLocalAudio'); - } else { - this.startUsingMic(); - } - }, slideTogglePlayerBottom(){ let elem = this.$('#player-bottom'); @@ -603,10 +572,11 @@ export default Component.extend(helperMixin, visualizerMixin, { }, play(replayPause) { let dancer = this.get('dancer'), - playQueuePointer = this.get('playQueuePointer'); + playQueuePointer = this.get('playQueuePointer'), + playing = this.get('playing'); if(playQueuePointer !== -1 ) { - if (this.get('playing')) { + if (playing) { dancer.pause(); if(!replayPause){ @@ -626,16 +596,11 @@ export default Component.extend(helperMixin, visualizerMixin, { dancer.play(); } + this.set('pauseLightUpdates', !playing); this.onColorloopModeChange(); this.toggleProperty('playing'); } }, - volumeChanged(value) { - this.changePlayerControl('volume', value); - if(this.get('playing')) { - this.get('dancer').setVolume(value/100); - } - }, next(repeatAll) { let playQueuePointer = this.get('playQueuePointer'), playQueue = this.get('playQueue'), @@ -744,15 +709,9 @@ export default Component.extend(helperMixin, visualizerMixin, { micBoostChanged(value) { this.set('micBoost', value); this.get('storage').set('huegasm.micBoost', value); - - if(this.get('usingMicAudio')) { - this.get('dancer').setBoost(value); - } }, audioModeChanged(value){ - if(value === 1) { - this.startUsingMic(); - } else if(value === 0) { + if(value === 0) { this.send('useLocalAudio'); } else { this.set('audioMode', value); diff --git a/mobile/app/pods/components/music-tab/mixins/helpers.js b/mobile/app/pods/components/music-tab/mixins/helpers.js index 8061117..2d6e69b 100644 --- a/mobile/app/pods/components/music-tab/mixins/helpers.js +++ b/mobile/app/pods/components/music-tab/mixins/helpers.js @@ -93,7 +93,6 @@ export default Mixin.create({ timeElapsed: 0, timeTotal: 0, lastLightBopIndex: 0, - usingMicSupported: false, // 0 - local, 1 - mic, possibly more to come audioMode: 0, @@ -197,18 +196,12 @@ export default Mixin.create({ let song = playQueue[playQueuePointer]; if(song.scUrl && !isNone(song.picture)){ pic = song.picture.replace('67x67', '500x500'); - } else { - pic = song.picture; } } return pic; }), - pauseLightUpdates: computed('playing', function(){ - return this.get('playing'); - }), - micIcon: computed('usingMicAudio', function(){ if(this.get('usingMicAudio')) { return 'mic'; diff --git a/mobile/app/pods/components/music-tab/template.hbs b/mobile/app/pods/components/music-tab/template.hbs index bbf4d4c..9c7c8b3 100644 --- a/mobile/app/pods/components/music-tab/template.hbs +++ b/mobile/app/pods/components/music-tab/template.hbs @@ -73,10 +73,6 @@ {{/paper-menu}} {{/if}} - {{#if usingMicSupported}} - {{paper-icon icon=micIcon class=usingMicAudioClass}} - {{/if}} - {{#if usingLocalAudio}} {{paper-icon "shuffle" class=shuffleClass}} {{paper-icon repeatIcon class=repeatClass}} @@ -198,6 +194,4 @@ -{{ember-notify messageStyle='bootstrap' closeAfter=5000}} - {{music-tab/add-soundcloud-sound-modal action="handleNewSoundCloudURL" isShowingModal=isShowingAddSoundCloudModal}} \ No newline at end of file diff --git a/mobile/app/styles/music-tab.scss b/mobile/app/styles/music-tab.scss index e573417..2e9eb22 100644 --- a/mobile/app/styles/music-tab.scss +++ b/mobile/app/styles/music-tab.scss @@ -146,7 +146,7 @@ background-color: white; width: 100%; height: 350px; - margin: 5px auto; + margin: 0 auto; border-radius: 5px; transition: 0.1s all ease-in-out; position: relative; @@ -255,7 +255,10 @@ background: white; padding-bottom: 20px; border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px + border-bottom-right-radius: 5px; + .md-label { + width: 100%; + } } #beat-container { diff --git a/mobile/config/environment.js b/mobile/config/environment.js index 22f5364..d613704 100644 --- a/mobile/config/environment.js +++ b/mobile/config/environment.js @@ -7,7 +7,6 @@ module.exports = function(environment) { environment: environment, rootURL: '/', locationType: 'hash', - ignoreFailures: false, EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build @@ -22,7 +21,6 @@ module.exports = function(environment) { }; if (environment === 'development') { - // ENV.ignoreFailures = true; // ENV.APP.LOG_RESOLVER = true; // ENV.APP.LOG_ACTIVE_GENERATION = true; // ENV.APP.LOG_TRANSITIONS = true; diff --git a/mobile/ember-cordova/cordova/config.xml b/mobile/ember-cordova/cordova/config.xml index ea3bcf1..711c5c9 100644 --- a/mobile/ember-cordova/cordova/config.xml +++ b/mobile/ember-cordova/cordova/config.xml @@ -1,100 +1,93 @@ - +Power
- {{paper-switch value=lightsOn onChange=(action (mut lightsOn)) disabled=trial skipProxy=trial label=lightsOnTxt}} + {{paper-switch value=lightsOn onChange=(action (mut lightsOn)) disabled=(or trial playing) skipProxy=trial label=lightsOnTxt}} {{/paper-item}} {{#paper-item}} @@ -18,7 +18,7 @@ {{#paper-menu offset="0 -50" as |menu|}} {{#menu.trigger}} {{#paper-button iconButton=false}} - {{paper-button raised=true class="color" disabled=trial}} + {{paper-button raised=true class="color" disabled=(or trial playing)}} {{/paper-button}} {{/menu.trigger}} {{#menu.content class="color-content" width=0 as |content|}} @@ -32,12 +32,12 @@ {{#paper-item}} {{paper-icon "flare" class=dimmerOnClass}}Strobe
- {{paper-switch value=strobeOn onChange=(action (mut strobeOn)) disabled=trial skipProxy=trial label=strobeOnTxt}} + {{paper-switch value=strobeOn onChange=(action (mut strobeOn)) disabled=(or trial playing) skipProxy=trial label=strobeOnTxt}} {{/paper-item}} {{#paper-item}} {{paper-icon "color-lens" class=dimmerOnClass}} {{paper-icon "loop" id="loop-addition" class=dimmerOnClass}}Colorloop
- {{paper-switch value=colorLoopOn onChange=(action (mut colorLoopOn)) disabled=trial skipProxy=trial label=colorloopOnTxt}} + {{paper-switch value=colorLoopOn onChange=(action (mut colorLoopOn)) disabled=(or trial playing) skipProxy=trial label=colorloopOnTxt}} {{/paper-item}} {{/paper-list}} \ No newline at end of file diff --git a/web/app/pods/components/music-tab/component.js b/web/app/pods/components/music-tab/component.js index 9cd19a4..43647b4 100644 --- a/web/app/pods/components/music-tab/component.js +++ b/web/app/pods/components/music-tab/component.js @@ -646,10 +646,11 @@ export default Component.extend(helperMixin, visualizerMixin, { }, play(replayPause) { let dancer = this.get('dancer'), - playQueuePointer = this.get('playQueuePointer'); + playQueuePointer = this.get('playQueuePointer'), + playing = this.get('playing'); if(playQueuePointer !== -1 ) { - if (this.get('playing')) { + if (playing) { dancer.pause(); if(!replayPause){ @@ -675,6 +676,7 @@ export default Component.extend(helperMixin, visualizerMixin, { dancer.play(); } + this.set('pauseLightUpdates', !playing); this.onColorloopModeChange(); this.toggleProperty('playing'); } diff --git a/web/app/pods/components/music-tab/mixins/helpers.js b/web/app/pods/components/music-tab/mixins/helpers.js index 5fda836..2a589e1 100644 --- a/web/app/pods/components/music-tab/mixins/helpers.js +++ b/web/app/pods/components/music-tab/mixins/helpers.js @@ -18,7 +18,7 @@ export default Mixin.create({ dancer: null, - notify: inject.service('notify'), + notify: inject.service(), beatOptions: { threshold: { @@ -200,18 +200,12 @@ export default Mixin.create({ let song = playQueue[playQueuePointer]; if(song.scUrl && !isNone(song.picture)){ pic = song.picture.replace('67x67', '500x500'); - } else { - pic = song.picture; } } return pic; }), - pauseLightUpdates: computed('playing', function(){ - return this.get('playing'); - }), - micIcon: computed('usingMicAudio', function(){ if(this.get('usingMicAudio')) { return 'mic'; diff --git a/web/app/pods/components/music-tab/template.hbs b/web/app/pods/components/music-tab/template.hbs index 4712f6a..9849dce 100644 --- a/web/app/pods/components/music-tab/template.hbs +++ b/web/app/pods/components/music-tab/template.hbs @@ -172,13 +172,13 @@ {{#if usingMicAudio}} -