Note: T212516 needs to be fixed before turning this on.
Consider a feature branch to speed up development and encourage you to break this work into small progressive easily-reviewable chunks rather than one giant commit. Sync with whoever is working on T212216
more details in T210653: [EPIC] AMC - Opting in, please read before starting this task. Note that the acceptance criteria in this task does not reflect the final version of the feature.
- Toggle is on the mobile settings page for logged in users server and client side
- For anonymous users, no toggle appears server or client side
- The feature is available as a separate setting (not a part of beta)
- When opting into the new mode using the toggle switch, there's no product need to reload the page (as currently the UI doesn't change in any visible way) but we may want to reload it given in future changes may happen. Developer should decide what makes the most sense here.
- When a user opts in to the AMC mode we need to ensure it is logged and compatible with Schema:PrefUpdate in WikimediaEvents per T212516. Make sure it uses either the WikimediaEventsHooks::onUserSaveOptions hook or the API. Note that if we use and update the hook, we also get T212516 fixed for free!
- 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)
Prototype & workflow
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.
This preference is likely needed to be registered in Special:Preferences (although can be added as a hidden preference). See MFEnableMobilePreferences for how we're managing mobile preferences currently.
Note, in the case of opting into beta mode when logged in, the setting of the mode is handled in 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.
Note: we wil NOT brand the experience like we do with the beta symbol (see screenshot).
This was added to beta as we got lots of bug reports (screenshots) and didn't know what configuration the user was using so how to replicate, but will not be used in AMC as we are expected the UI changes to be much more obvious.
sign off steps
- setup task to turn on amc mode with talk feature in production
- unstall T212516