From 7432f216bb357c2aeba176d0a47eeabd974a3056 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 3 Jun 2014 15:03:14 -0300 Subject: [PATCH 1/6] add handler for missing configuration errors --- js/controllers/signin.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 213e0a4aa..7185c0922 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -24,10 +24,16 @@ angular.module('copay.signin').controller('SigninController', console.log('## Obtaining passphrase...'); Passphrase.getBase64Async(password, function(passphrase){ console.log('## Passphrase obtained'); - var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase}); + var w, errMsg; + try{ + var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase}); + } catch (e){ + errMsg = e.message; + }; + if (!w) { $scope.loading = $scope.failure = false; - $rootScope.$flashMessage = { message: 'Wrong password', type: 'error'}; + $rootScope.$flashMessage = { message: errMsg || 'Wrong password', type: 'error'}; $rootScope.$digest(); return; } From ac58d9744e96a073131d4419c42492e56dfd4b25 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 3 Jun 2014 16:39:06 -0300 Subject: [PATCH 2/6] change angular module namespace to copayApp --- js/app.js | 69 ++++++++++++----------- js/controllers/addresses.js | 2 +- js/controllers/backup.js | 2 +- js/controllers/footer.js | 2 +- js/controllers/header.js | 2 +- js/controllers/import.js | 2 +- js/controllers/send.js | 2 +- js/controllers/settings.js | 2 +- js/controllers/setup.js | 2 +- js/controllers/signin.js | 2 +- js/controllers/transactions.js | 2 +- js/directives.js | 2 +- js/filters.js | 2 +- js/init.js | 2 +- js/routes.js | 4 +- js/services/controllerUtils.js | 2 +- js/services/passphrase.js | 2 +- js/services/socket.js | 2 +- js/services/video.js | 2 +- js/services/walletFactory.js | 2 +- test/unit/controllers/controllersSpec.js | 72 ++++++++++++------------ 21 files changed, 92 insertions(+), 89 deletions(-) diff --git a/js/app.js b/js/app.js index 64e9245b9..ce3c7e391 100644 --- a/js/app.js +++ b/js/app.js @@ -16,46 +16,47 @@ var log = function() { if (config.verbose) console.log(arguments); } +// From the bundle var copay = require('copay'); -var copayApp = window.copayApp = angular.module('copay',[ +var copayApp = window.copayApp = angular.module('copayApp',[ 'ngRoute', 'angularMoment', 'mm.foundation', 'monospaced.qrcode', 'notifications', - 'copay.filters', - 'copay.header', - 'copay.footer', - 'copay.addresses', - 'copay.transactions', - 'copay.send', - 'copay.backup', - 'copay.walletFactory', - 'copay.signin', - 'copay.socket', - 'copay.controllerUtils', - 'copay.setup', - 'copay.directives', - 'copay.video', - 'copay.import', - 'copay.passphrase', - 'copay.settings' + 'copayApp.filters', + 'copayApp.header', + 'copayApp.footer', + 'copayApp.addresses', + 'copayApp.transactions', + 'copayApp.send', + 'copayApp.backup', + 'copayApp.walletFactory', + 'copayApp.signin', + 'copayApp.socket', + 'copayApp.controllerUtils', + 'copayApp.setup', + 'copayApp.directives', + 'copayApp.video', + 'copayApp.import', + 'copayApp.passphrase', + 'copayApp.settings' ]); -angular.module('copay.header', []); -angular.module('copay.footer', []); -angular.module('copay.addresses', []); -angular.module('copay.transactions', []); -angular.module('copay.send', []); -angular.module('copay.backup', []); -angular.module('copay.walletFactory', []); -angular.module('copay.controllerUtils', []); -angular.module('copay.signin', []); -angular.module('copay.setup', []); -angular.module('copay.socket', []); -angular.module('copay.directives', []); -angular.module('copay.video', []); -angular.module('copay.import', []); -angular.module('copay.passphrase', []); -angular.module('copay.settings', []); +angular.module('copayApp.header', []); +angular.module('copayApp.footer', []); +angular.module('copayApp.addresses', []); +angular.module('copayApp.transactions', []); +angular.module('copayApp.send', []); +angular.module('copayApp.backup', []); +angular.module('copayApp.walletFactory', []); +angular.module('copayApp.controllerUtils', []); +angular.module('copayApp.signin', []); +angular.module('copayApp.setup', []); +angular.module('copayApp.socket', []); +angular.module('copayApp.directives', []); +angular.module('copayApp.video', []); +angular.module('copayApp.import', []); +angular.module('copayApp.passphrase', []); +angular.module('copayApp.settings', []); diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js index 943b5a6f4..a1884cab1 100644 --- a/js/controllers/addresses.js +++ b/js/controllers/addresses.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.addresses').controller('AddressesController', +angular.module('copayApp.addresses').controller('AddressesController', function($scope, $rootScope, $timeout, controllerUtils) { $scope.loading = false; var w = $rootScope.wallet; diff --git a/js/controllers/backup.js b/js/controllers/backup.js index e2605153a..e48836277 100644 --- a/js/controllers/backup.js +++ b/js/controllers/backup.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.backup').controller('BackupController', +angular.module('copayApp.backup').controller('BackupController', function($scope, $rootScope, $location, $window, $timeout, $modal) { $scope.title = 'Backup'; diff --git a/js/controllers/footer.js b/js/controllers/footer.js index 7fe81808d..82fe4762b 100644 --- a/js/controllers/footer.js +++ b/js/controllers/footer.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.footer').controller('FooterController', function($rootScope, $sce, $scope, $http) { +angular.module('copayApp.footer').controller('FooterController', function($rootScope, $sce, $scope, $http) { if (config.themes && Array.isArray(config.themes) && config.themes[0]) { $scope.themes = config.themes; diff --git a/js/controllers/header.js b/js/controllers/header.js index 30eb00d59..cdec7c5c4 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.header').controller('HeaderController', +angular.module('copayApp.header').controller('HeaderController', function($scope, $rootScope, $location, $notification, $http, walletFactory, controllerUtils) { $scope.menu = [ { diff --git a/js/controllers/import.js b/js/controllers/import.js index c2328e0ae..b65fc655c 100644 --- a/js/controllers/import.js +++ b/js/controllers/import.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.import').controller('ImportController', +angular.module('copayApp.import').controller('ImportController', function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) { $scope.title = 'Import a backup'; var reader = new FileReader(); diff --git a/js/controllers/send.js b/js/controllers/send.js index cc52b40b2..ff8e9b369 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.send').controller('SendController', +angular.module('copayApp.send').controller('SendController', function($scope, $rootScope, $window, $location, $timeout) { $scope.title = 'Send'; $scope.loading = false; diff --git a/js/controllers/settings.js b/js/controllers/settings.js index b87237eef..facceb343 100644 --- a/js/controllers/settings.js +++ b/js/controllers/settings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.settings').controller('SettingsController', +angular.module('copayApp.settings').controller('SettingsController', function($scope, $rootScope, $window, $location) { $scope.title = 'Settings'; diff --git a/js/controllers/setup.js b/js/controllers/setup.js index 6020b4acb..6523c2daa 100644 --- a/js/controllers/setup.js +++ b/js/controllers/setup.js @@ -32,7 +32,7 @@ var valid_pairs = { '1,12': 489 }; -angular.module('copay.setup').controller('SetupController', +angular.module('copayApp.setup').controller('SetupController', function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase) { $rootScope.videoInfo = {}; diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 7185c0922..42e73446a 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.signin').controller('SigninController', +angular.module('copayApp.signin').controller('SigninController', function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) { var cmp = function(o1, o2){ var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase(); diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index ede169280..3f47ffae1 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.transactions').controller('TransactionsController', +angular.module('copayApp.transactions').controller('TransactionsController', function($scope, $rootScope, $timeout, controllerUtils) { $scope.title = 'Transactions'; diff --git a/js/directives.js b/js/directives.js index 33fad2040..5e6ad0883 100644 --- a/js/directives.js +++ b/js/directives.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.directives') +angular.module('copayApp.directives') .directive('validAddress', [ function() { diff --git a/js/filters.js b/js/filters.js index 5954ea5d1..dd52d20e6 100644 --- a/js/filters.js +++ b/js/filters.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.filters', []) +angular.module('copayApp.filters', []) .filter('amTimeAgo', ['amMoment', function(amMoment) { return function(input) { return amMoment.preprocessDate(input).fromNow(); diff --git a/js/init.js b/js/init.js index 4c8f29b30..57a364790 100644 --- a/js/init.js +++ b/js/init.js @@ -2,5 +2,5 @@ angular.element(document).ready(function() { // Init the app - angular.bootstrap(document, ['copay']); + angular.bootstrap(document, ['copayApp']); }); diff --git a/js/routes.js b/js/routes.js index 5e44085eb..366b5f29f 100644 --- a/js/routes.js +++ b/js/routes.js @@ -2,7 +2,7 @@ //Setting up route angular - .module('copay') + .module('copayApp') .config(function($routeProvider) { $routeProvider @@ -56,7 +56,7 @@ angular //Setting HTML5 Location Mode angular - .module('copay') + .module('copayApp') .config(function($locationProvider) { $locationProvider .html5Mode(false); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 25f4bcb11..b2b4f8579 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.controllerUtils') +angular.module('copayApp.controllerUtils') .factory('controllerUtils', function($rootScope, $sce, $location, $notification, Socket, video) { var root = {}; var bitcore = require('bitcore'); diff --git a/js/services/passphrase.js b/js/services/passphrase.js index 21fd495ae..fb8196321 100644 --- a/js/services/passphrase.js +++ b/js/services/passphrase.js @@ -1,3 +1,3 @@ 'use strict'; -angular.module('copay.passphrase').value('Passphrase', new copay.Passphrase(config.passphrase)); +angular.module('copayApp.passphrase').value('Passphrase', new copay.Passphrase(config.passphrase)); diff --git a/js/services/socket.js b/js/services/socket.js index f9ac7bb26..7b3c4713f 100644 --- a/js/services/socket.js +++ b/js/services/socket.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay.socket').factory('Socket', +angular.module('copayApp.socket').factory('Socket', function($rootScope) { var listeners = []; var url = 'http://' + config.socket.host + ':' + config.socket.port; diff --git a/js/services/video.js b/js/services/video.js index e206f4ed2..9f4fb8523 100644 --- a/js/services/video.js +++ b/js/services/video.js @@ -93,4 +93,4 @@ Video.prototype.close = function() { this.mediaConnections = {}; }; -angular.module('copay.video').value('video', new Video()); +angular.module('copayApp.video').value('video', new Video()); diff --git a/js/services/walletFactory.js b/js/services/walletFactory.js index 49af6ef26..ba2497425 100644 --- a/js/services/walletFactory.js +++ b/js/services/walletFactory.js @@ -1,4 +1,4 @@ 'use strict'; -angular.module('copay.walletFactory').value('walletFactory', new copay.WalletFactory(config, copay.version)); +angular.module('copayApp.walletFactory').value('walletFactory', new copay.WalletFactory(config, copay.version)); diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index 12502bd8a..904c31377 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -3,39 +3,41 @@ // describe("Unit: Testing Controllers", function() { - beforeEach(angular.mock.module('copay')); - - it('should have a AddressesController controller', function() { - expect(copayApp.AddressesController).not.to.equal(null); - }); - - it('should have a BackupController controller', function() { - expect(copayApp.Backupcontroller).not.to.equal(null); - }); - - it('should have a HeaderController controller', function() { - expect(copayApp.HeaderController).not.to.equal(null); - }); - - it('should have a SendController controller', function() { - expect(copayApp.SendController).not.to.equal(null); - }); - - it('should have a SetupController controller', function() { - expect(copayApp.SetupController).not.to.equal(null); - }); - - it('should have a SigninController controller', function() { - expect(copayApp.SigninController).not.to.equal(null); - }); - - it('should have a TransactionsController controller', function() { - expect(copayApp.TransactionsController).not.to.equal(null); - }); - - beforeEach(angular.mock.module('copay.walletFactory')); - it('should display a link to create a new wallet if no wallets in localStorage', inject(function(walletFactory) { - expect(walletFactory.storage.getWalletIds()).to.be.empty; - })); - +// beforeEach(module('copay')); + beforeEach(module('copay.signin')); + + it('should have a AddressesController controller', function() { +console.log('[controllersSpec.js.10:copayApp:]',copayApp.controller); //TODO + expect(copayApp.AddressesController).not.to.equal(null); + }); +// +// it('should have a BackupController controller', function() { +// expect(copayApp.Backupcontroller).not.to.equal(null); +// }); +// +// it('should have a HeaderController controller', function() { +// expect(copayApp.HeaderController).not.to.equal(null); +// }); +// +// it('should have a SendController controller', function() { +// expect(copayApp.SendController).not.to.equal(null); +// }); +// +// it('should have a SetupController controller', function() { +// expect(copayApp.SetupController).not.to.equal(null); +// }); +// +// it('should have a SigninController controller', function() { +// expect(copayApp.SigninController).not.to.equal(null); +// console.log('[controllersSpec.js.30:copayApp:]',copayApp); //TODO +// }); +// +// it('should have a TransactionsController controller', function() { +// expect(copayApp.TransactionsController).not.to.equal(null); +// }); +// +// beforeEach(angular.mock.module('copay.walletFactory')); +// it('should display a link to create a new wallet if no wallets in localStorage', inject(function(walletFactory) { +// expect(walletFactory.storage.getWalletIds()).to.be.empty; +// })); }); From 77f6a8221a48cd7a6b6125a4686352190214c582 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 3 Jun 2014 17:42:36 -0300 Subject: [PATCH 3/6] change names in services --- js/app.js | 36 ++++-------------------- js/controllers/addresses.js | 2 +- js/controllers/backup.js | 2 +- js/controllers/footer.js | 2 +- js/controllers/header.js | 2 +- js/controllers/import.js | 2 +- js/controllers/send.js | 2 +- js/controllers/settings.js | 2 +- js/controllers/setup.js | 2 +- js/controllers/signin.js | 2 +- js/controllers/transactions.js | 2 +- js/services/controllerUtils.js | 2 +- js/services/passphrase.js | 3 +- js/services/socket.js | 2 +- js/services/video.js | 2 +- js/services/walletFactory.js | 2 +- karma.conf.js | 8 ++++-- test/unit/controllers/controllersSpec.js | 28 ++++++++++++++---- test/unit/directives/directivesSpec.js | 2 +- test/unit/services/servicesSpec.js | 7 ++--- 20 files changed, 53 insertions(+), 59 deletions(-) diff --git a/js/app.js b/js/app.js index ce3c7e391..2060979fc 100644 --- a/js/app.js +++ b/js/app.js @@ -26,37 +26,13 @@ var copayApp = window.copayApp = angular.module('copayApp',[ 'monospaced.qrcode', 'notifications', 'copayApp.filters', - 'copayApp.header', - 'copayApp.footer', - 'copayApp.addresses', - 'copayApp.transactions', - 'copayApp.send', - 'copayApp.backup', - 'copayApp.walletFactory', - 'copayApp.signin', - 'copayApp.socket', - 'copayApp.controllerUtils', - 'copayApp.setup', + 'copayApp.controllers', 'copayApp.directives', - 'copayApp.video', - 'copayApp.import', - 'copayApp.passphrase', - 'copayApp.settings' + 'copayApp.services', ]); -angular.module('copayApp.header', []); -angular.module('copayApp.footer', []); -angular.module('copayApp.addresses', []); -angular.module('copayApp.transactions', []); -angular.module('copayApp.send', []); -angular.module('copayApp.backup', []); -angular.module('copayApp.walletFactory', []); -angular.module('copayApp.controllerUtils', []); -angular.module('copayApp.signin', []); -angular.module('copayApp.setup', []); -angular.module('copayApp.socket', []); +angular.module('copayApp.filters', []); +angular.module('copayApp.controllers', []); angular.module('copayApp.directives', []); -angular.module('copayApp.video', []); -angular.module('copayApp.import', []); -angular.module('copayApp.passphrase', []); -angular.module('copayApp.settings', []); +angular.module('copayApp.services', []); + diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js index a1884cab1..8e9e0a213 100644 --- a/js/controllers/addresses.js +++ b/js/controllers/addresses.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.addresses').controller('AddressesController', +angular.module('copayApp.controllers').controller('AddressesController', function($scope, $rootScope, $timeout, controllerUtils) { $scope.loading = false; var w = $rootScope.wallet; diff --git a/js/controllers/backup.js b/js/controllers/backup.js index e48836277..f23a44f5d 100644 --- a/js/controllers/backup.js +++ b/js/controllers/backup.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.backup').controller('BackupController', +angular.module('copayApp.controllers').controller('BackupController', function($scope, $rootScope, $location, $window, $timeout, $modal) { $scope.title = 'Backup'; diff --git a/js/controllers/footer.js b/js/controllers/footer.js index 82fe4762b..280fff354 100644 --- a/js/controllers/footer.js +++ b/js/controllers/footer.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.footer').controller('FooterController', function($rootScope, $sce, $scope, $http) { +angular.module('copayApp.controllers').controller('FooterController', function($rootScope, $sce, $scope, $http) { if (config.themes && Array.isArray(config.themes) && config.themes[0]) { $scope.themes = config.themes; diff --git a/js/controllers/header.js b/js/controllers/header.js index cdec7c5c4..c33362952 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.header').controller('HeaderController', +angular.module('copayApp.controllers').controller('HeaderController', function($scope, $rootScope, $location, $notification, $http, walletFactory, controllerUtils) { $scope.menu = [ { diff --git a/js/controllers/import.js b/js/controllers/import.js index b65fc655c..f58d261bb 100644 --- a/js/controllers/import.js +++ b/js/controllers/import.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.import').controller('ImportController', +angular.module('copayApp.controllers').controller('ImportController', function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) { $scope.title = 'Import a backup'; var reader = new FileReader(); diff --git a/js/controllers/send.js b/js/controllers/send.js index ff8e9b369..9bb5d7700 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.send').controller('SendController', +angular.module('copayApp.controllers').controller('SendController', function($scope, $rootScope, $window, $location, $timeout) { $scope.title = 'Send'; $scope.loading = false; diff --git a/js/controllers/settings.js b/js/controllers/settings.js index facceb343..4c1bb13c1 100644 --- a/js/controllers/settings.js +++ b/js/controllers/settings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.settings').controller('SettingsController', +angular.module('copayApp.controllers').controller('SettingsController', function($scope, $rootScope, $window, $location) { $scope.title = 'Settings'; diff --git a/js/controllers/setup.js b/js/controllers/setup.js index 6523c2daa..4f49dcb96 100644 --- a/js/controllers/setup.js +++ b/js/controllers/setup.js @@ -32,7 +32,7 @@ var valid_pairs = { '1,12': 489 }; -angular.module('copayApp.setup').controller('SetupController', +angular.module('copayApp.controllers').controller('SetupController', function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase) { $rootScope.videoInfo = {}; diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 42e73446a..506c42512 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.signin').controller('SigninController', +angular.module('copayApp.controllers').controller('SigninController', function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) { var cmp = function(o1, o2){ var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase(); diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index 3f47ffae1..3613012c4 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.transactions').controller('TransactionsController', +angular.module('copayApp.controllers').controller('TransactionsController', function($scope, $rootScope, $timeout, controllerUtils) { $scope.title = 'Transactions'; diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index b2b4f8579..3581fa682 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllerUtils') +angular.module('copayApp.services') .factory('controllerUtils', function($rootScope, $sce, $location, $notification, Socket, video) { var root = {}; var bitcore = require('bitcore'); diff --git a/js/services/passphrase.js b/js/services/passphrase.js index fb8196321..00ff9e2be 100644 --- a/js/services/passphrase.js +++ b/js/services/passphrase.js @@ -1,3 +1,4 @@ 'use strict'; -angular.module('copayApp.passphrase').value('Passphrase', new copay.Passphrase(config.passphrase)); +angular.module('copayApp.services') + .value('Passphrase', new copay.Passphrase(config.passphrase)); diff --git a/js/services/socket.js b/js/services/socket.js index 7b3c4713f..1642309c2 100644 --- a/js/services/socket.js +++ b/js/services/socket.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.socket').factory('Socket', +angular.module('copayApp.services').factory('Socket', function($rootScope) { var listeners = []; var url = 'http://' + config.socket.host + ':' + config.socket.port; diff --git a/js/services/video.js b/js/services/video.js index 9f4fb8523..af2073589 100644 --- a/js/services/video.js +++ b/js/services/video.js @@ -93,4 +93,4 @@ Video.prototype.close = function() { this.mediaConnections = {}; }; -angular.module('copayApp.video').value('video', new Video()); +angular.module('copayApp.services').value('video', new Video()); diff --git a/js/services/walletFactory.js b/js/services/walletFactory.js index ba2497425..3e201b6f1 100644 --- a/js/services/walletFactory.js +++ b/js/services/walletFactory.js @@ -1,4 +1,4 @@ 'use strict'; -angular.module('copayApp.walletFactory').value('walletFactory', new copay.WalletFactory(config, copay.version)); +angular.module('copayApp.services').value('walletFactory', new copay.WalletFactory(config, copay.version)); diff --git a/karma.conf.js b/karma.conf.js index 63e9fb1e0..8331b8672 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -47,8 +47,6 @@ module.exports = function(config) { //Mocha stuff 'test/mocha.conf.js', - //test files - 'test/unit/**/*.js', //App-specific Code 'js/app.js', @@ -57,7 +55,11 @@ module.exports = function(config) { 'js/filters.js', 'js/services/*.js', 'js/controllers/*.js', - 'js/init.js' + 'js/init.js', + + + //test files + 'test/unit/**/*.js' ], diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index 904c31377..75d45e881 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -3,13 +3,31 @@ // describe("Unit: Testing Controllers", function() { -// beforeEach(module('copay')); - beforeEach(module('copay.signin')); - + beforeEach(module('notifications')); + beforeEach(module('copayApp.services')); + beforeEach(module('copayApp.controllers')); + + var scope, addressCtrl; +// + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); + addressCtrl = $controller('AddressesController', { + $scope: scope, + }); + })); + + + it('should have a AddressesController controller', function() { -console.log('[controllersSpec.js.10:copayApp:]',copayApp.controller); //TODO - expect(copayApp.AddressesController).not.to.equal(null); + expect(scope.loading).equal(false); }); + + it('selectedAddr should modify scope', function() { + expect(scope.selectedAddress).equal(undefined); + scope.selectAddress('hola'); + expect(scope.selectedAddr).equal('hola'); + }); + // // it('should have a BackupController controller', function() { // expect(copayApp.Backupcontroller).not.to.equal(null); diff --git a/test/unit/directives/directivesSpec.js b/test/unit/directives/directivesSpec.js index 42aa5f521..4f3b76d82 100644 --- a/test/unit/directives/directivesSpec.js +++ b/test/unit/directives/directivesSpec.js @@ -6,7 +6,7 @@ describe("Unit: Testing Directives", function() { var $scope, form; - beforeEach(module('copay.directives')); + beforeEach(module('copayApp.directives')); describe('Validate Address', function() { beforeEach(inject(function($compile, $rootScope) { diff --git a/test/unit/services/servicesSpec.js b/test/unit/services/servicesSpec.js index fd3563eee..fbb8f6c2d 100644 --- a/test/unit/services/servicesSpec.js +++ b/test/unit/services/servicesSpec.js @@ -3,22 +3,19 @@ // describe("Unit: Testing Services", function() { - beforeEach(angular.mock.module('copay.socket')); + beforeEach(angular.mock.module('copayApp.services')); it('should contain a Socket service', inject(function(Socket) { expect(Socket).not.to.equal(null); })); - - beforeEach(angular.mock.module('copay.walletFactory')); - it('should contain a walletFactory service', inject(function(walletFactory) { expect(walletFactory).not.to.equal(null); })); // TODO - /*beforeEach(angular.mock.module('copay.controllerUtils')); + /*beforeEach(angular.mock.module('copayApp.controllerUtils')); it('should contain a controllerUtils service', inject(function(controllerUtils) { expect(controllerUtils).not.to.equal(null); From ca7b9168c34efcce6504c5f2a1bdbdcc6e8b8c17 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 3 Jun 2014 17:46:37 -0300 Subject: [PATCH 4/6] rm log --- js/models/core/Wallet.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 0d2e99086..ee4da36ec 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -65,7 +65,6 @@ Wallet.prototype.seedCopayer = function(pubKey) { Wallet.prototype.connectToAll = function() { var all = this.publicKeyRing.getAllCopayerIds(); - console.log('[Wallet.js.58] connecting'); //TODO this.network.connectToCopayers(all); if (this.seededCopayerId) { this.sendWalletReady(this.seededCopayerId); From 7798e3825324957dbf9e90911c31657fcff63def Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Tue, 3 Jun 2014 18:38:56 -0300 Subject: [PATCH 5/6] remove console.logs --- API.js | 2 +- js/controllers/send.js | 4 +-- js/controllers/signin.js | 3 --- js/controllers/transactions.js | 2 -- js/models/blockchain/Insight.js | 2 -- js/models/core/PublicKeyRing.js | 7 +---- js/models/core/TxProposals.js | 3 --- js/models/core/Wallet.js | 3 --- js/models/core/WalletFactory.js | 7 +++-- js/models/network/Base.js | 41 ----------------------------- js/models/network/WebRTC.js | 32 ---------------------- js/models/storage/Base.js | 38 -------------------------- js/models/storage/File.js | 2 -- js/models/storage/LocalEncrypted.js | 2 +- js/models/storage/LocalPlain.js | 2 -- js/services/controllerUtils.js | 6 ----- js/services/notifications.js | 12 ++------- js/services/video.js | 2 -- 18 files changed, 9 insertions(+), 161 deletions(-) delete mode 100644 js/models/network/Base.js delete mode 100644 js/models/storage/Base.js diff --git a/API.js b/API.js index a97c821a2..e5e36636c 100644 --- a/API.js +++ b/API.js @@ -12,7 +12,7 @@ API.prototype._init = function(opts) { var WalletFactory = require('soop').load('./js/models/core/WalletFactory', { Storage: opts.Storage || require('./test/mocks/FakeStorage'), - Network: opts.Network || require('./js/models/network/Base'), + Network: opts.Network || require('./js/models/network/WebRTC'), Blockchain: opts.Blockchain || require('./js/models/blockchain/Insight') }); diff --git a/js/controllers/send.js b/js/controllers/send.js index 9bb5d7700..73569b501 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -93,7 +93,7 @@ angular.module('copayApp.controllers').controller('SendController', //alert(JSON.stringify(qrcode.process(context))); qrcode.decode(); } catch (e) { - console.log('error decoding QR: '+e); + // error decoding QR } }, 1500); }; @@ -135,7 +135,6 @@ angular.module('copayApp.controllers').controller('SendController', }; var _videoError = function(err) { - console.log('Video Error: ' + JSON.stringify(err)); _scanStop(); }; @@ -143,7 +142,6 @@ angular.module('copayApp.controllers').controller('SendController', _scanStop(); var str = (data.indexOf('bitcoin:') === 0) ? data.substring(8) : data; - console.log('QR code detected: ' + str); $scope.$apply(function() { $scope.address = str; }); diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 506c42512..daadea046 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -21,16 +21,13 @@ angular.module('copayApp.controllers').controller('SigninController', $scope.loading = true; var password = form.openPassword.$modelValue; - console.log('## Obtaining passphrase...'); Passphrase.getBase64Async(password, function(passphrase){ - console.log('## Passphrase obtained'); var w, errMsg; try{ var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase}); } catch (e){ errMsg = e.message; }; - if (!w) { $scope.loading = $scope.failure = false; $rootScope.$flashMessage = { message: errMsg || 'Wrong password', type: 'error'}; diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index 3613012c4..ce453bfac 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -54,7 +54,6 @@ angular.module('copayApp.controllers').controller('TransactionsController', $rootScope.txAlertCount = 0; var w = $rootScope.wallet; w.sendTx(ntxid, function(txid) { - console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO $rootScope.$flashMessage = txid ? {type:'success', message: 'Transaction broadcasted. txid: ' + txid} : {type:'error', message: 'There was an error sending the Transaction'} @@ -90,7 +89,6 @@ angular.module('copayApp.controllers').controller('TransactionsController', $scope.getTransactions = function(cb) { var w =$rootScope.wallet; if (w) { - console.log('### Querying last transactions...'); //TODO var addresses = w.getAddressesStr(); if (addresses.length > 0) { return w.blockchain.getTransactions(addresses, cb); diff --git a/js/models/blockchain/Insight.js b/js/models/blockchain/Insight.js index 50c5ac834..296a7725e 100644 --- a/js/models/blockchain/Insight.js +++ b/js/models/blockchain/Insight.js @@ -150,10 +150,8 @@ Insight.prototype.sendRawTransaction = function(rawtx, cb) { } }; this._request(options, function(err, res) { - console.log('[Insight.js.73:err:]', err); //TODO if (err) return cb(); - console.log('[Insight.js.74]', res); //TODO return cb(res.txid); }); }; diff --git a/js/models/core/PublicKeyRing.js b/js/models/core/PublicKeyRing.js index 52ad802b7..b09a75aae 100644 --- a/js/models/core/PublicKeyRing.js +++ b/js/models/core/PublicKeyRing.js @@ -13,10 +13,6 @@ var coinUtil = bitcore.util; var Transaction = bitcore.Transaction var util = bitcore.util; -var Storage = imports.Storage || require('../storage/Base.js'); -var storage = Storage.default(); - - function PublicKeyRing(opts) { opts = opts || {}; @@ -165,8 +161,7 @@ PublicKeyRing.prototype.getPubKeys = function(index, isChange) { PublicKeyRing.prototype._checkIndexRange = function (index, isChange) { if ( (isChange && index > this.changeAddressIndex) || (!isChange && index > this.addressIndex)) { - console.log('Out of bounds at getAddress: Index %d isChange: %d', index, isChange); - throw new Error('index out of bound'); + throw new Error('Out of bounds at getAddress: Index %d isChange: %d', index, isChange); } }; diff --git a/js/models/core/TxProposals.js b/js/models/core/TxProposals.js index 12aab20e5..11cb2de56 100644 --- a/js/models/core/TxProposals.js +++ b/js/models/core/TxProposals.js @@ -10,9 +10,6 @@ var Builder = bitcore.TransactionBuilder; var Script = bitcore.Script; var buffertools = bitcore.buffertools; -var Storage = imports.Storage || require('../storage/Base'); -var storage = Storage.default(); - function TxProposal(opts) { this.creator = opts.creator; this.createdTs = opts.createdTs; diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index ee4da36ec..3a6f32138 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -245,11 +245,8 @@ Wallet.prototype.netStart = function() { self.emit('ready', net.getPeer()); self.token = net.peer.options.token; setTimeout(function() { - console.log('[EMIT publicKeyRingUpdated:]'); //TODO self.emit('publicKeyRingUpdated', true); - console.log('[CONNECT:]'); //TODO self.scheduleConnect(); - console.log('[EMIT TxProposal]'); //TODO self.emit('txProposalsUpdated'); self.store(); }, 10); diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js index dfdfe3b96..58054502b 100644 --- a/js/models/core/WalletFactory.js +++ b/js/models/core/WalletFactory.js @@ -31,8 +31,9 @@ function WalletFactory(config, version) { WalletFactory.prototype.log = function(){ if (!this.verbose) return; - if (console) - console.log.apply(console, arguments); + if (console) { + console.log.apply(console, arguments); + } }; @@ -47,10 +48,8 @@ WalletFactory.prototype._checkRead = function(walletId) { }; WalletFactory.prototype.fromObj = function(obj) { - console.log('## Decrypting'); //TODO var w = Wallet.fromObj(obj, this.storage, this.network, this.blockchain); w.verbose = this.verbose; - this.log('### WALLET OPENED:', w.id); return w; }; diff --git a/js/models/network/Base.js b/js/models/network/Base.js deleted file mode 100644 index b38418572..000000000 --- a/js/models/network/Base.js +++ /dev/null @@ -1,41 +0,0 @@ -var imports = require('soop').imports(); -var EventEmitter = imports.EventEmitter || require('events').EventEmitter; - -/* - * Emits - * 'networkChange' - * when network layout has change (new/lost peers, etc) - * - * 'data' - * when an unknown data type arrives - * - * Provides - * send(toPeerIds, {data}, cb?) - * - */ - -function Network(opts) { - // TODO -} - -Network.parent = EventEmitter; -// Allows subscribing to the following events: -// Network#on('networkChange', listener); -// Network#on('data', listener); -Network.prototype.start = function(callback) { - // TODO -}; - -Network.prototype.send = function(peerIds, data, cb) { - // TODO -}; - -Network.prototype.connectTo = function(peerId, openCallback, closeCallback) { - // TODO -}; - -Network.prototype.disconnect = function(peerId, cb) { - // TODO -}; - -module.exports = require('soop')(Network); diff --git a/js/models/network/WebRTC.js b/js/models/network/WebRTC.js index a7cf412c8..8c252eeab 100644 --- a/js/models/network/WebRTC.js +++ b/js/models/network/WebRTC.js @@ -50,7 +50,6 @@ Network.prototype.cleanUp = function() { this.copayerForPeer={}; this.connections={}; if (this.peer) { - console.log('## DESTROYING PEER INSTANCE'); //TODO this.peer.disconnect(); this.peer.destroy(); this.peer = null; @@ -104,7 +103,6 @@ Network.prototype.connectedCopayers = function() { }; Network.prototype._deletePeer = function(peerId) { - console.log('### Deleting connection from peer:', peerId); delete this.isInboundPeerAuth[peerId]; delete this.copayerForPeer[peerId]; @@ -127,17 +125,14 @@ Network.prototype.connectToCopayers = function(copayerIds) { arrayDiff.forEach(function(copayerId) { if (this.allowedCopayerIds && !this.allowedCopayerIds[copayerId]) { - console.log('### IGNORING STRANGE COPAYER:', copayerId); this._deletePeer(this.peerFromCopayer(copayerId)); } else { - console.log('### CONNECTING TO:', copayerId); self.connectTo(copayerId); } }); }; Network.prototype._sendHello = function(copayerId) { - console.log('### SENDING HELLO TO ', copayerId); this.send(copayerId, { type: 'hello', copayerId: this.copayerId, @@ -158,25 +153,18 @@ Network.prototype._onData = function(encStr, isInbound, peerId) { var data = this._decrypt(encStr); payload= JSON.parse(data); } catch (e) { - console.log('### ERROR IN DATA: "%s" ', data, isInbound, e); this._deletePeer(peerId); return; } - console.log('### RECEIVED INBOUND?:%s TYPE: %s FROM %s', - isInbound, payload.type, peerId, payload); - if(isInbound && payload.type === 'hello') { var payloadStr = JSON.stringify(payload); if (this.allowedCopayerIds && !this.allowedCopayerIds[payload.copayerId]) { - console.log('#### Peer sent HELLO but it is not on the allowedCopayerIds. Closing connection', - this.allowedCopayerIds, payload.copayerId); this._deletePeer(peerId); return; } - console.log('#### Peer sent hello. Setting it up.'); //TODO this._addConnectedCopayer(payload.copayerId, isInbound); this._setInboundPeerAuth(peerId, true); return; @@ -199,7 +187,6 @@ Network.prototype._onData = function(encStr, isInbound, peerId) { Network.prototype._checkAnyPeer = function() { if (!this.connectedPeers.length) { - console.log('EMIT openError: no more peers, not even you!'); this.cleanUp(); this.emit('openError'); } @@ -219,9 +206,6 @@ Network.prototype._setupConnectionHandlers = function(dataConn, toCopayerId) { self.connections[dataConn.peer] = dataConn; - console.log('### DATA CONNECTION READY: %s (inbound: %s) AUTHENTICATING...', - dataConn.peer, isInbound); - // The connecting peer send hello if(toCopayerId) { self.emit('connected'); @@ -236,7 +220,6 @@ Network.prototype._setupConnectionHandlers = function(dataConn, toCopayerId) { }); dataConn.on('error', function(e) { - console.log('### DATA ERROR', e); //TODO self._onClose(dataConn.peer); self._checkAnyPeer(); self.emit('dataError'); @@ -245,7 +228,6 @@ Network.prototype._setupConnectionHandlers = function(dataConn, toCopayerId) { dataConn.on('close', function() { if (self.closing) return; - console.log('### CLOSE RECV FROM:', dataConn.peer); self._onClose(dataConn.peer); self._checkAnyPeer(); }); @@ -263,18 +245,14 @@ Network.prototype._setupPeerHandlers = function(openCallback) { p.on('error', function(err) { if (!err.message.match(/Could\snot\sconnect\sto peer/)) { - console.log('### PEER ERROR:', err); self.emit('error', err); } self._checkAnyPeer(); }); p.on('connection', function(dataConn) { - console.log('### NEW INBOUND CONNECTION %d/%d', self.connectedPeers.length, self.maxPeers); if (self.connectedPeers.length >= self.maxPeers) { - console.log('### PEER REJECTED. PEER MAX LIMIT REACHED'); dataConn.on('open', function() { - console.log('### CLOSING CONN FROM:' + dataConn.peer); dataConn.close(); }); } else { @@ -288,11 +266,9 @@ Network.prototype._setupPeerHandlers = function(openCallback) { Network.prototype._addCopayerMap = function(peerId, copayerId) { if (!this.copayerForPeer[peerId]) { if(Object.keys(this.copayerForPeer).length < this.maxPeers) { - console.log('Adding peer/copayer', peerId, copayerId); //TODO this.copayerForPeer[peerId]=copayerId; } else { - console.log('### maxPeerLimit of %d reached. Refusing to add more copayers.', this.maxPeers); //TODO } } }; @@ -333,7 +309,6 @@ Network.prototype.start = function(opts, openCallback) { if (!this.copayerId) this.setCopayerId(opts.copayerId); - console.log('CREATING PEER INSTANCE:', this.peerId); //TODO this.peer = new Peer(this.peerId, this.opts); this.started = true; this._setupPeerHandlers(openCallback); @@ -378,9 +353,6 @@ Network.prototype._sendToOne = function(copayerId, payload, sig, cb) { if (dataConn) { dataConn.send(payload); } - else { - console.log('[WebRTC.js.255] WARN: NO CONNECTION TO:', peerId); //TODO - } } if (typeof cb === 'function') cb(); }; @@ -417,7 +389,6 @@ Network.prototype.connectTo = function(copayerId) { var self = this; var peerId = this.peerFromCopayer(copayerId); - console.log('### STARTING CONNECTION TO:\n\t'+ peerId+"\n\t"+ copayerId); var dataConn = this.peer.connect(peerId, { serialization: 'none', reliable: true, @@ -426,9 +397,6 @@ Network.prototype.connectTo = function(copayerId) { }; Network.prototype.lockIncommingConnections = function(allowedCopayerIdsArray) { - if (!this.allowedCopayerIds) - console.log('[webrtc] #### LOCKING INCOMMING CONNECTIONS'); - this.allowedCopayerIds={}; for(var i in allowedCopayerIdsArray) { this.allowedCopayerIds[ allowedCopayerIdsArray[i] ] = true; diff --git a/js/models/storage/Base.js b/js/models/storage/Base.js deleted file mode 100644 index c023efe14..000000000 --- a/js/models/storage/Base.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -var imports = require('soop').imports(); - -function Storage() { -} - -// get value by key -Storage.prototype.get = function(walletId,k) { -}; - -// set value for key -Storage.prototype.set = function(walletId, k, v) { -}; - -// remove value for key -Storage.prototype.remove = function(walletId, k) { -}; - -Storage.prototype.getWalletIds = function() { -}; - -// obj contains keys to be set -Storage.prototype.setFromObj = function(walletId, obj) { -}; - -Storage.prototype.setFromEncryptedObj = function(walletId, obj) { -}; - -// wallet export - hex of encrypted wallet object -Storage.prototype.getEncryptedObj = function(walletId) { -}; - -// remove all values -Storage.prototype.clearAll = function() { -}; - -module.exports = require('soop')(Storage); diff --git a/js/models/storage/File.js b/js/models/storage/File.js index 50b44b6d9..beca5eb58 100644 --- a/js/models/storage/File.js +++ b/js/models/storage/File.js @@ -1,7 +1,6 @@ 'use strict'; var imports = require('soop').imports(); var fs = imports.fs || require('fs'); -var parent = imports.parent || require('./Base'); var CryptoJS = require('node-cryptojs-aes').CryptoJS; var passwords = []; @@ -12,7 +11,6 @@ function Storage(opts) { this.data = {}; passwords[0] = opts.password; } -Storage.parent = parent; Storage.prototype._encrypt = function(string) { var encrypted = CryptoJS.AES.encrypt(string, passwords[0]); diff --git a/js/models/storage/LocalEncrypted.js b/js/models/storage/LocalEncrypted.js index e30652adc..3ab93e160 100644 --- a/js/models/storage/LocalEncrypted.js +++ b/js/models/storage/LocalEncrypted.js @@ -41,7 +41,7 @@ Storage.prototype._decrypt = function(base64) { if (decrypted) decryptedStr = decrypted.toString(CryptoJS.enc.Utf8); } catch (e) { - console.log('Error while decrypting ' + base64); + // Error while decrypting return null; } return decryptedStr; diff --git a/js/models/storage/LocalPlain.js b/js/models/storage/LocalPlain.js index 982e1ea68..d75bc711f 100644 --- a/js/models/storage/LocalPlain.js +++ b/js/models/storage/LocalPlain.js @@ -1,11 +1,9 @@ 'use strict'; var imports = require('soop').imports(); -var parent = imports.parent || require('./Base'); function Storage() { } -Storage.parent = parent; Storage.prototype._read = function(k) { var ret; diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 3581fa682..e65e8c62a 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -100,7 +100,6 @@ angular.module('copayApp.services') }; root.updateBalance = function(cb) { - console.log('Updating balance...'); var w = $rootScope.wallet; $rootScope.balanceByAddr = {}; @@ -132,7 +131,6 @@ angular.module('copayApp.services') if (!w) return; opts = opts || {}; - console.log('## updating tx proposals', opts); //TODO var myCopayerId = w.getMyCopayerId(); var pendingForUs = 0; var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs }); @@ -150,7 +148,6 @@ angular.module('copayApp.services') i.isPending=1; } if (!opts.onlyPending || i.isPending) { - console.log('tx:',i); //TODO var tx = i.builder.build(); var outs = []; tx.outs.forEach(function(o) { @@ -175,7 +172,6 @@ angular.module('copayApp.services') $rootScope.txAlertCount = pendingForUs; } $rootScope.pendingTxCount = pendingForUs; - console.log('## Done updating tx proposals'); //TODO }; root.setSocketHandlers = function() { @@ -191,12 +187,10 @@ angular.module('copayApp.services') newAddrs.push(a); } for (var i = 0; i < newAddrs.length; i++) { - console.log('### SUBSCRIBE TO', newAddrs[i]); Socket.emit('subscribe', newAddrs[i]); } newAddrs.forEach(function(addr) { Socket.on(addr, function(txid) { - console.log('Received!', txid); $rootScope.receivedFund = [txid, addr]; root.updateBalance(function(){ $rootScope.$digest(); diff --git a/js/services/notifications.js b/js/services/notifications.js index ebd594b70..f38a370e6 100644 --- a/js/services/notifications.js +++ b/js/services/notifications.js @@ -3,7 +3,6 @@ angular.module('notifications', []). factory('$notification', ['$timeout',function($timeout){ -// console.log('notification service online'); var notifications = JSON.parse(localStorage.getItem('$notifications')) || [], queue = []; @@ -76,7 +75,6 @@ angular.module('notifications', []). requestHtml5ModePermissions: function(){ if (window.webkitNotifications){ - console.log('notifications are available'); if (window.webkitNotifications.checkPermission() === 0) { return true; } @@ -93,7 +91,6 @@ angular.module('notifications', []). } } else{ - console.log('notifications are not supported'); return false; } }, @@ -113,12 +110,10 @@ angular.module('notifications', []). /* ============== NOTIFICATION METHODS ==============*/ info: function(title, content, userData){ - console.log(title, content); return this.awesomeNotify('info','loop', title, content, userData); }, funds: function(title, content, userData){ - console.log(title, content); return this.awesomeNotify('funds','bitcoin', title, content, userData); }, @@ -168,9 +163,9 @@ angular.module('notifications', []). if(settings.html5Mode){ html5Notify(image, title, content, function(){ - console.log("inner on display function"); + // inner on display function }, function(){ - console.log("inner on close function"); + // inner on close function }); } else{ @@ -190,11 +185,9 @@ angular.module('notifications', []). save: function(){ // Save all the notifications into localStorage - // console.log(JSON); if(settings.localStorage){ localStorage.setItem('$notifications', JSON.stringify(notifications)); } - // console.log(localStorage.getItem('$notifications')); }, restore: function(){ @@ -218,7 +211,6 @@ angular.module('notifications', []). * Finally, the directive should have its own controller for * handling all of the notifications from the notification service */ -// console.log('this is a new directive'); var html = '
' + '
' + diff --git a/js/services/video.js b/js/services/video.js index af2073589..acff9327f 100644 --- a/js/services/video.js +++ b/js/services/video.js @@ -69,11 +69,9 @@ Video.prototype._addCall = function(mediaConnection, cb) { }); mediaConnection.on('close', function() { - console.log('Media connection closed with ' + peerID); cb(true, peerID, null); // ask to stop video streaming in UI }); mediaConnection.on('error', function(e) { - console.log('Media connection error with ' + peerID); cb(e, peerID, null); }); this.mediaConnections[peerID] = mediaConnection; From 7e14b62c48b0b82157b3d4f8605c367e132a390a Mon Sep 17 00:00:00 2001 From: Yemel Jardi Date: Wed, 4 Jun 2014 10:10:30 -0300 Subject: [PATCH 6/6] Change default config to connect insight at port 80 --- config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 88fe27c82..0fe548945 100644 --- a/config.js +++ b/config.js @@ -109,12 +109,12 @@ var defaultConfig = { // blockchain service API config blockchain: { host: 'test.insight.is', - port: 3001 + port: 80 }, // socket service API config socket: { host: 'test.insight.is', - port: 3001 + port: 80 }, // local encryption/security config