Repository navigation
feat(mobile): workspace management, share intake and connection retention - #544
Merged
Merged
Conversation
added 5 commits
September 10, 2026 18:49
Workspace folds were component state, so every launch brought the list back expanded (desktop already persists them). Move them into a hook backed by AsyncStorage, with an in-session cache so a remount does not flash expanded. Add the phone's side of workspace deletion: a long-press/shortcut menu on a workspace group that selects every session in it (folds included) or deletes it. The desktop grows a matching `delete_workspace` bridge command that reuses the GUI command, so the store cascade, the agent-session delete outbox and the orphaned scratch dirs behave identically; the user's files on disk are never touched.
Presenting the system camera or a picker pauses the host activity, which React Native reports as AppState background — so a photo round trip tore the WSS down, flashed "the desktop may be sleeping", and paid for a fresh handshake to restore a link that was never lost. Treat the app as active while a native surface is presented, bounded by a grace period so a flow the user never returns from still releases the connection.
Adds an Android share target: SEND/SEND_MULTIPLE intent filters for text, images and arbitrary files, plus a local `future-share-intent` module that captures both receipts (a cold start, where the share intent is the launch intent, and a warm start, where singleTask delivers it through onNewIntent and Activity.getIntent() still holds the original). Shared files are copied into app-owned cache storage when JavaScript asks for them, so the content URI's read grant never has to reach JS. The payload lands in the composer's new-conversation draft — the composer's existing restore path — and the intake starts a fresh conversation for it, so a share is reviewable before it is sent and the previous composer keeps its draft. iOS has no share extension target in this build; getPendingShare() resolves to null there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
手机端在使用中暴露出的五个问题,本 PR 一并处理(除 iOS 分享扩展外全部完成):
改动
工作区折叠状态持久化(
useCollapsedWorkspaces)折叠集合原本是组件 state,重启即丢。改为 AsyncStorage 持久化(与桌面端
useCollapsedWorkspaces同一约定),并保留一份进程内缓存:SessionList在进入/退出对话时会卸载重挂,没有缓存的话每次返回都会先展开一帧。首次持久化写入发生在读完存储之后,
避免在读到之前就把磁盘上的记录覆盖成空。
删除工作区 + 工作区内全选(桌面 + 手机)
delete_workspace桥接命令,直接复用 GUI 的commands::delete_workspace,因此 store 级联、agent 会话删除 outbox、孤儿 scratch/review 目录回收的行为完全一致;
工作区目录里的用户文件不会被删。
当前不可见的子会话),或删除整个工作区;确认框会带上会话数量并说明文件不会被删。
删除后同步清理本地目录、未读标记与标题覆盖。
连接在原生选页面期间保持(
nativePresentation)系统相机/相册/文件选择器是独立 Activity,会暂停宿主 Activity,RN 因此上报
AppState: background,于是setAppActive(false)主动断开了 WSS —— 回到 app 时要重连、并闪一下"桌面可能正在睡眠"。现在在原生页面展示期间保持连接(有超时上限,避免用户一去不回时
长期挂着连接)。桌面端心跳全程未中断。
分享进 app(Android)
app.config.ts增加SEND/SEND_MULTIPLEintent filter(text / image /*/*)。modules/future-share-intent:同时捕获冷启动(分享 intent 就是启动intent)与热启动(
singleTask走onNewIntent,此时Activity.getIntent()仍是旧 intent)两种收件路径;被分享的文件在 JS 索取时才复制进应用缓存目录,content URI 的读权限不必交给 JS。
再发送;原本在输入框里的内容会保留。
其他
AppContent用useSyncExternalStore订阅分享信号,使已经停在同一草稿上的编辑框重新读取草稿。mobile/README.md、docs/wiki/{zh,en}/Remote.md。未做 / 已知边界
getPendingShare()在 iOS 上返回null。需要的话可作为后续 PR。expo-image-picker的launchCameraAsync/launchImageLibraryAsync、expo-file-system的pickFileAsync、Android 无系统相册选择器时的
ACTION_PICK),本次未改这部分,只把它们纳入"原生页面期间保持连接"的范围。验证
tsc --noEmit、eslint .干净;jest43 个 suite / 639 个 case 通过(新增折叠持久化、工作区菜单与删除、连接保持、分享 intake、原生模块 JS 侧的测试)。
cargo fmt --check、cargo clippy --all-targets -- -D warnings干净;cargo test --lib1130 通过(含新增的delete_workspace桥接命令测试:缺 id 报错、级联删除工作区与其会话、磁盘文件保留、重复删除报错)。
FUTURE_VERSION=1.1.7):新增模块编译并注册(autolinking 解析出
packages: ['cn.future_os.shareintent.ShareIntentPackage']),生成的 manifest 含 5 条 share intent-filter。
🤖 Generated with Claude Code