wip - custom url handling
This commit is contained in:
parent
2b929c0d1e
commit
a5fce73848
|
|
@ -315,7 +315,8 @@
|
|||
$fetchingSpinnerLabel.show();
|
||||
|
||||
Promise.all([fetchScheduledSessions(), fetchUserDetail()]).then(function() {
|
||||
createSessionByCustomUrlScheme();
|
||||
// console.log('** calling createSessionByCustomUrlScheme() from scheduled_session');
|
||||
//createSessionByCustomUrlScheme();
|
||||
});
|
||||
|
||||
}
|
||||
|
|
@ -1557,15 +1558,8 @@
|
|||
//handle jamkazam:// custom URL scheme params
|
||||
//when a user submits create new session form (in the new react website)
|
||||
//this custom url scheme is loaded and as a result the JamKazam app loads create session window.
|
||||
function createSessionByCustomUrlScheme(){
|
||||
//an example URL would be: https://www.jamkazam.com/client#/createSession/custom~yes|privacy~2|description~hello|inviteeIds~1,2,3,4
|
||||
function createSessionByCustomUrlScheme(hash){
|
||||
|
||||
var hash = decodeURIComponent(context.location.hash);
|
||||
|
||||
if(hash === '' || hash.match(/custom~yes/) === null){
|
||||
return;
|
||||
}
|
||||
|
||||
var qStr = hash.substring(hash.lastIndexOf('/') + 1);
|
||||
|
||||
//decode the query params according to the custom format
|
||||
|
|
@ -1697,9 +1691,12 @@
|
|||
|
||||
initializeControls();
|
||||
events();
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.initialize = initialize;
|
||||
this.createSessionByCustomUrlScheme = createSessionByCustomUrlScheme;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,13 +286,16 @@
|
|||
var instrumentSelectorRSVPInstance = new JK.InstrumentSelector(JK.app);
|
||||
instrumentSelectorRSVPInstance.initialize(true);
|
||||
var createScheduledSessionScreen = new JK.CreateScheduledSession(JK.app);
|
||||
JK.createScheduledSessionScreen = createScheduledSessionScreen;
|
||||
|
||||
createScheduledSessionScreen.initialize(
|
||||
JK.InvitationDialogInstance,
|
||||
JK.FriendSelectorDialogInstance,
|
||||
instrumentSelectorInstance,
|
||||
instrumentSelectorRSVPInstance
|
||||
);
|
||||
JK.createScheduledSessionScreen = createScheduledSessionScreen;
|
||||
console.log("** createScheduledSessionScreen initialized **");
|
||||
|
||||
|
||||
var bandSetupScreen = new JK.BandSetupScreen(JK.app);
|
||||
bandSetupScreen.initialize(JK.InvitationDialogInstance, JK.FriendSelectorDialogInstance);
|
||||
|
|
@ -446,10 +449,45 @@
|
|||
}
|
||||
|
||||
JK.bindHoverEvents();
|
||||
|
||||
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
window.addEventListener('load', (event) => {
|
||||
|
||||
function handleCustomUrlScheme(){
|
||||
console.log("** handleCustomUrlScheme **");
|
||||
// this is a hack to create a session from a custom URL scheme
|
||||
// an example custom URL would be: https://www.jamkazam.com/client#/createSession/custom~yes|privacy~2|description~hello|inviteeIds~1,2,3,4
|
||||
|
||||
var hash = decodeURIComponent(window.location.hash)
|
||||
|
||||
console.log("** handleCustomUrlScheme hash **", hash);
|
||||
|
||||
if(hash === '' || !hash.includes("custom~yes")){ // if there is no hash or the hash does not contain custom~yes,
|
||||
return;
|
||||
}
|
||||
|
||||
var maxAttempts = 10;
|
||||
|
||||
var screenLoadInterval = setInterval(() => {
|
||||
if(hash.includes("#/createSession")){
|
||||
if (JK.createScheduledSessionScreen) {
|
||||
JK.createScheduledSessionScreen.createSessionByCustomUrlScheme(hash); // this will create a session
|
||||
clearInterval(screenLoadInterval);
|
||||
}else{
|
||||
console.log("** attempting to create session by custom URL scheme", maxAttempts);
|
||||
maxAttempts--;
|
||||
if(maxAttempts <= 0){
|
||||
clearInterval(screenLoadInterval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1000); // check every second
|
||||
|
||||
}
|
||||
handleCustomUrlScheme();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- version info: <%= version %> -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue