Files
Rocky e09ad34437 feat(flow): on-demand host handoff with reliable return and a back-tap tip
Keyboard
- Only jump to the app when the voice surface is shown (tab tap / opened
  there); typing tabs no longer leave the host on keyboard open.
- Wait up to 0.4 s for the arbiter to report the host app before leaving,
  and late-bind an id that arrives within 6 s of the jump.
- Empty arbiter callbacks no longer wipe an already captured host id;
  install the capture handler in every build configuration.

App
- Return to the previous app with up to four retries using iOS's real
  open result, and honor the skip-app-switch preference.
- Keep the pending host id across cold-start zombie reconciliation, and
  expire it after two minutes (legacy values without a timestamp stay valid).
- Show a light tip pointing at the system back control when we cannot
  return automatically ("点击返回,立即使用").

Tests: TTL behaviour and return retry policy.
2026-10-29 16:32:52 +08:00

38 lines
1.6 KiB
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// OSGHostArbiterProbe.h
// OSGKeyboard · Keyboard Extension
//
// 宿主识别探针(Debug / TestFlight / Release 均编译):iOS 26.4+ 通过
// _UIKeyboardArbiterClient 回调读取宿主 App 的 bundle ID,供冷启动后自动跳回。
// 原理参考 editorss/KeyboardHostBundleID(MIT)。
// 必须在 +load 安装,否则可能错过键盘首次切换宿主时的回调。
// 所有私有符号运行时按字符串查找,任何一步失败都静默退化为“识别不到宿主”。
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 回调可能在 arbiter 的私有队列上触发,不保证主线程。
typedef void (^OSGHostArbiterCaptureHandler)(NSString *_Nullable bundleId, NSString *_Nullable detail);
@interface OSGHostArbiterProbe : NSObject
/// 钩子是否已成功安装(私有类或方法不存在时为 NO)。
@property (class, nonatomic, readonly) BOOL isInstalled;
/// 最近一次回调读到的有效宿主 bundle ID;从未读到或已作废时为 nil。线程安全。
/// 读不到 ID 的空回调不会清掉它,只有 invalidateCapturedBundleId 会。
@property (class, nonatomic, readonly, nullable) NSString *lastCapturedBundleId;
/// 作废上一次的识别结果(键盘收起时调用,避免把上一个宿主当成当前宿主)。
+ (void)invalidateCapturedBundleId;
/// 每次 arbiter 回调都会调用;设置为 nil 取消。
+ (void)setCaptureHandler:(nullable OSGHostArbiterCaptureHandler)handler;
/// 主动让 arbiter 检查连接,可能触发一次回调,但不保证。
+ (void)pingArbiter;
@end
NS_ASSUME_NONNULL_END