Keep Edit Widget choices when an app moves an existing configurable widget to Voltra

未关闭
#393 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@mrevanzak 已经在做这个了。

开始于 2026年11月24日。

  • #394 来自 @mrevanzak —— 未关闭

评估

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

调研方向

Start in the config plugin's app.json schema and prebuild validation, then follow the codegen that emits the VoltraWidget_<id>_Intent and VoltraWidget_<id>_<param>_Choice Swift types. Read #391 for the dynamicOptions parameter handling and #392, which this proposal is a patch on top of. Done means intentName and entityName are accepted, default to today's names, invalid Swift identifiers are rejected at prebuild, and two widgets sharing a name generate one intent type.

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

描述

An app that moves a configurable widget from hand-written WidgetKit code to Voltra resets every placed widget's Edit Widget choices on update. iOS saves a placed widget's configuration under the Swift type names of its WidgetConfigurationIntent and of the AppEntity values in it. Voltra generates its own names (VoltraWidget_<id>_Intent, VoltraWidget_<id>_<param>_Choice), so the saved configuration no longer matches and each widget falls back to its default. Ours had a masjid picker, so after updating, people who picked a masjid other than their first would see the wrong one until they picked it again.

Proposal: let app.json name those types.

"appIntent": {
  "intentName": "SelectMasjidConfigurationAppIntent",
  "parameters": [
    { "name": "masjid", "title": "Masjid", "dynamicOptions": true, "entityName": "FollowedMasjid" }
  ]
}
  • appIntent.intentName names the generated WidgetConfigurationIntent.
  • entityName on a dynamicOptions parameter (#391) names the generated AppEntity, and its query becomes <entityName>Query.
  • Widgets can share an intent, as ours did: two widgets with the same name use one type, generated once.

Both default to today's names, and prebuild rejects a value that isn't a Swift identifier.

We run this as a patch on top of #392. On a simulator, a widget placed and configured with our old hand-written build kept its choice after installing the Voltra build over it. The old entity's id was an Int and the generated one is a String, and the extension's module name changed too; neither stopped the configuration from carrying over.

主要语言
TypeScript
星标
865
派生
50
平均合并
2 天 22 小时
30 天内合并 PR
18

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

callstackincubator/voltra 的其他 Issue

查看 callstackincubator/voltra 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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