更新 shenyan-app: HealthKit+WeatherKit+冰箱贴+pare+三区布局

- HealthKitBridge.m: 自定义原生模块,心率/步数/睡眠采集
- WeatherKitBridge.swift/m: 天气模块,当前+每日+每小时预报
- pare.py: 身体数据陡度监控,阈值告警→inbox+冰箱贴
- cyberboss: 5-20分钟随机唤醒,pare→decide→push
- 冰箱贴: 纸质感卡片,黑字多级透明度,独立输入框
- 首页三区无视觉布局: 左门/中记录/右冰箱
- 端口3003→3004(VS Code占用)
- 聊天屏锚定底部滚动

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 19:14:32 +08:00
parent d07d50dde5
commit 2a053ab88e
12 changed files with 791 additions and 184 deletions

View File

@@ -2,71 +2,63 @@
## 当前状态
iOS 真机可运行。双桥Mac + IDC通信。自制定制横幅推送。APNs Key 已备。Gitea 代码仓库已建
iOS 真机。Mac 桥单通道。APNs 后台推送已通。cyberboss + pare 主动联系。HealthKit + WeatherKit 身体天气。冰箱贴 + 三区无视觉布局
## 已完成
### 苹果开发者
- 付费开发者账号Team: Xiulun Wang, ID: ZZMLW32PHH
- Bundle ID: `com.shenyan.room`
- 真机签名、构建、安装全链路通
- 付费账号Team: Xiulun Wang, ID: ZZMLW32PHHBundle ID: com.shenyan.room
- APNs Key: 3VJ5X6V9Q8设备 token 已获取,后台推送已通
- WeatherKit 权限 + HealthKit 权限
### 首页
-张 bridge 状态图away / online / busy全屏
- 每 8 秒轮询 `101.36.73.102/health`
- 底部半透明状态文字
- 左半屏双击「敲门」进聊天室350ms 双击窗口POST /knock
-区无视觉布局左门50%双击敲)、中记录(窄竖条)、右冰箱贴
- Bridge 状态轮询,三张图片全屏背景
### 聊天屏
- FlatList 自动滚底消息持久化AsyncStorage + /history
- 用户消息右对齐rgba 0.1AI 消息左对齐rgba 0.06),圆角
- 桥断开提示「消息没发出去检查WiFi连接」
- 退出再进消息不丢
- FlatList 锚定底部onContentSizeChange + maintainVisibleContentPosition
- 消息 AsyncStorage 持久化 + /history
- 气泡 25% 白,聊天屏内不弹横幅
### 双桥通信
- **Mac 桥** `192.168.31.51:3003`Claude Code 异步回复Monitor + /respond
- **IDC 桥** `101.36.73.102`DeepSeek 同步回复POST /api/chat
- 发一条消息同时到两边,用户看到两个「阿晏」
### 推送通知(定制横幅 + 震动)
- 自制定制 Animated 横幅,从顶部滑下
- 暗色半透明背景 + 细白边框,点击关闭
- 3.5 秒自动消失
- Vibration.vibrate(400) 震动
- 覆盖首页和聊天屏
### 通信
- Mac 桥 `192.168.31.51:3004`3003 被 VS Code 占
- 端点: /send, /respond, /knock, /push, /push/clear, /poll, /history, /register-device, /notes, /notes/add, /notes/reply
- launchd 持久化
### APNs
- Key 已创建Key ID `3VJ5X6V9Q8`Team ID `ZZMLW32PHH`
- Key 文件:`bridge-local/AuthKey_3VJ5X6V9Q8.p8`
- 环境Sandbox & Production
- 桥端 apns.js 已写好JWT + HTTP/2
- 阻塞notifee `getAPNSToken()` 在 iOS 26 返回 null
- AppDelegate 原生注册 + Bridging Header点通知进聊天badge 清零
- 定制横幅 + 震动,前台/后台/锁屏全场景
### App 图标
- 已替换为眠眠设计的图标2048x2048 → 各尺寸)
### cyberboss + pare
- 5-20 分钟随机唤醒pare 先扫健康陡度 → decide.py 判断是否推
- pare 阈值: 心率±20/过高120/过低50/步数骤增2000/活动<100/睡眠<4h
- alert 同时入 inbox + 冰箱贴
### 本地桥bridge-local/server.js
- 端口 3003launchd 持久化
- 数据目录:`~/.shenyan-bridge/`
- 端点:/send, /respond, /knock, /push, /push/clear, /poll, /history, /register-device
- APNs 模块apns.jsJWT 生成 + HTTP/2 推送)
### HealthKit
- 自定义 ObjC 模块(兼容 Fabric interop每 10 分钟采心率/步数/睡眠
### WeatherKit
- Swift + ObjC 桥接模块,当前天气 + 每日/每小时预报
### 冰箱贴
- Modal 面板纸质感背景PIL 生成),黑字多级透明度
- 每便签独立输入框KeyboardAvoidingView 防遮挡
- 未读红点(打开清零),首页背景图
- 便签回复同步 inbox
### 代码仓库
- Gitea: `http://101.36.73.102:3112/fyah/mao1``shenyan-app/`
- IDC: `/home/idc/mao1/shenyan-room/技术/ShenYanApp/`
### 记忆库
- launchd 每天 4:03 执行记忆整理
## 已尝试但回退
- **BlurView 气泡**`@react-native-community/blur` 在 RN Fabric + iOS 26 上导致文字裁剪和缝隙 → 回退到纯色背景
- **notifee 系统通知**:引入后 app 黑屏 + `undefined is not a function` → 疑似 iOS 26 兼容问题 → 卸掉,改用自制定制横幅
## 已回退
- BlurView → Fabric + iOS 26 不兼容
- notifee → 换 push-notification-ios
- IDC 双桥 → 单通道
- 3003 端口 → 3004
## 待解决
- [ ] APNs token 获取iOS 26 + notifee 兼容)
- [ ] Monitor 5 分钟超时(需频繁 re-arm
- [ ] 自动回复器launchd + 外部 claude -p
- [ ] inbox 旧消息清理
- [ ] HealthKit 能力
- [ ] Mi Band 10 身体数据
- [ ] RoomFeed / EventCard 组件集成
- [ ] iOS Share Extension分享到沈晏
- Monitor 超时
- 中区功能
- 冰箱贴回复 → 聊天
- inbox 清理
- pare 真实数据验证