Files
kuentagym/frontend/android/app
HenryandClaude Sonnet 5 8e18e77437 Plan sharing: "Print / Save as PDF" on the mobile app
The printable one-page plan layout (lib/plan-share.js planPrintHTML) was
web-only: printPlan() renders it into a hidden iframe and calls
window.print(), which Android's WebView does not implement.

On mobile the same HTML is handed to the OS print flow via a small
first-party `Print` Capacitor plugin (one method, printHtml), which is
where the user picks "Save as PDF" / "Save to Files" or a real printer.
Web is unchanged.

- Android (PrintPlugin.java): load the HTML into an off-screen WebView and,
  once loaded, drive it through the system PrintManager. A strong ref keeps
  the WebView alive until the job spools. Registered in MainActivity next
  to InstallPlugin.
- iOS (PrintPlugin.swift + .m): UIPrintInteractionController with a
  UIMarkupTextPrintFormatter. Files added to App.xcodeproj.
- lib/mobile.js: printHtml() wrapper (registerPlugin('Print')).
- sheets.jsx: the MOBILE branch of "Print / Save as PDF" calls printHtml;
  the web branch still calls printPlan.

No new dependency — the OS renders the PDF. Native code is not exercised by
the pipeline; run the manual APK job and check on device.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DBkhHLqWtSYrPdsNE11PiP
2026-09-08 11:19:25 +01:00
..