**`DeviceDetector` is a provisional name.**
---
The `MobileContext#getDevice`, `#isMobileDevice`, `#getAMF`, and the `DeviceDetection`, `DeviceProperties`, and `HtmlDeviceProperties` classes are the part of the MobileFrontend codebase that guess a device's form factor.
Briefly, the `Device*` classes are used to guess the form factor given the User-Agent header and the Accept header. The `HtmlDeviceProperties` is stub class that represents a mobile device. The `MobileContext` methods share some of the responsibility of guessing at the device's form factor, which stops us from refining (if possible) the design of the `Device*` classes.
==AC
[x] The `MobileContext` class no longer bears responsibility for guessing at the device's form factor
[] ~~There exists a `MobileFrontend.DeviceDetector` service that is responsible for guessing at the device's form factor~~
==Proposed Plan (YMMV)
* Create the `MobileFrontend.DeviceDetector` service and corresponding class ("service class"), which answers the following questions:
* does the device have a mobile form factor?
* does the device have a tablet form factor?
* Review the design of the `Device*` classes and see whether they answer those questions directly
* Integrate `MobileContext#getDevice` and `#getAMF` with the service class, removing `MobileContext#getDevice` and `#getAMF`
* Remove `MobileContext#isMobileDevice`
* Make `MobileContext` depend on the service class and delegate to it when guessing at the device's form factor
== Test Plan
Either on our staging server or on your development wiki:
* Enable device detection, i.e. add `$wgMFAutodetectMobileView = true;` to `LocalSetttings.php` and:
** Browse to any page on the wiki using a desktop UA and you shouldn't see the Minerva skin.
** Browse to a page on the wiki using a mobile UA and you should see the Minerva skin.
** Browse to a page on the wiki using a tablet UA and you should see the Minerva skin.
** Browse to a page with the `X-Subdomain` header set to `M` and you should see the Minerva skin.
* Disable device detection, i.e. add `$wgMFAutodetectMobileView = false;` to `LocalSettings.php` and:
** Browse to any page on the wiki using any UA and you shouldn't see the Minerva skin.
** Browser to a page with the `X-Subdomain` header set to `M` and you shouldn't see the Minerva skin.