Open Bug 1907840 Opened 7 months ago Updated 4 months ago

Use a dedicated state for storing the microsurvey prompt state

Categories

(Fenix :: Experimentation and Telemetry, task, P3)

All
Android
task

Tracking

(Not tracked)

People

(Reporter: towhite, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid][group2])

See the review checker ReviewQualityCheckState.kt as an example.

Whiteboard: [f
Whiteboard: [f → [fxdroid][group2]

Based on the research I have done, this ticket requires substantial code changes due to the fact how the MicrosurveyBottomSheetFragment is created, how it is using the data in relation to the ReviewQualityCheckFragment.
The latter is using a store which encapsulates the middlewares required and also has a state.

The review quality check feature has it's own dedicated state and action, ReviewQualityCheckState and ReviewQualityCheckAction, which need to be created for the microsurvey feature, to have the same code structure between the features.

The microsurvey MessagingMiddleware uses the AppState and AppAction, which are too generic, and with a new state class, the AppAction.MessagingAction.MicrosurveyAction would be better used, but extracting this would mean having possible regressions, as the MessagingMiddleware uses actions from AppAction too, which would need to be moved to the new MicrosurveyAction.

The new MicrosurveyState class could have a state for the scenario when the microsurvey is disabled, enabled, and it can also have states for the actual survey state, that is, if the user selected an answer, completed the survey which are going to be consumed in the MicrosurveyBottomSheet composable.

The visibility of the MicrosurveyRequestPrompt can also be part of the state, as now inside HomeFragment#listenForMicrosurveyMessage the currentMicrosurvey field indicates if there is a microsurvey to be shown, which will show the prompt composable. This logic currently is outside of the HomeFragment's scope and needs to be abstracted out.

You need to log in before you can comment on or make changes to this bug.