Expose angular/common.js modules for util, app-config

This commit is contained in:
Tankred Hase 2014-11-19 17:19:55 +01:00
parent 1f5fa4ca41
commit e6b22bd0a0
8 changed files with 25 additions and 13 deletions

View File

@ -1,9 +1,17 @@
'use strict';
var appCfg = {};
var ngModule = angular.module('mail');
ngModule.factory('appConfig', function() {
return appCfg;
});
exports = appCfg;
/**
* Global app configurations
*/
exports.config = {
appCfg.config = {
cloudUrl: 'https://keys.whiteout.io',
privkeyServerUrl: 'https://keychain.whiteout.io',
adminUrl: 'https://admin-node.whiteout.io',
@ -38,7 +46,7 @@ if (typeof chrome !== 'undefined' && chrome.runtime && chrome.runtime.getManifes
}
function setConfigParams(manifest) {
var cfg = exports.config;
var cfg = appCfg.config;
function getUrl(beginsWith) {
return _.find(manifest.permissions, function(permission) {
@ -57,7 +65,7 @@ function setConfigParams(manifest) {
/**
* Strings are maintained here
*/
exports.string = {
appCfg.string = {
fallbackSubject: '(no subject)',
invitationSubject: 'Invitation to a private conversation',
invitationMessage: 'Hi,\n\nI use Whiteout Mail to send and receive encrypted email. I would like to exchange encrypted messages with you as well.\n\nPlease install the Whiteout Mail application. This application makes it easy to read and write messages securely with PGP encryption applied.\n\nGo to the Whiteout Networks homepage to learn more and to download the application: https://whiteout.io\n\n',

View File

@ -253,7 +253,7 @@ ctrl.logout = function() {
});
};
// TODO: move onConnect to emailDao
// TODO: move onConnect to Account service
/**
* Event that is called when the user agent goes online. This create new instances of the imap-client and pgp-mailer and connects to the mail server.

View File

@ -2,12 +2,12 @@
var ngModule = angular.module('woServices');
ngModule.service('mailConfig', MailConfig);
module.exports = MailConfig;
var cfg = require('../app-config').config;
function MailConfig($http, $q) {
function MailConfig($http, $q, appConfig) {
this._http = $http;
this._q = $q;
this._appConfig = appConfig;
}
/**
@ -20,7 +20,7 @@ MailConfig.prototype.get = function(emailAddress) {
});
}
var url = cfg.settingsUrl + emailAddress.split('@')[1];
var url = this._appConfig.settingsUrl + emailAddress.split('@')[1];
return this._http.get(url).then(function(res) {
return res.data;
});

View File

@ -2,6 +2,7 @@
var ngModule = angular.module('woServices');
ngModule.service('newsletter', Newsletter);
module.exports = Newsletter;
function Newsletter($q) {
this._q = $q;

View File

@ -1,5 +1,9 @@
'use strict';
var ngModule = angular.module('woUtil');
ngModule.service('connectionDoctor', ConnectionDoctor);
module.exports = ConnectionDoctor;
var TCPSocket = require('tcp-socket'),
appConfig = require('../app-config'),
cfg = appConfig.config,
@ -14,7 +18,7 @@ var TCPSocket = require('tcp-socket'),
*
* @constructor
*/
var ConnectionDoctor = function() {};
function ConnectionDoctor() {}
//
@ -293,6 +297,4 @@ function createError(code, message, underlyingError) {
error.underlyingError = underlyingError;
return error;
}
module.exports = ConnectionDoctor;
}

View File

@ -2,6 +2,7 @@
var ngModule = angular.module('woUtil');
ngModule.service('dialog', Dialog);
module.exports = Dialog;
function Dialog() {}

View File

@ -3,4 +3,5 @@
angular.module('woUtil', []);
require('./dialog');
require('./connection-doctor');
require('./update/update-handler');

View File

@ -4,7 +4,6 @@ var ngModule = angular.module('woUtil');
ngModule.service('updateHandler', ['deviceStorage', 'deviceStorage', 'auth', UpdateHandler]);
module.exports = UpdateHandler;
var axe = require('axe-logger'),
cfg = require('../../app-config').config,
updateV1 = require('./update-v1'),