-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Low
-
Affects Version/s: None
-
None
-
FLW Mobile App
-
UAT
Goal
Turn the Gamification module on or off per ASHA, driven by the server flag in flw-api/user/getUserDetail (backend ticket in AMM, linked).
Current state (branch naf_feature_gamification)
- helpers/GamificationConfigProvider.isMechanicEnabled combines Firebase Remote Config (master + per-mechanic + pilot userId allowlist). It always returns true in BuildConfig.DEBUG, so a flag can't be tested on debug/UAT QA builds.
- Only Monthly Recap uses it (MonthlyRecapAvailability, MonthlyRecapReminderWorker).
- Not gated: badge workers + TaskCompletionBus.start() (HomeActivity.setUpFirstTimePullWorker), evening notification alarm (HomeActivity → NotificationScheduler.schedule(), NotifBootReceiver, NotificationEngine.deliverEveningNotification), badge celebrations (observeBadgeCelebrations), the My Impact carousel and Badge Shelf in SchedulerFragment, the Journey screen, and BadgeSyncWorker.
Scope (mobile)
- Add an optional gamification model to UserDetailsInResponse (model/User.kt). Parse it in UserRepo.setUserRole (login) and UserRepo.setFacilityData (every Home open), and cache it in PreferenceDao. On network failure, keep the last cached value.
- GamificationConfigProvider.isMechanicEnabled = server flag for this ASHA only. Firebase Remote Config gating is not used: its code is commented out (not deleted) in GamificationConfigProvider and SakhiApplication (2026-11-03). Until this ticket lands, the provider returns each mechanic's defaultOn for a logged-in user (same as the old Remote Config defaults). Replace the blanket DEBUG bypass with a debug-only override so QA can test the server flag.
- Route every entry point through the provider: badge workers + bus, badge evaluation/sync, celebrations, the My Impact card + Badge Shelf navigation, evening alarm scheduling/boot re-arm/delivery, the Journey deeplink, and Monthly Recap (already gated).
- When the flag turns OFF: cancel the unique badge works, cancel the evening alarm, stop the bus, and hide the UI. Keep local badge/recap data so re-enabling resumes without loss. When it turns ON: schedule again on the next Home open.
- Default when no flag has been received yet (first login offline, older backend): OFF, so the module stays hidden until the server says otherwise. To be confirmed with product.
- Unit tests: provider truth table, prefs persistence, worker/alarm cancellation on toggle-off.
Acceptance criteria
- An ASHA with enabled=false sees no badges card, no recap strip, no celebrations, and gets no 21:00 notification. No badge workers run.
- Flipping the flag on the server takes effect on the next Home open, with no reinstall or re-login.
- Each mechanic can be toggled on its own (badges / monthlyRecap / notifications).
- Works offline using the last cached flag.
Dependency
Blocked by the AMM backend ticket (getUserDetail contract).