Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

chore(mobile): 合入前收尾——移除试用身份、原生形变模块改名、登记形变动效

kirozengc6c1f1f6783b
diff --git a/apps/mobile/app.config.js b/apps/mobile/app.config.js
index e8c06592af..92612eefc4 100644
--- a/apps/mobile/app.config.js
+++ b/apps/mobile/app.config.js
@@ -422,7 +422,5 @@ module.exports = (context = {}) => {
}
}
- return process.env.EXPO_PUBLIC_CINDY_NAV_DEMO === '1'
- ? require('./scripts/navigation-demo-config.cjs').applyNavigationDemoConfig(next)
- : next;
+ return next;
};
diff --git a/apps/mobile/docs/ios-native-components.md b/apps/mobile/docs/ios-native-components.md
index dbeaaeab72..2afe38978c 100644
--- a/apps/mobile/docs/ios-native-components.md
+++ b/apps/mobile/docs/ios-native-components.md
@@ -11,7 +11,7 @@
| 设备范围、任务显示等下拉菜单 | UIMenu | 菜单是系统的;触发按钮可由调用方提供。旧包缺原生模块时有自绘回退。[入口](../src/platform/chrome/NativePullDownMenu.tsx) |
| 普通确认弹窗 | UIAlertController,经 React Native Alert 调用 | 自定义多步骤编辑不能一概算系统弹窗。[入口](../src/platform/chrome/showActionMenu.ts) |
| 设置里的开关 | SwiftUI 系统开关,经 @expo/ui 使用 | 设置分组和说明布局仍是 RN,不代表整页 Settings 原生化。[实现](../src/platform/chrome/NativeSwitch.tsx) |
-| 顶栏圆形按钮、浮动新建按钮 | SwiftUI Button,原生玻璃/禁用反馈 | 保留 Cindy 业务图标,图标可以放在 RNHostView 里。首页浮动新建按钮外包一层原生形变视图:触摸由它接管(不播放按钮自身按压),按下即拉长成输入框药丸。[按钮](../src/platform/chrome/NativeChromeButton.ios.tsx)、[形变](../modules/cindy-tab-bar/ios/CindyTabBarModule.swift) |
+| 顶栏圆形按钮、浮动新建按钮 | SwiftUI Button,原生玻璃/禁用反馈 | 保留 Cindy 业务图标,图标可以放在 RNHostView 里。首页浮动新建按钮外包一层原生形变视图:触摸由它接管(不播放按钮自身按压),按下即拉长成输入框药丸。[按钮](../src/platform/chrome/NativeChromeButton.ios.tsx)、[形变](../modules/cindy-composer-morph/ios/CindyComposerMorphModule.swift) |
| 登录页继续、Apple / SSO 等按钮 | SwiftUI Button + Cindy 的标签、品牌图案和布局 | 登录整页、手机号框、协议勾选与法律文字链接仍有自定义实现。[实现](../src/components/LoginNativeButton.ios.tsx) |
| SSO 登录窗口 | ASWebAuthenticationSession | 登录网页由认证服务提供。[调用](../src/auth/AuthContext.tsx) |
| 任务内搜索 | SwiftUI TextField、Button、原生 sheet | 与首页的搜索框不是同一个实现。[实现](../src/session/SessionSearchNative.ios.tsx) |
@@ -38,4 +38,4 @@
- Android 保留现有平台实现;新建形变、药丸拉开与键盘逐帧跟随只在 iOS 生效。
以上是代码事实。真实界面还受系统版本、原生模块是否已装入、回退条件和入口影响。
-模拟器目检与交互测试结果单独记录在 [导航实验记录](./navigation-demo.md)。
+导航与新建输入框的交互细节和已知未完成项见 [导航与新建输入框](./navigation-and-composer.md)。
diff --git a/apps/mobile/docs/navigation-and-composer.md b/apps/mobile/docs/navigation-and-composer.md
new file mode 100644
index 0000000000..37e2f1a05b
--- /dev/null
+++ b/apps/mobile/docs/navigation-and-composer.md
@@ -0,0 +1,26 @@
+# 移动端导航与新建输入框
+
+移动端以侧边栏抽屉为主导航(左上菜单:任务 / 伙伴切换、搜索、设备管理、设置、切换账号、退出登录),
+首页右下角保留悬浮新建按钮。按钮与输入框药丸同为 55pt(`composerGeometry.pillHeight`),坐在输入框
+静止底线上:右缘 = 输入框右内边距 16pt,下缘 = 安全区 + 8pt。形变弹簧与时长登记在
+`docs/design-rules/DESIGN.md §14.4`。
+
+## 当前交互(iOS)
+
+- 新建:原生 `CindyComposerMorphSource`(`modules/cindy-composer-morph`)接管按钮触摸,按下即横向拉长成等高药丸(不播系统按压),
+ iOS 式利落弹簧(响应约 0.36s、刚度 305、阻尼比 0.67,单次过冲约 14pt 后停稳);抬手进入新建页,滑出松开弹回、不导航。页面挂载前由替身玻璃生长,
+ 就绪后真实玻璃带速度接力;进入时不播推入动画,进入后恢复普通返回动画。只有首页开启形变。
+- 输入框:新建、已有任务、伙伴聊天统一为 55pt 药丸,下沿同一条线;不自动聚焦。手动点药丸先向上
+ 拉开成完整卡片(原生),约 0.05s 后原生聚焦,键盘随后升起;输入框逐帧跟随键盘
+ (均在 `ComposerDockKeyboardFollow.tsx`:新建页 `DockKeyboardBottomSpacer`,已有任务 `DockKeyboardLift` / `DockKeyboardViewportSpacer`)。
+- 减弱动态效果:不播形变与拉开,直接到位。
+- 伙伴对话:左上角为返回(回到伙伴列表);Duo 系统栏已有返回时保留侧栏按钮,不出现两个返回。
+- 设置等整页滚动的二级页:顶栏透明、系统柔和边缘,内容滚到顶栏和底部指示条下面,无硬分界(设置、语音词典、账号注销、伙伴私聊、共享任务管理、资源列表);设备详情只去掉底部色带。
+
+## 已知未完成
+
+- 已有任务页键盘升起过程中,消息列表内容不随动,停稳后跳到底(自研历史列表滚动锚定)。
+- 卡片收回药丸仍为直接切换;禁用的新建按钮点击无说明。
+- Duo 各姿态、真机帧率未实测。
+- `devices.json` 同一对象里 `failed` 键重复(基线即如此,前者文案永不生效),未处理。
+- 设备详情页列表上方有固定的搜索条,列表顶端仍是硬切。
diff --git a/apps/mobile/docs/navigation-demo.md b/apps/mobile/docs/navigation-demo.md
deleted file mode 100644
index 0638faeb76..0000000000
--- a/apps/mobile/docs/navigation-demo.md
+++ /dev/null
@@ -1,102 +0,0 @@
-# 移动端导航与新建形变实验
-
-这是实验分支的交付说明,尚不是可分发的正式安装包。
-
-## 开发隔离
-
-- 目录:/Users/kiro/AI-Agent/Project/Cindy-mobile-nav-demo
-- 分支:experiment/mobile-bottom-navigation
-- 基线:c2dd5e0c5669420a785c1dfe2edd6bcc660afb9c
-- 创建日期:2026-09-27。
-- 独立 worktree 与 node_modules;未复制原工作区的未提交改动、凭证、用户数据或授权文件。
-- 只在此 worktree 编辑。不切换原目录的分支,不停止原目录的 Metro,不向 main 推送。
-
-## 试用构建隔离
-
-从本目录运行只读检查:
-
- node scripts/mobile-navigation-demo.mjs inspect --region=cn
- node scripts/mobile-navigation-demo.mjs inspect --region=global
-
-本地检查 JavaScript 打包(输出到系统临时目录,不安装、不上传):
-
- node scripts/mobile-navigation-demo.mjs export --region=cn --platform=ios
-
-在指定的已启动 iOS 模拟器上构建、安装并打开独立试用版:
-
- DEVELOPER_DIR=/Users/kiro/Downloads/Xcode.app/Contents/Developer node scripts/mobile-navigation-demo.mjs simulator --region=cn --udid=<模拟器 UUID>
-
-该入口复用仓内的有界 Pods 安装与原生指纹检查,生成自带 JS 的 Release 模拟器包,
-保留模拟器正常的本地代码签名与钥匙串能力;不需要团队分发签名、不使用 Metro 开发服务。
-构建只包含所选模拟器当前使用的架构(ONLY_ACTIVE_ARCH=YES)。
-必须使用 Xcode 27.1+:入口检查工具链版本、产物 SDK 与 Scene manifest;只在 27.1
-模拟器中运行一个 27.0 SDK 包不足以启用现有 Duo reserved-region 适配代码。
-ExpoModulesJSI 的接口清理脚本只识别旧编译器的 __ObjC. 写法,27.1 改为 __ObjC::。
-试用入口在此 worktree 的依赖副本里兼容两种写法,以原子替换断开 pnpm 硬链接,
-不改动共享 store、其他 worktree 或依赖版本;依赖脚本结构变化时停止并要求重新核对。
-只安装并重启独立试用应用,不卸载其他应用,不复制已有登录态。每次代码修改后重新运行
-会增量构建并更新随包 JS。打开窗口仍使用仓库的 sim-open 入口。
-
-入口只接受本实验分支和显式区域,不启动 Metro 开发服务、不争用 8081、不读其他目录的 .env。
-首次导出时若缺少被静态引用的 endpoint.dev.json,仅从仓内公开 example 初始化此 worktree 的忽略文件。
-
-| 区域 | iOS / Android 应用标识 | 应用自身链接 scheme |
-| --- | --- | --- |
-| Global | com.xd.cindy.navdemo | cindynavdemo |
-| 中国大陆 | com.xd.cindycn.navdemo | cindycnnavdemo |
-
-只设置 EXPO_PUBLIC_CINDY_NAV_DEMO 不足以识别为试用版:同时核验原生安装身份与 Expo 配置标记。
-试用构建禁用 OTA,不使用现有 EAS / self-host 项目和发布配置。首轮通过整包更新试用版本。
-普通构建未启用该变量时继续返回原配置。试用配置必然产生新原生指纹,需要独立出包;
-不能把试用包的 bundle 投给正式装机。本分支不能未经拆分就合入主干或正式发布线。
-
-## 定案(2026-09-29)
-
-- 不采用底部标签栏;回到侧边栏抽屉导航(左上菜单:任务/伙伴切换、搜索、设备管理、加入共享任务、
- 设置、切换账号、退出登录)。底栏相关代码、开关与文案已全部删除。
-- 保留首页悬浮新建按钮,按方案 A 坐在输入框静止底线上:右缘 = 输入框右内边距 16pt,
- 下缘 = 安全区 + 8pt,按钮与药丸同为 55pt(`composerGeometry.pillHeight`)。
-- 已合并「移动端账号信息优化」:侧栏账号区大号姓名 + 默认字母头像 + 公司小图标、不显示 ID;
- 侧栏右侧圆角与柔和阴影(DESIGN.md 已登记局部例外),滑出/关闭/拖动共用同一进度。
-
-## 当前交互(iOS)
-
-- 新建:原生 `CindyComposerMorphSource` 接管按钮触摸,按下即横向拉长成等高药丸(不播系统按压),
- iOS 式利落弹簧(响应约 0.36s、刚度 305、阻尼比 0.67,单次过冲约 14pt 后停稳);抬手进入新建页,滑出松开弹回、不导航。页面挂载前由替身玻璃生长,
- 就绪后真实玻璃带速度接力;进入时不播推入动画,进入后恢复普通返回动画。只有首页开启形变。
-- 输入框:新建、已有任务、伙伴聊天统一为 55pt 药丸,下沿同一条线;不自动聚焦。手动点药丸先向上
- 拉开成完整卡片(原生),约 0.05s 后原生聚焦,键盘随后升起;输入框逐帧跟随键盘
- (均在 `ComposerDockKeyboardFollow.tsx`:新建页 `DockKeyboardBottomSpacer`,已有任务 `DockKeyboardLift` / `DockKeyboardViewportSpacer`)。
-- 减弱动态效果:不播形变与拉开,直接到位。
-- 伙伴对话:左上角为返回(回到伙伴列表);Duo 系统栏已有返回时保留侧栏按钮,不出现两个返回。
-- 设置等整页滚动的二级页:顶栏透明、系统柔和边缘,内容滚到顶栏和底部指示条下面,无硬分界(设置、语音词典、账号注销、伙伴私聊、共享任务管理、资源列表);设备详情只去掉底部色带。
-
-## 已知未完成
-
-- 已有任务页键盘升起过程中,消息列表内容不随动,停稳后跳到底(自研历史列表滚动锚定)。
-- 卡片收回药丸仍为直接切换;禁用的新建按钮点击无说明。
-- 深色全量实走、Duo 各姿态、真机帧率未做。
-- `devices.json` 同一对象里 `failed` 键重复(基线即如此,前者文案永不生效),未处理。
-- 设备详情页列表上方有固定的搜索条,列表顶端仍是硬切。
-
-- 已合入 main 000337155f(2026-09-29):首页标题宽度改用 main 的对称算法,比试用版更早截断。
-
-## 合入前待办(效果全部确认后统一处理)
-
-2026-09-29 用户决定:试用阶段优先看效果,守护与登记类修正等所有效果确认后最后一次性处理;
-在此之前本分支不提交、不提 PR(CI 会拦)。
-
-- [ ] `designTokenDiscipline.test.ts` 失败:ALLOWLIST 里 `ComposerFrame.ios.tsx :: borderRadius: 30`
- 已过期(圆角移到 `composerGeometry.cornerRadius` 常量),同时让守护覆盖这类常量写法。
-- [ ] 圆钮入场弹簧(刚度 305、阻尼比 0.67,单次过冲约 14pt)和药丸拉开弹簧登记到 DESIGN.md §14.4 动效例外。
-- [ ] 形变与聚焦相关的散落时长(0.05 / 0.18 / 0.22 秒、320 / 400ms)改用 token 或登记原因。
-- [ ] 原生模块 `modules/cindy-tab-bar` 已不含标签栏,只剩新建形变与药丸拉开:合入前改名(如 cindy-composer-morph,需 pod install),
- 并拆掉试用身份(`src/config/navigationDemo.ts`、`app.config.js`、`scripts/*navigation-demo*`、env 中的 IS_NAVIGATION_DEMO);
- 原生改动触发冷更,合并前须指定把关人确认。
-- [ ] `envBundleTransform.test.ts`:`src/config/env.ts` 引入试用配置 `./navigationDemo` 后测试桩缺条目,补
- `if (id === './navigationDemo') return { IS_NAVIGATION_DEMO: false, NAVIGATION_DEMO_SCHEME: 'cindynavdemo' };`。
-
-## 验证记录
-
-完整试验过程(含已放弃的底栏方案)不再保留在仓库;最近一次验证:iPhone 浅色实走首页 / 侧栏 /
-新建形变 / 药丸对齐 / 点开弹键盘;Mobile 类型检查 0 错误;全量测试除合入前待办 3 项外通过。
diff --git a/apps/mobile/modules/cindy-composer-morph/expo-module.config.json b/apps/mobile/modules/cindy-composer-morph/expo-module.config.json
new file mode 100644
index 0000000000..937e5ca47f
--- /dev/null
+++ b/apps/mobile/modules/cindy-composer-morph/expo-module.config.json
@@ -0,0 +1,7 @@
+{
+ "platforms": ["apple"],
+ "apple": {
+ "podspecPath": "./ios/CindyComposerMorph.podspec",
+ "modules": ["CindyComposerMorphModule"]
+ }
+}
diff --git a/apps/mobile/modules/cindy-tab-bar/ios/CindyTabBar.podspec b/apps/mobile/modules/cindy-composer-morph/ios/CindyComposerMorph.podspec
similarity index 95%
rename from apps/mobile/modules/cindy-tab-bar/ios/CindyTabBar.podspec
rename to apps/mobile/modules/cindy-composer-morph/ios/CindyComposerMorph.podspec
index fce323bc96..56f9907a00 100644
--- a/apps/mobile/modules/cindy-tab-bar/ios/CindyTabBar.podspec
+++ b/apps/mobile/modules/cindy-composer-morph/ios/CindyComposerMorph.podspec
@@ -1,7 +1,7 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
- s.name = 'CindyTabBar'
+ s.name = 'CindyComposerMorph'
s.version = package['version']
s.summary = 'iOS new-task button to composer pill morph and pill-to-card expansion.'
s.description = s.summary
diff --git a/apps/mobile/modules/cindy-tab-bar/ios/CindyTabBarModule.swift b/apps/mobile/modules/cindy-composer-morph/ios/CindyComposerMorphModule.swift
similarity index 95%
rename from apps/mobile/modules/cindy-tab-bar/ios/CindyTabBarModule.swift
rename to apps/mobile/modules/cindy-composer-morph/ios/CindyComposerMorphModule.swift
index 5f7605f505..71663b4044 100644
--- a/apps/mobile/modules/cindy-tab-bar/ios/CindyTabBarModule.swift
+++ b/apps/mobile/modules/cindy-composer-morph/ios/CindyComposerMorphModule.swift
@@ -3,9 +3,9 @@ import UIKit
/// Home new-task button → composer pill morph, and the pill → card expansion.
/// The native part only animates; navigation stays in JS.
-public class CindyTabBarModule: Module {
+public class CindyComposerMorphModule: Module {
public func definition() -> ModuleDefinition {
- Name("CindyTabBar")
+ Name("CindyComposerMorph")
View(CindyComposerMorphSource.self) {
Events("onAction", "onGeometry")
Prop("actionDisabled") { (view: CindyComposerMorphSource, disabled: Bool) in view.actionDisabled = disabled }
@@ -48,7 +48,7 @@ final class CindyComposerMorphSource: ExpoView {
super.didMoveToWindow()
lastFrame = .null
if window == nil {
- if pressOrigin != nil { CindyComposerMorph.current?.cancel() }
+ if pressOrigin != nil { CindyComposerMorphAnimation.current?.cancel() }
pressOrigin = nil
} else { setNeedsLayout() }
}
@@ -57,26 +57,26 @@ final class CindyComposerMorphSource: ExpoView {
let rect = convert(bounds, to: window)
guard rect != lastFrame else { return }
lastFrame = rect
- onGeometry(CindyComposerMorph.geometry(rect, in: window, id: "layout"))
+ onGeometry(CindyComposerMorphAnimation.geometry(rect, in: window, id: "layout"))
}
private func pressBegan() {
- guard !actionDisabled, let window, CindyComposerMorph.current == nil else { return }
- pressOrigin = CindyComposerMorph.begin(source: self, window: window)
+ guard !actionDisabled, let window, CindyComposerMorphAnimation.current == nil else { return }
+ pressOrigin = CindyComposerMorphAnimation.begin(source: self, window: window)
if pressOrigin == nil { pressOrigin = [:] }
}
private func pressEnded(inside: Bool) {
guard let origin = pressOrigin else { return }
pressOrigin = nil
- guard inside, !actionDisabled, window != nil else { CindyComposerMorph.current?.cancel(); return }
+ guard inside, !actionDisabled, window != nil else { CindyComposerMorphAnimation.current?.cancel(); return }
if origin.isEmpty { onAction([:]); return }
- CindyComposerMorph.current?.commit()
+ CindyComposerMorphAnimation.current?.commit()
onAction(["origin": origin])
}
}
/// A short-lived in-memory handoff. The source screen is never saved to disk.
-@MainActor private final class CindyComposerMorph {
- static var current: CindyComposerMorph?
+@MainActor private final class CindyComposerMorphAnimation {
+ static var current: CindyComposerMorphAnimation?
/// Last composer contour per window size. Lets the button start growing on
/// the tap frame instead of waiting ~300ms for the new page to mount.
private static var landing: (window: CGSize, rect: CGRect, radius: CGFloat, style: UIUserInterfaceStyle)?
@@ -121,7 +121,7 @@ final class CindyComposerMorphSource: ExpoView {
guard window.bounds.contains(rect), !rect.isEmpty,
let backdrop = window.snapshotView(afterScreenUpdates: false),
let sourceImage = source.snapshotView(afterScreenUpdates: false) else { return nil }
- let transition = CindyComposerMorph(window: window, rect: rect, backdrop: backdrop, sourceImage: sourceImage)
+ let transition = CindyComposerMorphAnimation(window: window, rect: rect, backdrop: backdrop, sourceImage: sourceImage)
current = transition
if #available(iOS 26.0, *), !UIAccessibility.isReduceMotionEnabled {
if let landing, landing.window == window.bounds.size, abs(landing.rect.maxY - rect.maxY) < 2 {
@@ -423,7 +423,7 @@ final class CindyComposerMorphTarget: ExpoView {
expandFrom = nil
// Only the pill→card change: taller, same bottom edge, no entry morph.
if #available(iOS 26.0, *), CACurrentMediaTime() - expandArmedAt < 0.6, rect.height > from.height + 1,
- abs(rect.maxY - from.maxY) < 2, CindyComposerMorph.current == nil, let content = superview {
+ abs(rect.maxY - from.maxY) < 2, CindyComposerMorphAnimation.current == nil, let content = superview {
CindyComposerExpand.run(content: content, from: from, cornerRadius: targetCornerRadius)
}
} else if rect.size != lastRect?.size, let content = superview {
@@ -435,7 +435,7 @@ final class CindyComposerMorphTarget: ExpoView {
override func layoutSubviews() {
super.layoutSubviews()
expandIfArmed()
- if started == transitionId, let window, let transition = CindyComposerMorph.current,
+ if started == transitionId, let window, let transition = CindyComposerMorphAnimation.current,
transition.id == transitionId, (transition.overlay.bounds.size != window.bounds.size
|| (transition.glass != nil && transition.morphSize != bounds.size)) {
transition.finish()
@@ -451,13 +451,13 @@ final class CindyComposerMorphTarget: ExpoView {
guard let self, self.window != nil else { return }
self.onComplete([:])
}
- guard let transition = CindyComposerMorph.current, transition.id == id else { complete(); return }
+ guard let transition = CindyComposerMorphAnimation.current, transition.id == id else { complete(); return }
transition.run(target: target, rect: self.convert(self.bounds, to: window), cornerRadius: self.targetCornerRadius, completion: complete)
}
}
override func didMoveToWindow() {
super.didMoveToWindow()
- if window == nil, CindyComposerMorph.current?.id == transitionId { CindyComposerMorph.current?.finish() }
+ if window == nil, CindyComposerMorphAnimation.current?.id == transitionId { CindyComposerMorphAnimation.current?.finish() }
}
}
diff --git a/apps/mobile/modules/cindy-tab-bar/package.json b/apps/mobile/modules/cindy-composer-morph/package.json
similarity index 67%
rename from apps/mobile/modules/cindy-tab-bar/package.json
rename to apps/mobile/modules/cindy-composer-morph/package.json
index e7d5243ba0..75d9b95955 100644
--- a/apps/mobile/modules/cindy-tab-bar/package.json
+++ b/apps/mobile/modules/cindy-composer-morph/package.json
@@ -1,5 +1,5 @@
{
- "name": "cindy-tab-bar",
+ "name": "cindy-composer-morph",
"version": "0.1.0",
"private": true,
"license": "Apache-2.0"
diff --git a/apps/mobile/modules/cindy-tab-bar/expo-module.config.json b/apps/mobile/modules/cindy-tab-bar/expo-module.config.json
deleted file mode 100644
index aea9d3286b..0000000000
--- a/apps/mobile/modules/cindy-tab-bar/expo-module.config.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "platforms": ["apple"],
- "apple": {
- "podspecPath": "./ios/CindyTabBar.podspec",
- "modules": ["CindyTabBarModule"]
- }
-}
diff --git a/apps/mobile/scripts/navigation-demo-config.cjs b/apps/mobile/scripts/navigation-demo-config.cjs
deleted file mode 100644
index 3d02c48b44..0000000000
--- a/apps/mobile/scripts/navigation-demo-config.cjs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Branch-local trial identity. Never reuse a production installation or OTA feed.
-function applyNavigationDemoConfig(config, env = process.env) {
- if (env.EXPO_PUBLIC_CINDY_NAV_DEMO !== '1') return config;
- const region = env.EXPO_PUBLIC_CINDY_AUTH_REGION;
- if (region !== 'global' && region !== 'cn') throw new Error('Navigation demo requires an explicit cn/global region');
- if (env.EXPO_PUBLIC_XDT_OTA_SELFHOST === '1' || env.EAS_PROJECT_ID || env.EAS_BUILD_PROFILE || env.CINDY_USE_LOCAL_REGION_CONFIG === '1') {
- throw new Error('Navigation demo cannot use existing self-host, EAS project or release profiles');
- }
- // Provider callbacks must be provisioned for this separate app before use. Do
- // not let a developer shell accidentally embed the production registrations.
- for (const key of ['EXPO_PUBLIC_CINDY_GOOGLE_IOS_URL_SCHEME', 'EXPO_PUBLIC_CINDY_WECHAT_APP_ID']) {
- if (env[key]?.trim()) throw new Error(`Navigation demo requires separate login provisioning: ${key}`);
- }
- const identity = region === 'cn' ? 'com.xd.cindycn.navdemo' : 'com.xd.cindy.navdemo';
- const scheme = region === 'cn' ? 'cindycnnavdemo' : 'cindynavdemo';
- return {
- ...config,
- name: region === 'cn' ? 'Cindy 导航试用 CN' : 'Cindy Navigation Demo',
- slug: region === 'cn' ? 'cindy-navigation-demo-cn' : 'cindy-navigation-demo',
- scheme,
- ios: { ...config.ios, bundleIdentifier: identity, associatedDomains: [] },
- android: { ...config.android, package: identity, intentFilters: [] },
- updates: { enabled: false, checkAutomatically: 'NEVER' },
- extra: { ...config.extra, navigationDemo: true },
- };
-}
-module.exports = { applyNavigationDemoConfig };
diff --git a/apps/mobile/src/__tests__/envBundleTransform.test.ts b/apps/mobile/src/__tests__/envBundleTransform.test.ts
index e43d048a36..f2ecf371ea 100644
--- a/apps/mobile/src/__tests__/envBundleTransform.test.ts
+++ b/apps/mobile/src/__tests__/envBundleTransform.test.ts
@@ -39,7 +39,6 @@ describe('mobile endpoint overrides after Expo bundle transform', () => {
EXPO_PUBLIC_CINDY_AUTH_BASE_URL: 'https://fallback.example.invalid',
} } } };
if (id === '@cindy/maker-shared/client-endpoints') return {};
- if (id === './navigationDemo') return { IS_NAVIGATION_DEMO: false, NAVIGATION_DEMO_SCHEME: 'cindynavdemo' };
if (id === './endpointManifestLoader') return {
resolveMobileEndpointManifest() {
throw new Error('Importing endpoint overrides must not fetch a manifest');
diff --git a/apps/mobile/src/__tests__/navigationDemoConfig.test.ts b/apps/mobile/src/__tests__/navigationDemoConfig.test.ts
deleted file mode 100644
index da0725ab13..0000000000
--- a/apps/mobile/src/__tests__/navigationDemoConfig.test.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { createRequire } from 'node:module';
-import { describe, expect, it } from 'vitest';
-const require = createRequire(import.meta.url);
-const { applyNavigationDemoConfig } = require('../../scripts/navigation-demo-config.cjs');
-const base = { name: 'Cindy', scheme: 'cindy', ios: { bundleIdentifier: 'com.xd.cindy' }, android: { package: 'com.xd.cindy' }, updates: { url: 'https://updates.example.test', enabled: true }, extra: {} };
-describe('isolated navigation demo configuration', () => {
- it('leaves ordinary builds untouched, including object identity', () => {
- expect(applyNavigationDemoConfig(base, {})).toBe(base);
- });
- it.each(['cn', 'global'])('uses a separate install, callback and no OTA feed for %s', region => {
- const result = applyNavigationDemoConfig(base, { EXPO_PUBLIC_CINDY_NAV_DEMO: '1', EXPO_PUBLIC_CINDY_AUTH_REGION: region });
- const id = region === 'cn' ? 'com.xd.cindycn.navdemo' : 'com.xd.cindy.navdemo';
- expect(result.ios.bundleIdentifier).toBe(id); expect(result.android.package).toBe(id);
- expect(result.scheme).toBe(region === 'cn' ? 'cindycnnavdemo' : 'cindynavdemo');
- expect(result.updates).toEqual({ enabled: false, checkAutomatically: 'NEVER' });
- expect(result.extra.navigationDemo).toBe(true);
- expect(result.ios.associatedDomains).toEqual([]); expect(result.android.intentFilters).toEqual([]);
- expect(base.ios.bundleIdentifier).toBe('com.xd.cindy');
- });
- it.each([
- { EXPO_PUBLIC_XDT_OTA_SELFHOST: '1' }, { EAS_PROJECT_ID: 'production-project' },
- { EAS_BUILD_PROFILE: 'production' }, { CINDY_USE_LOCAL_REGION_CONFIG: '1' },
- { EXPO_PUBLIC_CINDY_WECHAT_APP_ID: 'wx-production' }, { EXPO_PUBLIC_CINDY_GOOGLE_IOS_URL_SCHEME: 'production-callback' },
- ])('rejects existing distribution/provider configuration %j', extra => {
- expect(() => applyNavigationDemoConfig(base, { EXPO_PUBLIC_CINDY_NAV_DEMO: '1', EXPO_PUBLIC_CINDY_AUTH_REGION: 'cn', ...extra })).toThrow();
- });
- it('requires an explicit supported region', () => {
- expect(() => applyNavigationDemoConfig(base, { EXPO_PUBLIC_CINDY_NAV_DEMO: '1' })).toThrow();
- });
-});
diff --git a/apps/mobile/src/__tests__/navigationDemoIdentity.test.ts b/apps/mobile/src/__tests__/navigationDemoIdentity.test.ts
deleted file mode 100644
index 359b839925..0000000000
--- a/apps/mobile/src/__tests__/navigationDemoIdentity.test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { afterEach, describe, expect, it, vi } from 'vitest';
-const fixture = vi.hoisted(() => ({ applicationId: 'com.xd.cindy', marked: true }));
-vi.mock('expo-application', () => ({ nativeApplicationVersion: '0.1.0', get applicationId() { return fixture.applicationId; } }));
-vi.mock('expo-constants', () => ({ default: { get expoConfig() { return { extra: { navigationDemo: fixture.marked } }; } } }));
-vi.mock('@react-native-async-storage/async-storage', () => ({ default: { getItem: async () => null, setItem: async () => undefined } }));
-afterEach(() => vi.unstubAllEnvs());
-describe('navigation demo installation boundary', () => {
- it.each([
- ['com.xd.cindy', true, '1', false],
- ['com.xd.cindycn', true, '1', false],
- ['com.xd.cindy.navdemo', false, '1', false],
- ['com.xd.cindy.navdemo', true, '0', false],
- ['com.xd.cindy.navdemo', true, '1', true],
- ['com.xd.cindycn.navdemo', true, '1', true],
- ])('checks native ID %s, marker %s and opt-in %s', async (id, marked, flag, expected) => {
- vi.resetModules(); fixture.applicationId = id; fixture.marked = marked;
- vi.stubEnv('EXPO_PUBLIC_CINDY_NAV_DEMO', flag);
- const config = await import('@/config/navigationDemo');
- expect(config.IS_NAVIGATION_DEMO).toBe(expected);
- if (expected) expect(config.NAVIGATION_DEMO_SCHEME).toBe(id.includes('cindycn') ? 'cindycnnavdemo' : 'cindynavdemo');
- });
-});
-
-describe('navigation trial browser login redirect', () => {
- it.each([
- ['cn', 'ios', 'com.xd.cindycn.navdemo', 'cindycnnavdemo', 'cindycn://auth'],
- ['global', 'ios', 'com.xd.cindy.navdemo', 'cindynavdemo', 'cindy://auth'],
- ['cn', 'android', 'com.xd.cindycn.navdemo', 'cindycnnavdemo', 'cindycnnavdemo://auth'],
- ['global', 'android', 'com.xd.cindy.navdemo', 'cindynavdemo', 'cindynavdemo://auth'],
- ['cn', 'ios', 'com.xd.cindycn', 'cindycn', 'cindycn://auth'],
- ['global', 'ios', 'com.xd.cindy', 'cindy', 'cindy://auth'],
- ])('keeps %s %s install %s isolated while choosing the supported browser callback', async (region, platform, id, scheme, callback) => {
- vi.resetModules(); fixture.applicationId = id; fixture.marked = true;
- vi.stubEnv('EXPO_PUBLIC_CINDY_NAV_DEMO', '1');
- vi.stubEnv('EXPO_PUBLIC_CINDY_AUTH_REGION', region);
- vi.stubEnv('EXPO_OS', platform);
- const config = await import('@/config/env');
- expect(config.APP_SCHEME).toBe(scheme);
- expect(config.MOBILE_REDIRECT_URL).toBe(callback);
- const { matchesOAuthCallbackUrl } = await import('@/auth/oauthCallback');
- expect(matchesOAuthCallbackUrl(callback + '?code=test-only&state=test-only', config.MOBILE_REDIRECT_URL)).toBe(true);
- expect(matchesOAuthCallbackUrl(callback + '/other?code=test-only&state=test-only', config.MOBILE_REDIRECT_URL)).toBe(false);
- });
-});
diff --git a/apps/mobile/src/config/env.ts b/apps/mobile/src/config/env.ts
index 84c33e7059..8793a7755e 100644
--- a/apps/mobile/src/config/env.ts
+++ b/apps/mobile/src/config/env.ts
@@ -1,6 +1,5 @@
import * as Application from 'expo-application';
import Constants from 'expo-constants';
-import { IS_NAVIGATION_DEMO, NAVIGATION_DEMO_SCHEME } from './navigationDemo';
import {
CLIENT_ENDPOINT_KEYS,
@@ -58,10 +57,10 @@ export const AUTH_REGION: CindyAuthRegion = (() => {
})();
export const BUILD_AUTH_REGION: ClientEndpointRegion =
AUTH_REGION === 'global' ? 'global' : 'cn';
-const REGIONAL_APP_SCHEME = { cn: 'cindycn', global: 'cindy', dev: 'cindydev' }[
+export const APP_SCHEME = { cn: 'cindycn', global: 'cindy', dev: 'cindydev' }[
AUTH_REGION
];
-export const APP_SCHEME = IS_NAVIGATION_DEMO ? NAVIGATION_DEMO_SCHEME : REGIONAL_APP_SCHEME;
+export const MOBILE_REDIRECT_URL = `${APP_SCHEME}://auth`;
// __DEV__ 端点初值来源:metro 构建期按 AUTH_REGION 把仓内
// config/endpoint.json 或 config/endpoint.global.json require 进 dev bundle
@@ -336,16 +335,6 @@ function resolveAppPlatform(): AppPlatform {
export const APP_PLATFORM: AppPlatform = resolveAppPlatform();
-// iOS ASWebAuthenticationSession delivers its matching callback directly to the
-// initiating session; the scheme need not be registered in Info.plist (see the
-// AuthenticationServices SDK contract and expo-web-browser/ios/WebAuthSession.swift).
-// Keep the trial's OS deep links/private installation independent, but authorize
-// with the regional callback already accepted by auth-server. State/PKCE and
-// exact callback validation remain in AuthContext. Android has no such capture
-// contract: its trial callback still requires separate server registration.
-export const MOBILE_REDIRECT_URL = (IS_NAVIGATION_DEMO && APP_PLATFORM === 'ios'
- ? REGIONAL_APP_SCHEME : APP_SCHEME) + '://auth';
-
/**
* 纯函数:清单 review(送审版本号)与二进制版本号严格相等、且当前安装不是
* TestFlight 时才进入审核模式;
diff --git a/apps/mobile/src/config/navigationDemo.ts b/apps/mobile/src/config/navigationDemo.ts
deleted file mode 100644
index bd28e84f62..0000000000
--- a/apps/mobile/src/config/navigationDemo.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import * as Application from 'expo-application';
-import Constants from 'expo-constants';
-
-/** Both the JS opt-in and the installed native identity must belong to the trial. */
-export const IS_NAVIGATION_DEMO = process.env.EXPO_PUBLIC_CINDY_NAV_DEMO === '1'
- && Constants.expoConfig?.extra?.navigationDemo === true
- && ['com.xd.cindy.navdemo', 'com.xd.cindycn.navdemo'].includes(Application.applicationId ?? '');
-
-export const NAVIGATION_DEMO_SCHEME = IS_NAVIGATION_DEMO && Application.applicationId === 'com.xd.cindycn.navdemo'
- ? 'cindycnnavdemo' : 'cindynavdemo';
diff --git a/apps/mobile/src/session/ComposerFrame.ios.tsx b/apps/mobile/src/session/ComposerFrame.ios.tsx
index 37c44eb7d2..9c83f922f2 100644
--- a/apps/mobile/src/session/ComposerFrame.ios.tsx
+++ b/apps/mobile/src/session/ComposerFrame.ios.tsx
@@ -6,9 +6,9 @@ import { requireNativeView, requireOptionalNativeModule } from 'expo';
import { StyleSheet } from 'react-native';
import { composerGeometry } from './composerGeometry';
-const MorphTarget = requireOptionalNativeModule('CindyTabBar') ? requireNativeView<{
+const MorphTarget = requireOptionalNativeModule('CindyComposerMorph') ? requireNativeView<{
transitionId: string; expandToken: string; cornerRadius: number; onComplete(): void; style: object; pointerEvents: 'none';
-}>('CindyTabBar', 'CindyComposerMorphTarget') : null;
+}>('CindyComposerMorph', 'CindyComposerMorphTarget') : null;
export const nativeComposerFrameAvailable = isLiquidGlassAvailable();
diff --git a/apps/mobile/src/session/ComposerMorphSource.ios.tsx b/apps/mobile/src/session/ComposerMorphSource.ios.tsx
index eff5c65453..0a0db64228 100644
--- a/apps/mobile/src/session/ComposerMorphSource.ios.tsx
+++ b/apps/mobile/src/session/ComposerMorphSource.ios.tsx
@@ -9,8 +9,8 @@ type NativeProps = {
onAction(event: { nativeEvent: { origin?: ComposerMorphOrigin } }): void;
onGeometry(event: { nativeEvent: ComposerMorphOrigin }): void;
};
-const NativeSource = requireOptionalNativeModule('CindyTabBar')
- ? requireNativeView<NativeProps>('CindyTabBar', 'CindyComposerMorphSource') : null;
+const NativeSource = requireOptionalNativeModule('CindyComposerMorph')
+ ? requireNativeView<NativeProps>('CindyComposerMorph', 'CindyComposerMorphSource') : null;
/**
* Hosts the floating new-task button. Native takes the touch: the circle starts
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 55770c06f0..f7688b525a 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -871,7 +871,7 @@ Applies to submit-on-Enter fields: the chat composer, goal input, ask input, etc
### 14.4 Motion & Transitions
-> Expanded 2026-07. Cindy's motion character extends the paper-like restraint of §1 / §7: **ordinary UI fades, nudges, and resizes smoothly; overshoot is limited to the explicitly registered Done and Usage History chart responses below**. Functional state transitions are allowed; decorative motion is forbidden. This section pins "functional" into executable tiers and prototypes so components stop inventing their own durations and curves.
+> Expanded 2026-07. Cindy's motion character extends the paper-like restraint of §1 / §7: **ordinary UI fades, nudges, and resizes smoothly; overshoot is limited to the explicitly registered Done, Usage History chart and mobile new-task morph responses below**. Functional state transitions are allowed; decorative motion is forbidden. This section pins "functional" into executable tiers and prototypes so components stop inventing their own durations and curves.
#### Motion tokens (the only tier source)
@@ -969,6 +969,12 @@ Only the two registered chart members inside Usage History may enlarge their non
- **Definition**: the active theme's official Light/Dark Cindy wordmark sits centered in the empty message viewport at 35% opacity; after a 200ms delayed-reveal threshold, one narrow neutral highlight traverses the wordmark shape. The PNG alpha channel is the mask, so motion is confined to the glyphs and never paints a panel/background. This is functional loading feedback for a measured long switch, not a decorative brand loop: ordinary sessions complete before the reveal threshold and never show it; the mark unmounts immediately when the message tree mounts.
- **Parameters / performance**: highlight cycle 1.6s, `cubic-bezier(0.4, 0, 0.2, 1)`, HTML pseudo-element `transform: translateX(-120% → 350%)` only (compositor-only). The neutral gradient is the narrow §2 exception registered under “Gradient System”; it may use only `transparent` and `--text-primary`, never brand red or a component-authored chromatic value. `prefers-reduced-motion` removes both the reveal and sheen animations and shows a static wordmark; `[data-app-hidden='true']` pauses the infinite sheen via `animation-play-state` while the window is hidden.
- **Scope boundary**: session-switch deferred-loading overlay only. No reuse for startup, streaming, tool execution, message generation, dialogs, cards, sidebars, empty states, or static branding. The standard `animate-spinner` remains the default loader everywhere else. Implementation: `components/branding/BrandLoadingMark.tsx`, `MessageStream.tsx`, and `.brand-loading-mark*` in `globals.css`.
+- **Mobile new-task morph(移动端新建按钮形变)** — the seventh sanctioned motion class (approved 2026-09-29), **only** for the iOS home floating new-task button and the composer pill it becomes (`apps/mobile/modules/cindy-composer-morph`):
+ - **Definition**: on touch-down the 55pt round button stretches horizontally, in place, into the equal-height composer pill (it does not play the button's own press). A stand-in glass grows over the old screen while the new-task page mounts; once the page is ready the real composer glass takes over with the stand-in's current velocity, so the trajectory is continuous and nothing is swapped at the end. Sliding off before release springs back into the button and does not navigate. Later, a tap on the pill opens it upward into the full composer card and then focuses the input; the keyboard follows (per-frame keyboard follow is layout, not motion, and has no easing).
+ - **Parameters**: button → pill uses an underdamped spring, stiffness **305**, damping ratio **0.67** (response ≈ 0.36s), one visible overshoot of ≈ 14pt on a phone pill, kept inside the 16pt screen inset; the stand-in, the real glass and the slide-off return share this spring. Pill → card uses a critically damped spring, stiffness **320**, damping ratio **1** (no overshoot), so the card is open before the keyboard starts rising. Both springs take their duration from physics; the nominal `UIViewPropertyAnimator` durations in code are ignored. Handoff fades: the old-screen snapshot clears in 0.16s ease-out, the stand-in reveals over 0.18s ease-out and dissolves over 0.22s ease-in-out after a 0.06s delay, and the composer controls fade in over 0.24s ease-out after a 0.1s delay. Native focus is requested 0.05s after the card starts opening.
+ - **Timing guards (not motion)**: a 1.6s native timeout ends a morph whose target never appears; the new-task page restores its normal push animation on `transitionEnd`, with a 1600ms fallback; the JS fallback focus (320ms) and focus-release grace (400ms) in `useComposerPillOpen.ts` only cover a missing native view or refused focus.
+ - **Degradation**: under Reduce Motion neither the morph nor the pill opening plays — the page and card land directly in place. Without the native module (non-iOS or older binaries) the JS path navigates and focuses without a morph.
+ - **Scope boundary**: this button and pill only. Its overshoot must not leak into other buttons, sheets or navigation; other mobile transitions stay on the tokens above. Implementation: `CindyComposerMorphModule.swift`, `ComposerMorphSource.ios.tsx`, `ComposerFrame.ios.tsx`, `useComposerPillOpen.ts`; geometry in `composerGeometry.ts`, behavior notes in `apps/mobile/docs/navigation-and-composer.md`.
- **Retired: mobile-download QR brand edge** — a rotating app-icon edge on the `MobileDownloadDialog` QR card was briefly registered here as a fourth (persistent) motion class on 2026-07-25 and **removed the same day** at the user's request: read as a strange ring turning behind the code. There is **no sanctioned persistent decorative motion** — the red lines above hold without exception. The card is now a bare QR (no edge, no border, no shadow, no tilt); its only motion is the linked ↔ onboarding size tween. Do not re-add. Contract test: `mobileDownloadDialog.test.tsx` → `keeps the QR card flat with no brand edge`.
### 14.5 聊天正文的可点性信号(Clickability in message bodies)
diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.md
index e58e4a3c34..c39c723162 100644
--- a/docs/design-rules/design-decision-log.md
+++ b/docs/design-rules/design-decision-log.md
@@ -12,6 +12,7 @@
## 2026-09
+- **09-29 移动端新建按钮形变登记为动效例外**——用户确认保留侧栏抽屉导航与首页悬浮新建按钮:按下即原位拉长成等高输入框药丸,带一次可见的 iOS 式回弹(刚度 305、阻尼比 0.67);手动点药丸再向上展开成卡片(临界阻尼、无回弹)后聚焦。登记为 `DESIGN.md §14.4` 第七类动效例外,仅限该按钮与药丸,减弱动态效果时直接到位。方向授权不代表真机帧率验收。
- **09-28 任务标签改为紧跟标题常显**——用户要求任务标签不再作为「任务信息」里可选的显示项,而是跟在任务标题后面必然显示。桌面侧栏移除「任务信息 → 标签」复选项;文字版、列表版色球由行尾信息槽移到标题之后,置顶卡片版由底部信息行移到标题首行之后。聊天标题栏与手机端原本已在标题后常显,不变。同日用户指出悬停任务时色球「变大、描边消失」:根因是悬停把外圈改为半透明的 `sidebar-item-hover`,透出色球本色;改为悬停不换外圈色,选中与当前任务仍跟随不透明行底。被取代:09 月「标签」与时间并列、默认勾选并留在行尾信息槽的处理。现行行为见 `docs/product-rules/task-tags.md`;本条为方向裁决,不代表实机视觉验收。
- **09-27 移动端主菜单账号层级与抽屉层次**——用户要求姓名放大、默认头像取代公司大 Logo、公司 Logo 缩为小图标、不展示 ID;左侧菜单滑出更流畅,右侧有圆角和适当阴影。账号头以用户姓名为主,邮箱与组织信息为辅;仅首页主菜单抽屉(含伙伴入口)登记柔和投影例外,取代该处零阴影要求,不扩展到页面卡片与任务列表侧栏。落点:`DESIGN.md §6`、`mobile-design-guide.md §1`、`HomeChromeDrawer.tsx` 与 `homeDrawerShadow` 色板 token。方向授权不代表实机视觉验收。
diff --git a/scripts/mobile-navigation-demo.mjs b/scripts/mobile-navigation-demo.mjs
deleted file mode 100644
index 64818833b5..0000000000
--- a/scripts/mobile-navigation-demo.mjs
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/env node
-// Local-only trial entry. No dev server, distribution signing, publishing or OTA upload.
-import { execFileSync, spawnSync } from 'node:child_process';
-import { createRequire } from 'node:module';
-import { dirname, resolve } from 'node:path';
-import { fileURLToPath } from 'node:url';
-import { constants, copyFileSync, existsSync, mkdtempSync, readdirSync, readFileSync, writeFileSync, renameSync, statSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { podInstallBounded } from '../apps/mobile/scripts/sim-pod-install.mjs';
-import { computeSimulatorNativeFingerprint, inspectSimulatorNativeIdentity } from '../apps/mobile/scripts/lib/sim-native-identity.mjs';
-
-const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
-const mobile = resolve(root, 'apps/mobile');
-const args = process.argv.slice(2);
-const command = args[0] ?? 'inspect';
-const region = args.find(arg => arg.startsWith('--region='))?.slice(9);
-const platform = args.find(arg => arg.startsWith('--platform='))?.slice(11);
-const udid = args.find(arg => arg.startsWith('--udid='))?.slice(7);
-if (!['inspect', 'export', 'simulator'].includes(command) || !['cn', 'global'].includes(region)
- || args.some((arg, index) => index > 0 && !arg.startsWith('--region=') && !arg.startsWith('--platform=') && !arg.startsWith('--udid='))
- || (command === 'export' && !['ios', 'android'].includes(platform))
- || (command === 'simulator' && (process.platform !== 'darwin' || !/^[A-Fa-f0-9-]{36}$/.test(udid ?? '')))) {
- throw new Error('Usage: inspect --region=cn|global; export --region=cn|global --platform=ios|android; simulator --region=cn|global --udid=<booted simulator UUID>');
-}
-const branch = execFileSync('git', ['branch', '--show-current'], { cwd: root, encoding: 'utf8' }).trim();
-if (branch !== 'experiment/mobile-bottom-navigation') throw new Error('This entry belongs to experiment/mobile-bottom-navigation only');
-execFileSync('git', ['merge-base', '--is-ancestor', 'c2dd5e0c5669420a785c1dfe2edd6bcc660afb9c', 'HEAD'], { cwd: root });
-
-// No .env or production provider registrations are borrowed from other worktrees.
-for (const key of Object.keys(process.env)) {
- if (key.startsWith('EXPO_PUBLIC_CINDY_GOOGLE_') || key.startsWith('EXPO_PUBLIC_CINDY_WECHAT_')
- || key.startsWith('EAS_') || key === 'CINDY_SELF_HOST_REGIONS_FILE'
- || key === 'CINDY_MOBILE_UPDATES_URL' || key === 'CINDY_MOBILE_OTA_NATIVE'
- || key === 'EXPO_PUBLIC_APP_VARIANT' || key === 'EXPO_PUBLIC_BETA_DEV') delete process.env[key];
-}
-Object.assign(process.env, {
- EXPO_PUBLIC_CINDY_NAV_DEMO: '1', EXPO_PUBLIC_CINDY_AUTH_REGION: region,
- EXPO_PUBLIC_XDT_OTA_SELFHOST: '0', CINDY_USE_LOCAL_REGION_CONFIG: '0',
- EXPO_NO_DOTENV: '1', EXPO_NO_TELEMETRY: '1',
-});
-const require = createRequire(import.meta.url);
-const config = require(resolve(mobile, 'app.config.js'))();
-const expectedId = region === 'cn' ? 'com.xd.cindycn.navdemo' : 'com.xd.cindy.navdemo';
-if (config.ios.bundleIdentifier !== expectedId || config.android.package !== expectedId
- || config.updates.enabled !== false || config.updates.url || config.extra.eas) {
- throw new Error('Trial isolation check failed');
-}
-console.log(JSON.stringify({ directory: root, branch, baseline: 'c2dd5e0c56', region,
- applicationId: expectedId, scheme: config.scheme, automaticUpdates: false,
- nativeInstallVerified: false }, null, 2));
-if (command === 'export' || command === 'simulator') {
- // Metro resolves even the unused dev require. Use the public example only;
- // never copy an internal endpoint file or .env from another worktree.
- const devEndpoint = resolve(root, 'config/endpoint.dev.json');
- if (!existsSync(devEndpoint)) copyFileSync(resolve(root, 'config/endpoint.dev.json.example'), devEndpoint, constants.COPYFILE_EXCL);
-}
-if (command === 'export') {
- const destination = mkdtempSync(resolve(tmpdir(), 'cindy-navigation-demo-' + region + '-' + platform + '-'));
- console.log('Export destination: ' + destination);
- const result = spawnSync(process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm',
- ['exec', 'expo', 'export', '--platform', platform, '--output-dir', destination, '--max-workers', '2'],
- { cwd: mobile, env: process.env, stdio: 'inherit', shell: process.platform === 'win32' });
- if (result.error) throw result.error;
- process.exitCode = result.status ?? 1;
-}
-if (command === 'simulator') {
- const run = (bin, argv, cwd = mobile) => execFileSync(bin, argv, { cwd, env: process.env, stdio: 'inherit' });
- const capture = (bin, argv) => execFileSync(bin, argv, { cwd: mobile, env: process.env, encoding: 'utf8' }).trim();
- const xcodeVersion = capture('xcodebuild', ['-version']);
- const version = /Xcode (\d+)\.(\d+)/.exec(xcodeVersion);
- if (!version || Number(version[1]) < 27 || (Number(version[1]) === 27 && Number(version[2]) < 1)) {
- throw new Error('Navigation trial requires Xcode 27.1+ to compile Duo reserved-region support. Set DEVELOPER_DIR explicitly.');
- }
- // Swift 6.4 in 27.1 spells private C++ names __ObjC::expo instead of
- // __ObjC.expo. Extend Expo's existing interface sanitizer for this syntax.
- // Atomic replacement breaks pnpm hardlinks: other worktrees/store stay intact.
- const jsiScript = resolve(dirname(require.resolve('expo-modules-jsi/package.json')), 'apple/scripts/build-xcframework.sh');
- const jsiSource = readFileSync(jsiScript, 'utf8');
- const oldSanitizer = String.raw`/^extension __ObjC\./`;
- const newSanitizer = '/^extension __ObjC[.:]/';
- if (jsiSource.includes(oldSanitizer)) {
- const replacement = jsiScript + '.navigation-demo-tmp';
- writeFileSync(replacement, jsiSource.replace(oldSanitizer, newSanitizer), { mode: statSync(jsiScript).mode });
- renameSync(replacement, jsiScript);
- } else if (!jsiSource.includes(newSanitizer)) {
- throw new Error('ExpoModulesJSI interface sanitizer changed; review the trial Xcode compatibility adjustment');
- }
- const devices = JSON.parse(capture('xcrun', ['simctl', 'list', 'devices', 'booted', '--json']));
- if (!Object.values(devices.devices).flat().some(device => device.udid.toLowerCase() === udid.toLowerCase() && device.state === 'Booted')) {
- throw new Error('Select an exact booted simulator; no other device will be changed');
- }
- Object.assign(process.env, { NODE_ENV: 'production', CI: '1' });
- const ios = resolve(mobile, 'ios');
- const buildDir = resolve(ios, 'build-navigation-demo-' + region);
- const readId = path => capture('plutil', ['-extract', 'CFBundleIdentifier', 'raw', '-o', '-', resolve(path, 'Info.plist')]);
- let workspace = existsSync(ios) ? readdirSync(ios).find(name => name.endsWith('.xcworkspace')) : undefined;
- const previousApp = workspace
- ? resolve(buildDir, 'Build/Products/Release-iphonesimulator', workspace.slice(0, -'.xcworkspace'.length) + '.app')
- : null;
- const reusableNativeProject = previousApp && existsSync(resolve(previousApp, 'Info.plist'))
- && readId(previousApp) === expectedId
- && inspectSimulatorNativeIdentity({ appPath: previousApp, projectDir: mobile, env: process.env }).healthy;
- if (reusableNativeProject) {
- console.log('Native inputs still match the existing build; refreshing bundled JavaScript without regenerating Pods.');
- } else {
- console.log('Generating isolated native project (no device data or existing apps are removed).');
- run('pnpm', ['exec', 'expo', 'prebuild', '--platform', 'ios', '--no-install']);
- await podInstallBounded({ iosDir: ios, env: process.env });
- workspace = readdirSync(ios).find(name => name.endsWith('.xcworkspace'));
- }
- if (!workspace) throw new Error('Native workspace missing after prebuild');
- const scheme = workspace.slice(0, -'.xcworkspace'.length);
- console.log('Building self-contained simulator app. Existing Metro services are not used.');
- run('xcodebuild', ['-workspace', resolve(ios, workspace), '-scheme', scheme,
- '-configuration', 'Release', '-sdk', 'iphonesimulator', '-destination', 'platform=iOS Simulator,id=' + udid,
- '-derivedDataPath', buildDir, '-jobs', '4', 'ONLY_ACTIVE_ARCH=YES', '-quiet', 'build']);
- const app = resolve(buildDir, 'Build/Products/Release-iphonesimulator', scheme + '.app');
- const sdk = capture('plutil', ['-extract', 'DTSDKName', 'raw', '-o', '-', resolve(app, 'Info.plist')]);
- if (!/^iphonesimulator27\.[1-9]/.test(sdk) && !/^iphonesimulator(2[8-9]|[3-9]\d)/.test(sdk)) {
- throw new Error('Built app does not contain a Duo-capable 27.1+ simulator SDK identity');
- }
- capture('plutil', ['-extract', 'UIApplicationSceneManifest', 'json', '-o', '-', resolve(app, 'Info.plist')]);
- if (readId(app) !== expectedId) throw new Error('Refusing to install a non-trial app');
- if (!existsSync(resolve(app, 'main.jsbundle'))) throw new Error('Embedded JavaScript missing; refusing to depend on another Metro');
- const expectedFingerprint = computeSimulatorNativeFingerprint(mobile, process.env);
- const beforeInstall = inspectSimulatorNativeIdentity({ appPath: app, expectedFingerprint });
- if (!beforeInstall.healthy) throw new Error('Built native runtime mismatch: ' + beforeInstall.code);
- run('xcrun', ['simctl', 'install', udid, app]);
- const installedApp = capture('xcrun', ['simctl', 'get_app_container', udid, expectedId, 'app']);
- if (readId(installedApp) !== expectedId || !inspectSimulatorNativeIdentity({ appPath: installedApp, expectedFingerprint }).healthy) {
- throw new Error('Installed trial identity/runtime did not match the build');
- }
- run('xcrun', ['simctl', 'launch', '--terminate-running-process', udid, expectedId]);
- run(process.execPath, [resolve(mobile, 'scripts/sim-open.mjs'), '--udid', udid]);
- console.log(JSON.stringify({ app, udid, applicationId: expectedId, fingerprint: expectedFingerprint,
- embeddedJavaScript: true, nativeInstallVerified: true, pageVerified: false }, null, 2));
-}