Skip to content

feat(macOS): 添加复制版本信息功能并显示 Core 版本 - #90

Open
ColdSpellhere wants to merge 2 commits into
MaaAssistantArknights:masterfrom
ColdSpellhere:feat/macos-version-info
Open

feat(macOS): 添加复制版本信息功能并显示 Core 版本#90
ColdSpellhere wants to merge 2 commits into
MaaAssistantArknights:masterfrom
ColdSpellhere:feat/macos-version-info

Conversation

@ColdSpellhere

@ColdSpellhere ColdSpellhere commented May 25, 2026

Copy link
Copy Markdown
Contributor

变更内容

  • 在 macOS 设置页新增“复制版本信息”功能,方便用户反馈 issue 时复制环境信息
  • 复制内容包含:
    • UI Version
    • Core Version
    • Resource Version
    • Resource Time
  • 在 GUI 资源版本日志中显示 Core 版本,方便从界面日志中确认当前 Core 构建版本
  • 暂不包含 Build Time,避免扩大改动范围

实现说明

  • UI Version 读取自 App Bundle 的 CFBundleShortVersionString
  • Core Version 通过 Core 侧 AsstGetVersion() 获取
  • Resource Version / Resource Time 复用现有 resourceChannel.version() 结果
  • macOS 侧通过 @_silgen_name("AsstGetVersion") 绑定 Core 符号
  • 未修改公共 Core 头文件,也未修改构建产物

本地测试

Debug 构建下复制版本信息结果示例:

UI Version: v1.0
Core Version: DEBUG_VERSION
Resource Version: 承诺
Resource Time: 2026-05-22 11:36:07.000

GUI 资源版本日志示例:

内置资源版本:承诺
更新时间:2026-05-22 11:36:07.000
Core 版本:DEBUG_VERSION

Debug 构建下 UI Version 来自 Version.xcconfig 中的 MARKETING_VERSION = 1.0,Core Version 来自 Debug Core 的 MAA_VERSION,因此显示为 v1.0DEBUG_VERSION

展示视频

Recording.at.2026-05-25.15.19.48.mp4

由 Sourcery 提供的摘要

为 macOS UI 添加复制详细版本信息的支持,并在应用中暴露 Core 版本数据。

新功能:

  • 在 macOS 设置中添加一个按钮,将 UI、Core 和资源的版本信息复制到剪贴板。

增强内容:

  • 将 Maa core 库中的 Core 版本信息暴露给 macOS 应用,并将其包含到资源版本日志中。
Original summary in English

Summary by Sourcery

Add macOS UI support for copying detailed version information and expose Core version data in the app.

New Features:

  • Add a macOS settings button to copy UI, Core, and resource version information to the clipboard.

Enhancements:

  • Expose Core version from the Maa core library to the macOS app and include it in resource version logs.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - 我在这里给出了一些整体性的反馈:

  • MAAProvider.coreVersion 目前在每次访问时都会调用 AsstGetVersion 并构造一个 String;建议缓存这个结果(例如使用 lazy static),以及/或者对可能为 null 或无效的 C 字符串做处理,以避免重复的 FFI 调用,以及在指针异常时可能发生的崩溃。
  • 版本文案的格式现在在 MaaVersionInfo.text 中构造了一次,而在日志消息中又单独构造了一次(MaaCore 版本 vs Core Version);建议将这部分格式化逻辑(以及术语)统一起来,这样可以在 UI 文案和日志之间长期保持一致性。
给 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- `MAAProvider.coreVersion` currently calls `AsstGetVersion` and constructs a `String` every time it's accessed; consider caching the result (e.g., a lazy static) and/or handling a potential null/invalid C string to avoid repeated FFI calls and possible crashes if the pointer is unexpected.
- The version text format is now constructed in `MaaVersionInfo.text` and separately in the log message (`MaaCore 版本` vs `Core Version`); consider centralizing the formatting (and terminology) so that the UI copy and logs stay consistent over time.

Sourcery 对开源项目是免费的——如果你喜欢我们的代码审查,请考虑帮忙分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈来改进以后的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • MAAProvider.coreVersion currently calls AsstGetVersion and constructs a String every time it's accessed; consider caching the result (e.g., a lazy static) and/or handling a potential null/invalid C string to avoid repeated FFI calls and possible crashes if the pointer is unexpected.
  • The version text format is now constructed in MaaVersionInfo.text and separately in the log message (MaaCore 版本 vs Core Version); consider centralizing the formatting (and terminology) so that the UI copy and logs stay consistent over time.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- `MAAProvider.coreVersion` currently calls `AsstGetVersion` and constructs a `String` every time it's accessed; consider caching the result (e.g., a lazy static) and/or handling a potential null/invalid C string to avoid repeated FFI calls and possible crashes if the pointer is unexpected.
- The version text format is now constructed in `MaaVersionInfo.text` and separately in the log message (`MaaCore 版本` vs `Core Version`); consider centralizing the formatting (and terminology) so that the UI copy and logs stay consistent over time.

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.

@ColdSpellhere

Copy link
Copy Markdown
Contributor Author

Hey - 我在这里给出了一些整体性的反馈:

  • MAAProvider.coreVersion 目前在每次访问时都会调用 AsstGetVersion 并构造一个 String;建议缓存这个结果(例如使用 lazy static),以及/或者对可能为 null 或无效的 C 字符串做处理,以避免重复的 FFI 调用,以及在指针异常时可能发生的崩溃。
  • 版本文案的格式现在在 MaaVersionInfo.text 中构造了一次,而在日志消息中又单独构造了一次(MaaCore 版本 vs Core Version);建议将这部分格式化逻辑(以及术语)统一起来,这样可以在 UI 文案和日志之间长期保持一致性。

给 AI 代理的提示

Please address the comments from this code review:

## Overall Comments
- `MAAProvider.coreVersion` currently calls `AsstGetVersion` and constructs a `String` every time it's accessed; consider caching the result (e.g., a lazy static) and/or handling a potential null/invalid C string to avoid repeated FFI calls and possible crashes if the pointer is unexpected.
- The version text format is now constructed in `MaaVersionInfo.text` and separately in the log message (`MaaCore 版本` vs `Core Version`); consider centralizing the formatting (and terminology) so that the UI copy and logs stay consistent over time.

Sourcery 对开源项目是免费的——如果你喜欢我们的代码审查,请考虑帮忙分享 ✨

帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈来改进以后的代码审查。
Original comment in English

已根据建议调整

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