Skip to content

添加websocket和smtp通知方法,添加bark通知,websocket为qq机器人预留。 #1254

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

Merged
merged 32 commits into from
Mar 12, 2025

Conversation

wy3057
Copy link
Contributor

@wy3057 wy3057 commented Mar 9, 2025

This pull request introduces several new features and enhancements to the notification system in the BetterGenshinImpact project. The most significant changes include the addition of WebSocket and Email notification support, as well as the necessary configurations and initializations for these new notifiers.

New Notification Features:

  • Added WebSocket notification support:

    • Introduced a new WebSocketNotifier class to handle WebSocket notifications.
    • Updated NotificationConfig to include properties for WebSocket configuration.
    • Updated NotificationService to initialize the WebSocketNotifier based on configuration.
  • Added Email notification support:

    • Introduced a new EmailNotifier class to handle Email notifications.
    • Updated NotificationConfig to include properties for Email configuration.
    • Updated NotificationService to initialize the EmailNotifier based on configuration.

Configuration and Initialization:

  • Updated NotificationConfig class to include new properties for WebSocket and Email configurations.
  • Updated NotificationService to initialize the new notifiers based on the provided configurations.

Minor Changes:

  • Added necessary using directives in NotificationConfig.cs and NotificationService.cs for new dependencies. [1] [2]
  • Adjusted design height in CommonSettingsPage.xaml to accommodate new settings.

@huiyadanli huiyadanli requested a review from Copilot March 9, 2025 16:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR introduces new notification methods via WebSocket and Email in the BetterGenshinImpact project, expanding the notification system's capabilities.

  • Added EmailNotifier and WebSocketNotifier implementations
  • Updated NotificationService to initialize and register these new notifiers based on configuration
  • Enhanced NotificationConfig to include settings for the new notifiers

Reviewed Changes

File Description
BetterGenshinImpact/Service/Notifier/EmailNotifier.cs Adds asynchronous email sending via SMTP with basic error handling
BetterGenshinImpact/Service/Notifier/WebSocketNotifier.cs Introduces WebSocket-based notification sending with connection management
BetterGenshinImpact/Service/Notification/NotificationService.cs Includes initialization logic for WebSocketNotifier and EmailNotifier in the service startup
BetterGenshinImpact/Service/Notification/NotificationConfig.cs Extends configuration to support WebSocket and Email notifications
BetterGenshinImpact/ViewModel/Pages/CommonSettingsPageViewModel.cs Adds test command methods for WebSocket and Email notifications

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


await smtpClient.SendMailAsync(mailMessage);
}
catch (System.Exception ex)

This comment was marked as off-topic.

@huiyadanli
Copy link
Member

话说邮件通知值得把图片加上吗

@wy3057
Copy link
Contributor Author

wy3057 commented Mar 9, 2025

如果用qq邮箱的话应该是很方便的,能直接点进去看见
image

- 提升 EmailNotifier 中的 SmtpClient 为类的成员变量,并在构造函数中初始化,优化资源使用
- 改进 WebSocketNotifier 的连接和重连逻辑,提高稳定性
- 优化通知器的错误处理和日志记录,增强可维护性
@wy3057 wy3057 changed the title 添加websocket和smtp通知方法,websocket为qq机器人预留。 添加websocket和smtp通知方法,添加bark通知,websocket为qq机器人预留。 Mar 12, 2025
@wy3057 wy3057 requested a review from Copilot March 12, 2025 08:55
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces three new notification methods—WebSocket, Email, and Bark—to enhance the notification system. It also updates configuration and initialization routines in the NotificationService and adds corresponding test commands in the settings page.

  • Added EmailNotifier, WebSocketNotifier, and BarkNotifier classes
  • Extended NotificationConfig with new properties, and updated NotificationService to register the new notifiers
  • Added UI commands in the settings page to test the new notification channels

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
BetterGenshinImpact/Service/Notifier/EmailNotifier.cs Introduces email notification functionality
BetterGenshinImpact/Service/Notifier/WebSocketNotifier.cs Adds WebSocket notifications with connection handling
BetterGenshinImpact/Service/Notifier/BarkNotifier.cs Implements Bark notifications; potential issue with device keys iteration
BetterGenshinImpact/Service/Notification/NotificationService.cs Updates notifier registration and adds resource disposal
BetterGenshinImpact/Service/Notification/NotificationConfig.cs Adds configuration for WebSocket, Email, and Bark
BetterGenshinImpact/ViewModel/Pages/CommonSettingsPageViewModel.cs Adds test command methods for new notifications

@huiyadanli huiyadanli merged commit 6becb9d into babalae:main Mar 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants