Skip to content

Conversation

@caixr23
Copy link
Contributor

@caixr23 caixr23 commented Nov 12, 2025

Fixed the issue where WiFi connection notifications were not appearing on the login screen. The problem was caused by incorrect flag handling for network monitoring and secret agent usage. Removed redundant member variables and methods that were duplicating functionality already provided by the NetManagerFlags system. Now properly uses flag-based configuration for network monitoring notifications.

The changes include:

  1. Removed m_monitorNetworkNotify and m_useSecretAgent member variables
  2. Removed setMonitorNetworkNotify() and setUseSecretAgent() methods
  3. Updated notification checks to use NetType::NetManagerFlag::Net_MonitorNotify flag
  4. Fixed logging configuration to use setDefaultCategory() instead of logToGlobalInstance()
  5. Cleaned up commented code and unused methods

Log: Fixed WiFi connection notifications not showing on login screen

Influence:

  1. Test WiFi connection notifications on login screen
  2. Verify network status changes trigger proper notifications
  3. Check that secret agent functionality works correctly
  4. Test network auto-scan functionality
  5. Verify logging system works properly after configuration change

fix: 修复登录界面连接WiFi无通知问题

修复了登录界面连接WiFi时没有通知显示的问题。问题原因是网络监控和密码代理
的标志处理不正确。移除了与NetManagerFlags系统功能重复的冗余成员变量和方
法。现在正确使用基于标志的配置来处理网络监控通知。

修改内容包括:

  1. 移除m_monitorNetworkNotify和m_useSecretAgent成员变量
  2. 移除setMonitorNetworkNotify()和setUseSecretAgent()方法
  3. 更新通知检查以使用NetType::NetManagerFlag::Net_MonitorNotify标志
  4. 修复日志配置,使用setDefaultCategory()替代logToGlobalInstance()
  5. 清理注释代码和未使用方法

Log: 修复登录界面WiFi连接通知不显示问题

Influence:

  1. 测试登录界面的WiFi连接通知功能
  2. 验证网络状态变化是否触发正确的通知
  3. 检查密码代理功能是否正常工作
  4. 测试网络自动扫描功能
  5. 验证日志系统在配置更改后正常工作

PMS: BUG-315291

Summary by Sourcery

Use flag-based configuration for network monitoring and secret agent, fix missing WiFi notifications on the login screen, and clean up redundant code and logging setup

Bug Fixes:

  • Fix WiFi connection notifications not appearing on the login screen by using the Net_MonitorNotify flag
  • Correct secret agent flag handling in notification logging

Enhancements:

  • Remove redundant m_monitorNetworkNotify and m_useSecretAgent members and related setter methods
  • Clean up commented and unused code
  • Update logging configuration to use setDefaultCategory instead of logToGlobalInstance

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 12, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR resolves the missing WiFi connection notifications on the login screen by removing redundant flag-related members and methods, migrating notification logic to use the NetManagerFlags system, updating the logging configuration, and cleaning up obsolete code.

Sequence diagram for WiFi connection notification logic using NetManagerFlags

sequenceDiagram
participant NetManagerThreadPrivate
participant NetworkManager_Device

NetManagerThreadPrivate->>NetworkManager_Device: addDeviceNotify(path)
alt Net_MonitorNotify flag is set
    NetManagerThreadPrivate->>NetworkManager_Device: Notify device status changed
else Net_MonitorNotify flag is not set
    NetManagerThreadPrivate-->>NetworkManager_Device: (No notification sent)
end
Loading

Sequence diagram for logging configuration update

sequenceDiagram
participant NetworkController
participant DtkCoreLoggerInstance

NetworkController->>DtkCoreLoggerInstance: setDefaultCategory(DNC().categoryName())
Loading

Class diagram for updated NetManagerThreadPrivate and NetManagerPrivate

classDiagram
class NetManagerThreadPrivate {
    +bool AirplaneModeEnabled()
    +void setEnabled(bool enabled)
    +void setAutoScanInterval(int ms)
    +void setAutoScanEnabled(bool enabled)
    +void setServerKey(const QString &serverKey)
    +void setNetCheckAvailable(bool available)
    +void setSecretAgent(QObject *agent)
    +void setFlags(NetType::NetManagerFlags flags)
    -NetType::NetManagerFlags m_flags
    -bool m_isInitialized
    -bool m_enabled
    -int m_autoScanInterval
    // Removed:
    // -bool m_monitorNetworkNotify
    // -bool m_useSecretAgent
    // -void setMonitorNetworkNotify(bool monitor)
    // -void setUseSecretAgent(bool enabled)
}

class NetManagerPrivate {
    +void setAutoScanInterval(int ms)
    +void setAutoScanEnabled(bool enabled)
    +void setEnabled(bool enabled)
    // Removed:
    // -void setMonitorNetworkNotify(bool monitor)
    // -void setUseSecretAgent(bool enabled)
}

NetManagerThreadPrivate <|-- NetManagerPrivate
Loading

File-Level Changes

