diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js
index ff69df286..9378e3cfb 100644
--- a/src/js/controllers/index.js
+++ b/src/js/controllers/index.js
@@ -185,12 +185,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$timeout(function() {
self.setOngoingProcess('updatingStatus', true);
- $log.debug('Updating Status:', fc);
+ $log.debug('Updating Status:', fc, tries);
get(function(err, walletStatus) {
- if (!err && untilItChanges && initBalance == walletStatus.balance.totalAmount && tries < 10) {
+ if (!err && untilItChanges && initBalance == walletStatus.balance.totalAmount && tries < 7) {
return $timeout(function() {
return self.updateAll(null, true, initBalance, ++tries);
- }, 1000);
+ }, 1400 * tries);
}
self.setOngoingProcess('updatingStatus', false);
if (err) {
@@ -677,7 +677,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
go.walletHome();
} else if (err && err.cors == 'rejected') {
$log.debug('CORS error:', err);
- } else if (err.code === 'ETIMEDOUT') {
+ } else if (err.code === 'ETIMEDOUT' || err.code === 'CONNERROR') {
$log.debug('Time out:', err);
} else {
var msg = 'Error at Wallet Service: ';
@@ -709,7 +709,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}, 5000);
});
- lodash.each(['NewOutgoingTx', 'NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved',
+ $rootScope.$on('NewOutgoingTx', function() {
+ self.updateAll(null, true);
+ });
+
+ lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved',
'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished'
], function(eventName) {
$rootScope.$on(eventName, function(event, untilItChanges) {
diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js
index 789db0e6e..93f0e2795 100644
--- a/src/js/controllers/walletHome.js
+++ b/src/js/controllers/walletHome.js
@@ -91,9 +91,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var parseError = function(err) {
if (err.message) {
+ // TODO : this is not used anymore?
if (err.message.indexOf('CORS') >= 0) {
err.message = gettext('Could not connect wallet service. Check your Internet connexion and your wallet service configuration.');
}
+
if (err.message.indexOf('TIMEDOUT') >= 0) {
err.message = gettext('Wallet service timed out. Check your Internet connexion and your wallet service configuration.');
}
@@ -200,7 +202,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
if (err) {
$scope.loading = false;
parseError(err);
- $scope.error = err.message || gettext('Could not sign transaction. Please try again.');
+ $scope.error = err.message || gettext('Could not accept payment. Check you connection and try again');
$scope.$digest();
} else {
//if txp has required signatures then broadcast it
@@ -213,12 +215,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.loading = false;
if (err) {
parseError(err);
- $scope.error = gettext('Could not broadcast transaction. Please try again.');
+ $scope.error = gettext('Could not broadcast payment. Check you connection and try again');
$scope.$digest();
} else {
+
+ console.log('[walletHome.js.219]'); //TODO
if (memo)
$log.info(memo);
- $modalInstance.close(txpsb, true);
+
+ txpsb.refreshUntilItChanges = true;
+ $modalInstance.close(txpsb);
}
});
} else {
@@ -240,7 +246,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.loading = false;
if (err) {
parseError(err);
- $scope.error = err.message || gettext('Could not reject transaction. Please try again.');
+ $scope.error = err.message || gettext('Could not reject payment. Check you connection and try again');
$scope.$digest();
} else {
$modalInstance.close(txpr);
@@ -262,7 +268,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
// Hacky: request tries to parse an empty response
if (err && !(err.message && err.message.match(/Unexpected/))) {
parseError(err);
- $scope.error = err.message || gettext('Could not delete transaction. Please try again.');
+ $scope.error = err.message || gettext('Could not delete payment proposal. Check you connection and try again');
$scope.$digest();
return;
}
@@ -281,13 +287,15 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.loading = false;
if (err) {
parseError(err);
- $scope.error = err.message || gettext('Could not send transaction. Please try again.');
+ $scope.error = err.message || gettext('Could not broadcast payment. Check you connection and try again');
$scope.$digest();
} else {
if (memo)
$log.info(memo);
- $modalInstance.close(txpb, true);
+
+ txpb.refreshUntilItChanges = true;
+ $modalInstance.close(txpb);
}
});
}, 100);
@@ -314,7 +322,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
m.addClass('slideOutRight');
});
- modalInstance.result.then(function(txp, refreshUntilItChanges) {
+ modalInstance.result.then(function(txp) {
+ var refreshUntilItChanges = txp.refreshUntilItChanges;
+ console.log('[walletHome.js.323:refreshUntilItChanges:]', refreshUntilItChanges); //TODO
self.setOngoingProcess();
if (txp) {
txStatus.notify(txp, function() {
@@ -333,21 +343,24 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.setNewAddress = function() {
var fc = profileService.focusedClient;
self.generatingAddress = true;
+ self.addrError = null;
fc.createAddress(function(err, addr) {
self.generatingAddress = false;
if (err) {
- if (err.error.match(/locked/gi)) {
+ if (err.error && err.error.match(/locked/gi)) {
$log.debug(err.error);
$timeout(function() {
self.setNewAddress();
}, 5000);
} else {
$log.debug('Creating address ERROR:', err);
- $scope.$emit('Local/ClientError', err);
+ parseError(err);
+ self.addrError = err.message || gettext('Could not create address. Check you connection and try again');
$scope.$digest();
}
return;
}
+ self.addrError = null;
self.addr = addr.address;
storageService.storeLastAddress(fc.credentials.walletId, addr.address, function() {
@@ -358,6 +371,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
};
this.setAddress = function() {
+ self.addrError = null;
+
if (self.addr)
return;
@@ -527,9 +542,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var fc = profileService.focusedClient;
$log.warn(err);
parseError(err);
- var errMessage = 'The transaction' + (fc.credentials.m > 1 ? ' proposal' : '') +
+ var errMessage =
+ fc.credentials.m > 1 ? gettext('Could not create payment proposal') : gettext('Could not send payment');
- ' could not be created: ' + (err.message ? err.message : err);
+ errMessage = errMessage + '. ' + (err.message ? err.message : gettext('Check you connection and try again'));
this.error = errMessage;
diff --git a/src/js/services/notificationsService.js b/src/js/services/notificationsService.js
index 986ed3e24..029d2d2ca 100644
--- a/src/js/services/notificationsService.js
+++ b/src/js/services/notificationsService.js
@@ -15,6 +15,10 @@ angular.module('copayApp.services')
};
root.storeLast = function(notificationData, walletId) {
+
+ if (notificationData.type == 'NewAddress')
+ return;
+
lastNotificationOnWallet[walletId] = {
creatorId: notificationData.creatorId,
type: notificationData.type,
@@ -38,7 +42,6 @@ angular.module('copayApp.services')
&& notificationData.type === 'TxProposalFinallyRejected')
return true;
-
return false;
};
@@ -73,7 +76,7 @@ angular.module('copayApp.services')
name, {color: color} );
break;
case 'NewOutgoingTx':
- notification.sent(gettext('Payment Proposal Sent'),
+ notification.sent(gettext('Payment Sent'),
name, {color: color} );
break;
case 'NewIncomingTx':