refactor(cleanup): Phase 2 — mechanical renames
refactor(cleanup): Phase 2 — mechanical renames
Section titled “refactor(cleanup): Phase 2 — mechanical renames”Branch: refactor/cleanup-phase-2-renames → refactor/cleanup-phase-1-dead-code (stacked; retarget to main once Phase 1 merges)
Phase 2 of docs/refactoring/architecture-cleanup-plan.md. It only renames and moves files and fixes import paths. The one identifier rename is episode_lenght → episode_length. No logic changes.
Changes (one commit per step)
Section titled “Changes (one commit per step)”| Step | Change |
|---|---|
| 10 | lib/TotalPlayTime.dart → lib/core/utils/total_play_time.dart (2 importers) |
| 11 | Swap the two auth file names so each matches its class: auth_bottomsheet.dart now holds AuthBottomSheet, and auth_bottomsheet_widget.dart holds AuthBottomSheetWidget. 16 importers updated. Git shows this as two full-file rewrites rather than renames, because both paths still exist |
| 12 | bloc/connectivity/connectivity_bloc.dart → connectivity_cubit.dart (the class is ConnectivityCubit; 3 importers plus the cubit test) |
| 13 | bloc/watch_history/ → bloc/watch_history_screen/ and bloc/series_episode/ → bloc/series/ |
| 14 | widgets/watchlist_bottomsheet/watchlist_bottomsheet_widget.dart → widgets/bottomsheet_widget/watchlist_bottom_menu.dart (class WatchlistBottomMenu; its only importer is WatchListBottomSheet) |
| 16 | const.dart: drop the doc comments, including the entitlement_token comment that had been pasted twice |
| 15 | episode_lenght → episode_length (const.dart and its 2 consumers) |
Where this differs from the plan doc
Section titled “Where this differs from the plan doc”- Step 13: the doc proposed renaming the classes (
WatchHistoryBloc,SeriesEpisodeBloc). But each file already matched its class, and only the folder was out of line. Every other folder inbloc/is named after its file prefix (watchlist_screen/,home_screen/, …), so the folders were renamed and the classes were left alone. - Step 14: the doc proposed moving
WatchListBottomSheetout ofbottomsheet_widget/. That class is a staticshow()helper, like its five siblings in that folder, so it stays put. The misnamed menu widget moved in next to it instead, and the emptywatchlist_bottomsheet/folder is gone.
Verification
Section titled “Verification”fvm flutter analyze: 0 errors and 259 warnings, the same asmain. The only changes are to messages that quote a renamed path or identifier:- The unused-import warning that was already in
deeplink_services.dartnow namesauth_bottomsheet_widget.dart. - The
non_constant_identifier_namesinfo now namesepisode_length. - Two
file_namesinfos are gone.
- The unused-import warning that was already in
fvm flutter test: 876 passed. The only failures are the two that already fail onmain(category_screen_test“Songs paints no category strip” andfeed_tabs_shell_test“a single-feed shell paints no strip at all”).dart run build_runner build --delete-conflicting-outputs: none of the moved files is generated or generates code. The only regenerated diff was incache_content_entity.g.dart, a file this PR does not touch. It is left out of this PR and explained in the note below.- On the iOS Simulator, a debug warm cold start logged the same startup sequence as Phase 1.
debugDumpAppshowedMainScaffold,HomeScreen,FeedTabsShelland the renamedAuthBottomSheetWidgetmounted, with no Flutter exceptions. Behind the ATT prompt the screen was black, but the Phase 1 build shows the same black screen on the same warm install, so the renames did not cause it.
Note, already on main and not caused by this PR
Section titled “Note, already on main and not caused by this PR”Commit 127e974b rolled lib/domain/entities/cache_content_entity.g.dart back to an older generated version:
- The adapter writes
contentAccessToken(field 22) but no longer reads it back. A downloaded item therefore loses its content-access token after an app restart. - The hand-kept
(fields[21] as int?) ?? 0became the bare castfields[21] as int. For rows written before field 21 existed, that cast throws, and_initHiveresponds by wiping thedownloadsbox.
A fix that survives regeneration is @HiveField(21, defaultValue: 0) on settlementAttempts, followed by a build_runner run. It deserves its own PR.
🤖 Generated with Claude Code