Change Details Files
Removed redundant network notification flags and methods
  • Removed m_monitorNetworkNotify and m_useSecretAgent member variables
  • Deleted setMonitorNetworkNotify() and setUseSecretAgent() methods
  • Removed related declarations in NetManager and NetManagerPrivate headers
net-view/operation/private/netmanagerthreadprivate.cpp
net-view/operation/netmanager.cpp
net-view/operation/netmanager.h
net-view/operation/private/netmanagerthreadprivate.h
net-view/operation/private/netmanager_p.h
Migrated notification checks to flag-based logic
  • Replaced m_monitorNetworkNotify guard with Net_MonitorNotify flag tests in addDeviceNotify
  • Updated onNotifyDeviceStatusChanged to use Net_MonitorNotify flag
net-view/operation/private/netmanagerthreadprivate.cpp
Updated logging configuration to use default category
  • Replaced logToGlobalInstance() call with setDefaultCategory() for DNC logger
src/networkcontroller.cpp
Cleaned up commented and unused code
  • Removed commented-out service and notification setup in networkmodule
  • Deleted obsolete setters and commented methods in headers
dss-network-plugin/networkmodule.cpp
net-view/operation/netmanager.h
net-view/operation/private/netmanager_p.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, robertkill

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Fixed the issue where WiFi connection notifications were not appearing
on the login screen. The problem was caused by incorrect flag handling
for network monitoring and secret agent usage. Removed redundant member
variables and methods that were duplicating functionality already
provided by the NetManagerFlags system. Now properly uses flag-based
configuration for network monitoring notifications.

The changes include:
1. Removed m_monitorNetworkNotify and m_useSecretAgent member variables
2. Removed setMonitorNetworkNotify() and setUseSecretAgent() methods
3. Updated notification checks to use
NetType::NetManagerFlag::Net_MonitorNotify flag
4. Fixed logging configuration to use setDefaultCategory() instead of
logToGlobalInstance()
5. Cleaned up commented code and unused methods

Log: Fixed WiFi connection notifications not showing on login screen

Influence:
1. Test WiFi connection notifications on login screen
2. Verify network status changes trigger proper notifications
3. Check that secret agent functionality works correctly
4. Test network auto-scan functionality
5. Verify logging system works properly after configuration change

fix: 修复登录界面连接WiFi无通知问题

修复了登录界面连接WiFi时没有通知显示的问题。问题原因是网络监控和密码代理
的标志处理不正确。移除了与NetManagerFlags系统功能重复的冗余成员变量和方
法。现在正确使用基于标志的配置来处理网络监控通知。

修改内容包括:
1. 移除m_monitorNetworkNotify和m_useSecretAgent成员变量
2. 移除setMonitorNetworkNotify()和setUseSecretAgent()方法
3. 更新通知检查以使用NetType::NetManagerFlag::Net_MonitorNotify标志
4. 修复日志配置,使用setDefaultCategory()替代logToGlobalInstance()
5. 清理注释代码和未使用方法

Log: 修复登录界面WiFi连接通知不显示问题

Influence:
1. 测试登录界面的WiFi连接通知功能
2. 验证网络状态变化是否触发正确的通知
3. 检查密码代理功能是否正常工作
4. 测试网络自动扫描功能
5. 验证日志系统在配置更改后正常工作

PMS: BUG-315291
@caixr23 caixr23 merged commit 55f53da into linuxdeepin:master Nov 12, 2025
13 of 16 checks passed
@caixr23 caixr23 deleted the BUG-315291 branch November 12, 2025 08:51
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这段代码修改进行审查分析:

  1. 代码逻辑改进:
  • 移除了多个冗余的配置方法,如 setMonitorNetworkNotify() 和 setUseSecretAgent(),改用统一的 NetManagerFlags 来管理配置,这是一个好的设计改进。
  • 将 m_isInitialized 的设置位置从 doInit() 开始移到末尾,这样可以确保所有初始化操作都完成后再标记为已初始化,更加安全。
  1. 代码质量提升:
  • 删除了注释掉的代码,使代码更加整洁。
  • 移除了重复的 m_isInitialized = true 设置。
  • 统一了配置管理方式,使用 flags 替代多个独立的布尔变量。
  1. 性能优化:
  • 使用 flags.testFlag() 替代直接访问布尔变量,虽然性能影响很小,但代码更加统一和可维护。
  1. 安全性考虑:
  • 修改日志记录方式,从 logToGlobalInstance 改为 setDefaultCategory,这样可以更好地控制日志输出范围。

建议改进:

  1. 在 NetManagerThreadPrivate::doInit() 中,建议将 m_isInitialized 的设置放在 try-catch 块中,以确保即使初始化过程中出现异常,也能正确处理状态。

  2. 对于 flags 的使用,建议添加更多的文档注释,说明每个 flag 的具体作用和使用场景。

  3. 在删除 setMonitorNetworkNotify() 等方法时,建议在代码提交信息中记录这一变更,以便其他开发者了解这一改动。

  4. 建议对 NetManagerFlags 的值进行范围检查,防止设置无效的标志位。

总体来说,这次改动提升了代码的可维护性和一致性,是一次很好的重构。

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.

3 participants