Move dummy folders to dummy service

This commit is contained in:
Tankred Hase 2014-12-03 19:05:54 +01:00
parent c012f54c89
commit 987ddbd796
2 changed files with 47 additions and 29 deletions

View File

@ -13,7 +13,7 @@ var NOTIFICATION_SENT_TIMEOUT = 2000;
// Controller // Controller
// //
var NavigationCtrl = function($scope, $routeParams, $location, account, email, outbox, notification, appConfig, dialog) { var NavigationCtrl = function($scope, $routeParams, $location, account, email, outbox, notification, appConfig, dialog, dummy) {
if (!$routeParams.dev && !account.isLoggedIn()) { if (!$routeParams.dev && !account.isLoggedIn()) {
$location.path('/'); // init app $location.path('/'); // init app
return; return;
@ -108,7 +108,8 @@ var NavigationCtrl = function($scope, $routeParams, $location, account, email, o
function initializeFolders() { function initializeFolders() {
// create dummy folder in dev environment only // create dummy folder in dev environment only
if ($routeParams.dev) { if ($routeParams.dev) {
createDummyFolders(); $scope.$root.account = {};
$scope.account.folders = dummy.listFolders();
return; return;
} }
@ -128,33 +129,6 @@ var NavigationCtrl = function($scope, $routeParams, $location, account, email, o
timeout: NOTIFICATION_SENT_TIMEOUT timeout: NOTIFICATION_SENT_TIMEOUT
}, function() {}); }, function() {});
} }
// attach dummy folders for development
function createDummyFolders() {
$scope.$root.account = {};
$scope.account.folders = [{
type: 'Inbox',
count: 2,
path: 'INBOX'
}, {
type: 'Sent',
count: 0,
path: 'SENT'
}, {
type: config.outboxMailboxType,
count: 0,
path: config.outboxMailboxPath
}, {
type: 'Drafts',
count: 0,
path: 'DRAFTS'
}, {
type: 'Trash',
count: 0,
path: 'TRASH'
}];
}
}; };
// //

View File

@ -6,6 +6,50 @@ module.exports = Dummy;
function Dummy() {} function Dummy() {}
Dummy.prototype.listFolders = function() {
var dummies = [{
type: 'Inbox',
count: 2,
path: 'INBOX',
wellknown: true
}, {
type: 'Sent',
count: 0,
path: 'SENT',
wellknown: true
}, {
type: 'Outbox',
count: 0,
path: 'OUTBOX',
wellknown: true
}, {
type: 'Drafts',
count: 0,
path: 'DRAFTS',
wellknown: true
}, {
type: 'Trash',
count: 0,
path: 'TRASH',
wellknown: true
}, {
type: 'Flagged',
count: 0,
path: 'FLAGGED',
wellknown: true
}, {
name: 'Archive',
count: 0,
path: 'ARCHIVE'
}, {
name: 'Junk',
count: 0,
path: 'JUNK'
}];
return dummies;
};
Dummy.prototype.listMails = function() { Dummy.prototype.listMails = function() {
var uid = 1000000; var uid = 1000000;