Repository navigation
fix: Android widget ETA and refresh failure states - #101
steventeng2022 wants to merge 1 commit into
Conversation
Av1anJay
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved — no blocking defects found in the changed widget code.
What I verified by reading the diff plus the surrounding FavoriteGroupWidgetSupport code:
widgetEtaTextseparates unavailable estimates (null/negative →--) from an actually arriving bus (0→ 進站中,1-59→ 即將進站) and ignores blank or JSON-nullmessages that the previousformatEtaTextrendered verbatim. The unit tests cover the boundaries,Int.MIN_VALUE, and the"null"/" NULL "message cases.buildContentRemoteViewsnow fetches onlyitems.take(MAX_WIDGET_ITEMS)and de-duplicates route and station requests withassociateBy, so hidden entries no longer produce network work or failure state (hiddenEntriesDoNotTriggerFailuresexercises exactly that, including the 6-item container count).- Failure surfacing is per item (
更新失敗,無法取得班次,請重試) plus a group-level部分資料更新失敗,請點右上角重試。, and the last complete-refresh timestamp is preserved on partial failure (updateTimestamp = successfulFetches > 0 && !hasFailures). - The loading state uses
partiallyUpdateAppWidget, so previously rendered arrivals stay visible instead of being replaced by the empty view.
Checks run: this host has no Flutter/Android toolchain (and no emulator), so I could not execute the Robolectric suites locally — I relied on CI instead. Run 37102905090 on 78c8f701 is green, and the Build Android APK job's new step "Test Android widget ETA and rendering" reports success, i.e. FavoriteWidgetRenderingTest and WidgetEtaTextTest really executed against the inflated RemoteViews (not a no-match filter). Verify (Analyze/Test/Web geometry) also passes.
Non-blocking suggestion: the new step filters to tw.avianjay.taiwanbus.flutter.*Widget*Test, so the other Kotlin test classes under android/app/src/test (LastBusMessageTest, RouteTripMonitorServiceTest, TripNotificationTextTest, YABusApplicationTest) still never run in CI — no other workflow invokes :app:testDebugUnitTest. Running the task without --tests, or with tw.avianjay.taiwanbus.flutter.*Test, would give those existing suites coverage too. See the inline note.
Summary
Related to #30. The original intermittent widget crash has not been reproduced; this PR addresses concrete display and refresh-state problems without claiming to close that report.
Validation
Device checks still needed