options for running with local peerJs server. Ux fixes
This commit is contained in:
parent
6627184ebc
commit
1e64031ec3
7 changed files with 85 additions and 31 deletions
|
|
@ -2,7 +2,32 @@
|
|||
|
||||
angular.module('copay.controllerUtils').factory('controllerUtils', function ($rootScope, $location, Socket) {
|
||||
var root = {};
|
||||
|
||||
root.logout = function(scope) {
|
||||
delete $rootScope['wallet'];
|
||||
$rootScope.totalBalance = 0;
|
||||
$location.path('signin');
|
||||
};
|
||||
|
||||
root.onError = function(scope) {
|
||||
if (scope) scope.loading = false;
|
||||
$rootScope.flashMessage = {type:'error', message: 'Could not connect to peer'};
|
||||
root.logout();
|
||||
}
|
||||
|
||||
|
||||
root.onErrorDigest = function(scope) {
|
||||
root.onError(scope);
|
||||
$rootScope.$digest();
|
||||
}
|
||||
|
||||
|
||||
root.setupUxHandlers = function(w) {
|
||||
|
||||
w.on('badMessage', function(peerId) {
|
||||
$rootScope.flashMessage = {type:'error', message: 'Received wrong message from peer id:' + peerId};
|
||||
});
|
||||
|
||||
w.on('created', function() {
|
||||
$location.path('peer');
|
||||
$rootScope.wallet = w;
|
||||
|
|
@ -14,14 +39,11 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro
|
|||
});
|
||||
});
|
||||
w.on('refresh', function() {
|
||||
console.log('[controllerUtils.js] RECEIVED REFRESH'); //TODO
|
||||
});
|
||||
|
||||
w.on('openError', function(){
|
||||
$scope.loading = false;
|
||||
$rootScope.flashMessage = {type:'error', message: 'Wallet not found'};
|
||||
$location.path('signin');
|
||||
console.log('[controllerUtils.js] Refreshing'); //TODO
|
||||
$rootScope.$digest();
|
||||
});
|
||||
w.on('openError', root.onErrorDigest);
|
||||
w.on('close', root.onErrorDigest);
|
||||
};
|
||||
|
||||
root.handleTransactionByAddress = function(scope) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue