mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 13:35:42 +09:00
feat(voice): rework screen share delivery behind an experiment (#2859)
This commit is contained in:
1 parent
574a93257c
commit
c157ab5752
121 files changed
+7205
-5502
No files matched your search
@@ -7,22 +7,34 @@ import type {DesktopTroubleshootingSettings} from '@app/types/electron.d';
|
||||
const logger = new Logger('DesktopTroubleshootingUtils');
|
||||
|
||||
let cachedSettings: DesktopTroubleshootingSettings | null = null;
|
||||
let pendingPromise: Promise<DesktopTroubleshootingSettings | null> | null = null;
|
||||
|
||||
function fetchSettings(): Promise<DesktopTroubleshootingSettings | null> {
|
||||
const electronApi = getElectronAPI();
|
||||
if (!electronApi?.getDesktopTroubleshootingSettings) return Promise.resolve(null);
|
||||
return electronApi
|
||||
.getDesktopTroubleshootingSettings()
|
||||
.then((settings) => {
|
||||
cachedSettings = settings;
|
||||
return settings;
|
||||
})
|
||||
.catch((error) => {
|
||||
logger.error('Failed to read desktop troubleshooting settings', error);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
export function getCachedDesktopTroubleshootingSettings(): DesktopTroubleshootingSettings | null {
|
||||
return cachedSettings;
|
||||
}
|
||||
|
||||
export async function getDesktopTroubleshootingSettings(): Promise<DesktopTroubleshootingSettings | null> {
|
||||
const electronApi = getElectronAPI();
|
||||
if (!electronApi?.getDesktopTroubleshootingSettings) return null;
|
||||
try {
|
||||
const settings = await electronApi.getDesktopTroubleshootingSettings();
|
||||
cachedSettings = settings;
|
||||
return settings;
|
||||
} catch (error) {
|
||||
logger.error('Failed to read desktop troubleshooting settings', error);
|
||||
return null;
|
||||
}
|
||||
export function getDesktopTroubleshootingSettings(): Promise<DesktopTroubleshootingSettings | null> {
|
||||
if (cachedSettings) return Promise.resolve(cachedSettings);
|
||||
if (pendingPromise) return pendingPromise;
|
||||
pendingPromise = fetchSettings().finally(() => {
|
||||
pendingPromise = null;
|
||||
});
|
||||
return pendingPromise;
|
||||
}
|
||||
|
||||
export async function setDesktopDisableHardwareAcceleration(
|
||||
|
||||
Reference in new issue
Block a user