mirror of https://github.com/BTCPrivate/copay.git
replace flashmessage for notifications
This commit is contained in:
parent
bdfac63f1a
commit
e389a3f82c
|
@ -32,10 +32,8 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
$scope.submitForm = function(form) {
|
||||
if (form.$invalid) {
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'Unable to send a transaction proposal. Please, try again',
|
||||
type: 'error'
|
||||
};
|
||||
var message = 'Unable to send transaction proposal.';
|
||||
notification.error('Error', message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -50,20 +48,16 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
w.createTx(address, amount, commentText, function(ntxid) {
|
||||
if (w.totalCopayers > 1) {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'The transaction proposal has been created',
|
||||
type: 'success'
|
||||
};
|
||||
var message = 'The transaction proposal has been created';
|
||||
notification.success('Success!', message);
|
||||
$rootScope.$digest();
|
||||
} else {
|
||||
w.sendTx(ntxid, function(txid) {
|
||||
$rootScope.$flashMessage = txid ? {
|
||||
type: 'success',
|
||||
message: 'Transaction broadcasted. txid: ' + txid
|
||||
} : {
|
||||
type: 'error',
|
||||
message: 'There was an error sending the Transaction'
|
||||
};
|
||||
if (txid) {
|
||||
notification.success('Transaction broadcast', 'Transaction id: ' + txid);
|
||||
} else {
|
||||
notification.error('Error', 'There was an error sending the transaction.');
|
||||
}
|
||||
$scope.loading = false;
|
||||
});
|
||||
}
|
||||
|
@ -202,10 +196,11 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
errorMsg = e.message;
|
||||
}
|
||||
|
||||
$rootScope.$flashMessage = {
|
||||
message: errorMsg ? errorMsg : 'Entry removed successful',
|
||||
type: errorMsg ? 'error' : 'success'
|
||||
};
|
||||
if (errorMsg) {
|
||||
notification.error('Error', errorMsg);
|
||||
} else {
|
||||
notification.success('Success', 'Entry removed successfully');
|
||||
}
|
||||
$rootScope.$digest();
|
||||
}, 500);
|
||||
};
|
||||
|
@ -223,10 +218,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
$scope.submitAddressBook = function(form) {
|
||||
if (form.$invalid) {
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'Complete required fields, please',
|
||||
type: 'error'
|
||||
};
|
||||
notification.error('Form Error', 'Please complete required fields');
|
||||
return;
|
||||
}
|
||||
var entry = {
|
||||
|
@ -255,10 +247,11 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
errorMsg = e.message;
|
||||
}
|
||||
|
||||
$rootScope.$flashMessage = {
|
||||
message: errorMsg ? errorMsg : 'New entry has been created',
|
||||
type: errorMsg ? 'error' : 'success'
|
||||
};
|
||||
if (errorMsg) {
|
||||
notification.error('Error', errorMsg);
|
||||
} else {
|
||||
notification.success('Success', 'New entry has been created');
|
||||
}
|
||||
$rootScope.$digest();
|
||||
}, 500);
|
||||
$anchorScroll();
|
||||
|
|
|
@ -68,10 +68,7 @@ angular.module('copayApp.controllers').controller('SetupController',
|
|||
|
||||
$scope.create = function(form) {
|
||||
if (form && form.$invalid) {
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'Please, enter required fields',
|
||||
type: 'error'
|
||||
};
|
||||
notification.error('Error', 'Please enter the required fields');
|
||||
return;
|
||||
}
|
||||
$scope.loading = true;
|
||||
|
|
|
@ -30,7 +30,6 @@ angular.module('copayApp.directives')
|
|||
link: function(scope, element, attrs, ctrl) {
|
||||
setTimeout(function() {
|
||||
scope.$apply(function() {
|
||||
$rootScope.$flashMessage = {};
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
|
|
@ -36,35 +36,27 @@ angular.module('copayApp.services')
|
|||
|
||||
root.onErrorDigest = function(scope, msg) {
|
||||
root.onError(scope);
|
||||
if (msg) $rootScope.$flashMessage = {
|
||||
type: 'error',
|
||||
message: msg
|
||||
};
|
||||
if (msg) {
|
||||
notification.error('Error', msg);
|
||||
}
|
||||
$rootScope.$digest();
|
||||
};
|
||||
|
||||
root.installStartupHandlers = function(wallet, $scope) {
|
||||
wallet.on('serverError', function(msg) {
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'There was an error connecting to the PeerJS server.' + (msg || 'Check you settings and Internet connection.'),
|
||||
type: 'error',
|
||||
};
|
||||
notification.error('PeerJS Error', 'There was an error connecting to the PeerJS server.'
|
||||
+ (msg || 'Check you settings and Internet connection.'));
|
||||
root.onErrorDigest($scope);
|
||||
$location.path('addresses');
|
||||
});
|
||||
wallet.on('connectionError', function() {
|
||||
var message = "Looks like you are already connected to this wallet, please logout from it and try importing it again.";
|
||||
$rootScope.$flashMessage = {
|
||||
message: message,
|
||||
type: 'error'
|
||||
};
|
||||
var message = "Looks like you are already connected to this wallet, please logout and try importing it again.";
|
||||
notification.error('PeerJS Error', message);
|
||||
root.onErrorDigest($scope);
|
||||
});
|
||||
wallet.on('serverError', function() {
|
||||
$rootScope.$flashMessage = {
|
||||
message: 'The PeerJS server is not responding, please try again',
|
||||
type: 'error'
|
||||
};
|
||||
var message = 'The PeerJS server is not responding, please try again';
|
||||
notification.error('PeerJS Error', message);
|
||||
root.onErrorDigest($scope);
|
||||
});
|
||||
wallet.on('ready', function() {
|
||||
|
@ -79,10 +71,7 @@ angular.module('copayApp.services')
|
|||
$rootScope.isCollapsed = true;
|
||||
$rootScope.$watch('insightError', function(status) {
|
||||
if (status === -1) {
|
||||
$rootScope.$flashMessage = {
|
||||
type: 'success',
|
||||
message: 'Networking Restored :)',
|
||||
};
|
||||
notification.success('Networking restored', 'Connection to Insight re-established');
|
||||
$rootScope.insightError = 0;
|
||||
}
|
||||
});
|
||||
|
@ -117,10 +106,7 @@ angular.module('copayApp.services')
|
|||
notification.enableHtml5Mode(); // for chrome: if support, enable it
|
||||
|
||||
w.on('badMessage', function(peerId) {
|
||||
$rootScope.$flashMessage = {
|
||||
type: 'error',
|
||||
message: 'Received wrong message from peer id:' + peerId
|
||||
};
|
||||
notification.error('Error', 'Received wrong message from peer ' + peerId);
|
||||
});
|
||||
w.on('ready', function(myPeerID) {
|
||||
$rootScope.wallet = w;
|
||||
|
|
Loading…
Reference in New Issue