more fixes

This commit is contained in:
Gabriel Bazán 2016-12-13 14:21:57 -03:00
commit ebaefebe8b
8 changed files with 40 additions and 34 deletions

View file

@ -456,7 +456,8 @@ msgstr ""
msgid "Confirm & Finish" msgid "Confirm & Finish"
msgstr "" msgstr ""
#: src/js/services/walletService.js:839 #: src/js/services/walletService.js:842
#: src/js/services/walletService.js:843
msgid "Confirm you new spending password" msgid "Confirm you new spending password"
msgstr "" msgstr ""
@ -808,8 +809,8 @@ msgstr ""
msgid "Enter Amount" msgid "Enter Amount"
msgstr "" msgstr ""
#: src/js/services/walletService.js:852 #: src/js/services/walletService.js:856
#: src/js/services/walletService.js:867 #: src/js/services/walletService.js:871
msgid "Enter Spending Password" msgid "Enter Spending Password"
msgstr "" msgstr ""
@ -817,7 +818,7 @@ msgstr ""
msgid "Enter Two Factor for BitPay Card" msgid "Enter Two Factor for BitPay Card"
msgstr "" msgstr ""
#: src/js/services/walletService.js:837 #: src/js/services/walletService.js:839
msgid "Enter new spending password" msgid "Enter new spending password"
msgstr "" msgstr ""
@ -981,7 +982,7 @@ msgstr ""
msgid "Export wallet" msgid "Export wallet"
msgstr "" msgstr ""
#: src/js/services/walletService.js:999 #: src/js/services/walletService.js:1003
#: www/views/tab-export-qrCode.html:9 #: www/views/tab-export-qrCode.html:9
msgid "Exporting via QR not supported for this wallet" msgid "Exporting via QR not supported for this wallet"
msgstr "" msgstr ""
@ -2362,7 +2363,7 @@ msgstr ""
msgid "The password of the recovery phrase (if set)" msgid "The password of the recovery phrase (if set)"
msgstr "" msgstr ""
#: src/js/services/walletService.js:951 #: src/js/services/walletService.js:955
msgid "The payment was created but could not be completed. Please try again from home screen" msgid "The payment was created but could not be completed. Please try again from home screen"
msgstr "" msgstr ""

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, gettext, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, amazonService, glideraService, bwcError, bitpayCardService) { angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, amazonService, glideraService, bwcError, bitpayCardService) {
var cachedTxp = {}; var cachedTxp = {};
var toAmount; var toAmount;
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
@ -351,7 +351,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
popupService.showAlert(gettextCatalog.getString('Error at confirm'), msg); popupService.showAlert(gettextCatalog.getString('Error at confirm'), bwcError.msg(msg));
}; };
function apply(txp) { function apply(txp) {
@ -373,13 +373,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
// ToDo: use a credential's (or fc's) function for this // ToDo: use a credential's (or fc's) function for this
if (description && !wallet.credentials.sharedEncryptingKey) { if (description && !wallet.credentials.sharedEncryptingKey) {
var msg = 'Could not add message to imported wallet without shared encrypting key'; var msg = gettextCatalog.getString('Could not add message to imported wallet without shared encrypting key');
$log.warn(msg); $log.warn(msg);
return setSendError(msg); return setSendError(msg);
} }
if (toAmount > Number.MAX_SAFE_INTEGER) { if (toAmount > Number.MAX_SAFE_INTEGER) {
var msg = 'Amount too big'; var msg = gettextCatalog.getString('Amount too big');
$log.warn(msg); $log.warn(msg);
return setSendError(msg); return setSendError(msg);
} }

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('createController', angular.module('copayApp.controllers').controller('createController',
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettext, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) { function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
@ -67,10 +67,10 @@ angular.module('copayApp.controllers').controller('createController',
function updateSeedSourceSelect(n) { function updateSeedSourceSelect(n) {
var seedOptions = [{ var seedOptions = [{
id: 'new', id: 'new',
label: gettext('Random'), label: gettextCatalog.getString('Random'),
}, { }, {
id: 'set', id: 'set',
label: gettext('Specify Recovery Phrase...'), label: gettextCatalog.getString('Specify Recovery Phrase...'),
}]; }];
$scope.seedSource = seedOptions[0]; $scope.seedSource = seedOptions[0];

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('joinController', angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) { function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
@ -50,10 +50,10 @@ angular.module('copayApp.controllers').controller('joinController',
var updateSeedSourceSelect = function() { var updateSeedSourceSelect = function() {
self.seedOptions = [{ self.seedOptions = [{
id: 'new', id: 'new',
label: gettext('Random'), label: gettextCatalog.getString('Random'),
}, { }, {
id: 'set', id: 'set',
label: gettext('Specify Recovery Phrase...'), label: gettextCatalog.getString('Specify Recovery Phrase...'),
}]; }];
$scope.seedSource = self.seedOptions[0]; $scope.seedSource = self.seedOptions[0];

View file

@ -107,7 +107,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
} }
} }
var setError = function (err, prefix) { var setError = function(err, prefix) {
$scope.sendStatus = ''; $scope.sendStatus = '';
$scope.loading = false; $scope.loading = false;
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix)); popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix));
@ -164,9 +164,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.loading = true; $scope.loading = true;
$timeout(function() { $timeout(function() {
ongoingProcess.set('broadcastTx', true); ongoingProcess.set('broadcastingTx', true);
walletService.broadcastTx($scope.wallet, $scope.tx, function(err, txpb) { walletService.broadcastTx($scope.wallet, $scope.tx, function(err, txpb) {
ongoingProcess.set('broadcastTx', false); ongoingProcess.set('broadcastingTx', false);
if (err) { if (err) {
return setError(err, gettextCatalog.getString('Could not broadcast payment')); return setError(err, gettextCatalog.getString('Could not broadcast payment'));
@ -185,7 +185,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.wallet.getTx($scope.tx.id, function(err, tx) { $scope.wallet.getTx($scope.tx.id, function(err, tx) {
if (err) { if (err) {
if (err.message && err.message == 'Transaction proposal not found' && if (err.message && err.message == 'Transaction proposal not found' &&
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) { (eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
$scope.tx.removed = true; $scope.tx.removed = true;
$scope.tx.canBeRemoved = false; $scope.tx.canBeRemoved = false;
$scope.tx.pendingForUs = false; $scope.tx.pendingForUs = false;
@ -209,7 +209,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
}); });
}; };
var bwsEvent = $rootScope.$on('bwsEvent', function(e, walletId, type, n) { var bwsEvent = $rootScope.$on('bwsEvent', function(e, walletId, type, n) {
lodash.each([ lodash.each([
'TxProposalRejectedBy', 'TxProposalRejectedBy',
'TxProposalAcceptedBy', 'TxProposalAcceptedBy',

View file

@ -56,6 +56,8 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
force: !!force, force: !!force,
}, function(err, status) { }, function(err, status) {
$scope.updatingStatus = false; $scope.updatingStatus = false;
console.log(err);
console.log("####################12412412");
if (err) { if (err) {
if (err === 'WALLET_NOT_REGISTERED') { if (err === 'WALLET_NOT_REGISTERED') {
$scope.walletNotRegistered = true; $scope.walletNotRegistered = true;

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.services') angular.module('copayApp.services')
.factory('trezor', function($log, $timeout, gettext, lodash, bitcore, hwWallet) { .factory('trezor', function($log, $timeout, lodash, bitcore, hwWallet) {
var root = {}; var root = {};
var SETTLE_TIME = 3000; var SETTLE_TIME = 3000;
@ -82,7 +82,7 @@ angular.module('copayApp.services')
if (txp.outputs.length > 1) if (txp.outputs.length > 1)
return callback('Only single output TXPs are supported in TREZOR'); return callback('Only single output TXPs are supported in TREZOR');
} else { } else {
return callback('Unknown TXP at TREZOR'); return callback('Unknown TXP at TREZOR');
} }
if (txp.outputs) { if (txp.outputs) {

View file

@ -140,11 +140,13 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
wallet.getStatus({ wallet.getStatus({
twoStep: true twoStep: true
}, function(err, ret) { }, function(err, ret) {
console.log(err);
console.log("###########################");
if (err) { if (err) {
if (err instanceof errors.NOT_AUTHORIZED) { if (err instanceof errors.NOT_AUTHORIZED) {
return cb('WALLET_NOT_REGISTERED'); return cb('WALLET_NOT_REGISTERED');
} }
return cb(bwcError.msg(err, gettext('Could not update Wallet'))); return cb(err);
} }
return cb(null, ret); return cb(null, ret);
}); });
@ -404,7 +406,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
function getNewTxs(newTxs, skip, cb) { function getNewTxs(newTxs, skip, cb) {
getTxsFromServer(wallet, skip, endingTxid, requestLimit, function(err, res, shouldContinue) { getTxsFromServer(wallet, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
if (err) { if (err) {
$log.warn('BWS Error:' + err); //TODO $log.warn(bwcError.msg(err, 'BWS Error')); //TODO
if (err instanceof errors.CONNECTION_ERROR || (err.message && err.message.match(/5../))) { if (err instanceof errors.CONNECTION_ERROR || (err.message && err.message.match(/5../))) {
log.info('Retrying history download in 5 secs...'); log.info('Retrying history download in 5 secs...');
return $timeout(function() { return $timeout(function() {
@ -834,8 +836,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.encrypt = function(wallet, cb) { root.encrypt = function(wallet, cb) {
askPassword(wallet.name, gettextCatalog.getString('Enter new spending password'), function(password) { var title = gettextCatalog.getString('Enter new spending password');
askPassword(wallet.name, title, function(password) {
if (!password) return cb('no password'); if (!password) return cb('no password');
title = gettextCatalog.getString('Confirm you new spending password');
askPassword(wallet.name, gettextCatalog.getString('Confirm you new spending password'), function(password2) { askPassword(wallet.name, gettextCatalog.getString('Confirm you new spending password'), function(password2) {
if (!password2 || password != password2) if (!password2 || password != password2)
return cb('password mismatch'); return cb('password mismatch');
@ -849,7 +853,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.decrypt = function(wallet, cb) { root.decrypt = function(wallet, cb) {
$log.debug('Disabling private key encryption for' + wallet.name); $log.debug('Disabling private key encryption for' + wallet.name);
askPassword(wallet.name, gettext('Enter Spending Password'), function(password) { askPassword(wallet.name, gettextCatalog.getString('Enter Spending Password'), function(password) {
if (!password) return cb('no password'); if (!password) return cb('no password');
try { try {
@ -864,7 +868,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.handleEncryptedWallet = function(wallet, cb) { root.handleEncryptedWallet = function(wallet, cb) {
if (!root.isEncrypted(wallet)) return cb(); if (!root.isEncrypted(wallet)) return cb();
askPassword(wallet.name, gettext('Enter Spending Password'), function(password) { askPassword(wallet.name, gettextCatalog.getString('Enter Spending Password'), function(password) {
if (!password) return cb('No password'); if (!password) return cb('No password');
if (!wallet.checkPassword(password)) return cb('Wrong password'); if (!wallet.checkPassword(password)) return cb('Wrong password');
@ -929,13 +933,13 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
} }
root.prepare(wallet, function(err, password) { root.prepare(wallet, function(err, password) {
if (err) return cb('Prepare error: ' + err); if (err) return cb(bwcError.msg(err));
ongoingProcess.set('sendingTx', true, customStatusHandler); ongoingProcess.set('sendingTx', true, customStatusHandler);
publishFn(wallet, txp, function(err, publishedTxp) { publishFn(wallet, txp, function(err, publishedTxp) {
ongoingProcess.set('sendingTx', false, customStatusHandler); ongoingProcess.set('sendingTx', false, customStatusHandler);
if (err) return cb('Send Error: ' + err); if (err) return cb(bwcError.msg(err));
ongoingProcess.set('signingTx', true, customStatusHandler); ongoingProcess.set('signingTx', true, customStatusHandler);
root.signTx(wallet, publishedTxp, password, function(err, signedTxp) { root.signTx(wallet, publishedTxp, password, function(err, signedTxp) {
@ -945,10 +949,9 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
if (err) { if (err) {
$log.warn('sign error:' + err); $log.warn('sign error:' + err);
// TODO? var msg = err && err.message ?
var msg = err.message ?
err.message : err.message :
gettext('The payment was created but could not be completed. Please try again from home screen'); gettextCatalog.getString('The payment was created but could not be completed. Please try again from home screen');
$rootScope.$emit('Local/TxAction', wallet.id); $rootScope.$emit('Local/TxAction', wallet.id);
return cb(msg); return cb(msg);
@ -958,7 +961,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
ongoingProcess.set('broadcastingTx', true, customStatusHandler); ongoingProcess.set('broadcastingTx', true, customStatusHandler);
root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) { root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
ongoingProcess.set('broadcastingTx', false, customStatusHandler); ongoingProcess.set('broadcastingTx', false, customStatusHandler);
if (err) return cb('sign error' + err); if (err) return cb(bwcError.msg(err));
$rootScope.$emit('Local/TxAction', wallet.id); $rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, broadcastedTxp); var type = root.getViewStatus(wallet, broadcastedTxp);