mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
@@ -38,4 +38,11 @@ export class WorkspaceDialogService extends Service {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
closeAll() {
|
||||
const dialogs = this.dialogs$.value;
|
||||
dialogs.forEach(dialog => {
|
||||
this.close(dialog.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { CurrentUserDBEditorSettingProvider } from './impls/user-db';
|
||||
import { EditorSettingProvider } from './provider/editor-setting-provider';
|
||||
import { EditorSettingService } from './services/editor-setting';
|
||||
import { SpellCheckSettingService } from './services/spell-check-setting';
|
||||
import { TraySettingService } from './services/tray-settings';
|
||||
export type { FontFamily } from './schema';
|
||||
export { EditorSettingSchema, fontStyleOptions } from './schema';
|
||||
export { EditorSettingService } from './services/editor-setting';
|
||||
@@ -30,3 +31,7 @@ export function configureSpellCheckSettingModule(framework: Framework) {
|
||||
DesktopApiService,
|
||||
]);
|
||||
}
|
||||
|
||||
export function configureTraySettingModule(framework: Framework) {
|
||||
framework.service(TraySettingService, [GlobalStateService]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import type {
|
||||
MenubarStateKey,
|
||||
MenubarStateSchema,
|
||||
} from '@affine/electron/main/shared-state-schema';
|
||||
import { LiveData, Service } from '@toeverything/infra';
|
||||
|
||||
import type { GlobalStateService } from '../../storage';
|
||||
|
||||
const MENUBAR_SETTING_KEY: typeof MenubarStateKey = 'menubarState';
|
||||
|
||||
export class TraySettingService extends Service {
|
||||
constructor(private readonly globalStateService: GlobalStateService) {
|
||||
super();
|
||||
}
|
||||
|
||||
setting$ = LiveData.from(
|
||||
this.globalStateService.globalState.watch<MenubarStateSchema>(
|
||||
MENUBAR_SETTING_KEY
|
||||
),
|
||||
null
|
||||
).map(v => v ?? { enabled: true });
|
||||
|
||||
setEnabled(enabled: boolean) {
|
||||
this.globalStateService.globalState.set(MENUBAR_SETTING_KEY, {
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user