Luke 37099 Posted December 11, 2022 Share 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 ! Link to comment Share on other sites More sharing options...
TeamB 2353 Posted December 11, 2022 Share 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? Link to comment Share on other sites More sharing options...
Luke 37099 Posted December 12, 2022 Author Share 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. Link to comment Share on other sites More sharing options...
Luke 37099 Posted December 12, 2022 Author Share 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. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted December 12, 2022 Share 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? Link to comment Share on other sites More sharing options...
Luke 37099 Posted December 12, 2022 Author Share 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. Link to comment Share on other sites More sharing options...
Albertax 12 Posted December 12, 2022 Share Posted December 12, 2022 Will DiscordNotifications require an update work in the new beta. I’m on mobile but it’s saying Undefined Link to comment Share on other sites More sharing options...
Luke 37099 Posted December 12, 2022 Author Share 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? Link to comment Share on other sites More sharing options...
Albertax 12 Posted December 12, 2022 Share Posted December 12, 2022 3 hours ago, Luke said: Yes. Who develops that? @rechigo seems to Link to comment Share on other sites More sharing options...
Albertax 12 Posted January 13, 2023 Share Posted January 13, 2023 @LukeHi Luke, if @rechigo has been inactive for a while - does this mean the plugin will never be updated again? Link to comment Share on other sites More sharing options...
Luke 37099 Posted January 13, 2023 Author Share 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. Link to comment Share on other sites More sharing options...
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