HTML5 Notification support on chrome

This commit is contained in:
Gustavo Cortez 2014-05-15 02:13:25 -03:00
commit 2dc5513592
5 changed files with 408 additions and 1 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copay.header').controller('HeaderController',
function($scope, $rootScope, $location, walletFactory, controllerUtils) {
function($scope, $rootScope, $location, $notification, walletFactory, controllerUtils) {
$scope.menu = [
{
'title': 'Addresses',
@ -27,6 +27,15 @@ angular.module('copay.header').controller('HeaderController',
}
});
// Initialize alert notification (not show when init wallet)
$rootScope.showTxAlert = 0;
$notification.enableHtml5Mode(); // for chrome: if support, enable it
$rootScope.$watch('showTxAlert', function(showTxAlert) {
if (showTxAlert && showTxAlert > 0) {
$notification.info('New Transaction', ($rootScope.showTxAlert == 1) ? 'You have pending a transaction proposal' : 'You have pending ' + $rootScope.showTxAlert + ' transaction proposals', showTxAlert);
}
});
$scope.isActive = function(item) {
if (item.link && item.link.replace('#','') == $location.path()) {
return true;