2014-03-14 13:38:27 -07:00
|
|
|
'use strict';
|
|
|
|
|
2014-08-27 13:09:29 -07:00
|
|
|
var copay = require('copay');
|
2014-10-25 15:57:12 -07:00
|
|
|
var _ = require('lodash');
|
2014-12-04 12:59:02 -08:00
|
|
|
var LS = require('../js/plugins/LocalStorage');
|
2014-12-04 10:45:50 -08:00
|
|
|
var ls = new LS();
|
2014-12-02 05:40:24 -08:00
|
|
|
|
2014-12-04 10:45:50 -08:00
|
|
|
|
2014-12-05 09:23:33 -08:00
|
|
|
// TODO move this to configService !
|
|
|
|
var config = copay.defaultConfig;
|
2014-12-04 10:45:50 -08:00
|
|
|
ls.getItem('config', function(err, data) {
|
2014-12-05 09:23:33 -08:00
|
|
|
var localConfig;
|
|
|
|
try {
|
2014-12-04 10:45:50 -08:00
|
|
|
localConfig = JSON.parse(data);
|
2014-12-05 09:23:33 -08:00
|
|
|
} catch(e) {};
|
2014-12-04 10:45:50 -08:00
|
|
|
if (localConfig) {
|
|
|
|
var cmv = copay.version.split('.')[1];
|
|
|
|
var lmv = localConfig.version ? localConfig.version.split('.')[1] : '-1';
|
|
|
|
if (cmv === lmv) {
|
|
|
|
_.each(localConfig, function(value, key) {
|
|
|
|
config[key] = value;
|
|
|
|
});
|
|
|
|
}
|
2014-05-16 08:40:26 -07:00
|
|
|
}
|
2014-12-04 10:45:50 -08:00
|
|
|
});
|
2014-05-16 08:40:26 -07:00
|
|
|
|
2014-09-01 11:13:23 -07:00
|
|
|
var modules = [
|
2014-03-19 09:17:18 -07:00
|
|
|
'ngRoute',
|
2014-05-16 13:18:25 -07:00
|
|
|
'angularMoment',
|
2014-03-27 08:07:10 -07:00
|
|
|
'mm.foundation',
|
2014-03-27 12:43:51 -07:00
|
|
|
'monospaced.qrcode',
|
2014-07-30 16:12:22 -07:00
|
|
|
'ngIdle',
|
2014-09-05 12:56:47 -07:00
|
|
|
'gettext',
|
2014-11-11 11:53:30 -08:00
|
|
|
'ui.gravatar',
|
2014-11-22 19:33:57 -08:00
|
|
|
'ngTouch',
|
2014-06-03 12:39:06 -07:00
|
|
|
'copayApp.filters',
|
2014-06-16 12:46:17 -07:00
|
|
|
'copayApp.services',
|
2014-06-03 13:42:36 -07:00
|
|
|
'copayApp.controllers',
|
2014-06-03 12:39:06 -07:00
|
|
|
'copayApp.directives',
|
2014-09-01 11:13:23 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
var copayApp = window.copayApp = angular.module('copayApp', modules);
|
2014-03-25 07:35:04 -07:00
|
|
|
|
2014-12-05 09:23:33 -08:00
|
|
|
var defaults = JSON.parse(JSON.stringify(copay.defaultConfig));
|
2014-10-14 14:47:39 -07:00
|
|
|
copayApp.value('defaults', defaults);
|
2014-10-14 11:31:23 -07:00
|
|
|
|
2014-07-17 12:53:38 -07:00
|
|
|
copayApp.config(function($sceDelegateProvider) {
|
2014-08-27 13:09:29 -07:00
|
|
|
$sceDelegateProvider.resourceUrlWhitelist([
|
|
|
|
'self',
|
|
|
|
'mailto:**'
|
2014-07-17 12:53:38 -07:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2014-11-11 11:53:30 -08:00
|
|
|
angular.module('ui.gravatar').config([
|
2014-12-01 06:19:18 -08:00
|
|
|
'gravatarServiceProvider',
|
|
|
|
function(gravatarServiceProvider) {
|
2014-11-11 11:53:30 -08:00
|
|
|
gravatarServiceProvider.defaults = {
|
2014-12-01 06:19:18 -08:00
|
|
|
size: 35
|
2014-11-11 11:53:30 -08:00
|
|
|
};
|
|
|
|
// Use https endpoint
|
|
|
|
gravatarServiceProvider.secure = true;
|
|
|
|
}
|
|
|
|
]);
|
2014-07-30 16:12:22 -07:00
|
|
|
|
2014-06-03 13:42:36 -07:00
|
|
|
angular.module('copayApp.filters', []);
|
2014-06-16 12:46:17 -07:00
|
|
|
angular.module('copayApp.services', []);
|
2014-06-03 13:42:36 -07:00
|
|
|
angular.module('copayApp.controllers', []);
|
2014-06-03 12:39:06 -07:00
|
|
|
angular.module('copayApp.directives', []);
|