From 8ae89c1cbbe11961ee0ae9c8ca7996fc23ad50c1 Mon Sep 17 00:00:00 2001 From: Nuwan Date: Wed, 30 Apr 2025 17:40:21 +0530 Subject: [PATCH] debug custom URL handling in app --- web/app/assets/javascripts/JamServer.js | 4 +-- web/app/assets/javascripts/asyncJamClient.js | 2 -- .../assets/javascripts/customUrlHandler.js | 28 +++++++++---------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/web/app/assets/javascripts/JamServer.js b/web/app/assets/javascripts/JamServer.js index 8d220604a..f13b0abfc 100644 --- a/web/app/assets/javascripts/JamServer.js +++ b/web/app/assets/javascripts/JamServer.js @@ -303,9 +303,7 @@ } console.log("logged with new msg", msg); const loggedInResp = await context.jamClient.OnLoggedIn(msg); // ACTS AS CONTINUATION - alert( - "JamServer: loggedInResp received: " + JSON.stringify(loggedInResp) - ); + //handle customUrl if (loggedInResp && loggedInResp['CustomUrl']) { const customUrl = loggedInResp['CustomUrl'] handleCustomUrl(customUrl); diff --git a/web/app/assets/javascripts/asyncJamClient.js b/web/app/assets/javascripts/asyncJamClient.js index 90f78a76c..bdfb93901 100644 --- a/web/app/assets/javascripts/asyncJamClient.js +++ b/web/app/assets/javascripts/asyncJamClient.js @@ -556,7 +556,6 @@ break; case '3012': //customUrl const customUrl = response['CustomUrl'] - alert('3012', customUrl) //if localStorage is available and has customUrl key, remove it if(localStorage){ if(localStorage.getItem('customUrl')){ @@ -573,7 +572,6 @@ window.location.href = httpUrl; } }else{ - alert('Error: Invalid customUrl received.') logger.log(`[asyncJamClient] invalid customUrl: ${httpUrl}`); } } diff --git a/web/app/assets/javascripts/customUrlHandler.js b/web/app/assets/javascripts/customUrlHandler.js index 4bccfd41b..6f4bbd55d 100644 --- a/web/app/assets/javascripts/customUrlHandler.js +++ b/web/app/assets/javascripts/customUrlHandler.js @@ -25,23 +25,23 @@ //handle create session. #/createSession is a valid hash. switch to the createSession screen and handle creating a session from the custom URL if (hash.includes("#/createSession/")) { // if the hash contains the createSession flag - // if(context.SessionStore.inSession()){ - // // if the user is already in a session, show a notification - // console.log("You are already in a session. Please leave the session to create a new one."); - // alert("You are already in a session. Please leave the session to create a new one."); - // clearInterval(screenLoadInterval); - // return; - // } - if (JK.createScheduledSessionScreen && JK.CreateScheduledSessionDataIsLoaded) { // if the createScheduledSessionScreen is loaded - JK.createScheduledSessionScreen.createSessionByCustomUrlScheme(hash); // this will create a session - clearInterval(screenLoadInterval); - } else { - console.log("attempting to create session. ", maxAttempts); - maxAttempts--; - if (maxAttempts <= 0) { + if(context.SessionStore && context.SessionStore.inSession()){ + // clearInterval(screenLoadInterval); + // return; + }else{ + console.log("attempting to create session", maxAttempts); + if (JK.createScheduledSessionScreen && JK.CreateScheduledSessionDataIsLoaded) { // if the createScheduledSessionScreen is loaded + JK.createScheduledSessionScreen.createSessionByCustomUrlScheme(hash); // this will create a session clearInterval(screenLoadInterval); + } else { + console.log("attempting to create session. ", maxAttempts); + maxAttempts--; + if (maxAttempts <= 0) { + clearInterval(screenLoadInterval); + } } } + } //handle join session. there is no joinSession screen. JK.SessionUtils is a helper class that handles joining a session