SDA-4657: OpenFin - unregisterIntentHandler patch (#2273)

This commit is contained in:
Antoine Rollin
2025-01-27 15:00:46 +01:00
committed by GitHub
parent 599a2f3ff1
commit 17d1a6a96d
4 changed files with 7 additions and 5 deletions

View File

@@ -673,7 +673,7 @@ describe('main api handler', () => {
const spy = jest.spyOn(openfinHandler, 'unregisterIntentHandler'); const spy = jest.spyOn(openfinHandler, 'unregisterIntentHandler');
const value = { const value = {
cmd: apiCmds.openfinUnregisterIntentHandler, cmd: apiCmds.openfinUnregisterIntentHandler,
intentName: 'ViewContact', uuid: 'uuid',
}; };
ipcMain.send(apiName.symphonyApi, value); ipcMain.send(apiName.symphonyApi, value);

View File

@@ -649,7 +649,7 @@ ipcMain.handle(
case apiCmds.openfinJoinSessionContextGroup: case apiCmds.openfinJoinSessionContextGroup:
return openfinHandler.joinSessionContextGroup(arg.contextGroupId); return openfinHandler.joinSessionContextGroup(arg.contextGroupId);
case apiCmds.openfinUnregisterIntentHandler: case apiCmds.openfinUnregisterIntentHandler:
return openfinHandler.unregisterIntentHandler(arg.intentName); return openfinHandler.unregisterIntentHandler(arg.uuid);
case apiCmds.openfinFireIntentForContext: case apiCmds.openfinFireIntentForContext:
return openfinHandler.fireIntentForContext(arg.context); return openfinHandler.fireIntentForContext(arg.context);
case apiCmds.openfinRemoveFromContextGroup: case apiCmds.openfinRemoveFromContextGroup:

View File

@@ -118,10 +118,12 @@ export class OpenfinHandler {
/** /**
* Removes an intent handler for a given intent * Removes an intent handler for a given intent
*/ */
public unregisterIntentHandler(uuid: UUID) { public async unregisterIntentHandler(uuid: UUID) {
const unsubscriptionCallback = this.intentHandlerSubscriptions.get(uuid); const unsubscriptionCallback = this.intentHandlerSubscriptions.get(uuid);
unsubscriptionCallback.unsubscribe();
const response = await unsubscriptionCallback.unsubscribe();
this.intentHandlerSubscriptions.delete(uuid); this.intentHandlerSubscriptions.delete(uuid);
return response;
} }
/** /**

View File

@@ -1070,7 +1070,7 @@ export class SSFApi {
const response = await local.ipcRenderer.invoke(apiName.symphonyApi, { const response = await local.ipcRenderer.invoke(apiName.symphonyApi, {
cmd: apiCmds.openfinUnregisterIntentHandler, cmd: apiCmds.openfinUnregisterIntentHandler,
callbackId, uuid: callbackId,
}); });
return response; return response;
} }