Skip to content

feat(pigeon): DownloadNotifications 迁移到 channel 模式 - #83

Merged
StillMisty merged 1 commit into
mainfrom
feat/pigeon-download-notifications
Nov 19, 2026
Merged

StillMisty merged 1 commit into
mainfrom
feat/pigeon-download-notifications

Conversation

@StillMisty

Copy link
Copy Markdown
Owner

Part of #70. Closes #82.

概要

DownloadNotifications 从手写 MethodChannel 迁移到 Pigeon channel 模式(Android-only),旧通道保留 fallback。

  • schema:tool/pigeon/download_notifications.dart(start(StartRequest) / update(UpdateRequest) / stop(id))
  • 生成物:download_notifications.g.dart + Kotlin DownloadNotificationsApi.g.kt;errorClassName 避免和 widget / DownloadsPublisher 重复 FlutterError
  • 原生:DownloadNotificationsImpl(@Keep,applicationContext)委托现有 DownloadNotifications 对象;MainActivity 注册 Pigeon,旧通道 handler 保留
  • Dart:download_notifications_adapter.dart 封装 Pigeon transport;PigeonFirstDownloadNotifications 在 data 层组合 fallback;非 Android 保持 Noop
  • CI drift 增加该 schema 的 Pigeon 生成(channel 模式,Linux 可跑)

验证

  • flutter analyze --no-pub:0 issue
  • flutter test --no-pub:3545 通过
  • docs check:OK
  • Pigeon 重跑无 diff;生成物已提交
  • Android 模拟器(API 37):download_notifications_pigeon_test.dart 3 项通过(Pigeon start/update/stop、旧通道 fallback、工厂默认路径)
  • release APK 构建 / 启动:无 ClassNotFoundException / NoSuchMethodError / AndroidRuntime 崩溃;apkanalyzer 确认生成类保留

说明 / 边界

  • 通知权限不可用时原生 no-op,测试只验证不抛;未人工确认通知栏视觉。
  • release 模式不支持 driver,AOT 下只验证注册 / 类保留,实际调用链由 debug 集成测试覆盖。
  • int → Kotlin Long → toInt():与旧通道的 32 位进度字段一致;超大文件(>2GB)进度仍沿用旧限制。
  • 不改 Apple / release.yml / widget / DownloadsPublisher;旧通道保留。

@StillMisty
StillMisty marked this pull request as ready for review November 19, 2026 18:37
@StillMisty
StillMisty merged commit 30858c4 into main Nov 19, 2026
5 checks passed
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.

Pigeon 契约:DownloadNotifications(Android,channel 模式)

1 participant