Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Fix unexpected desktop mode on mobile devices + small fixes (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
RainLoop committed Sep 24, 2017
1 parent 677a5f2 commit ed56853
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 88 deletions.
5 changes: 2 additions & 3 deletions dev/Common/Links.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '/',
Expand Down Expand Up @@ -59,7 +58,7 @@ export function rootAdmin()
*/
export function rootUser()
{
return IS_MOBILE ? SERVER_PREFIX + '/Mobile/' : ROOT;
return ROOT;
}

/**
Expand Down Expand Up @@ -171,7 +170,7 @@ export function append()
*/
export function change(email)
{
return serverRequest('Change' + (IS_MOBILE ? 'Mobile' : '')) + encodeURIComponent(email) + '/';
return serverRequest('Change') + encodeURIComponent(email) + '/';
}

/**
Expand Down
8 changes: 4 additions & 4 deletions dev/Model/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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');
}
});

Expand All @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -33,14 +33,14 @@
"keywords": [
"webmail",
"php",
"javascript",
"simple",
"modern",
"mail",
"web-based",
"email",
"client",
"openpgp",
"plugins"
"openpgp"
],
"readmeFilename": "README.md",
"engines": {
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ public static function CreateStream($aSubStreams)

$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');

Expand Down Expand Up @@ -181,26 +184,6 @@ public function stream_read($iCount)
$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++;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions rainloop/v/0.0.0/app/libraries/RainLoop/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,20 @@ private function localHandle()
$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;
}
}
}
Expand Down
18 changes: 4 additions & 14 deletions rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,19 +829,19 @@ public function ServiceAdminAppData($sAdd = '')
/**
* @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 '';
}

/**
* @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 '';
}
Expand Down Expand Up @@ -1183,16 +1183,6 @@ private function changeAction()
}
}

/**
* @return string
*/
public function ServiceChangeMobile()
{
$this->changeAction();
$this->oActions->Location('./?/Mobile/');
return '';
}

/**
* @return string
*/
Expand Down
6 changes: 3 additions & 3 deletions rainloop/v/0.0.0/app/templates/Views/User/Login.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@
</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">
<span data-bind="visible: !mobile && mobileDevice">
<span data-bind="visible: !mobile">
<i class="icon-mobile"></i>
&nbsp;
<a href="./?/Mobile/" tabindex="-1">
<a href="./?/MobileVersion/" tabindex="-1">
<span class="i18n" data-i18n="MOBILE/BUTTON_MOBILE_VERSION"></span>
</a>
</span>
<span data-bind="visible: mobile">
<i class="icon-laptop"></i>
&nbsp;
<a href="./?/SkipMobile/" tabindex="-1">
<a href="./?/DesktopVersion/" tabindex="-1">
<span class="i18n" data-i18n="MOBILE/BUTTON_DESKTOP_VERSION"></span>
</a>
</span>
Expand Down
6 changes: 3 additions & 3 deletions rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
</li>
<li class="divider" role="presentation" data-bind="visible: allowSettings || allowHelp"></li>
<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>
&nbsp;&nbsp;
<span class="i18n" data-i18n="MOBILE/BUTTON_DESKTOP_VERSION"></span>
</a>
</li>
<li class="e-item" role="presentation" data-bind="visible: !mobile && mobileDevice">
<a class="e-link menuitem" href="./?/Mobile/" tabindex="-1">
<li class="e-item" role="presentation" data-bind="visible: !mobile">
<a class="e-link menuitem" href="./?/MobileVersion/" tabindex="-1">
<i class="icon-mobile"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="MOBILE/BUTTON_MOBILE_VERSION"></span>
Expand Down
Loading

0 comments on commit ed56853

Please sign in to comment.