feat: widen ScreenShareConfig types, bump persist to v12
This commit is contained in:
@@ -7,8 +7,8 @@ import { useAuthStore } from './authStore';
|
|||||||
import { isElectron } from '../platform/platform';
|
import { isElectron } from '../platform/platform';
|
||||||
|
|
||||||
export interface ScreenShareConfig {
|
export interface ScreenShareConfig {
|
||||||
height: 1080 | 720 | 540;
|
height: number | 'native';
|
||||||
fps: 60 | 45 | 30;
|
fps: number;
|
||||||
mode: 'gaming' | 'text';
|
mode: 'gaming' | 'text';
|
||||||
customBitrateKbps: number | null;
|
customBitrateKbps: number | null;
|
||||||
shareAudio: boolean;
|
shareAudio: boolean;
|
||||||
@@ -526,7 +526,7 @@ export const useVoiceStore = create<VoiceState>()(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'backspace-voice-settings',
|
name: 'backspace-voice-settings',
|
||||||
version: 11,
|
version: 12,
|
||||||
migrate: (persistedState: any, version: number) => {
|
migrate: (persistedState: any, version: number) => {
|
||||||
if (version === 0) {
|
if (version === 0) {
|
||||||
persistedState.streamAttenuationEnabled = false;
|
persistedState.streamAttenuationEnabled = false;
|
||||||
@@ -575,6 +575,13 @@ export const useVoiceStore = create<VoiceState>()(
|
|||||||
persistedState.screenShareConfig.shareAudio = !isElectron();
|
persistedState.screenShareConfig.shareAudio = !isElectron();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (version < 12) {
|
||||||
|
// Validate screenShareConfig.height after type widening
|
||||||
|
const cfg = persistedState.screenShareConfig;
|
||||||
|
if (cfg && typeof cfg.height !== 'number' && cfg.height !== 'native') {
|
||||||
|
cfg.height = 1080;
|
||||||
|
}
|
||||||
|
}
|
||||||
return persistedState;
|
return persistedState;
|
||||||
},
|
},
|
||||||
storage: createJSONStorage(() => localStorage),
|
storage: createJSONStorage(() => localStorage),
|
||||||
|
|||||||
Reference in New Issue
Block a user