基本功能

This commit is contained in:
吕新雨
2026-01-28 22:13:55 +08:00
parent 049995692d
commit b485b52eec
6 changed files with 488 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
# iOS Widget技术计划V1 写死文案)
## 1. 计划目标
在 iOS 上实现真正可添加到桌面的小组件WidgetKit ExtensionV1 先展示**写死的美观文案**,不做 App->Widget 数据同步与更新。
- **构建方式**:方案 A`expo prebuild` + Xcode
- **点击跳转**:跳转到 App 的 Home
- **尺寸**Small / Medium / Large 都支持
## 2. 默认技术决策
- **小组件实现**iOS 原生 WidgetKit ExtensionSwiftUI
- **数据来源**V1 写死在 Widget 代码内
- **跳转**:使用 Widget 的 `widgetURL` 打开 App深链
- **App 侧路由**:使用现有 `expo-router`
## 3. Deep Link 约定(点击小组件打开 Home
### 3.1 Scheme
当前 `client/app.json` 中已存在:
- `expo.scheme = "client"`
因此小组件点击跳转使用:
- `client:///(app)/home`
> 说明:这是 expo-router 的路径形态;若你后续调整路由结构,需要同步更新此 URL。
## 4. 实施步骤(高层)
1. **预构建 iOS 原生工程**:生成 `client/ios/`
2. **在 Xcode 创建 WidgetKit Extension**:命名例如 `MindfulnessWidget`
3. **实现 3 种尺寸 UI**Small/Medium/Large 都展示写死文案,但排版适配不同尺寸
4. **设置点击跳转**:为 Widget 配置 `widgetURL` 指向 `client:///(app)/home`
5. **本地运行验证**:在模拟器安装 App添加桌面小组件并验证显示与跳转
## 5. 验收标准
- 可以在 iOS 桌面添加小组件Small/Medium/Large
- 小组件展示写死文案,排版美观
- 点击小组件能打开 App 并进入 Home
## 6. 风险与注意事项
- **Expo Go 不支持**:必须用 Xcode 运行预构建后的 App或后续 EAS Build
- **Bundle Identifier**:当前 `client/app.json` 使用 `com.anonymous.client`,仅适合本地验证;上线前需替换为真实 bundle id并同步证书/签名