2014-11-17 12:58:03 -05:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var ngModule = angular.module('woServices');
|
|
|
|
ngModule.service('account', Account);
|
|
|
|
|
2014-11-18 12:44:00 -05:00
|
|
|
var Email = require('./email');
|
2014-11-17 12:58:03 -05:00
|
|
|
|
|
|
|
function Account() {
|
2014-11-18 12:44:00 -05:00
|
|
|
this._emailDAOs = [];
|
2014-11-17 12:58:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lists all of the current accounts connected to the app
|
|
|
|
* @return {Array<Object>} The account objects containing folder and message objects
|
|
|
|
*/
|
|
|
|
Account.prototype.all = function() {
|
2014-11-18 12:44:00 -05:00
|
|
|
return this._emailDAOs.map(function(emailDao) {
|
|
|
|
return emailDao._account;
|
|
|
|
});
|
2014-11-17 12:58:03 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Login to an existing email account. This creates a new email data access object instance for that account and logs in via IMAP.
|
|
|
|
* @param {String} options.emailAddress The account's email address
|
|
|
|
*/
|
|
|
|
Account.prototype.login = function(options) {
|
2014-11-18 12:44:00 -05:00
|
|
|
var emailDao = new Email();
|
|
|
|
this._emailDAOs.push(emailDao);
|
2014-11-17 12:58:03 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new whiteout account. This creates a new email data access object instance for that account and logs in via IMAP.
|
|
|
|
* @param {String} options.emailAddress The account's email address
|
|
|
|
*/
|
|
|
|
Account.prototype.create = function(options) {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logout of an email account. This creates a new email data access object instance for that account and logs in via IMAP.
|
|
|
|
* @param {String} options.emailAddress The account's email address
|
|
|
|
*/
|
|
|
|
Account.prototype.logout = function(options) {};
|