Skip to content

feat(earthquake): add 4:5 and 9:16 report sharing cards - #674

Draft
YinCheng0106 wants to merge 3 commits into
mainfrom
feat/share-card
Draft

YinCheng0106 wants to merge 3 commits into
mainfrom
feat/share-card

Conversation

@YinCheng0106

@YinCheng0106 YinCheng0106 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

這個 PR 做了什麼

在地震報告詳情加入分享卡片預覽,可將 4:5 資訊卡與 9:16 限時動態圖片存入相簿。此 PR 是開發草稿,尚未核准公開發布。

正式程式碼

  • 4:5 資訊卡輸出 1080 × 1350 PNG,9:16 限時動態輸出 1080 × 1920 PNG。兩者使用固定畫布字級與共用 DPIP App 圖示,預覽操作元件支援系統文字縮放。
  • iOS 與 Android 透過原生 MapLibre Snapshot 取得底圖及同一畫格的觀測投影座標。依震央與觀測範圍配置相機,對齊資訊區、品牌與標記,Android 的拍攝方位固定正北。縣市及鄉鎮市區界線維持顯示。
  • 預設按投影距離使用 40 px 分群。代表位置、群內最大震度、觀測筆數和標記避讓由同一批觀測產生。開發旗標可切換 D75-compact 候選及對應圖例。
  • 儲存前確認權限與請求仍有效。已完成的 PNG 可在儲存失敗後重試。依平台權限狀態顯示重試、前往設定或限制訊息。在地化涵蓋 App 語系,分享對話框與觀測標記提供無障礙標籤。

測試

  • Flutter 涵蓋相機取景、分群、標記與圖例配置、固定字級與輸出尺寸、權限與儲存、格式切換與過期請求。測試使用單色合成底圖及 7 份離線地震報告樣本。
  • Android 裝置測試以原生 MapLibre 比對 1×、2×、3× 的 PNG 尺寸與北向投影,並驗證錯誤回傳和同時擷取。

已知問題與發布阻礙

  1. Task 3。iOS Snapshot 對裁切過的多邊形描邊時,可能將向量圖磚邊緣畫成假的行政界線。
  2. Task 5B-2。MapLibre Snapshot 可能在可見範圍仍缺必要底圖圖磚時回傳成功。PNG 尺寸與投影驗證無法證明每塊圖磚已繪出。
  3. Task 3D-2。現行圖磚的權威產製方、同版未裁切幾何與產製規則仍未取得,行政界線修復缺少來源依據。
  4. D75-compact。75 km 群徑限制為暫定候選,仍待地震資料與產品端核可。預設關閉,僅以開發旗標驗證。
  5. Instagram 可移動貼紙。仍在可行性研究階段,App 目前提供相簿 PNG 儲存。
  6. 實機驗收。iOS/Android 實機無障礙、Instagram 限時動態匯入,以及 Android API 26–28 的舊版權限流程尚待驗證。

相關 issue

怎麼驗

以下是 rebase 至 main(3b1020dc)後的本機結果,對應分支 HEAD d7352191。

檢查 結果
DPIP_NO_CACHE=1 tool/check.sh 通過。格式檢查 1,207 份檔案、0 份修改,分析器無問題。工作流程、安全性、分層、儲存等檢查全過。在地化產生與 12 個 ARB 一致性通過,codegen 重跑無差異。
Flutter 全套與覆蓋率 3,909 通過、11 跳過、0 失敗。行覆蓋率 94.69%(38,878/41,058)。
分享回歸 預設 40 px 分群與 DPIP_STORY_D75_COMPACT=true 各 107 項通過。測試含固定畫布字級、兩種 PNG 尺寸、相簿權限、同一 PNG 重試及過期請求防護。
iOS tool/dev/test_ios.sh iPhone 18 Pro、iOS 27.2 模擬器,RunnerTests 421 通過、0 失敗。
iOS tool/dev/test_widget_ui.sh iOS 27.2 模擬器,WidgetFixtureUITests 25 通過、0 失敗。
Android tool/dev/test_android_device.sh Pixel 10 Pro、API 37 AVD,10 通過、0 失敗。包含 4 個 Snapshot/投影案例與 6 個 Widget 裝置案例。
Android tool/dev/test_android.sh Gradle JVM 全套 620 通過、0 跳過、0 失敗。
Android tool/dev/lint_android.sh 通過。
Git 3 筆提交符合提交規範,索引與分支差異的空白檢查通過。

在 iOS 與 Android 模擬器的正式地震報告詳情開啟「預覽分享卡片」,分別儲存 4:5 與 9:16。同一筆臺南市東山區報告在兩平台均從相簿讀回並解碼為 1080 × 1350、1080 × 1920 PNG。兩端的震央、觀測標記、資訊區與品牌位置相符,iOS 的 Story 仍可見 Task 3 的假邊界。

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過。
  • 依原生地圖與配置、相簿基礎、分享介面與測試三個提交整理。
  • 格式、分析與 Flutter 全套測試通過。
  • 新增的操作文案與無障礙標籤使用 AppLocalizations。
  • GitHub CI 全部通過。待本草稿的檢查完成。
  • UI 驗收完成。已檢視模擬器圖面,實機無障礙與 Instagram 匯入仍待驗證。

Platform: all

New(zh-Hant): 地震報告可預覽並儲存 4:5 資訊卡與 9:16 限時動態圖片
New(en-US): Preview and save 4:5 information cards and 9:16 Story images from earthquake reports
@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.97407% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.66%. Comparing base (3b1020d) to head (d735219).

Files with missing lines Patch % Lines
...ke/presentation/widgets/earthquake_share_card.dart 76.02% 35 Missing ⚠️
.../presentation/widgets/earthquake_share_dialog.dart 94.18% 20 Missing ⚠️
...thquake/presentation/pages/report_detail_page.dart 84.05% 11 Missing ⚠️
lib/core/platform/image_saver.dart 86.27% 7 Missing ⚠️
...sentation/widgets/earthquake_share_story_card.dart 98.94% 4 Missing ⚠️
...ures/earthquake/presentation/story_camera_fit.dart 96.15% 1 Missing ⚠️
...ake/presentation/story_observation_clustering.dart 97.22% 1 Missing ⚠️

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YinCheng0106 YinCheng0106 self-assigned this Nov 20, 2026
@YinCheng0106 YinCheng0106 added android Issues or pull requests related to the Android platform. ios Issues or pull requests related to the iOS platform. labels Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android Issues or pull requests related to the Android platform. ios Issues or pull requests related to the iOS platform. size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant