Show the app version on the About screen

未关闭 适合新手
#31 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
react-native, typescript
领域
mobile

调研方向

从 apps/mobile/src/app/about.tsx、apps/mobile/src/adapters/device-lab.ts 中的 appVersion() 适配器,以及 apps/mobile/src/one-turn.test.ts 中对应的测试模式开始。在两个 locale 文件中添加版本文案键,并在 apps/mobile/preview/src/stubs/adapters.ts 中添加 preview stub;更新 apps/mobile/preview/shots.mjs 中 About 的截图配置。运行列出的 mobile 和 copy 测试以及 typecheck;完成标准是 About 显示可选择的本地化版本,并且两个 locale 中都存在所请求的 Light 和 Deep sea 截图。

由索引模型根据 Issue 内容生成。

描述

copy good first issue ui

Why

The bug form asks for "the version on the About screen", but About doesn't show one. Now that preview APKs are on GitHub Releases, people need it to say which build they run (ROADMAP.md, Now: preview APKs).

What to do

Today About is apps/mobile/src/app/about.tsx (copy keys HM-SET-08.*). The app's version is already read for the Device lab report by appVersion() in apps/mobile/src/adapters/device-lab.ts, from Constants.expoConfig?.version.

  1. Test first: add apps/mobile/src/about-version.test.ts (node:test). It reads src/app/about.tsx and checks that the screen shows the copy key HM-SET-08.version filled with appVersion(). apps/mobile/src/one-turn.test.ts reads a screen's source the same way. Watch it fail.
  2. Add HM-SET-08.version to packages/copy/locales/en.json ("Version {version}") and packages/copy/locales/es-419.json ("Versión {version}").
  3. In about.tsx, show it under the body text as a small, soft line, and make it selectable so people can copy it into a bug report.
  4. The preview harness replaces everything in src/adapters with apps/mobile/preview/src/stubs/adapters.ts. Add appVersion there, returning a version like "0.1.0-preview.1", so the preview still builds.
  5. Take the screenshots. The About shot in apps/mobile/preview/shots.mjs uses other(...), which shoots es-419 only; switch it to core(...) for English too, or take them on a phone.

Done when

  • About shows the app's version: on a dev build, the one in apps/mobile/app.json; on a preview APK, the tag's version, which the release workflow writes into app.json before it builds.
  • The line is selectable.
  • The pull request has screenshots of About in light and Deep sea, es-419 and en.

How to check

pnpm --filter @hermit/mobile test
pnpm --filter @hermit/copy test
pnpm --filter @hermit/mobile typecheck

With the preview harness (Apple silicon Mac today): cd apps/mobile/preview && pnpm build && pnpm shoot about.

Keep in mind

  • The string lives in packages/copy, in both locales, with the same {version} placeholder and no em or en dashes.
  • Don't import expo-constants in the screen. Screens get phone facts through src/adapters, which the preview replaces.
  • The tagline, the signature and the disclaimer on About are brand lines kept as they are on purpose (see the comment at the top of about.tsx). Leave them alone.
主要语言
TypeScript
星标
11
派生
0
平均合并
10 分钟
30 天内合并 PR
6

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DojoCodingLabs/hermit 的其他 Issue

查看 DojoCodingLabs/hermit 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。