|
@@ -20,19 +20,30 @@ export class ExecService extends Service {
|
|
|
async launchApp ({ app_name, args }, { ipc_context, msg_id } = {}) {
|
|
|
const app = ipc_context?.caller?.app;
|
|
|
const process = ipc_context?.caller?.process;
|
|
|
-
|
|
|
+
|
|
|
// This mechanism will be replated with xdrpc soon
|
|
|
const child_instance_id = window.uuidv4();
|
|
|
|
|
|
+ const svc_ipc = this.services.get('ipc');
|
|
|
+ const connection = ipc_context ? svc_ipc.add_connection({
|
|
|
+ source: process.uuid,
|
|
|
+ target: child_instance_id,
|
|
|
+ }) : undefined;
|
|
|
+
|
|
|
// The "body" of this method is in a separate file
|
|
|
const child_process = await launch_app({
|
|
|
name: app_name,
|
|
|
args: args ?? {},
|
|
|
parent_instance_id: app?.appInstanceID,
|
|
|
uuid: child_instance_id,
|
|
|
+ ...(connection ? {
|
|
|
+ parent_pseudo_id: connection.backward.uuid,
|
|
|
+ } : {}),
|
|
|
});
|
|
|
|
|
|
const send_child_launched_msg = (...a) => {
|
|
|
+ if ( ! process ) return;
|
|
|
+ // TODO: (maybe) message process instead of iframe
|
|
|
const parent_iframe = process?.references?.iframe;
|
|
|
parent_iframe.contentWindow.postMessage({
|
|
|
msg: 'childAppLaunched',
|
|
@@ -67,9 +78,10 @@ export class ExecService extends Service {
|
|
|
window.report_app_closed(child_process.uuid);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
return {
|
|
|
- appInstanceID: child_instance_id,
|
|
|
+ appInstanceID: connection ?
|
|
|
+ connection.forward.uuid : child_instance_id,
|
|
|
usesSDK: true,
|
|
|
};
|
|
|
}
|
|
@@ -96,10 +108,17 @@ export class ExecService extends Service {
|
|
|
const options = svc_process.select_by_name(app_name);
|
|
|
const process = options[0];
|
|
|
|
|
|
- await process.handle_connection(caller_process, args);
|
|
|
+ const svc_ipc = this.services.get('ipc');
|
|
|
+ const connection = svc_ipc.add_connection({
|
|
|
+ source: caller_process.uuid,
|
|
|
+ target: process.uuid,
|
|
|
+ });
|
|
|
+
|
|
|
+ const response = await process.handle_connection(
|
|
|
+ connection.backward, args);
|
|
|
|
|
|
return {
|
|
|
- appInstanceID: process.uuid,
|
|
|
+ appInstanceID: connection.forward.uuid,
|
|
|
response,
|
|
|
};
|
|
|
}
|