Fixed Conflicts:
bower.json js/directives.js views/includes/sidebar.html
This commit is contained in:
commit
b94f66f32e
17 changed files with 79 additions and 40 deletions
|
|
@ -27,6 +27,7 @@ var copayApp = window.copayApp = angular.module('copayApp', [
|
|||
'angularMoment',
|
||||
'mm.foundation',
|
||||
'monospaced.qrcode',
|
||||
'ngIdle',
|
||||
'copayApp.filters',
|
||||
'copayApp.services',
|
||||
'copayApp.controllers',
|
||||
|
|
@ -40,6 +41,7 @@ copayApp.config(function($sceDelegateProvider) {
|
|||
]);
|
||||
});
|
||||
|
||||
|
||||
angular.module('copayApp.filters', []);
|
||||
angular.module('copayApp.services', []);
|
||||
angular.module('copayApp.controllers', []);
|
||||
|
|
|
|||
|
|
@ -20,13 +20,6 @@ angular.module('copayApp.controllers').controller('AddressesController',
|
|||
var ModalInstanceCtrl = function ($scope, $modalInstance, address) {
|
||||
$scope.address = address;
|
||||
|
||||
$scope.openExternal = function(address) {
|
||||
var url = 'bitcoin:' + address;
|
||||
if (window.cordova) return window.open(url, '_blank');
|
||||
|
||||
window.location = url;
|
||||
}
|
||||
|
||||
$scope.cancel = function () {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -82,4 +82,15 @@ angular.module('copayApp.controllers').controller('SidebarController',
|
|||
// Init socket handlers (with no wallet yet)
|
||||
controllerUtils.setSocketHandlers();
|
||||
|
||||
if ($rootScope.wallet) {
|
||||
$scope.$on('$idleStart', function(a) {
|
||||
notification.warning('Session will be closed', 'Your session is about to expire due to inactivity');
|
||||
});
|
||||
|
||||
$scope.$on('$idleTimeout', function() {
|
||||
$scope.signout();
|
||||
notification.warning('Session closed', 'Session closed because a long time of inactivity');
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -198,24 +198,31 @@ angular.module('copayApp.directives')
|
|||
}
|
||||
};
|
||||
})
|
||||
// From https://gist.github.com/asafge/7430497
|
||||
.directive('ngReallyClick', [
|
||||
|
||||
function() {
|
||||
.directive('openExternal', function() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, element, attrs) {
|
||||
element.bind('click', function() {
|
||||
var message = attrs.ngReallyMessage;
|
||||
if (message && confirm(message)) {
|
||||
scope.$apply(attrs.ngReallyClick);
|
||||
}
|
||||
window.open('bitcoin:'+attrs.address, '_blank');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
})
|
||||
// From https://gist.github.com/asafge/7430497
|
||||
.directive('ngReallyClick', [function() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, element, attrs) {
|
||||
element.bind('click', function() {
|
||||
var message = attrs.ngReallyMessage;
|
||||
if (message && confirm(message)) {
|
||||
scope.$apply(attrs.ngReallyClick);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
.directive('match', function () {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
|
|
@ -265,5 +272,4 @@ angular.module('copayApp.directives')
|
|||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function HDParams(opts) {
|
|||
|
||||
HDParams.init = function(totalCopayers) {
|
||||
preconditions.shouldBeNumber(totalCopayers);
|
||||
var ret = [new HDParams()];
|
||||
var ret = [new HDParams({receiveIndex: 1})];
|
||||
for (var i = 0 ; i < totalCopayers ; i++) {
|
||||
ret.push(new HDParams({copayerIndex: i}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,17 +65,22 @@ angular
|
|||
//Setting HTML5 Location Mode
|
||||
angular
|
||||
.module('copayApp')
|
||||
.config(function($locationProvider) {
|
||||
.config(function($locationProvider, $idleProvider) {
|
||||
$locationProvider
|
||||
.html5Mode(false)
|
||||
.hashPrefix('!');
|
||||
// IDLE timeout
|
||||
$idleProvider.idleDuration(15 * 60); // in seconds
|
||||
$idleProvider.warningDuration(10); // in seconds
|
||||
})
|
||||
.run(function($rootScope, $location) {
|
||||
.run(function($rootScope, $location, $idle) {
|
||||
$idle.watch();
|
||||
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
||||
if (!util.supports.data) {
|
||||
$location.path('unsupported');
|
||||
} else {
|
||||
if ((!$rootScope.wallet || !$rootScope.wallet.id) && next.validate) {
|
||||
$idle.unwatch();
|
||||
$location.path('/');
|
||||
}
|
||||
if ($rootScope.wallet && !$rootScope.wallet.isReady()) {
|
||||
|
|
|
|||
|
|
@ -185,13 +185,14 @@ angular.module('copayApp.services')
|
|||
|
||||
root.updateAddressList = function() {
|
||||
var w = $rootScope.wallet;
|
||||
if (w)
|
||||
if (w && w.isReady())
|
||||
$rootScope.addrInfos = w.getAddressesInfo();
|
||||
};
|
||||
|
||||
root.updateBalance = function(cb) {
|
||||
var w = $rootScope.wallet;
|
||||
if (!w) return root.onErrorDigest();
|
||||
if (!w.isReady()) return;
|
||||
|
||||
$rootScope.balanceByAddr = {};
|
||||
$rootScope.updatingBalance = true;
|
||||
|
|
@ -212,6 +213,10 @@ angular.module('copayApp.services')
|
|||
$rootScope.totalBalanceBTC = (balanceSat / COIN);
|
||||
$rootScope.availableBalance = safeBalanceSat * satToUnit;
|
||||
$rootScope.availableBalanceBTC = (safeBalanceSat / COIN);
|
||||
|
||||
$rootScope.lockedBalance = (balanceSat - safeBalanceSat) * satToUnit;
|
||||
$rootScope.lockedBalanceBTC = (balanceSat - safeBalanceSat) / COIN;
|
||||
|
||||
var balanceByAddr = {};
|
||||
for (var ii in balanceByAddrSat) {
|
||||
balanceByAddr[ii] = balanceByAddrSat[ii] * satToUnit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue