From c33c98085fc4c65ca11ebb14324d2559ae64ad76 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Thu, 5 Jan 2017 13:49:38 +1300 Subject: [PATCH] Notify when starting radio --- mopidy_iris/__init__.py | 2 +- src/js/components/Parallax.js | 37 ++-------------------------- src/js/services/pusher/middleware.js | 29 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 36 deletions(-) diff --git a/mopidy_iris/__init__.py b/mopidy_iris/__init__.py index 739f67bc..01fdd9f0 100755 --- a/mopidy_iris/__init__.py +++ b/mopidy_iris/__init__.py @@ -8,7 +8,7 @@ from frontend import IrisFrontend from http import RequestHandler logger = logging.getLogger(__name__) -__version__ = '2.10.12' +__version__ = '2.10.13' ## # Core extension class diff --git a/src/js/components/Parallax.js b/src/js/components/Parallax.js index af94cd06..a2ba0590 100755 --- a/src/js/components/Parallax.js +++ b/src/js/components/Parallax.js @@ -84,7 +84,7 @@ export default class Parallax extends React.Component{ if( this._loaded ){ this.setState( { scrollTop: window.scrollY }, - this.updateCanvas( this.state.image ) + this.updateCanvas( this.state.image ) ) } } @@ -150,43 +150,10 @@ export default class Parallax extends React.Component{ image.y = ( ( this.state.canvas.height / 2 ) - ( image.height / 2 ) ) + ( ( percent / 100 ) * 100); // actually draw the image on the canvas - context.drawImage(image.object, image.x, image.y, image.width, image.height); + context.drawImage(image.object, image.x, image.y, image.width, image.height) // now update our component self.setState({ image: image }); - - // poll for scroll changes - /* - var animateInterval = $interval( - function(){ - window.requestAnimationFrame(function( event ){ - - var bannerPanel = $(document).find('.intro'); - - // if we've scrolled or resized - if( - state.scrollTop != $(document).scrollTop() || - state.windowWidth != $(window).width() || - state.windowHeight != $(window).height() ){ - - // update our state - state.scrollTop = $(document).scrollTop(); - state.windowWidth = $(window).width(); - state.windowHeight = $(window).height(); - - var bannerHeight = bannerPanel.outerHeight(); - - // and if we're within the bounds of our document - // this helps prevent us animating when the objects in question are off-screen - if( state.scrollTop < bannerHeight ){ - positionArtistBackground( image ); - } - } - }); - }, - 10 - );*/ - } render(){ diff --git a/src/js/services/pusher/middleware.js b/src/js/services/pusher/middleware.js index d97b0ff9..05c932cb 100755 --- a/src/js/services/pusher/middleware.js +++ b/src/js/services/pusher/middleware.js @@ -168,6 +168,20 @@ const PusherMiddleware = (function(){ case 'PUSHER_START_RADIO': + store.dispatch({ + type: 'PUSHER_SEND_BROADCAST', + action: 'broadcast', + ignore_self: true, + data: { + type: 'notification', + data: { + title: 'Radio started', + body: ' started radio mode', + icon: '' + } + } + }) + var data = { action: 'start_radio', seed_artists: [], @@ -190,6 +204,21 @@ const PusherMiddleware = (function(){ break case 'PUSHER_STOP_RADIO': + + store.dispatch({ + type: 'PUSHER_SEND_BROADCAST', + action: 'broadcast', + ignore_self: true, + data: { + type: 'notification', + data: { + title: 'Radio stopped', + body: ' stopped radio mode', + icon: '' + } + } + }) + store.dispatch( uiActions.createNotification('Stopping radio') ) var data = { action: 'stop_radio',