* VRFS-792 - also guard against direct session link joins with no ftue

This commit is contained in:
Seth Call 2014-03-01 17:01:45 -06:00
parent 87f4890638
commit 725460176a
6 changed files with 92 additions and 90 deletions

View File

@ -137,7 +137,7 @@
}
function FTUEGetGoodConfigurationList() {
return ['a']
return ['a'];
}
function RegisterVolChangeCallBack(functionName) {

View File

@ -17,6 +17,9 @@
var logger = context.JK.logger;
var jamClient = context.jamClient;
var win32 = true;
var batchModify = false;
var pendingFtueSave = false;
var successfulFtue = false;
// tracks in the loopback FTUe what the currently chosen audio driver is
var currentAudioDriverId = null;
@ -53,9 +56,17 @@
function afterHide(data) {
// Unsubscribe from FTUE VU callbacks.
jamClient.FTUERegisterVUCallbacks('', '', '');
if(!successfulFtue && app.cancelFtue) {
app.cancelFtue();
app.afterFtue = null;
app.cancelFtue = null;
}
}
function beforeShow(data) {
successfulFtue = false;
var vuMeters = [
'#ftue-2-audio-input-vu-left',
'#ftue-2-audio-input-vu-right',
@ -543,16 +554,19 @@
setDefaultInstrumentFromProfile();
logger.debug("Calling FTUESave(" + true + ")");
jamClient.FTUESave(true);
jamClient.FTUESetStatus(true); // No FTUE wizard next time
rest.userCertifiedGear({success: true});
// notify anyone curious about how it went
$('div[layout-id=ftue]').trigger('ftue_success');
successfulFtue = true; // important to before closeDialog
app.layout.closeDialog('ftue');
if (app.afterFtue) {
// If there's a function to invoke, invoke it.
app.afterFtue();
app.afterFtue = null;
app.cancelFtue = null;
}
return false;
}
@ -630,15 +644,21 @@
// this is necesasry because if you do a FTUE pass, close the client, and pick the same device
// the backend will *silently* use values from before, because the frontend does not query the backend
// for these values anywhere.
// setting all 3 of these cause 3 FTUE's. Instead, we set batchModify to true so that they don't call FtueSave(false), and call later ourselves
batchModify = true;
newFtueAsioFrameSizeToBackend($('#ftue-2-asio-framesize'));
newFtueAsioInputLatencyToBackend($('#ftue-2-asio-input-latency'));
newFtueAsioOutputLatencyToBackend($('#ftue-2-asio-output-latency'));
batchModify = false;
//setLevels(0);
renderVolumes();
logger.debug("Calling FTUESave(" + false + ")");
jamClient.FTUESave(false)
pendingFtueSave = false; // this is not really used in any real fashion. just setting back to false due to batch modify above
jamClient.FTUESave(false);
setVuCallbacks();
var latency = jamClient.FTUEGetExpectedLatency();
@ -647,7 +667,9 @@
}
function newFtueSave(persist) {
console.log("newFtueSave persist(" +persist+ ")")
newFtueUpdateLatencyView('loading');
logger.debug("Calling FTUESave(" + persist + ")");
jamClient.FTUESave(persist);
var latency = jamClient.FTUEGetExpectedLatency();
newFtueUpdateLatencyView(latency);
@ -703,7 +725,7 @@
renderStopNewFtueLatencyTesting();
return;
}
newFtueSave(false);
if (batchModify) { pendingFtueSave = true; } else { newFtueSave(false); }
});
}
@ -715,7 +737,7 @@
renderStopNewFtueLatencyTesting();
return;
}
newFtueSave(false);
if (batchModify) { pendingFtueSave = true; } else { newFtueSave(false); }
});
}
@ -727,7 +749,7 @@
renderStopNewFtueLatencyTesting();
return;
}
newFtueSave(false);
if (batchModify) { pendingFtueSave = true; } else { newFtueSave(false); }
});
}
@ -778,6 +800,11 @@
$bout.val('0');
}
// you need to give these to the backend now; if you don't, when the device is selected, the backend
// may fail to open it (especially with kernel streaming). Causes scary looking errors to user.
newFtueAsioFrameSizeToBackend($('#ftue-2-asio-framesize'));
newFtueAsioInputLatencyToBackend($('#ftue-2-asio-input-latency'));
newFtueAsioOutputLatencyToBackend($('#ftue-2-asio-output-latency'));
}
function resetFtueLatencyView() {

View File

@ -215,7 +215,6 @@
type: "GET",
dataType: "json",
url: url,
async: false,
processData: false
});
}
@ -241,7 +240,6 @@
type: "GET",
dataType: "json",
url: url,
async: true,
processData: false
});
}

View File

