copay/js/app.js

70 lines
1.5 KiB
JavaScript
Raw Normal View History

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-12 06:21:48 -08:00
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',
'mm.foundation',
2014-03-27 12:43:51 -07:00
'monospaced.qrcode',
'ngIdle',
'gettext',
2014-11-11 11:53:30 -08:00
'ui.gravatar',
2014-11-22 19:33:57 -08:00
'ngTouch',
'copayApp.filters',
2014-06-16 12:46:17 -07:00
'copayApp.services',
2014-06-03 13:42:36 -07:00
'copayApp.controllers',
'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));
copayApp.value('defaults', defaults);
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-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', []);
angular.module('copayApp.directives', []);