Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ function SampleActionButtonDropdownPlugin(
}, 5000);
},
}),
new ActionButtonDropdownOption({
label: 'Stop notifications',
icon: 'copy',
tooltip: 'this is a button injected by plugin',
allowed: true,
onClick: () => {
pluginApi.uiCommands.notification.setEnabledDisplayNotifications(false);
},
}),
new ActionButtonDropdownOption({
label: showingGenericContentInPresentationArea ? 'Return previous presentation content' : 'Set different content in presentation area',
icon: 'copy',
Expand Down
14 changes: 13 additions & 1 deletion src/ui-commands/notification/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NotificationEnum } from './enums';
import { SendNotificationCommandArguments } from './types';
import { SendNotificationCommandArguments, SetEnableDisplayNotificationsArguments } from './types';

export const notification = {
/**
Expand All @@ -14,4 +14,16 @@ export const notification = {
}),
);
},
/**
* Decides if notifications stop being displayed.
*/
setEnabledDisplayNotifications: (isNotificationDisplayEnabled: boolean) => {
window.dispatchEvent(
new CustomEvent<
SetEnableDisplayNotificationsArguments
>(NotificationEnum.SET_ENABLED_DISPLAY, {
detail: { isNotificationDisplayEnabled },
}),
);
},
};
3 changes: 2 additions & 1 deletion src/ui-commands/notification/enums.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum NotificationEnum {
SEND = 'SEND_NOTIFICATION',
SEND = 'SEND_NOTIFICATION_COMMAND',
SET_ENABLED_DISPLAY = 'SET_ENABLED_DISPLAY_COMMAND'
}

export enum NotificationTypeUiCommand {
Expand Down
5 changes: 5 additions & 0 deletions src/ui-commands/notification/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export interface SendNotificationCommandArguments {
small?: boolean;
}

export interface SetEnableDisplayNotificationsArguments {
isNotificationDisplayEnabled: boolean;
}

export interface UiCommandsNotificationObject {
send: (information: SendNotificationCommandArguments) => void;
setEnabledDisplayNotifications: (isNotificationDisplayEnabled: boolean) => void;
}
Loading