Skip to content

v0.1.15

Choose a tag to compare

@github-actions github-actions released this 02 Oct 05:46
· 5 commits to master since this release

🐞 修复:旧版 WebView 打开 PDF 直接失败

部分 Android 设备报 「PDF 打开失败:Promise.withResolvers is not a function」,PDF 完全打不开。

原因:pdfjs-dist 4.x 使用了 Promise.withResolvers(ES2024,需要 Chrome 119+),而 Vite 的 build.target 只做语法降级、不会补 API;系统 WebView 版本偏低的机器(Chrome < 119)一打开 PDF 就抛错。

修复:

  • 新增 src/lib/polyfills.js:纯语句 + 全部特性检测(现代浏览器上完全是 no-op),补齐 Promise.withResolvers / any / allSettled / try、Array/String 的 at / findLast / toSorted / toReversed / toSpliced / with、replaceAll、Object.hasOwn / fromEntries / groupBy、Map.groupBy、Set 集合运算、URL.canParse、AbortSignal.timeout、structuredClone
  • main.jsx 最先导入该补丁,确保在 App → pdfEngine → pdfjs 求值前完成打补丁
  • vite.config.js 新增 pdfWorkerPolyfills 插件:把同一份补丁原样前置进 pdfjs 的 worker 产物(worker 是独立线程,主线程补丁到不了它,而 worker 里同样调用了这些 API)——构建日志里 worker 体积 +14.2 kB 就是注入结果
  • 新增 npm run verify:polyfills(tools/verify-polyfills.mjs):先删掉 27 个 API 模拟旧 WebView,再加载补丁逐项断言行为,作为回归守卫

💡 仍建议在设备上更新「Android System WebView」/ Chrome,以获得完整性能与新特性支持。

产物说明

  • app-debug.apk — debug 签名,直接安装即用
  • app-release-unsigned.apk — 未签名,需自行 apksigner 签名后安装
  • Note-Studio-0.1.15-Windows.exe — Windows 便携版

⚠️ 三个产物均为本机构建,包含被 .gitignore 排除的 PDF 工作室运行时(dart-pdf-editor / open-pdf-studio);CI 干净 checkout 构建不出这些目录,同名覆盖了 CI 上传的缺运行时版本。

Full Changelog: v0.1.14...v0.1.15