fixes for public session creation and joining

This commit is contained in:
Nuwan 2022-10-12 19:39:09 +05:30
parent 38baea686f
commit 5487e62f5a
4 changed files with 33 additions and 12 deletions

View File

@ -56,6 +56,28 @@
});
}
// function createScheduledSessionPromise(options) {
// return new Promise((resolve, reject) => {
// $.ajax({
// type: "POST",
// dataType: "json",
// contentType: 'application/json',
// url: "/api/sessions",
// processData: false,
// data: JSON.stringify(options)
// })
// .done(resp => {
// console.log("Session created", resp);
// resolve(resp)
// })
// .fail(error => {
// console.log("Session create error", error);
// reject(error)
// })
// })
// }
function getBroadcastNotification(options) {
var userId = getId(options);
return $.ajax({
@ -132,6 +154,7 @@
}
function joinSessionPromise(options) {
console.log('joinSessionOpts', options);
var sessionId = options["session_id"];
delete options["session_id"];
return new Promise(function(resolve, reject){

View File

@ -997,7 +997,7 @@ ConfigureTracksActions = @ConfigureTracksActions
try{
await this.gearUtils.guardAgainstActiveProfileMissing(this.app, result)
try{
this.userTracks = await this.waitForSessionPageEnterDone()
@ -1006,18 +1006,18 @@ ConfigureTracksActions = @ConfigureTracksActions
logger.debug("user has passed all session guards")
this.joinSession()
}catch(error){
if (!result.controlled_location) {
return SessionActions.leaveSession.trigger({location: "/client#/home"});
if (!error.controlled_location) {
SessionActions.leaveSession.trigger({location: "/client#/home"});
}
}
}catch(error){
if (data === "timeout") {
if (error === "timeout") {
context.JK.alertSupportedNeeded('The audio system has not reported your configured tracks in a timely fashion.');
} else if (data === 'session_over') {
} else if (error === 'session_over') {
// do nothing; session ended before we got the user track info. just bail
logger.debug("session is over; bailing");
} else {
context.JK.alertSupportedNeeded('Unable to determine configured tracks due to reason: ' + data);
context.JK.alertSupportedNeeded('Unable to determine configured tracks due to reason: ' + error);
}
SessionActions.leaveSession.trigger({location: '/client#/home'});
@ -1026,11 +1026,11 @@ ConfigureTracksActions = @ConfigureTracksActions
}catch(error){
const leaveBehavior = {};
if (data && (data.reason === 'handled')) {
if (data.nav === 'BACK') {
if (error && (error.reason === 'handled')) {
if (error.nav === 'BACK') {
leaveBehavior.location = -1;
} else {
leaveBehavior.location = data.nav;
leaveBehavior.location = error.nav;
}
} else {
leaveBehavior.location = '/client#/home';
@ -1106,7 +1106,7 @@ ConfigureTracksActions = @ConfigureTracksActions
await context.JK.guardAgainstSinglePlayerProfile(app);
resolve();
}catch(error){
reject()
reject(error)
}
} else {
resolve();

View File

@ -1478,7 +1478,6 @@
context.JK.createSession = function(app, data) {
// auto pick an 'other' instrument
var otherId = context.JK.server_to_client_instrument_map.Other.server_id; // get server ID
var otherInstrumentInfo = context.JK.instrument_id_to_instrument[otherId]; // get display name

View File

@ -672,7 +672,6 @@
};
context.JK.privateSessionSettings(data)
context.JK.createSession(_app, data)
.done(function(response) {
var sessionId = response.id;