Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] In-App Notification API for plugins #1292

Open
QbDesu opened this issue Apr 28, 2022 · 1 comment
Open

[Feature] In-App Notification API for plugins #1292

QbDesu opened this issue Apr 28, 2022 · 1 comment

Comments

@QbDesu
Copy link
Collaborator

QbDesu commented Apr 28, 2022

Describe the feature you'd like

  • see InAppNotifications / XenoLib notifications for an example of how they could look
  • other than toasts they have the ability to take in another icon, image, like a profile image, or another visual indicator related to whatever the notification is about
  • the API would probably similar to those used for Toasts and Notices
  • ability to change the position of the Notification via a BD setting, similar to XenoLib
  • ability to bind click event handlers, probably passed as onClick in the options object with a close function passed as the parameter
  • preferably a small x in the corner to quickly dismiss them
  • maybe return the notification DOM node or something else useful?
  • unlike PowerCord's absolutely hideous notifications I say there shouldn't be an option to buttons onto the notification

Example API inspired by the existing Toast api in TS style pseudocode:

BdApi.showNotification(text: string|Node, options?: {
    type?: "success"|"info"|"warn"|"error",
    icon?: Node,
    timeout?: number,
    onClick?: (closeFn: ()=>void) => void
})

Some plugins implement notifications themselves, such as In-App Notifications, XenoLib (even if it's not officially support), and I think BDFDB also has something similar. They are a nicer alternative to toasts in a lot of cases as they can be actively dismissed so they are better suited for longer texts than toasts. They can receive click events and are designed to also be able to display another icon.

The advantage of having it in BD itself would be a unified look and setting for the notification position, notifications from different sources not running the risk of overlapping each other, and of course not every dev wanting to display notifications like this having to implement it themself.

XenoLib notification + position setting as an example:
image
image

@Tropix126
Copy link
Member

Tropix126 commented Apr 28, 2022

Might as well throw in my personal opinion - I think that most of these can be added in as improvements to the existing toasts API rather than as a new notification system and the rest are more suited for notices or modals. Comparing to Powercord's current Notifications API, they primarily serve as a method of user input designed to be explicitly dismissed by the user (which we have Notices and showConfirmationModal for). The other plugins that you mentioned could be pretty easily replaced to just use the current Toasts API, save for maybe custom icons which wouldn't be too difficult to add. Full-on overlay notifications that require user interaction to dismiss but don't accept user input is rather intrusive in my opinion.

@rauenzi rauenzi added this to the Refresh Plugin API milestone Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants