jenkins-bot has submitted this change and it was merged.
Change subject: Provide low-resolution NetSpeed option in Special:MobileOptions
......................................................................
Provide low-resolution NetSpeed option in Special:MobileOptions
After chatting with Ori,
given the images saving in bytes, the lower fully loaded time
(35s to 22s) and the fact the code is written let's make
this an available option to our users.
On long term it's probably a better option than disabling images altogether
(We may want to remove the image disabling feature if we see a drop in usage
as a result of this new option)
Have okayed with Jon Katz and Nirzar.
Change-Id: I1fe8538eb679fb7397f482407ba88c4286174e39
---
M i18n/en.json
M i18n/qqq.json
M includes/MobileContext.php
M includes/specials/SpecialMobileOptions.php
4 files changed, 27 insertions(+), 0 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/i18n/en.json b/i18n/en.json
index 755b5f5..f62a46d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -246,6 +246,7 @@
"mobile-frontend-nearby-title": "Nearby",
"mobile-frontend-nearby-sectiontext": "Near the topic of this page",
"mobile-frontend-news-items": "In the news",
+ "mobile-frontend-low-res-explain": "Receive content optimised for a
slow connection.",
"mobile-frontend-opt-in-explain": "By joining the beta, you will get
access to the latest experimental features which may be subject to software
defects.",
"mobile-frontend-overlay-close": "Close",
"mobile-frontend-overlay-continue": "Continue",
@@ -297,6 +298,7 @@
"mobile-frontend-search-submit": "Go",
"mobile-frontend-settings-images-explain": "Load all image content that
appears in a page.",
"mobile-frontend-settings-beta": "Beta",
+ "mobile-frontend-settings-lowres": "Data saving",
"mobile-frontend-settings-site-description": "{{SITENAME}} is available
in $1 {{PLURAL:$1|language|languages}}. All available versions are listed
below",
"mobile-frontend-settings-site-header": "{{SITENAME}} Languages",
"mobile-frontend-sign-in-error-heading": "Whoops",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1f9b628..291edeb 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -244,6 +244,7 @@
"mobile-frontend-nearby-title": "Title of
[[Special:Nearby]].\n{{Identical|Nearby}}",
"mobile-frontend-nearby-sectiontext": "Name of the link, which links
the user to [[Special:Nearby]] if the article has coordinates.",
"mobile-frontend-news-items": "The title that will appear before the
element with the mf-itn selector.",
+ "mobile-frontend-low-res-explain": "Used as description for the \"Data
saving\" setting in [[Special:MobileOptions]].",
"mobile-frontend-opt-in-explain": "Used as description for the \"Beta\"
in [[Special:MobileOptions]], if the beta is not enabled.",
"mobile-frontend-overlay-close": "Text for the button in an overlay
that, when clicked, dismisses the overlay.\n{{Identical|Close}}",
"mobile-frontend-overlay-continue": "Text for the button in an overlay
that, when clicked, continues to the next screen or
step.\n{{Identical|Continue}}",
@@ -295,6 +296,7 @@
"mobile-frontend-search-submit": "Label for the button near the search
box.\n{{Identical|Go}}",
"mobile-frontend-settings-images-explain": "Short description on
[[Special:MobileOptions]], that the user can enable or disable images with this
option.",
"mobile-frontend-settings-beta": "Text for beta on settings
page.\n{{Identical|Beta}}",
+ "mobile-frontend-settings-lowres": "Text for data saving option on
settings page.",
"mobile-frontend-settings-site-description": "Shown on
[[Special:MobileOptions]]. Parameters:\n* $1 - the number of other language
versions for this wiki",
"mobile-frontend-settings-site-header": "Heading for the
Special:MobileOptions/Language page - only visible to non JavaScript users",
"mobile-frontend-sign-in-error-heading": "Heading for when an error
occurred. You can translate \"Error\" instead.",
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 66c19a0..90d9a96 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -198,6 +198,17 @@
}
/**
+ * Set NetSpeed designation.
+ * @param string $value of net speed. Currently accepts
self::NETSPEED_FAST
+ * or self::NETSPEED_SLOW
+ */
+ public function setNetSpeed( $value ) {
+ $this->netSpeed = $value;
+ $this->getRequest()->response()
+ ->setCookie( 'NetSpeed', $this->netSpeed, 0, array(
'prefix' => '' ) );
+ }
+
+ /**
* Whether the user is allowed to upload
* @return boolean
*/
diff --git a/includes/specials/SpecialMobileOptions.php
b/includes/specials/SpecialMobileOptions.php
index 2da4b37..c565dd1 100644
--- a/includes/specials/SpecialMobileOptions.php
+++ b/includes/specials/SpecialMobileOptions.php
@@ -114,6 +114,13 @@
'id' => 'enable-images-toggle',
);
+ $options['lowres'] = array(
+ 'checked' => $context->getNetSpeed() ===
MobileContext::NETSPEED_SLOW ? 'checked' : '',
+ 'label' => $this->msg(
'mobile-frontend-settings-lowres' )->text(),
+ 'description' => $this->msg(
'mobile-frontend-low-res-explain' )->text(),
+ 'name' => 'enableLowResImages',
+ );
+
// beta settings
if ( $this->getMFConfig()->get( 'MFEnableBeta' ) ) {
$options['beta'] = array(
@@ -235,6 +242,11 @@
return;
}
wfIncrStats( 'mobile.options.saves' );
+
+ // set the net speed cookie
+ $context->setNetSpeed( $request->getBool( 'enableLowResImages'
) ?
+ MobileContext::NETSPEED_SLOW :
MobileContext::NETSPEED_FAST );
+
if ( $request->getBool( 'enableBeta' ) ) {
$group = 'beta';
if ( !$context->isBetaGroupMember() ) {
--
To view, visit https://gerrit.wikimedia.org/r/269566
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1fe8538eb679fb7397f482407ba88c4286174e39
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits