fix(stage-tamagotchi): guard systemPreferences calls on Linux (#2380)
This commit is contained in:
@@ -3,19 +3,20 @@ import type { BrowserWindow } from 'electron'
|
||||
|
||||
import { defineInvokeHandler } from '@moeru/eventa'
|
||||
import { systemPreferences } from 'electron'
|
||||
import { isLinux } from 'std-env'
|
||||
|
||||
import { electron } from '../../../shared/eventa'
|
||||
|
||||
export function createSystemPreferencesService(params: { context: ReturnType<typeof createContext>['context'], window: BrowserWindow }) {
|
||||
defineInvokeHandler(params.context, electron.systemPreferences.getMediaAccessStatus, (type) => {
|
||||
if (!type) {
|
||||
if (isLinux || !type) {
|
||||
return 'not-determined'
|
||||
}
|
||||
|
||||
return systemPreferences.getMediaAccessStatus(type[0])
|
||||
})
|
||||
defineInvokeHandler(params.context, electron.systemPreferences.askForMediaAccess, (type) => {
|
||||
if (!type) {
|
||||
if (isLinux || !type) {
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user