mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import {makeSyncedField} from '@app/features/user/state/SyncedField';
|
|
import {VoicePromptsStateSchema} from '@fluxer/schema/src/gen/fluxer/user/preferences/v1/preferences_pb';
|
|
import {makeAutoObservable} from 'mobx';
|
|
|
|
class VoicePrompts {
|
|
skipHideOwnCameraConfirm = false;
|
|
skipHideOwnScreenShareConfirm = false;
|
|
|
|
constructor() {
|
|
makeAutoObservable(
|
|
this,
|
|
{getSkipHideOwnCameraConfirm: false, getSkipHideOwnScreenShareConfirm: false},
|
|
{autoBind: true},
|
|
);
|
|
void this.initPersistence();
|
|
}
|
|
|
|
private async initPersistence(): Promise<void> {
|
|
await makeSyncedField(this, {
|
|
field: 'voicePrompts',
|
|
schema: VoicePromptsStateSchema,
|
|
persist: ['skipHideOwnCameraConfirm', 'skipHideOwnScreenShareConfirm'],
|
|
toMessage: (s) => ({
|
|
skipHideOwnCameraConfirm: s.skipHideOwnCameraConfirm,
|
|
skipHideOwnScreenshareConfirm: s.skipHideOwnScreenShareConfirm,
|
|
}),
|
|
applyMessage: (s, m) => {
|
|
s.skipHideOwnCameraConfirm = m.skipHideOwnCameraConfirm;
|
|
s.skipHideOwnScreenShareConfirm = m.skipHideOwnScreenshareConfirm;
|
|
},
|
|
});
|
|
}
|
|
|
|
getSkipHideOwnCameraConfirm(): boolean {
|
|
return this.skipHideOwnCameraConfirm;
|
|
}
|
|
|
|
setSkipHideOwnCameraConfirm(value: boolean): void {
|
|
this.skipHideOwnCameraConfirm = value;
|
|
}
|
|
|
|
getSkipHideOwnScreenShareConfirm(): boolean {
|
|
return this.skipHideOwnScreenShareConfirm;
|
|
}
|
|
|
|
setSkipHideOwnScreenShareConfirm(value: boolean): void {
|
|
this.skipHideOwnScreenShareConfirm = value;
|
|
}
|
|
}
|
|
|
|
export default new VoicePrompts();
|