1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-23 01:12:19 -05:00

[WO-448] Do not show reader on first select in mobile mode

This commit is contained in:
Tankred Hase 2014-07-21 16:05:29 +02:00
parent 23298e8f12
commit 2019f7f657
2 changed files with 12 additions and 7 deletions

View File

@ -5,12 +5,12 @@ define(function(require) {
_ = require('underscore'), _ = require('underscore'),
appController = require('js/app-controller'), appController = require('js/app-controller'),
notification = require('js/util/notification'), notification = require('js/util/notification'),
emailDao, outboxBo, keychainDao, searchTimeout; emailDao, outboxBo, keychainDao, searchTimeout, firstSelect;
var INIT_DISPLAY_LEN = 20, var INIT_DISPLAY_LEN = 20,
SCROLL_DISPLAY_LEN = 10; SCROLL_DISPLAY_LEN = 10;
var MailListCtrl = function($scope, $timeout) { var MailListCtrl = function($scope) {
// //
// Init // Init
// //
@ -56,7 +56,12 @@ define(function(require) {
} }
$scope.state.mailList.selected = email; $scope.state.mailList.selected = email;
if (!firstSelect) {
// only toggle to read view on 2nd select in mobile mode
$scope.state.read.toggle(true); $scope.state.read.toggle(true);
}
firstSelect = false;
keychainDao.refreshKeyForUserId(email.from[0].address, onKeyRefreshed); keychainDao.refreshKeyForUserId(email.from[0].address, onKeyRefreshed);
@ -183,9 +188,8 @@ define(function(require) {
// Shows the next message based on the uid of the currently selected element // Shows the next message based on the uid of the currently selected element
if (currentFolder().messages.indexOf(currentMessage()) === -1) { if (currentFolder().messages.indexOf(currentMessage()) === -1) {
$timeout(function() { firstSelect = true; // reset first selection
$scope.select($scope.displayMessages[0]); $scope.select($scope.displayMessages[0]);
});
} }
}); });
@ -388,6 +392,7 @@ define(function(require) {
return; return;
} }
firstSelect = false;
$scope.select(_.findWhere(currentFolder().messages, { $scope.select(_.findWhere(currentFolder().messages, {
uid: uid uid: uid
})); }));

View File

@ -458,7 +458,7 @@ define(function(require) {
scope.remove(mail); scope.remove(mail);
expect(emailDaoMock.deleteMessage.calledOnce).to.be.true; expect(emailDaoMock.deleteMessage.calledOnce).to.be.true;
expect(scope.state.mailList.selected).to.not.exist; expect(scope.state.mailList.selected).to.exist;
}); });
}); });
}); });