From ed5685314e6248ae8e5545f469a443feb0b5e4e5 Mon Sep 17 00:00:00 2001 From: RainLoop Date: Sun, 24 Sep 2017 19:14:48 +0300 Subject: [PATCH] Fix unexpected desktop mode on mobile devices + small fixes (#1514) --- dev/Common/Links.js | 5 +- dev/Model/Message.js | 8 +- package.json | 18 ++-- .../MailSo/Base/StreamWrappers/SubStreams.php | 25 +---- .../0.0.0/app/libraries/RainLoop/Actions.php | 2 +- .../0.0.0/app/libraries/RainLoop/Service.php | 24 ++--- .../app/libraries/RainLoop/ServiceActions.php | 18 +--- .../0.0.0/app/templates/Views/User/Login.html | 6 +- .../templates/Views/User/SystemDropDown.html | 6 +- yarn.lock | 91 +++++++++++++++---- 10 files changed, 115 insertions(+), 88 deletions(-) diff --git a/dev/Common/Links.js b/dev/Common/Links.js index fb421824e..2c70a680d 100644 --- a/dev/Common/Links.js +++ b/dev/Common/Links.js @@ -10,7 +10,6 @@ const SUB_QUERY_PREFIX = '&q[]=', VERSION = Settings.appSettingsGet('version'), - IS_MOBILE = Settings.appSettingsGet('mobile'), WEB_PREFIX = Settings.appSettingsGet('webPath') || '', VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/', @@ -59,7 +58,7 @@ export function rootAdmin() */ export function rootUser() { - return IS_MOBILE ? SERVER_PREFIX + '/Mobile/' : ROOT; + return ROOT; } /** @@ -171,7 +170,7 @@ export function append() */ export function change(email) { - return serverRequest('Change' + (IS_MOBILE ? 'Mobile' : '')) + encodeURIComponent(email) + '/'; + return serverRequest('Change') + encodeURIComponent(email) + '/'; } /** diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 4d8a0c227..6d5741c73 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -761,6 +761,7 @@ class MessageModel extends AbstractModel .addClass('lazy-inited') .attr('src', element.dataset.original) .removeAttr('data-loaded') + .removeAttr('data-original') .css({opacity: 0.3}) .animate({opacity: 1}, 500); } @@ -781,13 +782,12 @@ class MessageModel extends AbstractModel $this .addClass('lazy') .attr('data-original', $this.attr(attr)) - .removeAttr('data-loaded') - .removeAttr(attr); + .removeAttr('data-loaded'); } else { $this.attr('src', $this.attr(attr)) - .removeAttr('data-loaded').removeAttr(attr); + .removeAttr('data-loaded'); } }); @@ -796,7 +796,7 @@ class MessageModel extends AbstractModel const $this = $(this); // eslint-disable-line no-invalid-this let style = trim($this.attr('style')); style = '' === style ? '' : (';' === style.substr(-1) ? style + ' ' : style + '; '); - $this.attr('style', style + $this.attr(attr)).removeAttr(attr); + $this.attr('style', style + $this.attr(attr)); }); if (lazy) diff --git a/package.json b/package.json index 217290645..cc98964ed 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "title": "RainLoop Webmail", "description": "Simple, modern & fast web-based email client", "private": true, - "version": "1.11.2", - "ownCloudVersion": "5.0.1", + "version": "1.11.3", + "ownCloudVersion": "5.0.5", "homepage": "http://rainloop.net", "main": "gulpfile.js", "author": { @@ -33,14 +33,14 @@ "keywords": [ "webmail", "php", + "javascript", "simple", "modern", "mail", "web-based", "email", "client", - "openpgp", - "plugins" + "openpgp" ], "readmeFilename": "README.md", "engines": { @@ -66,13 +66,13 @@ "copy-webpack-plugin": "4.0.1", "element-dataset": "2.2.6", "es6-promise-polyfill": "1.2.0", - "eslint": "4.6.1", + "eslint": "4.7.2", "eslint-plugin-compat": "1.0.4", "gulp": "3.9.1", "gulp-autoprefixer": "4.0.0", "gulp-cached": "1.1.1", "gulp-chmod": "2.0.0", - "gulp-clean-css": "3.8.0", + "gulp-clean-css": "3.9.0", "gulp-concat-util": "0.5.5", "gulp-eol": "0.1.2", "gulp-eslint": "4.0.0", @@ -107,18 +107,18 @@ "knockout-projections": "github:stevesanderson/knockout-projections#v1.1.0", "knockout-sortable": "0.14.1", "lightgallery": "1.2.21", - "lozad": "1.0.2", + "lozad": "1.0.4", "matchmedia-polyfill": "0.3.0", "moment": "2.18.1", "node-fs": "0.1.7", "node-notifier": "5.1.2", "normalize.css": "7.0.0", - "openpgp": "2.5.10", + "openpgp": "2.5.11", "opentip": "2.4.3", "pikaday": "1.6.1", "raw-loader": "0.5.1", "rimraf": "2.6.2", - "run-sequence": "2.1.0", + "run-sequence": "2.2.0", "simplestatemanager": "3.4.0", "style-loader": "0.18.2", "underscore": "1.8.3", diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Base/StreamWrappers/SubStreams.php b/rainloop/v/0.0.0/app/libraries/MailSo/Base/StreamWrappers/SubStreams.php index cd967af6c..d82929bd0 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Base/StreamWrappers/SubStreams.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Base/StreamWrappers/SubStreams.php @@ -67,7 +67,10 @@ class SubStreams $sHashName = \MailSo\Base\Utils::Md5Rand(); - self::$aStreams[$sHashName] = $aSubStreams; + self::$aStreams[$sHashName] = array_map(function($mItem) { + return \is_resource($mItem) ? $mItem : + \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString($mItem); + }, $aSubStreams); \MailSo\Base\Loader::IncStatistic('CreateStream/SubStreams'); @@ -181,26 +184,6 @@ class SubStreams $this->iIndex++; } } - else if (\is_string($mCurrentPart)) - { - $sReadResult = \substr($mCurrentPart, 0, $iCount); - - $sReturn .= $sReadResult; - - $iLen = \strlen($sReadResult); - if ($iCount < $iLen) - { - $this->sBuffer = \substr($sReturn, $iCount); - $sReturn = \substr($sReturn, 0, $iCount); - $iCount = 0; - } - else - { - $iCount -= $iLen; - } - - $this->iIndex++; - } } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 59f06dc59..3cbda6e85 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -14,7 +14,7 @@ class Actions const AUTH_SPEC_LOGOUT_TOKEN_KEY = 'rlspeclogout'; const AUTH_SPEC_LOGOUT_CUSTOM_MSG_KEY = 'rlspeclogoutcmk'; const AUTH_ADMIN_TOKEN_KEY = 'rlaauth'; - const RL_SKIP_MOBILE_KEY = 'rlmobile'; + const RL_MOBILE_TYPE = 'rlmobiletype'; /** * @var \MailSo\Base\Http diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php index 56e0e57e2..b19d81616 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php @@ -162,18 +162,20 @@ class Service $bMobileDevice = $oMobileDetect->isMobile() && ($bUseMobileVersionForTablets ? true : !$oMobileDetect->isTablet()); - $bMobile = (0 < \count($aPaths) && !empty($aPaths[0]) && 'mobile' === \strtolower($aPaths[0])); - } - - if ($bIndex && !$bMobile) - { - $iMobileKey = (int) \RainLoop\Utils::GetCookie(\RainLoop\Actions::RL_SKIP_MOBILE_KEY, 0); - if (1 !== $iMobileKey) + if ($bIndex) { - if ($bMobileDevice) - { - $this->oActions->Location('./?/Mobile/'); - return $this; + $sMobileType = (string) \RainLoop\Utils::GetCookie(\RainLoop\Actions::RL_MOBILE_TYPE, ''); + switch ($sMobileType) { + default: + $sMobileType = ''; + $bMobile = $bMobileDevice; + break; + case 'mobile': + $bMobile = true; + break; + case 'desktop': + $bMobile = false; + break; } } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index c3f09fb36..9f383809a 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -829,9 +829,9 @@ class ServiceActions /** * @return string */ - public function ServiceSkipMobile() + public function ServiceMobileVersion() { - \RainLoop\Utils::SetCookie(\RainLoop\Actions::RL_SKIP_MOBILE_KEY, 1); + \RainLoop\Utils::SetCookie(\RainLoop\Actions::RL_MOBILE_TYPE, 'mobile'); $this->oActions->Location('./'); return ''; } @@ -839,9 +839,9 @@ class ServiceActions /** * @return string */ - public function ServiceClearSkipMobile() + public function ServiceDesktopVersion() { - \RainLoop\Utils::ClearCookie(\RainLoop\Actions::RL_SKIP_MOBILE_KEY); + \RainLoop\Utils::SetCookie(\RainLoop\Actions::RL_MOBILE_TYPE, 'desktop'); $this->oActions->Location('./'); return ''; } @@ -1183,16 +1183,6 @@ class ServiceActions } } - /** - * @return string - */ - public function ServiceChangeMobile() - { - $this->changeAction(); - $this->oActions->Location('./?/Mobile/'); - return ''; - } - /** * @return string */ diff --git a/rainloop/v/0.0.0/app/templates/Views/User/Login.html b/rainloop/v/0.0.0/app/templates/Views/User/Login.html index 2fb04dbbd..5fdb3fc9f 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/Login.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/Login.html @@ -119,17 +119,17 @@
Powered by RainLoop
- +   - +   - + diff --git a/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html b/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html index 5a1c3ed9f..ec7e2d419 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html @@ -58,14 +58,14 @@ -