* VRFS-3348 - support JamTrack opening automatically when opened from account page

This commit is contained in:
Seth Call 2015-07-21 08:08:34 -05:00
parent 131c2dc95b
commit 4345d898f7
8 changed files with 70 additions and 16 deletions

View File

@ -98,9 +98,10 @@ source 'https://rails-assets.org' do
gem 'rails-assets-classnames'
end
group :development, :production do
gem 'rack-timeout'
end
#group :development, :production do
# gem 'rack-timeout'
#end
group :development, :test do
gem 'rspec-rails', '2.14.2'
gem "activerecord-import", "~> 0.4.1"

View File

@ -88,8 +88,8 @@ context.JK.AccountJamTracks = class AccountJamTracks
context.location = '/client#/session/' + newSessionId
# Re-loading the session settings will cause the form to reset with the right stuff in it.
# This is an extra xhr call, but it keeps things to a single codepath
loadSessionSettings()
context.JK.GA.trackSessionCount data.musician_access, data.fan_access, invitationCount
#loadSessionSettings()
context.JK.GA.trackSessionCount data.musician_access, data.fan_access, 0
context.JK.GA.trackSessionMusicians context.JK.GA.SessionCreationTypes.create
).fail (jqXHR) =>
handled = false

View File

@ -4,6 +4,7 @@
//= require ./react-components/stores/RecordingStore
//= require ./react-components/stores/SessionStore
//= require ./react-components/stores/MixerStore
//= require ./react-components/stores/JamTrackStore
//= require ./react-components/stores/SessionNotificationStore
//= require ./react-components/stores/MediaPlaybackStore
//= require ./react-components/stores/SessionMyTracksStore

View File

@ -77,7 +77,7 @@ mixins.push(Reflux.listenTo(MediaPlaybackStore, 'onMediaStateChanged'))
</div>`
windowUnloaded: () ->
SessionActions.closeMedia() unless window.DontAutoCloseMedia
SessionActions.closeMedia(false) unless window.DontAutoCloseMedia
componentDidMount: () ->

View File

@ -1,6 +1,7 @@
context = window
rest = context.JK.Rest()
SessionActions = @SessionActions
JamTrackActions = @JamTrackActions
ReactCSSTransitionGroup = React.addons.CSSTransitionGroup
MIX_MODES = context.JK.MIX_MODES
EVENTS = context.JK.EVENTS
@ -8,7 +9,16 @@ ChannelGroupIds = context.JK.ChannelGroupIds
@SessionMediaTracks = React.createClass({
mixins: [@SessionMediaTracksMixin, Reflux.listenTo(@SessionMediaTracksStore,"onInputsChanged"), Reflux.listenTo(@AppStore,"onAppInit")]
mixins: [@SessionMediaTracksMixin,
Reflux.listenTo(@SessionMediaTracksStore,"onInputsChanged"),
Reflux.listenTo(@AppStore,"onAppInit"),
Reflux.listenTo(@JamTrackStore, "onJamTrackStateChanged")]
onJamTrackStateChanged: (jamTrack) ->
if jamTrack?
@loadJamTrack(jamTrack)
else
SessionActions.closeMedia(true)
inputsChangedProcessed: (state) ->
@ -27,11 +37,10 @@ ChannelGroupIds = context.JK.ChannelGroupIds
@state.childWindow.DontAutoCloseMedia = true
@state.childWindow.close()
closeAudio: (e) ->
e.preventDefault()
SessionActions.closeMedia()
SessionActions.closeMedia(false)
cancelDownloadJamTrack: (e) ->
e.preventDefault()
@ -103,8 +112,7 @@ ChannelGroupIds = context.JK.ChannelGroupIds
@app.layout.showDialog('open-jam-track-dialog').one(EVENTS.DIALOG_CLOSED, (e, data) =>
# once the dialog is closed, see if the user has a jamtrack selected
if !data.canceled && data.result.jamTrack
@loadJamTrack(data.result.jamTrack)
JamTrackActions.open(data.result.jamTrack)
else
logger.debug("OpenJamTrack dialog closed with no selection; ignoring", data)
)

View File

@ -0,0 +1,7 @@
context = window
@JamTrackActions = Reflux.createActions({
open: {}
close: {}
})

View File

@ -0,0 +1,34 @@
$ = jQuery
context = window
logger = context.JK.logger
rest = context.JK.Rest()
EVENTS = context.JK.EVENTS
JamTrackActions = @JamTrackActions
@JamTrackStore = Reflux.createStore(
{
listenables: JamTrackActions
jamTrack: null
init: ->
# Register with the app store to get @app
this.listenTo(context.AppStore, this.onAppInit)
onAppInit: (app) ->
@app = app
onOpen: (jamTrack) ->
if @jamTrack?
@app.notify({text: 'Unable to open JamTrack because another one is already open.'})
return
@jamTrack = jamTrack
this.trigger(@jamTrack)
onClose: () ->
@jamTrack = null
this.trigger(@jamTrack)
}
)

View File

@ -5,7 +5,7 @@ rest = context.JK.Rest()
EVENTS = context.JK.EVENTS
MIX_MODES = context.JK.MIX_MODES
JamTrackActions = @JamTrackActions
SessionActions = @SessionActions
RecordingActions = @RecordingActions
NotificationActions = @NotificationActions
@ -203,8 +203,8 @@ NotificationActions = @NotificationActions
@sessionPageEnterDeferred = null
onCloseMedia: () ->
# codeInitiated means the user did not initiate this
onCloseMedia: (codeInitiated) ->
logger.debug("SessionStore: onCloseMedia")
if @helper.recordedTracks()
@ -216,7 +216,7 @@ NotificationActions = @NotificationActions
else if @helper.isMetronomeOpen()
@closeMetronomeTrack()
else
logger.error("don't know how to close open media");
logger.error("don't know how to close open media") unless codeInitiated
closeJamTrack: () ->
logger.debug("closing jam track");
@ -244,6 +244,7 @@ NotificationActions = @NotificationActions
)
context.jamClient.JamTrackStopPlay()
JamTrackActions.close()
onOpenBackingTrack: (result) ->
@ -766,9 +767,10 @@ NotificationActions = @NotificationActions
.done((response) =>
logger.debug("jamtrack opened")
# now actually load the jamtrack
# TODO
context.SessionActions.updateSession.trigger(response);
# context.JK.CurrentSessionModel.updateSession(response);
# loadJamTrack(jamTrack);
JamTrackActions.open(jamTrack)
)
.fail((jqXHR) =>
@app.notifyServerError(jqXHR, "Unable to Open JamTrack For Playback")
@ -1041,6 +1043,7 @@ NotificationActions = @NotificationActions
@openBackingTrack = null
@downloadingJamTrack = false
JamTrackActions.close()
NotificationActions.sessionEnded()
$(context.AppStore).triggerHandler('SessionEnded')