onLogginIn api handle for custom url wip

This commit is contained in:
Nuwan 2024-10-14 12:17:58 +05:30
parent 1280a3ca86
commit 15583ce99d
3 changed files with 37 additions and 20 deletions

View File

@ -379,14 +379,17 @@
const url = new URL(loggedInResp);
const redirectTo = new URLSearchParams(url.search).get("redirect-to");
if (redirectTo) {
const cusQuery = redirectTo.substring(
redirectTo.lastIndexOf("/") + 1
);
if (redirectTo.includes("/client#/createSession")) {
JK.createScheduledSessionScreen.launchSessionFromCustomUrlScheme(
cusQuery
);
}
// const cusQuery = redirectTo.substring(
// redirectTo.lastIndexOf("/") + 1
// );
//if (redirectTo.includes("/client#/createSession")) {
// JK.createScheduledSessionScreen.launchSessionFromCustomUrlScheme(
// cusQuery
// );
//}
localStorage.setItem("after-login-redirect-to", redirectTo);
}
} catch (e) {
console.log("error in handleLoggedInResponse", e);

View File

@ -1524,18 +1524,19 @@
}
function launchSessionFromCustomUrlScheme(urlString){
//an example URL would be: https://www.jamkazam.com/client#/createSession/custom~yes|privacy~2|description~hello|inviteeIds~1,2,3,4
var 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;
}
//an example URL would be: /client#/createSession/custom~yes|privacy~2|description~hello|inviteeIds~1,2,3,4
//var 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;
//}
var hash = decodeURIComponent(url.hash);
var qStr = hash.substring(hash.lastIndexOf('/') + 1);
//var hash = decodeURIComponent(url.hash);
//var qStr = hash.substring(hash.lastIndexOf('/') + 1);
//decode the query params according to the custom format
var qParamsArr = qStr.split('|');
var isCustom, privacy, description, inviteeIds;

View File

@ -293,7 +293,6 @@
instrumentSelectorInstance,
instrumentSelectorRSVPInstance
);
var bandSetupScreen = new JK.BandSetupScreen(JK.app);
bandSetupScreen.initialize(JK.InvitationDialogInstance, JK.FriendSelectorDialogInstance);
@ -447,6 +446,20 @@
}
JK.bindHoverEvents();
//after-login-redirect
if (localStorage.getItem('after-login-redirect-to')) {
var redirect = localStorage.getItem('after-login-redirect-to');
const cusQuery = redirect.substring(redirectTo.lastIndexOf("/") + 1);
if (redirect.includes("/client#/createSession")) {
alert("create session");
}
localStorage.removeItem('after-login-redirect');
}
})
</script>