Skip to content

主题模式仅保存在本地 - #17

Open
reece00 wants to merge 3 commits into
TransmtfTeam:mainfrom
reece00:codex/local-theme-mode
Open

reece00 wants to merge 3 commits into
TransmtfTeam:mainfrom
reece00:codex/local-theme-mode

Conversation

@reece00

@reece00 reece00 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

背景说明

不同设备的使用环境与用户偏好可能不同,同一账户在手机、电脑等设备上可能需要不同的明暗显示模式。因此 themeMode 仅保存在当前设备,不参与跨设备云同步;themeColor 继续按既有行为参与云同步。主题模式不再同步后,无需继续保留旧 darkMode 字段的兼容读写。

修改内容

  • 云同步快照、上传载荷、拉取处理、冲突差异及回滚不再包含 themeMode 和 darkMode。
  • 删除旧 darkMode 的本地存储回退、镜像写入和跨标签监听;同步哈希类型与未使用翻译项一并清理。
  • 旧版仅保存 hrt-dark-mode 的显示偏好不再迁移或继承;缺少或无效 themeMode 时,预渲染脚本和 ThemeContext 均默认使用 system。这是预期行为,显式的 light、dark、system 选择保持不变。
  • 同步哈希 schema 升级至 v5,哈希和冲突判断仅覆盖仍需跨设备同步的字段。

实现说明

  • src/contexts/CloudSyncContext.tsx:从同步字段集合、本地快照、上传、云端应用、冲突合并/回滚及跨标签触发条件中移除 themeMode 和 darkMode。
  • src/contexts/AppDataContext.tsx:移除主题模式和旧布尔字段的哈希计算、同步键监听及云端更新转发。
  • src/components/SyncConflictModal.tsx:删除不再同步的主题模式和旧深色标记的冲突字段显示与格式化。
  • src/pages/SettingsPage.tsx:导入后的同步哈希计算不再附加本地主题模式字段。
  • src/contexts/ThemeContext.tsx 与 index.html:仅以 hrt-theme-mode 作为本地模式来源,移除旧键回退与镜像写入,并统一 system 默认值。
  • src/utils/dataHash.ts 与 src/utils/dataHash.test.ts:收紧同步数据类型,并断言投影只包含当前同步字段。
  • src/i18n/translations.ts:删除旧深色模式冲突字段的中英文翻译。

@reece00 reece00 changed the title 同步层移除主题模式字段 主题模式仅保存在本地 Sep 14, 2026
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