File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,4 +45,21 @@ describe('desktop preload bridge', () => {
4545 [ 'desktop:settings:set-browser-search-suggestions' , false ] ,
4646 ] )
4747 } )
48+
49+ it ( 'exposes native microphone settings only on supported platforms' , async ( ) => {
50+ const exposed = exposeInMainWorld . mock . calls . find ( ( [ name ] ) => name === 'simDesktop' ) ?. [ 1 ] as
51+ | SimDesktopApi
52+ | undefined
53+ if ( ! exposed ) throw new Error ( 'Expected the desktop preload API to be exposed' )
54+
55+ const isSupportedPlatform = process . platform === 'darwin' || process . platform === 'win32'
56+ expect ( typeof exposed . openMicrophoneSettings ) . toBe (
57+ isSupportedPlatform ? 'function' : 'undefined'
58+ )
59+
60+ if ( isSupportedPlatform ) {
61+ await exposed . openMicrophoneSettings ?.( )
62+ expect ( invoke ) . toHaveBeenLastCalledWith ( 'desktop:open-microphone-settings' )
63+ }
64+ } )
4865} )
Original file line number Diff line number Diff line change @@ -114,8 +114,12 @@ function shellVersion(): string {
114114const api : SimDesktopApi = {
115115 version : shellVersion ( ) ,
116116 openExternal : ( url : string ) : Promise < boolean > => ipcRenderer . invoke ( 'desktop:open-external' , url ) ,
117- openMicrophoneSettings : ( ) : Promise < boolean > =>
118- ipcRenderer . invoke ( 'desktop:open-microphone-settings' ) ,
117+ ...( process . platform === 'darwin' || process . platform === 'win32'
118+ ? {
119+ openMicrophoneSettings : ( ) : Promise < boolean > =>
120+ ipcRenderer . invoke ( 'desktop:open-microphone-settings' ) ,
121+ }
122+ : { } ) ,
119123 beginOAuthConnect : ( providerId : string , scope ?: DesktopOAuthConnectScope ) : Promise < boolean > =>
120124 ipcRenderer . invoke ( 'desktop:oauth-connect' , providerId , scope ) ,
121125 onOAuthConnectComplete : ( callback : ( result : DesktopOAuthConnectResult ) => void ) : ( ( ) => void ) => {
You can’t perform that action at this time.
0 commit comments