== Background
more details in {T210653}, **please read** before starting this task. Note that the acceptance criteria in this task does not reflect the final version of the feature.
== Acceptance criteria
[] Toggle is on the mobile settings page for logged in users
[] For anonymous users, no toggle appears
[] The feature is available as a separate setting (not a part of beta)
= Open questions
[] FeaturesManager::isFeatureAvailableInContext will need to be updated to take a $user object and check the stored value of AMC. It's unclear if that needs to be part of this change or separated into a new task or the talk task (T212216)
[] Will we need to brand the experience to show it has worked a la beta?
{F27638009}
[] When opting into the new mode using the toggle switch, do we need to reload the page in any way (on beta we do as the beta interface might change!)?
== Mockup
{F27322644}
== Prototype & workflow
https://wikimedia.invisionapp.com/share/RNO2HHBPK7M#/screens/331909359_Enabling-Disabling
= Developer notes
Note: that the form currently works with and WITHOUT JavaScript
{F27637937}
The form is a standard POST form with the post handled in SpecialMobileOptions::submitSettingsForm
This will need to set a user preference when the user is logged in.
Ideally that user preference should only be set if the value has changed from the default (otherwise every save to this form is going to set a value unnecessarily)
The new field will need to be added if the user is logged in.
Note, in the case of opting into beta mode when logged in, the setting of the mode is handled in [[ https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/includes/MobileContext.php#L272 | setMobileMode ]]. This code might be useful to look at.
The JS mode will be a little trickier.
That will need to inject a toggle box and HIDE the checkbox (see https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/resources/mobile.special.mobileoptions.scripts/mobileoptions.js#L128 and implementation of beta toggle)
Make sure it's possible to tab between the controls as a proxy to check that the form is accessible.