Fix unexpected desktop mode on mobile devices + small fixes (#1514)

This commit is contained in:
RainLoop 2017-09-24 19:14:48 +03:00
parent 677a5f2e35
commit ed5685314e
10 changed files with 115 additions and 88 deletions

View file

@ -10,7 +10,6 @@ const
SUB_QUERY_PREFIX = '&q[]=', SUB_QUERY_PREFIX = '&q[]=',
VERSION = Settings.appSettingsGet('version'), VERSION = Settings.appSettingsGet('version'),
IS_MOBILE = Settings.appSettingsGet('mobile'),
WEB_PREFIX = Settings.appSettingsGet('webPath') || '', WEB_PREFIX = Settings.appSettingsGet('webPath') || '',
VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/', VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/',
@ -59,7 +58,7 @@ export function rootAdmin()
*/ */
export function rootUser() export function rootUser()
{ {
return IS_MOBILE ? SERVER_PREFIX + '/Mobile/' : ROOT; return ROOT;
} }
/** /**
@ -171,7 +170,7 @@ export function append()
*/ */
export function change(email) export function change(email)
{ {
return serverRequest('Change' + (IS_MOBILE ? 'Mobile' : '')) + encodeURIComponent(email) + '/'; return serverRequest('Change') + encodeURIComponent(email) + '/';
} }
/** /**

View file

@ -761,6 +761,7 @@ class MessageModel extends AbstractModel
.addClass('lazy-inited') .addClass('lazy-inited')
.attr('src', element.dataset.original) .attr('src', element.dataset.original)
.removeAttr('data-loaded') .removeAttr('data-loaded')
.removeAttr('data-original')
.css({opacity: 0.3}) .css({opacity: 0.3})
.animate({opacity: 1}, 500); .animate({opacity: 1}, 500);
} }
@ -781,13 +782,12 @@ class MessageModel extends AbstractModel
$this $this
.addClass('lazy') .addClass('lazy')
.attr('data-original', $this.attr(attr)) .attr('data-original', $this.attr(attr))
.removeAttr('data-loaded') .removeAttr('data-loaded');
.removeAttr(attr);
} }
else else
{ {
$this.attr('src', $this.attr(attr)) $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 const $this = $(this); // eslint-disable-line no-invalid-this
let style = trim($this.attr('style')); let style = trim($this.attr('style'));
style = '' === style ? '' : (';' === style.substr(-1) ? style + ' ' : 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) if (lazy)

View file

@ -3,8 +3,8 @@
"title": "RainLoop Webmail", "title": "RainLoop Webmail",
"description": "Simple, modern & fast web-based email client", "description": "Simple, modern & fast web-based email client",
"private": true, "private": true,
"version": "1.11.2", "version": "1.11.3",
"ownCloudVersion": "5.0.1", "ownCloudVersion": "5.0.5",
"homepage": "http://rainloop.net", "homepage": "http://rainloop.net",
"main": "gulpfile.js", "main": "gulpfile.js",
"author": { "author": {
@ -33,14 +33,14 @@
"keywords": [ "keywords": [
"webmail", "webmail",
"php", "php",
"javascript",
"simple", "simple",
"modern", "modern",
"mail", "mail",
"web-based", "web-based",
"email", "email",
"client", "client",
"openpgp", "openpgp"
"plugins"
], ],
"readmeFilename": "README.md", "readmeFilename": "README.md",
"engines": { "engines": {
@ -66,13 +66,13 @@
"copy-webpack-plugin": "4.0.1", "copy-webpack-plugin": "4.0.1",
"element-dataset": "2.2.6", "element-dataset": "2.2.6",
"es6-promise-polyfill": "1.2.0", "es6-promise-polyfill": "1.2.0",
"eslint": "4.6.1", "eslint": "4.7.2",
"eslint-plugin-compat": "1.0.4", "eslint-plugin-compat": "1.0.4",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-autoprefixer": "4.0.0", "gulp-autoprefixer": "4.0.0",
"gulp-cached": "1.1.1", "gulp-cached": "1.1.1",
"gulp-chmod": "2.0.0", "gulp-chmod": "2.0.0",
"gulp-clean-css": "3.8.0", "gulp-clean-css": "3.9.0",
"gulp-concat-util": "0.5.5", "gulp-concat-util": "0.5.5",
"gulp-eol": "0.1.2", "gulp-eol": "0.1.2",
"gulp-eslint": "4.0.0", "gulp-eslint": "4.0.0",
@ -107,18 +107,18 @@
"knockout-projections": "github:stevesanderson/knockout-projections#v1.1.0", "knockout-projections": "github:stevesanderson/knockout-projections#v1.1.0",
"knockout-sortable": "0.14.1", "knockout-sortable": "0.14.1",
"lightgallery": "1.2.21", "lightgallery": "1.2.21",
"lozad": "1.0.2", "lozad": "1.0.4",
"matchmedia-polyfill": "0.3.0", "matchmedia-polyfill": "0.3.0",
"moment": "2.18.1", "moment": "2.18.1",
"node-fs": "0.1.7", "node-fs": "0.1.7",
"node-notifier": "5.1.2", "node-notifier": "5.1.2",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",
"openpgp": "2.5.10", "openpgp": "2.5.11",
"opentip": "2.4.3", "opentip": "2.4.3",
"pikaday": "1.6.1", "pikaday": "1.6.1",
"raw-loader": "0.5.1", "raw-loader": "0.5.1",
"rimraf": "2.6.2", "rimraf": "2.6.2",
"run-sequence": "2.1.0", "run-sequence": "2.2.0",
"simplestatemanager": "3.4.0", "simplestatemanager": "3.4.0",
"style-loader": "0.18.2", "style-loader": "0.18.2",
"underscore": "1.8.3", "underscore": "1.8.3",

View file

@ -67,7 +67,10 @@ class SubStreams
$sHashName = \MailSo\Base\Utils::Md5Rand(); $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'); \MailSo\Base\Loader::IncStatistic('CreateStream/SubStreams');
@ -181,26 +184,6 @@ class SubStreams
$this->iIndex++; $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++;
}
} }
} }

View file

@ -14,7 +14,7 @@ class Actions
const AUTH_SPEC_LOGOUT_TOKEN_KEY = 'rlspeclogout'; const AUTH_SPEC_LOGOUT_TOKEN_KEY = 'rlspeclogout';
const AUTH_SPEC_LOGOUT_CUSTOM_MSG_KEY = 'rlspeclogoutcmk'; const AUTH_SPEC_LOGOUT_CUSTOM_MSG_KEY = 'rlspeclogoutcmk';
const AUTH_ADMIN_TOKEN_KEY = 'rlaauth'; const AUTH_ADMIN_TOKEN_KEY = 'rlaauth';
const RL_SKIP_MOBILE_KEY = 'rlmobile'; const RL_MOBILE_TYPE = 'rlmobiletype';
/** /**
* @var \MailSo\Base\Http * @var \MailSo\Base\Http

View file

@ -162,18 +162,20 @@ class Service
$bMobileDevice = $oMobileDetect->isMobile() && $bMobileDevice = $oMobileDetect->isMobile() &&
($bUseMobileVersionForTablets ? true : !$oMobileDetect->isTablet()); ($bUseMobileVersionForTablets ? true : !$oMobileDetect->isTablet());
$bMobile = (0 < \count($aPaths) && !empty($aPaths[0]) && 'mobile' === \strtolower($aPaths[0])); if ($bIndex)
}
if ($bIndex && !$bMobile)
{ {
$iMobileKey = (int) \RainLoop\Utils::GetCookie(\RainLoop\Actions::RL_SKIP_MOBILE_KEY, 0); $sMobileType = (string) \RainLoop\Utils::GetCookie(\RainLoop\Actions::RL_MOBILE_TYPE, '');
if (1 !== $iMobileKey) switch ($sMobileType) {
{ default:
if ($bMobileDevice) $sMobileType = '';
{ $bMobile = $bMobileDevice;
$this->oActions->Location('./?/Mobile/'); break;
return $this; case 'mobile':
$bMobile = true;
break;
case 'desktop':
$bMobile = false;
break;
} }
} }
} }

View file

@ -829,9 +829,9 @@ class ServiceActions
/** /**
* @return string * @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('./'); $this->oActions->Location('./');
return ''; return '';
} }
@ -839,9 +839,9 @@ class ServiceActions
/** /**
* @return string * @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('./'); $this->oActions->Location('./');
return ''; return '';
} }
@ -1183,16 +1183,6 @@ class ServiceActions
} }
} }
/**
* @return string
*/
public function ServiceChangeMobile()
{
$this->changeAction();
$this->oActions->Location('./?/Mobile/');
return '';
}
/** /**
* @return string * @return string
*/ */

View file

@ -119,17 +119,17 @@
</div> </div>
<div class="e-powered thm-powered" data-bind="visible: loginPowered">Powered by <a href="http://www.rainloop.net" target="_blank">RainLoop</a></div> <div class="e-powered thm-powered" data-bind="visible: loginPowered">Powered by <a href="http://www.rainloop.net" target="_blank">RainLoop</a></div>
<div class="e-mobile-switcher thm-mobile-switcher"> <div class="e-mobile-switcher thm-mobile-switcher">
<span data-bind="visible: !mobile && mobileDevice"> <span data-bind="visible: !mobile">
<i class="icon-mobile"></i> <i class="icon-mobile"></i>
&nbsp; &nbsp;
<a href="./?/Mobile/" tabindex="-1"> <a href="./?/MobileVersion/" tabindex="-1">
<span class="i18n" data-i18n="MOBILE/BUTTON_MOBILE_VERSION"></span> <span class="i18n" data-i18n="MOBILE/BUTTON_MOBILE_VERSION"></span>
</a> </a>
</span> </span>
<span data-bind="visible: mobile"> <span data-bind="visible: mobile">
<i class="icon-laptop"></i> <i class="icon-laptop"></i>
&nbsp; &nbsp;
<a href="./?/SkipMobile/" tabindex="-1"> <a href="./?/DesktopVersion/" tabindex="-1">
<span class="i18n" data-i18n="MOBILE/BUTTON_DESKTOP_VERSION"></span> <span class="i18n" data-i18n="MOBILE/BUTTON_DESKTOP_VERSION"></span>
</a> </a>
</span> </span>

View file

@ -58,14 +58,14 @@
</li> </li>
<li class="divider" role="presentation" data-bind="visible: allowSettings || allowHelp"></li> <li class="divider" role="presentation" data-bind="visible: allowSettings || allowHelp"></li>
<li class="e-item" role="presentation" data-bind="visible: mobile"> <li class="e-item" role="presentation" data-bind="visible: mobile">
<a class="e-link menuitem" href="./?/SkipMobile/" tabindex="-1"> <a class="e-link menuitem" href="./?/DesktopVersion/" tabindex="-1">
<i class="icon-laptop"></i> <i class="icon-laptop"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="i18n" data-i18n="MOBILE/BUTTON_DESKTOP_VERSION"></span> <span class="i18n" data-i18n="MOBILE/BUTTON_DESKTOP_VERSION"></span>
</a> </a>
</li> </li>
<li class="e-item" role="presentation" data-bind="visible: !mobile && mobileDevice"> <li class="e-item" role="presentation" data-bind="visible: !mobile">
<a class="e-link menuitem" href="./?/Mobile/" tabindex="-1"> <a class="e-link menuitem" href="./?/MobileVersion/" tabindex="-1">
<i class="icon-mobile"></i> <i class="icon-mobile"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="i18n" data-i18n="MOBILE/BUTTON_MOBILE_VERSION"></span> <span class="i18n" data-i18n="MOBILE/BUTTON_MOBILE_VERSION"></span>

View file

@ -1271,9 +1271,9 @@ classnames@2.2.5:
version "2.2.5" version "2.2.5"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.5.tgz#fb3801d453467649ef3603c7d61a02bd129bde6d" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.5.tgz#fb3801d453467649ef3603c7d61a02bd129bde6d"
clean-css@4.1.8: clean-css@4.1.9:
version "4.1.8" version "4.1.9"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.1.8.tgz#061455b2494a750ac98f46d8d5ebb17c679ea9d1" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.1.9.tgz#35cee8ae7687a49b98034f70de00c4edd3826301"
dependencies: dependencies:
source-map "0.5.x" source-map "0.5.x"
@ -1680,7 +1680,7 @@ electron-to-chromium@^1.3.11, electron-to-chromium@^1.3.18:
version "1.3.21" version "1.3.21"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.21.tgz#a967ebdcfe8ed0083fc244d1894022a8e8113ea2" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.21.tgz#a967ebdcfe8ed0083fc244d1894022a8e8113ea2"
element-dataset@^2.2.6: element-dataset@2.2.6:
version "2.2.6" version "2.2.6"
resolved "https://registry.yarnpkg.com/element-dataset/-/element-dataset-2.2.6.tgz#a4e46dbb3ee991e8c7d5366ec654f87670c2ef80" resolved "https://registry.yarnpkg.com/element-dataset/-/element-dataset-2.2.6.tgz#a4e46dbb3ee991e8c7d5366ec654f87670c2ef80"
dependencies: dependencies:
@ -1844,7 +1844,49 @@ eslint-scope@^3.7.1:
esrecurse "^4.1.0" esrecurse "^4.1.0"
estraverse "^4.1.1" estraverse "^4.1.1"
eslint@4.6.1, eslint@^4.0.0: eslint@4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.7.2.tgz#ff6f5f5193848a27ee9b627be3e73fb9cb5e662e"
dependencies:
ajv "^5.2.0"
babel-code-frame "^6.22.0"
chalk "^2.1.0"
concat-stream "^1.6.0"
cross-spawn "^5.1.0"
debug "^3.0.1"
doctrine "^2.0.0"
eslint-scope "^3.7.1"
espree "^3.5.1"
esquery "^1.0.0"
estraverse "^4.2.0"
esutils "^2.0.2"
file-entry-cache "^2.0.0"
functional-red-black-tree "^1.0.1"
glob "^7.1.2"
globals "^9.17.0"
ignore "^3.3.3"
imurmurhash "^0.1.4"
inquirer "^3.0.6"
is-resolvable "^1.0.0"
js-yaml "^3.9.1"
json-stable-stringify "^1.0.1"
levn "^0.3.0"
lodash "^4.17.4"
minimatch "^3.0.2"
mkdirp "^0.5.1"
natural-compare "^1.4.0"
optionator "^0.8.2"
path-is-inside "^1.0.2"
pluralize "^7.0.0"
progress "^2.0.0"
require-uncached "^1.0.3"
semver "^5.3.0"
strip-ansi "^4.0.0"
strip-json-comments "~2.0.1"
table "^4.0.1"
text-table "~0.2.0"
eslint@^4.0.0:
version "4.6.1" version "4.6.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.6.1.tgz#ddc7fc7fd70bf93205b0b3449bb16a1e9e7d4950" resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.6.1.tgz#ddc7fc7fd70bf93205b0b3449bb16a1e9e7d4950"
dependencies: dependencies:
@ -1893,6 +1935,13 @@ espree@^3.5.0:
acorn "^5.1.1" acorn "^5.1.1"
acorn-jsx "^3.0.0" acorn-jsx "^3.0.0"
espree@^3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.1.tgz#0c988b8ab46db53100a1954ae4ba995ddd27d87e"
dependencies:
acorn "^5.1.1"
acorn-jsx "^3.0.0"
esprima@^4.0.0: esprima@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"
@ -2418,11 +2467,11 @@ gulp-chmod@2.0.0:
stat-mode "^0.2.0" stat-mode "^0.2.0"
through2 "^2.0.0" through2 "^2.0.0"
gulp-clean-css@3.8.0: gulp-clean-css@3.9.0:
version "3.8.0" version "3.9.0"
resolved "https://registry.yarnpkg.com/gulp-clean-css/-/gulp-clean-css-3.8.0.tgz#3f7c17975fb8f3d311051e880d7ac99cd387d7ef" resolved "https://registry.yarnpkg.com/gulp-clean-css/-/gulp-clean-css-3.9.0.tgz#e43e4c8d695060f6ba08a154d8e76d0d87b1c822"
dependencies: dependencies:
clean-css "4.1.8" clean-css "4.1.9"
gulp-util "3.0.8" gulp-util "3.0.8"
through2 "2.0.3" through2 "2.0.3"
vinyl-sourcemaps-apply "0.2.1" vinyl-sourcemaps-apply "0.2.1"
@ -2882,7 +2931,7 @@ interpret@^1.0.0:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0"
intersection-observer@^0.4.2: intersection-observer@0.4.2:
version "0.4.2" version "0.4.2"
resolved "https://registry.yarnpkg.com/intersection-observer/-/intersection-observer-0.4.2.tgz#24100ed620baf6a427072996d4d73366e9ec93ef" resolved "https://registry.yarnpkg.com/intersection-observer/-/intersection-observer-0.4.2.tgz#24100ed620baf6a427072996d4d73366e9ec93ef"
@ -3691,9 +3740,9 @@ loud-rejection@^1.0.0:
currently-unhandled "^0.4.1" currently-unhandled "^0.4.1"
signal-exit "^3.0.0" signal-exit "^3.0.0"
lozad@1.0.2: lozad@1.0.4:
version "1.0.2" version "1.0.4"
resolved "https://registry.yarnpkg.com/lozad/-/lozad-1.0.2.tgz#9936b781f81592e2c8309e14e9556ad9bebb403d" resolved "https://registry.yarnpkg.com/lozad/-/lozad-1.0.4.tgz#0e03e5f66a054172e74939c69190ebe70c236d01"
lru-cache@2: lru-cache@2:
version "2.7.3" version "2.7.3"
@ -4168,9 +4217,9 @@ onetime@^2.0.0:
dependencies: dependencies:
mimic-fn "^1.0.0" mimic-fn "^1.0.0"
openpgp@2.5.10: openpgp@2.5.11:
version "2.5.10" version "2.5.11"
resolved "https://registry.yarnpkg.com/openpgp/-/openpgp-2.5.10.tgz#f5e9ee3c9c008bd5e3a030365e0a4b20a152d1a4" resolved "https://registry.yarnpkg.com/openpgp/-/openpgp-2.5.11.tgz#d36c819c0918e012c7d1e8126e4551bc0a1f2738"
dependencies: dependencies:
node-fetch "^1.3.3" node-fetch "^1.3.3"
node-localstorage "~1.3.0" node-localstorage "~1.3.0"
@ -4398,6 +4447,10 @@ pluralize@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762"
pluralize@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777"
postcss-value-parser@^3.2.3: postcss-value-parser@^3.2.3:
version "3.3.0" version "3.3.0"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz#87f38f9f18f774a4ab4c8a232f5c5ce8872a9d15" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz#87f38f9f18f774a4ab4c8a232f5c5ce8872a9d15"
@ -4797,9 +4850,9 @@ run-async@^2.2.0:
dependencies: dependencies:
is-promise "^2.1.0" is-promise "^2.1.0"
run-sequence@2.1.0: run-sequence@2.2.0:
version "2.1.0" version "2.2.0"
resolved "https://registry.yarnpkg.com/run-sequence/-/run-sequence-2.1.0.tgz#149da012516f21dcf79db6dc99a2a95603631b21" resolved "https://registry.yarnpkg.com/run-sequence/-/run-sequence-2.2.0.tgz#b3f8d42836db89d08b2fe704eaf0c93dfd8335e2"
dependencies: dependencies:
chalk "^1.1.3" chalk "^1.1.3"
gulp-util "^3.0.8" gulp-util "^3.0.8"