From edb3e75800f7e38e694c462e9e672b08fba22764 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Tue, 20 May 2014 14:31:00 -0300 Subject: [PATCH] Alert when incoming transaction (not proposal) --- js/controllers/header.js | 6 ++++++ js/services/controllerUtils.js | 1 + js/services/notifications.js | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/js/controllers/header.js b/js/controllers/header.js index c741a8a9d..2a6af91f1 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -29,6 +29,12 @@ angular.module('copay.header').controller('HeaderController', } }); + $rootScope.$watch('receivedFund', function(receivedFund) { + if (receivedFund) { + $notification.funds('Received fund', 'on ' + receivedFund[1], receivedFund); + } + }); + $scope.isActive = function(item) { if (item.link && item.link.replace('#','') == $location.path()) { return true; diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index d9e10dcd0..1b36334bd 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -192,6 +192,7 @@ angular.module('copay.controllerUtils') 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 a6ed7093f..ebd594b70 100644 --- a/js/services/notifications.js +++ b/js/services/notifications.js @@ -9,6 +9,7 @@ angular.module('notifications', []). var settings = { info: { duration: 5000, enabled: true }, + funds: { duration: 5000, enabled: true }, warning: { duration: 5000, enabled: true }, error: { duration: 5000, enabled: true }, success: { duration: 5000, enabled: true }, @@ -115,6 +116,11 @@ angular.module('notifications', []). 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); + }, error: function(title, content, userData){ return this.awesomeNotify('error', 'remove', title, content, userData);