Merge pull request #119878 from microsoft/isidorn/notificationVisible

add visible flag to notification
This commit is contained in:
Isidor Nikolic 2021-03-25 15:43:26 +01:00 committed by GitHub
commit ff869cd358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -90,7 +90,9 @@ export function registerNotificationCommands(center: INotificationsCenterControl
handler: accessor => {
const telemetryService = accessor.get(ITelemetryService);
model.notifications.forEach(n => {
telemetryService.publicLog2<NotificationMetrics, NotificationMetricsClassification>('notification:hide', notificationToMetrics(n.message.original, n.sourceId, n.silent));
if (n.visible) {
telemetryService.publicLog2<NotificationMetrics, NotificationMetricsClassification>('notification:hide', notificationToMetrics(n.message.original, n.sourceId, n.silent));
}
});
center.hide();
@ -171,7 +173,9 @@ export function registerNotificationCommands(center: INotificationsCenterControl
CommandsRegistry.registerCommand(HIDE_NOTIFICATION_TOAST, accessor => {
const telemetryService = accessor.get(ITelemetryService);
model.notifications.forEach(n => {
telemetryService.publicLog2<NotificationMetrics, NotificationMetricsClassification>('notification:hide', notificationToMetrics(n.message.original, n.sourceId, n.silent));
if (n.visible) {
telemetryService.publicLog2<NotificationMetrics, NotificationMetricsClassification>('notification:hide', notificationToMetrics(n.message.original, n.sourceId, n.silent));
}
});
toasts.hide();
});

View file

@ -285,6 +285,7 @@ export interface INotificationViewItem {
readonly progress: INotificationViewItemProgress;
readonly expanded: boolean;
readonly visible: boolean;
readonly canCollapse: boolean;
readonly hasProgress: boolean;
@ -611,6 +612,10 @@ export class NotificationViewItem extends Disposable implements INotificationVie
return this._actions;
}
get visible(): boolean {
return this._visible;
}
updateSeverity(severity: Severity): void {
this._severity = severity;
this._onDidChangeContent.fire({ kind: NotificationViewItemContentChangeKind.SEVERITY });