🦄 refactor: 改善任务栏歌词兼容性 by apoint123 · Pull Request #825 · imsyy/SPlayer
Summary of Changes
Hello @apoint123, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
此拉取请求旨在显著提升任务栏歌词功能在不同Windows任务栏配置下的兼容性。通过引入更健壮的策略选择和回退机制,特别是针对Windows 11上可能存在的“魔改”任务栏,确保了即使在非标准环境下,歌词也能正常显示。核心改进在于,系统现在能够智能地检测当前任务栏的结构,并在首选策略不适用时,无缝切换到备用策略,从而为用户提供更稳定的体验。
Highlights
- 策略回退机制优化: 改进了任务栏歌词策略的初始化逻辑,现在会根据Windows版本号优先选择策略,并在首选策略初始化失败时,自动尝试备选策略(例如,在Windows 11上,如果Win11策略失败,会回退到Win10策略)。
- Win11策略兼容性增强: Win11任务栏策略现在会检查是否存在特定的XAML桥接窗口。如果该桥接窗口不存在,则认为Win11策略不适用(可能因为任务栏被修改),从而触发回退机制。
- 常量定义集中化: 将
BRIDGE_CLASS常量从uia.rs移动到utils.rs并公开,提高了代码的可维护性和组织性。 - 类型定义文件更新: 为自动生成的
index.d.ts文件添加了/* eslint-disable */注释,以避免Linting警告。
Changelog
- native/taskbar-lyric/src/lib.rs
- 重构了
create_strategy函数,引入了主备策略选择和回退逻辑。 - 根据Windows版本号(>=22000为Win11)确定主备策略的顺序。
- 如果主策略初始化失败,则尝试初始化备用策略。
- 重构了
- native/taskbar-lyric/src/strategy/win11.rs
init方法中新增了对XAML桥接窗口(BRIDGE_CLASS)的检查。- 如果找不到XAML桥接窗口,Win11策略初始化将失败,从而允许系统回退到其他策略。
- 导入
BRIDGE_CLASS常量从utils模块。
- native/taskbar-lyric/src/uia.rs
- 移除了本地定义的
BRIDGE_CLASS常量。 - 现在从
utils模块导入BRIDGE_CLASS。
- 移除了本地定义的
- native/taskbar-lyric/src/utils.rs
- 新增了
pub const BRIDGE_CLASS定义,集中管理此常量。 - 导入
windows_core::PCWSTR。
- 新增了
- native/tools/index.d.ts
- 在文件顶部添加了
/* eslint-disable */注释。
- 在文件顶部添加了
Activity
- 此拉取请求由apoint123创建,目前没有其他活动记录。
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