Repository navigation
Conversation
Codecov Report❌ Patch coverage is ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
這個 PR 做了什麼
接續 eq-report-pic(Rust 繪圖、C ABI),把 DPIP 這一端的 Flutter FFI 準備做好:之後建置流程把原生庫放進產物,就能直接畫橫式地震報告分享圖,不用再繞 Flutter UI 截圖。這支 PR 沒有任何畫面在用它,app 現在的行為不變。
改動內容:
正式程式碼
pubspec.yaml/pubspec.lock:ffi從 transitive 改成直接相依(renderer 要自己malloc/free原生記憶體),版號仍由 lock 決定。lib/core/platform/native_library.dart:平台 → 檔名的唯一一份對照(Android/Linuxlib<name>.so、macOS.dylib、Windows.dll、iOSDynamicLibrary.process)。開不起來回Result不丟例外——少了這個原生庫的 build 還是要能發地震警報。lib/shared/seismic/report_picture/eq_report_pic_bindings.dart:從 eq-report-picdart/lib/eq_report_pic.dart(c6d3420)整支搬過來,兩處本地修改都標了DPIP::拿掉它自己的open()(改走NativeLibrary),加上freeRendererlib/shared/seismic/report_picture/report_picture.dart:ReportPicture.open()建立 renderer(字型解析+底圖解碼在 isolate)、render()每次丟到新的 isolate 畫、dispose()釋放;ReportPictureFailure分開「這個 build 沒有原生庫」與「畫失敗」,呼叫端可以決定退回 Flutter 畫的卡片。lib/core/error/failure.dart:上述ReportPictureFailure/ReportPictureFailureReason。assets/fonts/report/:三支字型(13.8 MB,M+ 2p Bold/Gen Shin Gothic Bold/Noto Sans TC Black)與授權說明。不內嵌在 Rust 裡:內嵌會讓每個 Android ABI 都多一份;字型由 app 當 asset 帶著,建立 renderer 時依 fallback 順序傳進去。三支跟 cwa-eq-map 同一組,兩邊畫出來才會一樣。ARCHITECTURE.md:新增 Native libraries(FFI)一節,寫清楚 isolate 規則、打包方式(AndroidjniLibs、iOS xcframework +-force_load)與「沒有原生庫也要能啟動」。測試
test/core/platform/native_library_test.dart:檔名對照、iOS 走 process、缺檔與 loader 丟例外都轉成Result。test/shared/seismic/report_picture_test.dart:三支字型 asset 真的載得到且不是空檔;缺庫與 ABI 符號不符都在open()就回unavailable,不會拖到 render 才炸。沒做的、刻意留下的
.so/xcframework 放進去之前,ReportPicture.open()一律回unavailable。相關 issue
沒有對應的 issue。
上游:ExpTechTW/eq-report-pic(
c6d3420)。怎麼驗
tool/dev/analyze.sh:No issues found。tool/dev/test.sh test/core/platform/native_library_test.dart test/shared/seismic/report_picture_test.dart:11 個測試通過。tool/check.sh:format/analyze/codegen 與各道 bash gate(workflows、workflow_security、tooling、l10n、pubspec_lock、notification_sounds、build_info、widget_township_resources、layering、storage、wall_clock)都過;全套測試除了test/tool/的 10 個環境失敗以外全過。origin/mainworktree 一樣失敗,與這支 PR 無關:這個 clone 只有 60 個 commit(shallow),release_notes_platform_test需要的b6ea9e89/61f69f1a不在物件庫;其餘是腳本在容器裡的執行權限。CI 的完整 checkout 不會有這個問題。檢查清單
tool/check/commits.sh origin/main..HEAD通過gh pr checks:build、Android、iOS、code-review、codecov ×2 都是 pass;Instrumented skipped)