chore(flow): expand host-return whitelist and add a DEBUG host bundle probe

- Rebuild the return-to-host whitelist from the CN/US top charts plus Apple
  system apps; drop the canOpenURL pre-check (LSApplicationQueriesSchemes
  is capped at 50) and let open() report failure.
- Never record an OSG bundle id as the host to return to.
- DEBUG only: probe the host bundle id through the keyboard arbiter
  callback and surface the log on a Home test card. Release builds keep
  the previous behaviour (no host identification).
This commit is contained in:
2026-10-20 20:06:36 +02:00
parent d540a58594
commit ad79c2ea13
16 changed files with 807 additions and 327 deletions
@@ -0,0 +1,38 @@
// OSGHostArbiterProbe.h
// OSGKeyboard · Keyboard Extension
//
// 临时调试探针(仅 DEBUG):iOS 26.4+ 通过 _UIKeyboardArbiterClient 回调
// 读取宿主 App 的 bundle ID。原理参考 editorss/KeyboardHostBundleID(MIT)。
// 必须在 +load 安装,否则可能错过键盘首次切换宿主时的回调。
#import <Foundation/Foundation.h>
#ifdef DEBUG
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。线程安全。
@property (class, nonatomic, readonly, nullable) NSString *lastCapturedBundleId;
/// 作废上一次的识别结果(键盘收起时调用,避免把上一个宿主当成当前宿主)。
+ (void)invalidateCapturedBundleId;
/// 每次 arbiter 回调都会调用;设置为 nil 取消。
+ (void)setCaptureHandler:(nullable OSGHostArbiterCaptureHandler)handler;
/// 主动让 arbiter 检查连接,可能触发一次回调,但不保证。
+ (void)pingArbiter;
@end
NS_ASSUME_NONNULL_END
#endif