sync: from linuxdeepin/dde-session-shell#492
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts the notification parameters used by UpdateWorker::doUpdate based on the ENABLE_DSS_SNIPE build flag to align with upstream dde-session-shell behavior. Sequence diagram for UpdateWorker doUpdate notification parameterssequenceDiagram
participant UpdateWorker
participant NotificationsService as org_freedesktop_Notifications
UpdateWorker->>NotificationsService: Notify(app_name, replaces_id, app_icon, summary, body, actions, hints, expire_timeout)
alt ENABLE_DSS_SNIPE disabled
Note over UpdateWorker,NotificationsService: Build without ENABLE_DSS_SNIPE
UpdateWorker->>NotificationsService: Notify(app_name = Update, replaces_id = 0, app_icon = package-updated-failed, summary = , body = Please_plug_in_and_then_install_updates, actions = [], hints = {}, expire_timeout = default)
else ENABLE_DSS_SNIPE enabled
Note over UpdateWorker,NotificationsService: Build with ENABLE_DSS_SNIPE
UpdateWorker->>NotificationsService: Notify(app_name = org.deepin.dde.control-center, replaces_id = 0, app_icon = , summary = , body = Please_plug_in_and_then_install_updates, actions = [], hints = {}, expire_timeout = default)
end
Class diagram for UpdateWorker doUpdate changeclassDiagram
class UpdateWorker {
+doUpdate(powerOff bool) void
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider moving the shared
.arg(static_cast<uint>(0))call outside the#ifndef/#elseblock so the conditional compilation only wraps the differing arguments, which will make the code easier to read and maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider moving the shared `.arg(static_cast<uint>(0))` call outside the `#ifndef/#else` block so the conditional compilation only wraps the differing arguments, which will make the code easier to read and maintain.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#60
c5b26ed to
9b3347b
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot, yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review这段代码是一个 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进建议
修改后的代码示例(结合建议):// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
// ... (其他代码)
void UpdateWorker::doUpdate(bool powerOff)
{
// ... (前置代码)
QDBusMessage::createMethodCall("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications",
"Notify")
#ifndef ENABLE_DSS_SNIPE
// 标准模式:使用默认应用名称和更新失败图标
.arg(tr("Update"))
.arg(static_cast<uint>(0))
.arg("package-updated-failed")
#else
// 特定模式:使用控制中心作为应用名称,且不显示图标
.arg("org.deepin.dde.control-center")
.arg(static_cast<uint>(0))
.arg(QString()) // 统一使用 QString() 表示无图标
#endif
.arg(QString()) // 统一使用 QString() 代替 ""
.arg(tr("Please plug in and then install updates."))
.arg(QStringList());
// ... (后续代码)
}总体而言,这段代码的修改是为了适配不同的构建环境,逻辑清晰,没有明显的安全隐患。采纳上述关于注释和代码风格的建议后,代码的可维护性将得到进一步提升。 |
Synchronize source files from linuxdeepin/dde-session-shell.
Source-pull-request: linuxdeepin/dde-session-shell#60
Summary by Sourcery
Enhancements: