join session by custom url schema
This commit is contained in:
parent
98273bae0d
commit
fb80a3a2c5
|
|
@ -549,6 +549,14 @@
|
|||
const customUrl = response['JKSessionCreateFromCustomUrlEvent']['CustomUrl']
|
||||
context.JK.createScheduledSessionScreen.launchSessionFromCustomUrlScheme(customUrl)
|
||||
}
|
||||
break;
|
||||
case '3013': //JKJoinSessionFromCustomUrlEvent
|
||||
logger.log(`[asyncJamClient] 3013 JKJoinSessionFromCustomUrlEvent: ${response['JKJoinSessionFromCustomUrlEvent']['CustomUrl']}`);
|
||||
if(context.JK.FindSessionScreen){
|
||||
const customUrl = response['JKJoinSessionFromCustomUrlEvent']['CustomUrl']
|
||||
context.JK.SessionUtils.joinSessionByCustomUrlScheme(customUrl)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,4 +344,37 @@
|
|||
await context.jamClient.SessionPageLeave();
|
||||
}
|
||||
|
||||
sessionUtils.joinSessionFromCustomUrlScheme = function(urlString) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(urlString);
|
||||
} catch (error) {
|
||||
logger.debug(error);
|
||||
context.JK.app.notifyAlert("Error", "An invalid URL was given. Couldn't create the session. Please try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
const hash = decodeURIComponent(url.hash);
|
||||
|
||||
const qStr = hash.substring(hash.lastIndexOf('/') + 1);
|
||||
const qParamsArr = qStr.split('|');
|
||||
let isCustom = undefined;
|
||||
let sessionId = undefined;
|
||||
qParamsArr.forEach(function(q) {
|
||||
const qp = q.split('~');
|
||||
if (qp[0] === 'custom') {
|
||||
isCustom = qp[1];
|
||||
}
|
||||
if (qp[0] === 'joinSessionId') {
|
||||
return sessionId = qp[1];
|
||||
}});
|
||||
if (!isCustom || (isCustom !== 'yes')) {
|
||||
return;
|
||||
}
|
||||
if (!sessionId) {
|
||||
return;
|
||||
}
|
||||
this.joinSession(sessionId);
|
||||
}
|
||||
|
||||
})(window, jQuery);
|
||||
|
|
|
|||
Loading…
Reference in New Issue