mirror of
https://github.com/finos/SymphonyElectron.git
synced 2026-10-25 22:20:06 -05:00
SDA-4770 Expose Openfin API - Adding setContext (#2308)
This commit is contained in:
1 parent
2ffd498fb8
commit
8b9c469163
13 files changed
+37
-13
No files matched your search
@@ -53,7 +53,7 @@
|
||||
"licenseKey": "",
|
||||
"runtimeVersion": "",
|
||||
"autoConnect": false,
|
||||
"channelName": "",
|
||||
"platformUuid": "",
|
||||
"connectionTimeout": "10000"
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ if [ "$EUID" -ne 0 ]; then
|
||||
defaults write "$plistFilePath" uuid -string ""
|
||||
defaults write "$plistFilePath" licenseKey -string ""
|
||||
defaults write "$plistFilePath" runtimeVersion -string ""
|
||||
defaults write "$plistFilePath" channelName -string ""
|
||||
defaults write "$plistFilePath" platformUuid -string ""
|
||||
defaults write "$plistFilePath" autoConnect -bool false
|
||||
else
|
||||
sudo -u "$userName" defaults write "$plistFilePath" url -string "$pod_url"
|
||||
@@ -176,7 +176,7 @@ else
|
||||
sudo -u "$userName" defaults write "$plistFilePath" uuid -string ""
|
||||
sudo -u "$userName" defaults write "$plistFilePath" licenseKey -string ""
|
||||
sudo -u "$userName" defaults write "$plistFilePath" runtimeVersion -string ""
|
||||
sudo -u "$userName" defaults write "$plistFilePath" channelName -string ""
|
||||
sudo -u "$userName" defaults write "$plistFilePath" platformUuid -string ""
|
||||
sudo -u "$userName" defaults write "$plistFilePath" autoConnect -bool false
|
||||
fi
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ jest.mock('../src/app/config-handler', () => {
|
||||
uuid: 'some-uuid',
|
||||
licenseKey: 'some-license-key',
|
||||
runtimeVersion: 'some-runtime-version',
|
||||
channelName: 'some-channel-name',
|
||||
platformUuid: 'platform-uuid',
|
||||
connectionTimeout: '1000',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ jest.mock('../src/app/config-handler', () => ({
|
||||
uuid: 'mock-uuid',
|
||||
licenseKey: 'mock-license',
|
||||
runtimeVersion: 'mock-version',
|
||||
channelName: 'mock-channel',
|
||||
platformUuid: 'platform-uuid',
|
||||
connectionTimeout: '10000',
|
||||
},
|
||||
})),
|
||||
@@ -76,7 +76,7 @@ describe('Openfin', () => {
|
||||
jest.useFakeTimers();
|
||||
const connectSyncSpy = jest
|
||||
.spyOn(connectMock.Interop, 'connectSync')
|
||||
.mockImplementationOnce((_channelName) => {
|
||||
.mockImplementationOnce((_platformUuid) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
@@ -113,7 +113,7 @@ describe('Openfin', () => {
|
||||
jest.useFakeTimers();
|
||||
const connectSyncSpy = jest
|
||||
.spyOn(connectMock.Interop, 'connectSync')
|
||||
.mockImplementationOnce((_channelName) => {
|
||||
.mockImplementationOnce((_platformUuid) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
|
||||
@@ -95,7 +95,7 @@ describe('Plist Handler', () => {
|
||||
autoConnect: undefined,
|
||||
licenseKey: undefined,
|
||||
runtimeVersion: undefined,
|
||||
channelName: undefined,
|
||||
platformUuid: undefined,
|
||||
uuid: undefined,
|
||||
connectionTimeout: undefined,
|
||||
},
|
||||
|
||||
@@ -168,7 +168,7 @@ export interface IOpenfin {
|
||||
uuid: string;
|
||||
licenseKey: string;
|
||||
runtimeVersion: string;
|
||||
channelName: string;
|
||||
platformUuid: string;
|
||||
autoConnect: boolean;
|
||||
connectionTimeout: string;
|
||||
}
|
||||
|
||||
@@ -654,6 +654,8 @@ ipcMain.handle(
|
||||
return openfinHandler.fireIntentForContext(arg.context);
|
||||
case apiCmds.openfinRemoveFromContextGroup:
|
||||
return openfinHandler.removeFromContextGroup();
|
||||
case apiCmds.openfinSetContext:
|
||||
return openfinHandler.setContext(arg.context);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -60,10 +60,10 @@ export class OpenfinHandler {
|
||||
'openfin-handler: connection established to openfin runtime',
|
||||
);
|
||||
logger.info(
|
||||
`openfin-handler: starting connection to interop broker using channel ${openfin.channelName}...`,
|
||||
`openfin-handler: starting connection to interop broker using channel ${openfin.platformUuid}...`,
|
||||
);
|
||||
|
||||
this.interopClient = this.fin.Interop.connectSync(openfin.channelName);
|
||||
this.interopClient = this.fin.Interop.connectSync(openfin.platformUuid);
|
||||
this.isConnected = true;
|
||||
this.interopClient?.onDisconnection(this.disconnectionHandler);
|
||||
|
||||
@@ -202,6 +202,14 @@ export class OpenfinHandler {
|
||||
return this.interopClient?.fireIntentForContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a context for the context group of the current entity.
|
||||
* @param context
|
||||
*/
|
||||
public setContext(context: any) {
|
||||
return this.interopClient?.setContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Leaves current context group
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,7 @@ const OPENFIN = {
|
||||
uuid: 'string',
|
||||
licenseKey: 'string',
|
||||
runtimeVersion: 'string',
|
||||
channelName: 'string',
|
||||
platformUuid: 'string',
|
||||
autoConnect: 'boolean',
|
||||
connectionTimeout: 'string',
|
||||
};
|
||||
|
||||
@@ -97,6 +97,7 @@ export enum apiCmds {
|
||||
openfinFireIntentForContext = 'openfin-fire-intent-for-context',
|
||||
openfinRemoveFromContextGroup = 'openfin-remove-from-context-group',
|
||||
openfinGetClientInfo = 'openfin-get-client-info',
|
||||
openfinSetContext = 'openfin-set-context',
|
||||
}
|
||||
|
||||
export enum apiName {
|
||||
|
||||
@@ -12,7 +12,7 @@ export const ConfigFieldsDefaultValues: Partial<IConfig> = {
|
||||
uuid: '',
|
||||
licenseKey: '',
|
||||
runtimeVersion: '',
|
||||
channelName: '',
|
||||
platformUuid: '',
|
||||
autoConnect: false,
|
||||
connectionTimeout: '10000',
|
||||
},
|
||||
|
||||
@@ -121,6 +121,7 @@ if (ssfWindow.ssf) {
|
||||
fireIntentForContext: ssfWindow.ssf.openfinFireIntentForContext,
|
||||
removeFromContextGroup: ssfWindow.ssf.openfinRemoveFromContextGroup,
|
||||
getClientInfo: ssfWindow.ssf.openfinGetClientInfo,
|
||||
setContext: ssfWindow.ssf.openfinSetContext,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1127,6 +1127,18 @@ export class SSFApi {
|
||||
return clients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a context for the context group of the current entity.
|
||||
* @param context
|
||||
*/
|
||||
public async openfinSetContext(context: any) {
|
||||
const response = await local.ipcRenderer.invoke(apiName.symphonyApi, {
|
||||
cmd: apiCmds.openfinSetContext,
|
||||
context,
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows JS to register SDA for phone numbers clicks
|
||||
* @param {Function} phoneNumberCallback callback function invoked when receiving a phone number for calls/sms
|
||||
|
||||
Reference in new issue
Block a user