Skip to content

Commit

Permalink
Upgrade electron@30.0.9 (#2158)
Browse files Browse the repository at this point in the history
* Upgrade electron@30.0.9

* Adapt media permissions handler due to types changes
  • Loading branch information
sbenmoussati authored Jun 5, 2024
1 parent 7f2fe2c commit c999e27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"builder-util-runtime": "^9.0.3",
"cross-env": "7.0.3",
"del": "3.0.0",
"electron": "29.3.1",
"electron": "30.0.9",
"electron-builder": "^24.13.2",
"electron-devtools-installer": "^3.2.0",
"electron-icon-maker": "0.0.5",
Expand Down
21 changes: 14 additions & 7 deletions src/app/window-actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
BrowserWindow,
dialog,
PermissionRequestHandlerHandlerDetails,
MediaAccessPermissionRequest,
OpenExternalPermissionRequest,
systemPreferences,
WebContents,
} from 'electron';
Expand Down Expand Up @@ -414,13 +415,13 @@ export const handleSessionPermissions = async (
* @param permission {boolean} - config value to a specific permission (only supports media permissions)
* @param message {string} - custom message displayed to the user
* @param callback {function}
* @param details {PermissionRequestHandlerHandlerDetails} - object passed along with certain permission types. see {@link https://www.electronjs.org/docs/api/session#sessetpermissionrequesthandlerhandler}
* @param details MediaAccessPermissionRequest see {@link https://www.electronjs.org/docs/latest/api/session/#sessetpermissionrequesthandlerhandler}
*/
const handleMediaPermissions = async (
permission: boolean,
message: string,
callback: (permission: boolean) => void,
details: PermissionRequestHandlerHandlerDetails,
details: MediaAccessPermissionRequest,
): Promise<void> => {
logger.info('window-action: permission is ->', permission);
let systemAudioPermission;
Expand Down Expand Up @@ -497,7 +498,7 @@ export const handlePermissionRequests = (webContents: WebContents): void => {
PERMISSIONS_NAMESPACE,
)(),
callback,
details,
details as MediaAccessPermissionRequest,
);
case Permissions.LOCATION:
return handleSessionPermissions(
Expand Down Expand Up @@ -546,9 +547,15 @@ export const handlePermissionRequests = (webContents: WebContents): void => {
);
case Permissions.OPEN_EXTERNAL:
if (
details?.externalURL?.startsWith('symphony:') ||
details?.externalURL?.startsWith('tel:') ||
details?.externalURL?.startsWith('mailto:')
(details as OpenExternalPermissionRequest)?.externalURL?.startsWith(
'symphony:',
) ||
(details as OpenExternalPermissionRequest)?.externalURL?.startsWith(
'tel:',
) ||
(details as OpenExternalPermissionRequest)?.externalURL?.startsWith(
'mailto:',
)
) {
return callback(true);
}
Expand Down

0 comments on commit c999e27

Please sign in to comment.