Skip to content

Comments

🐛 修复点击更新日志通知打开页面问题#1266

Merged
CodFrm merged 3 commits intorelease/v1.3from
fix/update-notification
Feb 19, 2026
Merged

🐛 修复点击更新日志通知打开页面问题#1266
CodFrm merged 3 commits intorelease/v1.3from
fix/update-notification

Conversation

@CodFrm
Copy link
Member

@CodFrm CodFrm commented Feb 18, 2026

概述 Descriptions

变更内容 Changes

截图 Screenshots

@CodFrm CodFrm requested a review from Copilot February 18, 2026 14:27
@CodFrm CodFrm requested review from Copilot and removed request for Copilot February 18, 2026 14:34
Copy link
Contributor

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 PR fixes an issue where clicking on the update log notification doesn't properly open the documentation page. The fix moves the notification creation logic to a centralized location and adds support for URL options in notifications.

Changes:

  • Moved InfoNotification function from utils to service worker with enhanced URL handling capability
  • Added caching mechanism to store notification options (including URLs) for later retrieval
  • Implemented click handler in GMApi to open URLs when notifications are clicked

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pkg/utils/utils.ts Removed the original InfoNotification function
src/app/service/service_worker/utils.ts Added enhanced InfoNotification function with URL option support and caching
src/app/service/service_worker/synchronize.ts Updated import to use new InfoNotification location
src/app/service/service_worker/subscribe.ts Updated import to use new InfoNotification location
src/app/service/service_worker/index.ts Updated import and added URL parameter when creating update notification
src/app/service/service_worker/gm_api/gm_api.ts Added notification click handler to open URLs and clean up cache
src/manifest.json Bumped version from 1.3.0.1400 to 1.3.0.1500
package.json Bumped version from 1.3.0-beta.3 to 1.3.0-beta.4

Comment on lines +1338 to +1341
} else if (event === "close") {
// 删除缓存
cacheInstance.del(`notification:${notificationId}:options`);
}
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

当通知被清除时,缓存也应该被删除。建议在第1336行 chrome.notifications.clear(notificationId) 之前也调用 cacheInstance.del(),以确保在所有情况下都能正确清理缓存。或者,可以将缓存删除逻辑提取为一个独立的函数来避免重复。

Copilot uses AI. Check for mistakes.
export type NotificationOptionCache = {
url?: string;
};

Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

函数缺少文档注释。建议添加 JSDoc 注释说明该函数的用途、参数含义以及 options 参数的作用,特别是 URL 选项会如何影响通知的行为。

Suggested change
/**
* 显示基础通知,并可选地为通知绑定额外参数(如跳转 URL)。
*
* 当提供 {@link NotificationOptionCache.url} 时,会将该选项与通知 ID 关联后
* 缓存到 {@link cacheInstance} 中,键名格式为 `notification:{notificationId}:options`
* 以便在 gm_api 中统一根据通知 ID 读取并处理(例如在点击通知时打开对应的 URL)。
*
* @param title 通知标题。
* @param msg 通知内容文本。
* @param options 额外的通知选项,例如 `url` 字段用于指定后续处理时需要打开的页面地址。
*/

Copilot uses AI. Check for mistakes.
@CodFrm CodFrm merged commit 75180b7 into release/v1.3 Feb 19, 2026
8 of 9 checks 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.

1 participant