From e2cc1cee4b66729f9c451819c0c758e64b7a05ce Mon Sep 17 00:00:00 2001 From: Claudio Costa Date: Wed, 24 Jul 2024 17:56:45 +0200 Subject: [PATCH] [MM-51514] Allow Calls widget to open user settings (#3109) * Allow Calls widget to open user settings * Bump api-types version * Bump --- api-types/index.ts | 3 +++ api-types/lib/index.d.ts | 2 ++ api-types/package-lock.json | 4 ++-- api-types/package.json | 2 +- src/common/communication.ts | 1 + src/main/preload/externalAPI.ts | 4 ++++ src/main/windows/callsWidgetWindow.ts | 2 ++ src/types/externalAPI.ts | 1 + 8 files changed, 16 insertions(+), 3 deletions(-) diff --git a/api-types/index.ts b/api-types/index.ts index 6ac63cef..7738696e 100644 --- a/api-types/index.ts +++ b/api-types/index.ts @@ -76,6 +76,9 @@ export type DesktopAPI = { openStopRecordingModal: (channelID: string) => void; onOpenStopRecordingModal: (listener: (channelID: string) => void) => () => void; + openCallsUserSettings: () => void; + onOpenCallsUserSettings: (listener: () => void) => () => void; + // Utility unregister: (channel: string) => void; } diff --git a/api-types/lib/index.d.ts b/api-types/lib/index.d.ts index 0eb97c63..14d117e6 100644 --- a/api-types/lib/index.d.ts +++ b/api-types/lib/index.d.ts @@ -63,5 +63,7 @@ export type DesktopAPI = { onOpenThreadForCalls: (listener: (threadID: string) => void) => () => void; openStopRecordingModal: (channelID: string) => void; onOpenStopRecordingModal: (listener: (channelID: string) => void) => () => void; + openCallsUserSettings: () => void; + onOpenCallsUserSettings: (listener: () => void) => () => void; unregister: (channel: string) => void; }; diff --git a/api-types/package-lock.json b/api-types/package-lock.json index f4967a04..345d3ff3 100644 --- a/api-types/package-lock.json +++ b/api-types/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mattermost/desktop-api", - "version": "5.9.0-1", + "version": "5.10.0-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mattermost/desktop-api", - "version": "5.9.0-1", + "version": "5.10.0-1", "license": "MIT", "peerDependencies": { "typescript": "^4.3.0 || ^5.0.0" diff --git a/api-types/package.json b/api-types/package.json index 652f107b..e2e38553 100644 --- a/api-types/package.json +++ b/api-types/package.json @@ -1,6 +1,6 @@ { "name": "@mattermost/desktop-api", - "version": "5.9.0-1", + "version": "5.10.0-1", "description": "Shared types for the Desktop App API provided to the Web App", "keywords": [ "mattermost" diff --git a/src/common/communication.ts b/src/common/communication.ts index f65e3519..df8659bd 100644 --- a/src/common/communication.ts +++ b/src/common/communication.ts @@ -134,6 +134,7 @@ export const CALLS_ERROR = 'calls-error'; export const CALLS_JOIN_REQUEST = 'calls-join-request'; export const CALLS_WIDGET_OPEN_THREAD = 'calls-widget-open-thread'; export const CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL = 'calls-widget-open-stop-recording-modal'; +export const CALLS_WIDGET_OPEN_USER_SETTINGS = 'calls-widget-open-user-settings'; export const REQUEST_CLEAR_DOWNLOADS_DROPDOWN = 'request-clear-downloads-dropdown'; export const CLOSE_DOWNLOADS_DROPDOWN = 'close-downloads-dropdown'; diff --git a/src/main/preload/externalAPI.ts b/src/main/preload/externalAPI.ts index eb0b666f..7db9512a 100644 --- a/src/main/preload/externalAPI.ts +++ b/src/main/preload/externalAPI.ts @@ -38,6 +38,7 @@ import { CALLS_POPOUT_FOCUS, CALLS_WIDGET_OPEN_THREAD, CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL, + CALLS_WIDGET_OPEN_USER_SETTINGS, GET_DESKTOP_SOURCES, UNREADS_AND_MENTIONS, LEGACY_OFF, @@ -117,6 +118,9 @@ const desktopAPI: DesktopAPI = { openStopRecordingModal: (channelID) => ipcRenderer.send(CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL, channelID), onOpenStopRecordingModal: (listener) => createListener(CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL, listener), + openCallsUserSettings: () => ipcRenderer.send(CALLS_WIDGET_OPEN_USER_SETTINGS), + onOpenCallsUserSettings: (listener) => createListener(CALLS_WIDGET_OPEN_USER_SETTINGS, listener), + // Utility unregister: (channel) => ipcRenderer.removeAllListeners(channel), }; diff --git a/src/main/windows/callsWidgetWindow.ts b/src/main/windows/callsWidgetWindow.ts index 11469ef3..6fafec75 100644 --- a/src/main/windows/callsWidgetWindow.ts +++ b/src/main/windows/callsWidgetWindow.ts @@ -19,6 +19,7 @@ import { CALLS_WIDGET_SHARE_SCREEN, CALLS_WIDGET_OPEN_THREAD, CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL, + CALLS_WIDGET_OPEN_USER_SETTINGS, DESKTOP_SOURCES_MODAL_REQUEST, GET_DESKTOP_SOURCES, UPDATE_SHORTCUT_MENU, @@ -77,6 +78,7 @@ export class CallsWidgetWindow { ipcMain.on(CALLS_JOIN_REQUEST, this.forwardToMainApp(CALLS_JOIN_REQUEST)); ipcMain.on(CALLS_WIDGET_OPEN_THREAD, this.handleCallsOpenThread); ipcMain.on(CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL, this.handleCallsOpenStopRecordingModal); + ipcMain.on(CALLS_WIDGET_OPEN_USER_SETTINGS, this.forwardToMainApp(CALLS_WIDGET_OPEN_USER_SETTINGS)); // deprecated in favour of CALLS_LINK_CLICK ipcMain.on(CALLS_WIDGET_CHANNEL_LINK_CLICK, this.handleCallsWidgetChannelLinkClick); diff --git a/src/types/externalAPI.ts b/src/types/externalAPI.ts index 6f141a5e..563da09b 100644 --- a/src/types/externalAPI.ts +++ b/src/types/externalAPI.ts @@ -24,4 +24,5 @@ export interface ExternalAPI { createListener(event: 'desktop-sources-modal-request', listener: () => void): () => void; createListener(event: 'calls-widget-open-thread', listener: (threadID: string) => void): () => void; createListener(event: 'calls-widget-open-stop-recording-modal', listener: (channelID: string) => void): () => void; + createListener(event: 'calls-widget-open-user-settings', listener: () => void): () => void; }