SDA-1699 - Context bridge implementation for SDA - Mana (#968)

This commit is contained in:
Kiran Niranjan 2020-04-11 18:01:33 +05:30 committed by GitHub
parent e1a0acdb4e
commit aae049c5dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { ipcRenderer, webFrame } from 'electron';
import { contextBridge, ipcRenderer, webFrame } from 'electron';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { apiCmds, apiName } from '../common/api-interface';
@ -46,6 +46,39 @@ const createAPI = () => {
createAPI();
if (ssfWindow.ssf) {
// New context bridge api that exposes all the methods on to window object
contextBridge.exposeInMainWorld('manaSSF', {
CryptoLib: ssfWindow.ssf.CryptoLib,
Search: ssfWindow.ssf.Search,
Notification: ssfWindow.ssf.Notification,
getMediaSource: ssfWindow.ssf.getMediaSource,
activate: ssfWindow.ssf.activate,
bringToFront: ssfWindow.ssf.bringToFront,
getVersionInfo: ssfWindow.ssf.getVersionInfo,
registerActivityDetection: ssfWindow.ssf.registerActivityDetection,
registerBoundsChange: ssfWindow.ssf.registerBoundsChange,
registerLogger: ssfWindow.ssf.registerLogger,
registerProtocolHandler: ssfWindow.ssf.registerProtocolHandler,
registerLogRetriever: ssfWindow.ssf.registerLogRetriever,
sendLogs: ssfWindow.ssf.sendLogs,
registerAnalyticsEvent: ssfWindow.ssf.registerAnalyticsEvent,
ScreenSnippet: ssfWindow.ssf.ScreenSnippet,
openScreenSnippet: ssfWindow.ssf.openScreenSnippet,
closeScreenSnippet: ssfWindow.ssf.closeScreenSnippet,
setBadgeCount: ssfWindow.ssf.setBadgeCount,
setLocale: ssfWindow.ssf.setLocale,
setIsInMeeting: ssfWindow.ssf.setIsInMeeting,
showNotificationSettings: ssfWindow.ssf.showNotificationSettings,
showScreenSharingIndicator: ssfWindow.ssf.showScreenSharingIndicator,
openScreenSharingIndicator: ssfWindow.ssf.openScreenSharingIndicator,
closeScreenSharingIndicator: ssfWindow.ssf.closeScreenSharingIndicator,
registerRestartFloater: ssfWindow.ssf.registerRestartFloater,
setCloudConfig: ssfWindow.ssf.setCloudConfig,
checkMediaPermission: ssfWindow.ssf.checkMediaPermission,
});
}
/**
* Returns a random number that is between (min - max)
* if min is 4hrs and max is 12hrs then the