wip custom url handling
This commit is contained in:
parent
f71c0913b7
commit
1326f933e2
|
|
@ -49,8 +49,6 @@
|
|||
var connectTimeout = null;
|
||||
var activityTimeout;
|
||||
|
||||
|
||||
|
||||
// elements
|
||||
var $inSituBanner = null;
|
||||
var $inSituBannerHolder = null;
|
||||
|
|
@ -281,14 +279,22 @@
|
|||
}
|
||||
}
|
||||
console.log("logged with new msg", msg);
|
||||
await context.jamClient.OnLoggedIn(msg); // ACTS AS CONTINUATION
|
||||
const loggedInResp = await context.jamClient.OnLoggedIn(msg); // ACTS AS CONTINUATION
|
||||
console.log("OnLoggedIn response 1", loggedInResp);
|
||||
if (loggedInResp && loggedInResp['CustomUrl']) {
|
||||
handleLoggedInResponse(loggedInResp['CustomUrl']);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("fallback to old callback", e);
|
||||
await context.jamClient.OnLoggedIn(
|
||||
const loggedInResp = await context.jamClient.OnLoggedIn(
|
||||
payload.user_id,
|
||||
payload.token,
|
||||
payload.username
|
||||
); // ACTS AS CONTINUATION
|
||||
console.log("OnLoggedIn response 1", loggedInResp);
|
||||
if (loggedInResp && loggedInResp['CustomUrl']) {
|
||||
handleLoggedInResponse(loggedInResp['CustomUrl']);
|
||||
}
|
||||
}
|
||||
|
||||
$.cookie("client_id", payload.client_id);
|
||||
|
|
@ -367,6 +373,30 @@
|
|||
}, 0);
|
||||
}
|
||||
|
||||
function handleLoggedInResponse(loggedInResp) {
|
||||
console.log("handleLoggedInResponse", context.JK);
|
||||
try {
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("error in handleLoggedInResponse", e);
|
||||
context.JK.app.notifyAlert(
|
||||
"Error",
|
||||
"An invalid URL was given. Please try again."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function setActive(active) {
|
||||
if (context.UserActivityActions) {
|
||||
context.UserActivityActions.setActive(active);
|
||||
|
|
@ -740,10 +770,12 @@
|
|||
}
|
||||
};
|
||||
|
||||
Promise.allSettled = Promise.allSettled ||
|
||||
Promise.allSettled =
|
||||
Promise.allSettled ||
|
||||
((promises) =>
|
||||
Promise.all(
|
||||
promises.map(p => p
|
||||
promises.map((p) =>
|
||||
p
|
||||
.then((value) => ({
|
||||
status: "fulfilled",
|
||||
value,
|
||||
|
|
@ -773,7 +805,7 @@
|
|||
|
||||
//const clientTypePromise = context.JK.clientType();
|
||||
const clientType = context.JK.clientType();
|
||||
|
||||
|
||||
const operatingModePromise = context.jamClient.getOperatingMode();
|
||||
const macHashPromise = context.jamClient.SessionGetMacHash();
|
||||
//const osStringPromise = context.JK.GetOSAsString();
|
||||
|
|
@ -833,7 +865,7 @@
|
|||
client_id: client_id,
|
||||
machine: machine,
|
||||
os: os,
|
||||
product: 'JamClientModern',
|
||||
product: "JamClientModern",
|
||||
//jamblaster_serial_no: context.PlatformStore.jamblasterSerialNo(),
|
||||
udp_reachable: context.JK.StunInstance
|
||||
? !context.JK.StunInstance.sync()
|
||||
|
|
@ -1002,7 +1034,7 @@
|
|||
};
|
||||
|
||||
server.onMessage = function (e) {
|
||||
console.log("__ONMESSAGE__", JSON.parse(e.data))
|
||||
console.log("__ONMESSAGE__", JSON.parse(e.data));
|
||||
var message = JSON.parse(e.data),
|
||||
messageType = message.type.toLowerCase(),
|
||||
payload = message[messageType],
|
||||
|
|
|
|||
|
|
@ -543,20 +543,20 @@
|
|||
const audioFormat = response['AudioFormat']
|
||||
context.RecordingActions.audioRecordingFormatChanged(`.${audioFormat}`)
|
||||
break;
|
||||
case '3012': //JKSessionCreateFromCustomUrlEvent
|
||||
logger.log(`[asyncJamClient] 3012 JKSessionCreateFromCustomUrlEvent: ${response['JKSessionCreateFromCustomUrlEvent']['CustomUrl']}`);
|
||||
if(context.JK.createScheduledSessionScreen){
|
||||
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;
|
||||
// case '3012': //JKSessionCreateFromCustomUrlEvent
|
||||
// logger.log(`[asyncJamClient] 3012 JKSessionCreateFromCustomUrlEvent: ${response['JKSessionCreateFromCustomUrlEvent']['CustomUrl']}`);
|
||||
// if(context.JK.createScheduledSessionScreen){
|
||||
// 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.joinSessionFromCustomUrlScheme(customUrl)
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,13 +286,14 @@
|
|||
var instrumentSelectorRSVPInstance = new JK.InstrumentSelector(JK.app);
|
||||
instrumentSelectorRSVPInstance.initialize(true);
|
||||
var createScheduledSessionScreen = new JK.CreateScheduledSession(JK.app);
|
||||
createScheduledSessionScreen.initialize(
|
||||
JK.InvitationDialogInstance,
|
||||
JK.FriendSelectorDialogInstance,
|
||||
instrumentSelectorInstance,
|
||||
instrumentSelectorRSVPInstance
|
||||
);
|
||||
JK.createScheduledSessionScreen = createScheduledSessionScreen;
|
||||
createScheduledSessionScreen.initialize(
|
||||
JK.InvitationDialogInstance,
|
||||
JK.FriendSelectorDialogInstance,
|
||||
instrumentSelectorInstance,
|
||||
instrumentSelectorRSVPInstance
|
||||
);
|
||||
|
||||
|
||||
var bandSetupScreen = new JK.BandSetupScreen(JK.app);
|
||||
bandSetupScreen.initialize(JK.InvitationDialogInstance, JK.FriendSelectorDialogInstance);
|
||||
|
|
|
|||
Loading…
Reference in New Issue