Luke 42077 Posted December 11, 2022 Posted December 11, 2022 @ackbarr @darkside40 @TeamB Your plugins will require updates, but I'm happy to say you should be able to migrate easily and you'll end up with less code than you had before. You don't even have to write a full configuration screen anymore, only a portion of a screen ! See Prowl here: https://github.com/MediaBrowser/Prowl/blob/master/MediaBrowser.Plugins.ProwlNotifications/Configuration/entryeditor.template.html https://github.com/MediaBrowser/Prowl/blob/master/MediaBrowser.Plugins.ProwlNotifications/Configuration/entryeditor.js On the C# side, you don't need any custom api endpoints, only the Notifier class to send the notifications: https://github.com/MediaBrowser/Prowl/blob/master/MediaBrowser.Plugins.ProwlNotifications/Notifier.cs The Core UI will take care of the rest for you, including sending a test notification: Please let me know if you have any questions. Thanks !
TeamB 2438 Posted December 11, 2022 Posted December 11, 2022 sorry what is changing? This is the notification code I use in Playback Reporting https://github.com/faush01/playback_reporting/blob/54bfa5ab97452d8ad6e65492e9b2d2a822c39e7d/playback_reporting/Tasks/TaskNotifictionMediaReport.cs#L201-L208 I dont think I needed any config page, it just sends notificationsusing the INotificationManager, what do I need to change?
Luke 42077 Posted December 12, 2022 Author Posted December 12, 2022 4 hours ago, TeamB said: sorry what is changing? This is the notification code I use in Playback Reporting https://github.com/faush01/playback_reporting/blob/54bfa5ab97452d8ad6e65492e9b2d2a822c39e7d/playback_reporting/Tasks/TaskNotifictionMediaReport.cs#L201-L208 I dont think I needed any config page, it just sends notificationsusing the INotificationManager, what do I need to change? I'm going to add a compatibility layer to ensure that code will work again, however even with that, I would still make a couple changes to improve the experience of your plugin. I would switch to this method to send: void SendNotification(NotificationRequest request) The request object here will have a lot more properties you can set if you have the data available. For example, if a notification you're sending is based on a BaseItem or User, you can attach those to the notification.
Luke 42077 Posted December 12, 2022 Author Posted December 12, 2022 The second change for notification senders is that you can no longer force the notification to be sent. The user or admin has to enable that notification id. You should create your own notification type so that it appears in the notification setup dialog, like here for example: To do this, implement INotificationTypeFactory, and create notification types for the kinds of notifications you will send, and then they will show up in both the WebHooks dialog as well as the dialog for Notifications. This isn't required, but if you don't do this, then your notifications will be assigned as External, and users will have to enable that which will be less obvious.
TeamB 2438 Posted December 12, 2022 Posted December 12, 2022 2 minutes ago, Luke said: You should create your own notification type so that it appears in the notification setup dialog, like here for example: I do that already: https://github.com/faush01/playback_reporting/blob/54bfa5ab97452d8ad6e65492e9b2d2a822c39e7d/playback_reporting/Notifications.cs I dont actually think I need to change anything then?
Luke 42077 Posted December 12, 2022 Author Posted December 12, 2022 The signature on that has changed slightly: NotificationTypeInfo.Type => NotificationTypeInfo.Id NotificationTypeInfo.Category => NotificationTypeInfo.CategoryName And then make sure to set NotificationTypeInfo.CategoryId. GetNotificationTypes passes in a locale, which you can optionally use if you want to localize the Name or CategoryName. You can also just ignore it if you don't want to do that. Make sure to update to nuget package 4.8.0.20-beta12. Nuget actually presents 4.8.0.20-beta9 as the latest.
Albertax 14 Posted December 12, 2022 Posted December 12, 2022 Will DiscordNotifications require an update work in the new beta. I’m on mobile but it’s saying Undefined
Luke 42077 Posted December 12, 2022 Author Posted December 12, 2022 29 minutes ago, Albertax said: Will DiscordNotifications require an update work in the new beta. I’m on mobile but it’s saying Undefined Yes. Who develops that?
Albertax 14 Posted December 12, 2022 Posted December 12, 2022 3 hours ago, Luke said: Yes. Who develops that? @rechigo seems to
Albertax 14 Posted January 13, 2023 Posted January 13, 2023 @LukeHi Luke, if @rechigo has been inactive for a while - does this mean the plugin will never be updated again?
Luke 42077 Posted January 13, 2023 Author Posted January 13, 2023 3 hours ago, Albertax said: @LukeHi Luke, if Rechigo has been inactive for a while - does this mean the plugin will never be updated again? If his source code is available then I can update it, otherwise he'll have to do it.
sjtuross 9 Posted October 23, 2024 Posted October 23, 2024 On 12/12/2022 at 10:13 AM, Luke said: void SendNotification(NotificationRequest request) Related to this new API, is there a light way to get the users who subscribe to my custom notification? So I can create NotificationRequest just for these users or none. The reason is that it could help save some unnecessary business logic processing. Currently it seems such user filtering happens in SendNotification itself.
Luke 42077 Posted October 23, 2024 Author Posted October 23, 2024 2 minutes ago, sjtuross said: Related to this new API, is there a light way to get the users who subscribe to my custom notification? So I can create NotificationRequest just for these users or none. The reason is that it could help save some unnecessary business logic processing. Currently it seems such user filtering happens in SendNotification itself. Hi, what do you mean by custom notification?
sjtuross 9 Posted October 23, 2024 Posted October 23, 2024 3 minutes ago, Luke said: Hi, what do you mean by custom notification? Thanks for your reply Luke. I created a class inherited from INotificationTypeFactory. That's what I mean custom notification.
Luke 42077 Posted October 23, 2024 Author Posted October 23, 2024 4 hours ago, sjtuross said: Related to this new API, is there a light way to get the users who subscribe to my custom notification? So I can create NotificationRequest just for these users or none. The reason is that it could help save some unnecessary business logic processing. Currently it seems such user filtering happens in SendNotification itself. I see what you mean. Currently there is not, so you'd have to just send it out for all users.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now