@ -229,30 +229,41 @@
}
}
function initializeSession() {
// indicate that the screen is active, so that
// body-scoped drag handlers can go active
screenActive = true;
// Subscribe for callbacks on audio events
context.jamClient.SessionRegisterCallback("JK.HandleBridgeCallback");
context.jamClient.RegisterRecordingCallbacks("JK.HandleRecordingStartResult", "JK.HandleRecordingStopResult", "JK.HandleRecordingStarted", "JK.HandleRecordingStopped", "JK.HandleRecordingAborted");
context.jamClient.SessionSetAlertCallback("JK.AlertCallback");
context.jamClient.SessionSetConnectionStatusRefreshRate(1000);
// If you load this page directly, the loading of the current user
// is happening in parallel. We can't join the session until the
// current user has been completely loaded. Poll for the current user
// before proceeding with session joining.
function checkForCurrentUser() {
if (context.JK.userMe) {
afterCurrentUserLoaded();
} else {
context.setTimeout(checkForCurrentUser, 100);
}
}
checkForCurrentUser();
}
function afterShow(data) {
// indicate that the screen is active, so that
// body-scoped drag handlers can go active
screenActive = true;
// Subscribe for callbacks on audio events
context.jamClient.SessionRegisterCallback("JK.HandleBridgeCallback");
context.jamClient.RegisterRecordingCallbacks("JK.HandleRecordingStartResult", "JK.HandleRecordingStopResult", "JK.HandleRecordingStarted", "JK.HandleRecordingStopped", "JK.HandleRecordingAborted");
context.jamClient.SessionSetAlertCallback("JK.AlertCallback");
context.jamClient.SessionSetConnectionStatusRefreshRate(1000);
// If you load this page directly, the loading of the current user
// is happening in parallel. We can't join the session until the
// current user has been completely loaded. Poll for the current user
// before proceeding with session joining.
function checkForCurrentUser() {
if (context.JK.userMe) {
afterCurrentUserLoaded();
} else {
context.setTimeout(checkForCurrentUser, 100);
}
if (!(context.JK.hasOneConfiguredDevice())) {
app.afterFtue = function() { initializeSession(); };
app.cancelFtue = function() { promptLeave = false; window.location = '/client#/home' };
app.layout.startNewFtue();
}
else {
initializeSession();
}
checkForCurrentUser();
}
function notifyWithUserInfo(title , text, clientId) {
@ -431,7 +442,7 @@
{ no_cancel: true });
}
else {
app.ajaxError(xhr, textStatus, errorMessage);
app.notifyServerError(xhr, 'Unable to Join Session');
}
});
}
@ -450,9 +461,13 @@
}
function beforeHide(data) {
screenActive = false;
sessionModel.leaveCurrentSession()
.fail(app.ajaxError);
if(screenActive) {
// this path is possible if FTUE is invoked on session page, and they cancel
sessionModel.leaveCurrentSession()
.fail(app.ajaxError);
}
screenActive = false;
}
function handleTransitionsInRecordingPlayback() {

View File

@ -289,43 +289,6 @@
return foundParticipant;
}
function addTrack(sessionId, data) {
logger.debug("updating tracks on the server %o", data);
var url = "/api/sessions/" + sessionId + "/tracks";
$.ajax({
type: "POST",
dataType: "json",
contentType: 'application/json',
url: url,
async: false,
data: JSON.stringify(data),
processData:false,
success: function(response) {
// save to the backend
logger.debug("successfully updated tracks on the server");
//refreshCurrentSession();
},
error: function(jqXHR) { app.notifyServerError(jqXHR, "Unable to refresh session data") }
});
}
function updateTrack(sessionId, trackId, data) {
var url = "/api/sessions/" + sessionId + "/tracks/" + trackId;
$.ajax({
type: "POST",
dataType: "json",
contentType: 'application/json',
url: url,
async: false,
data: JSON.stringify(data),
processData:false,
success: function(response) {
logger.debug("Successfully updated track info (" + JSON.stringify(data) + ")");
},
error: function(jqXHR) { app.notifyServerError(jqXHR, "Unable to refresh session data") }
});
}
function deleteTrack(sessionId, trackId) {
if (trackId) {
@ -481,8 +444,6 @@
this.subscribe = subscribe;
this.participantForClientId = participantForClientId;
this.isPlayingRecording = isPlayingRecording;
this.addTrack = addTrack;
this.updateTrack = updateTrack;
this.deleteTrack = deleteTrack;
this.onWebsocketDisconnected = onWebsocketDisconnected;
this.recordingModel = recordingModel;

View File

@ -560,27 +560,28 @@
$.each(response.participants, function(index, val) {
participants.push({"photo_url": context.JK.resolveAvatarUrl(val.user.photo_url), "name": val.user.name});
});
var participantHtml = "You have been invited to join a session with: <br/><br/>";
participantHtml += "<table><tbody>";
$.each(participants, function(index, val) {
if (index < 4) {
participantHtml += "<tr><td><img class='avatar-small' src='" + context.JK.resolveAvatarUrl(val.photo_url) + "' /></td><td>" + val.name + "</td></tr>";
}
});
participantHtml += "</tbody></table>";
app.notify({
"title": "Session Invitation",
"text": participantHtml
}, {
"ok_text": "JOIN SESSION",
"ok_callback": openTerms,
"ok_callback_args": { "session_id": payload.session_id, "notification_id": payload.notification_id }
});
}).error(app.ajaxError);
var participantHtml = "You have been invited to join a session with: <br/><br/>";
participantHtml += "<table><tbody>";
$.each(participants, function(index, val) {
if (index < 4) {
participantHtml += "<tr><td><img class='avatar-small' src='" + context.JK.resolveAvatarUrl(val.photo_url) + "' /></td><td>" + val.name + "</td></tr>";
}
});
participantHtml += "</tbody></table>";
app.notify({
"title": "Session Invitation",
"text": participantHtml
}, {
"ok_text": "JOIN SESSION",
"ok_callback": openTerms,
"ok_callback_args": { "session_id": payload.session_id, "notification_id": payload.notification_id }
});
});
}