Skip to content

feat(cdp): 圈选支持 - #51

Open
YoloMao wants to merge 4 commits into
masterfrom
feat/cdp-circle
Open

feat(cdp): 圈选支持#51
YoloMao wants to merge 4 commits into
masterfrom
feat/cdp-circle

Conversation

@YoloMao

@YoloMao YoloMao commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

背景

Flutter + CDP 场景下无埋点事件(PAGE / VIEW_CLICK)已跑通,但圈选不可用:Circle 插件在 CDP 模式下不注册,且 Flutter 元素入口按 NewSaaS 协议强制要求 xcontent,CDP 数据会被静默丢弃。

本 PR 以 iOS SDK 3.9.1(CDP 产品线)的 WebCircle 实现为协议基准,逐字段比对后补齐 CDP 圈选支持。比对结论:ohos 现有 ready / refreshScreenshot 消息模型与 CDP 协议完全一致,无需改动;差异仅在下列四处。

改动

  1. Circle 插件注册放开 CDPAnalyticsCore.startCore
    注册条件由 (NewSaaS || SaaS) && autotrackEnabled 改为 autotrackEnabled(三种模式均支持圈选)。

  2. Flutter 元素校验按 mode 分支CircleElement.setPagesAndElementsForFlutter
    CDP 协议无 xcontent 概念(元素以 xpath + index + page 定位),CDP 下入选校验放宽为 nodeType / zLevel / xpath 必填;NewSaaS 行为不变。页面对象补 isIgnored 透传(对齐 iOS page dict)。

  3. _ScreenshotElement.xcontent 改为可选
    CDP 下(原生路径与 Flutter 路径)不再序列化 xcontent,对齐 iOS 3.9.1 的元素序列化字段。

  4. 补齐 web 端 quit 消息处理Circle._handleMessage
    NewSaaS/CDP 分支此前只处理 ready / incompatible_version;web 端退出圈选时 app 侧会悬挂。现对齐 iOS:停止圈选并提示「设备已断开连接」。

文档(docs/GrowingAnalytics/circle/Circle.mddocs/GrowingAnalytics/core/AnalyticsCore.md)已同步。

验证

  • GrowingAnalytics@default assembleHar 构建通过
  • ws 协议逐字段比对记录见 growingio-sdk-flutter docs/harmonyos_cdp_webcircle.md(基准:growingio-sdk-ios-autotracker tag 3.9.1)
  • 待办:CDP 环境真机联调(重点:元素可框选、web 端退出后 app 正常停止)

🤖 Generated with Claude Code

YoloMao and others added 2 commits July 8, 2026 17:36
以 iOS SDK 3.9.1(CDP 产品线)的 WebCircle 实现为协议基准:

- AnalyticsCore.startCore:Circle 插件注册条件放开 CDP 模式
  (NewSaaS / SaaS / CDP 均支持,仍需 autotrackEnabled)
- CircleElement.setPagesAndElementsForFlutter:元素校验按 mode 分支,
  CDP 下 nodeType / zLevel / xpath 必填即可(CDP 协议无 xcontent 概念,
  元素以 xpath + index + page 定位);页面补 isIgnored 透传
- _ScreenshotElement.xcontent 改为可选,CDP 下不再序列化空 xcontent
- Circle._handleMessage:补齐 web 端 quit 消息处理(停止圈选并提示断开),
  对齐 iOS 行为

ready / refreshScreenshot 消息字段经逐字段比对已与 CDP 协议一致,无需改动。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@YoloMao YoloMao changed the title feat(circle): CDP 模式圈选支持 feat(cdp): 圈选支持 Jul 8, 2026
YoloMao and others added 2 commits July 9, 2026 11:53
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant