diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-22 09:52:26 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-22 09:52:26 +0300 |
| commit | b0f07dd0a4535a330553e323417ccdd354fae22f (patch) | |
| tree | a39fb53a0dc6206d57c690ea11d317b9a20772cc /player-android/lib/utils | |
| parent | aaf61a9e3c0e1439faee36c21462e0788639b7f1 (diff) | |
Fix bb review issues: stale snapshot, double-tap guard, button dedup, comments
- _downloadEpisodeAt: read _episodes fresh inside setState instead of using
the pre-await snapshot, and guard that the index is still valid and the row
still lacks a mediaId, preventing silent overwrites of data refreshed by
_load() during the await.
- Add Set<int> _pendingDownloads to prevent concurrent download API calls when
the user double-taps; visually disable the button while in-flight via new
isLoading parameter on _DownloadButton.
- Extract _EpisodeActionButton shared primitive to eliminate structural
duplication between _PlayButton and _DownloadButton (DRY).
- Fix misleading mediaId null-safety comment to describe the actual guarantee.
- Add comments to episodeToggleErrorMessage and episodeDownloadErrorMessage
explaining why they use action-specific fallback strings.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'player-android/lib/utils')
| -rw-r--r-- | player-android/lib/utils/error_mappers.dart | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/player-android/lib/utils/error_mappers.dart b/player-android/lib/utils/error_mappers.dart index 4427efa..b7c0fe3 100644 --- a/player-android/lib/utils/error_mappers.dart +++ b/player-android/lib/utils/error_mappers.dart @@ -318,6 +318,9 @@ String episodeToggleErrorMessage(Object error) { } return dioConnectionErrorMessage(error); } + // Action-specific fallback: gives the user more context than a generic + // "Unexpected error" message when the toggle mutation fails for an unknown + // reason (e.g. an exception type that is not a DioException). return 'Could not update episode. Please try again.'; } @@ -345,5 +348,8 @@ String episodeDownloadErrorMessage(Object error) { } return dioConnectionErrorMessage(error); } + // Action-specific fallback: gives the user more context than a generic + // "Unexpected error" message when the download mutation fails for an unknown + // reason (e.g. an exception type that is not a DioException). return 'Could not download episode. Please try again.'; } |
