-
Type:
Story
-
Resolution: Unresolved
-
Priority:
High
-
Affects Version/s: None
-
STOP TB Sprint 12, STOP TB Sprint 13
Background / Context
TB-related functionality has grown and is now tightly coupled, which slows down fixes and enhancements as the app scales.
Current Behaviour
Unused code stays in the codebase. It makes builds slower, adds conditional branches that can never be reached, and makes the real code paths harder to follow.
Expected Behaviour / Requirement
Delete code that is confirmed unused. Simplify the conditionals that depended on it. App behaviour must stay exactly the same.
Tasks
- Remove unreachable HomeActivity and supervisor navigation (#12, Medium). Delete HomeActivity, HomeFragment, HomeViewModel, the screens only nav_home reaches, and nav_supervisor. Remove the is HomeActivity checks from 29 files, keeping the else-branch behaviour. Keep fragments that nav_volunteer still uses. One module per PR.
- Remove unused disease-programme workers and repositories (#16, Low). Delete the 13 unreferenced workers (e.g. PullMalariaFromAmritWorker, PushToD2DWorker) and the Malaria, AES, Filaria, KalaAzar, Leprosy and Asha repos. Keep Room entities and DAOs that migrations reference. Before removing the ~5 workers referenced only inside WorkerUtils, confirm they have no callers.
- Remove unused list and form adapters (#17, Low). Delete about 20 unused adapters, including FormInputAdapterOld and FormInputAdapterWithBgIcon. In the same PR, remove the matching <variable> entries in layout XML, or data binding won't compile.
- Clean up unused DAO methods, helpers and DTOs (#18, Low). Remove about 70 DAO methods, 39 HelperUtil functions, 24 BindingUtils adapters, 16 JsonAdapters DTOs, 20 unused mappers in Ben.kt and the 600-line commented block. Before deleting each item, grep src, res and tests to confirm nothing uses it.
- Replace deprecated APIs and fix silent error handling.
User Story
As a developer, I want unused code removed so that the codebase is smaller, builds faster and only shows the code paths that actually run.
Acceptance Criteria
- Given HomeActivity is removed, when the app is built and launched, then every reachable screen and flow works as before.
- Given the unused workers are removed, when sync runs (online and on camp Wi-Fi), then all TB, ABHA and NCD sync jobs run as before.
- Given the unused adapters are removed, when the app is built, then data binding compiles and every list screen renders correctly.
- Given an existing install is upgraded, when the app starts, then all Room migrations succeed and no data is lost.
- Given a 100k to 1M record dataset, when the app starts and syncs, then performance is equal to or better than before.
Business Rules / Validations
- Never delete Room entities, DAOs or tables that migrations reference.
- Delete only what grep across src, res and tests confirms is unused.
- Each task ships as its own PR, and each PR needs a clean build plus a smoke test.
QA / Testing Considerations
-
- Run a full smoke test of every reachable screen and the navigation from Login, Volunteer and Camp mode.
- Run sync regression, both online and on offline camp Wi-Fi.
- Test an upgrade from the current production release on a device that has unsynced data.
- Compare APK size and build time before and after.