Skip to content

功能页入口迁移为远程配置驱动 - #33

Open
r1zzup wants to merge 1 commit into
TokenTeam:mainfrom
r1zzup:feat/function-apps-remote-config
Open

功能页入口迁移为远程配置驱动#33
r1zzup wants to merge 1 commit into
TokenTeam:mainfrom
r1zzup:feat/function-apps-remote-config

Conversation

@r1zzup

@r1zzup r1zzup commented Aug 23, 2026

Copy link
Copy Markdown

功能页(学习工具 / 生活服务 / 校园资讯)的入口此前硬编码在前端。本次改为从远程配置仓库(iwut-config)拉取 function-apps.json,由远端控制哪些功能对用户可见,不再需要发版即可上/下线入口。

改动

  • 新增 schemas/function-apps.schema.json:远程配置结构的 JSON Schema(draft-07),约束 id、颜色、路由/链接二选一等规则。
  • 新增 services/function-apps.ts:拉取、解析并校验远程配置,非法条目静默丢弃,route/uri 互斥校验。
  • 新增 store/function-apps.ts:Zustand store,5 分钟节流 + persist 持久化。
  • 修改 app/(tabs)/function.tsx:改为从 store 读取分区与入口,移除本地默认兜底(远程即唯一来源),复用现有 i18n 辅助函数 resolveLocalizedString
  • 修改 .gitignore:补充 .gradle/package-lock.json,避免本地构建噪声入库。
  • 清理 lib/i18n 中已无引用的死键。

验证

  • JSON Schema 经 ajv 校验远程 function-apps.json 通过。
  • 类型检查:新增/改动文件无类型错误(需先 bun install 拉取 main 新引入的依赖)。
  • 未连接网络时页面静默降级为空态,不再兜底展示。

@r1zzup
r1zzup requested a review from zhxycn as a code owner August 23, 2026 19:43

@zhxycn zhxycn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

请清理你的分支,本地构建测试的噪声不应提交至仓库

Comment thread constants/default-function-apps.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

不需要添加默认App这层兜底,我们改为从远端拉取本身就是为了控制哪些功能是用户可见的

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

已移除默认兜底

@r1zzup
r1zzup force-pushed the feat/function-apps-remote-config branch 2 times, most recently from 18076b0 to 0f058f7 Compare August 24, 2026 05:13
Comment thread app/(tabs)/function.tsx Outdated
],
},
];
function resolveLocalizedString(value: LocalizedString): string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i18n辅助函数项目里有,直接使用即可

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

已改用项目现有的 resolveLocalizedString

Comment thread .gitignore
node_modules/

# 项目使用 bun 作为包管理器;package-lock.json 由 npm 生成,不入库
package-lock.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

不应修改此文件

功能页入口由远程配置驱动,支持 route 与 lan 两种类型;新增 schema 校验;移除硬编码与默认兜底;清理 i18n 死键

Co-Authored-By: Claude <noreply@anthropic.com>
@r1zzup
r1zzup force-pushed the feat/function-apps-remote-config branch from 0f058f7 to f7559d3 Compare August 27, 2026 05:41
@r1zzup
r1zzup requested a review from zhxycn August 27, 2026 05:49
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.

2 participants