Add "Do Not Disturb" Mode (#149645)

* Add mute icon to notification center toolbar

* Add placeholder mute method

* Add config service support

* Refactor mute toggle behavior

* More refactoring

* Add hack for switching actions on toggle

* Use do-not-disturb icons

* Update status bar icon

* Add comment for hack todo

* Add experimental tag

* Update setting name references

* Fix typo

* Update status bar icon and filter all errors

* Update icons

* Updates icon and toggle behavior

* Update codicons ttf

* cleanups

* Use UI state instead of setting

* Show window progress instead of notification

* Update Storage scopes

* Update Storage scopes

* Refactor to use NotificationService

* Minor fixes

* Update tests

* Address PR feedback

* Update tests

* 💄

* 💄

* zen - use dnd mode for filtering

* set filters right on startup

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
This commit is contained in:
David Dossett
2022-06-27 06:49:10 -07:00
committed by GitHub
parent 9b1c6cb3ff
commit f148d86fd2
15 changed files with 149 additions and 42 deletions

View File

@@ -6,7 +6,7 @@
import * as assert from 'assert';
import { MainThreadMessageService } from 'vs/workbench/api/browser/mainThreadMessageService';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService, INotification, NoOpNotification, INotificationHandle, Severity, IPromptChoice, IPromptOptions, IStatusMessageOptions, NotificationsFilter } from 'vs/platform/notification/common/notification';
import { INotificationService, INotification, NoOpNotification, INotificationHandle, Severity, IPromptChoice, IPromptOptions, IStatusMessageOptions } from 'vs/platform/notification/common/notification';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { mock } from 'vs/base/test/common/mock';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
@@ -24,8 +24,10 @@ const emptyCommandService: ICommandService = {
const emptyNotificationService = new class implements INotificationService {
declare readonly _serviceBrand: undefined;
doNotDisturbMode: boolean = false;
onDidAddNotification: Event<INotification> = Event.None;
onDidRemoveNotification: Event<INotification> = Event.None;
onDidChangeDoNotDisturbMode: Event<void> = Event.None;
notify(...args: any[]): never {
throw new Error('not implemented');
}
@@ -44,19 +46,17 @@ const emptyNotificationService = new class implements INotificationService {
status(message: string | Error, options?: IStatusMessageOptions): IDisposable {
return Disposable.None;
}
setFilter(filter: NotificationsFilter): void {
throw new Error('not implemented.');
}
};
class EmptyNotificationService implements INotificationService {
declare readonly _serviceBrand: undefined;
doNotDisturbMode: boolean = false;
constructor(private withNotify: (notification: INotification) => void) {
}
onDidAddNotification: Event<INotification> = Event.None;
onDidRemoveNotification: Event<INotification> = Event.None;
onDidChangeDoNotDisturbMode: Event<void> = Event.None;
notify(notification: INotification): INotificationHandle {
this.withNotify(notification);
@@ -77,9 +77,6 @@ class EmptyNotificationService implements INotificationService {
status(message: string, options?: IStatusMessageOptions): IDisposable {
return Disposable.None;
}
setFilter(filter: NotificationsFilter): void {
throw new Error('Method not implemented.');
}
}
suite('ExtHostMessageService', function () {