提交 354657c3 编写于 作者: I isidor

progress service: support silent progress

上级 cfeb8f86
......@@ -62,6 +62,7 @@ export interface IProgressNotificationOptions extends IProgressOptions {
readonly primaryActions?: ReadonlyArray<IAction>;
readonly secondaryActions?: ReadonlyArray<IAction>;
readonly delay?: number;
readonly silent?: boolean;
}
export interface IProgressWindowOptions extends IProgressOptions {
......
......@@ -251,7 +251,7 @@ export class ProgressService extends Disposable implements IProgressService {
return toDisposable(() => promiseResolve());
};
const createNotification = (message: string, increment?: number): INotificationHandle => {
const createNotification = (message: string, silent: boolean, increment?: number): INotificationHandle => {
const notificationDisposables = new DisposableStore();
const primaryActions = options.primaryActions ? Array.from(options.primaryActions) : [];
......@@ -294,7 +294,8 @@ export class ProgressService extends Disposable implements IProgressService {
message,
source: options.source,
actions: { primary: primaryActions, secondary: secondaryActions },
progress: typeof increment === 'number' && increment >= 0 ? { total: 100, worked: increment } : { infinite: true }
progress: typeof increment === 'number' && increment >= 0 ? { total: 100, worked: increment } : { infinite: true },
silent
});
// Switch to window based progress once the notification
......@@ -346,10 +347,10 @@ export class ProgressService extends Disposable implements IProgressService {
// create notification now or after a delay
if (typeof options.delay === 'number' && options.delay > 0) {
if (typeof notificationTimeout !== 'number') {
notificationTimeout = setTimeout(() => notificationHandle = createNotification(titleAndMessage!, step?.increment), options.delay);
notificationTimeout = setTimeout(() => notificationHandle = createNotification(titleAndMessage!, !!options.silent, step?.increment), options.delay);
}
} else {
notificationHandle = createNotification(titleAndMessage, step?.increment);
notificationHandle = createNotification(titleAndMessage, !!options.silent, step?.increment);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册