more fixes

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

View File

@ -456,7 +456,8 @@ msgstr ""
msgid "Confirm & Finish"
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"
msgstr ""
@ -808,8 +809,8 @@ msgstr ""
msgid "Enter Amount"
msgstr ""
#: src/js/services/walletService.js:852
#: src/js/services/walletService.js:867
#: src/js/services/walletService.js:856
#: src/js/services/walletService.js:871
msgid "Enter Spending Password"
msgstr ""
@ -817,7 +818,7 @@ msgstr ""
msgid "Enter Two Factor for BitPay Card"
msgstr ""
#: src/js/services/walletService.js:837
#: src/js/services/walletService.js:839
msgid "Enter new spending password"
msgstr ""
@ -981,7 +982,7 @@ msgstr ""
msgid "Export wallet"
msgstr ""
#: src/js/services/walletService.js:999
#: src/js/services/walletService.js:1003
#: www/views/tab-export-qrCode.html:9
msgid "Exporting via QR not supported for this wallet"
msgstr ""
@ -2362,7 +2363,7 @@ msgstr ""
msgid "The password of the recovery phrase (if set)"
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"
msgstr ""

View File

@ -1,6 +1,6 @@
'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 toAmount;
var isChromeApp = platformInfo.isChromeApp;
@ -351,7 +351,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error at confirm'), msg);
popupService.showAlert(gettextCatalog.getString('Error at confirm'), bwcError.msg(msg));
};
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
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);
return setSendError(msg);
}
if (toAmount > Number.MAX_SAFE_INTEGER) {
var msg = 'Amount too big';
var msg = gettextCatalog.getString('Amount too big');
$log.warn(msg);
return setSendError(msg);
}

View File

@ -1,7 +1,7 @@
'use strict';
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 isCordova = platformInfo.isCordova;
@ -67,10 +67,10 @@ angular.module('copayApp.controllers').controller('createController',
function updateSeedSourceSelect(n) {
var seedOptions = [{
id: 'new',
label: gettext('Random'),
label: gettextCatalog.getString('Random'),
}, {
id: 'set',
label: gettext('Specify Recovery Phrase...'),
label: gettextCatalog.getString('Specify Recovery Phrase...'),
}];
$scope.seedSource = seedOptions[0];

View File

@ -1,7 +1,7 @@
'use strict';
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 isDevel = platformInfo.isDevel;
@ -50,10 +50,10 @@ angular.module('copayApp.controllers').controller('joinController',
var updateSeedSourceSelect = function() {
self.seedOptions = [{
id: 'new',
label: gettext('Random'),
label: gettextCatalog.getString('Random'),
}, {
id: 'set',
label: gettext('Specify Recovery Phrase...'),
label: gettextCatalog.getString('Specify Recovery Phrase...'),
}];
$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.loading = false;
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix));
@ -164,9 +164,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.loading = true;
$timeout(function() {
ongoingProcess.set('broadcastTx', true);
ongoingProcess.set('broadcastingTx', true);
walletService.broadcastTx($scope.wallet, $scope.tx, function(err, txpb) {
ongoingProcess.set('broadcastTx', false);
ongoingProcess.set('broadcastingTx', false);
if (err) {
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) {
if (err) {
if (err.message && err.message == 'Transaction proposal not found' &&
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
$scope.tx.removed = true;
$scope.tx.canBeRemoved = 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([
'TxProposalRejectedBy',
'TxProposalAcceptedBy',

View File

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

View File

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

View File

@ -140,11 +140,13 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
wallet.getStatus({
twoStep: true
}, function(err, ret) {
console.log(err);
console.log("###########################");
if (err) {
if (err instanceof errors.NOT_AUTHORIZED) {
return cb('WALLET_NOT_REGISTERED');
}
return cb(bwcError.msg(err, gettext('Could not update Wallet')));
return cb(err);
}
return cb(null, ret);
});
@ -404,7 +406,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
function getNewTxs(newTxs, skip, cb) {
getTxsFromServer(wallet, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
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../))) {
log.info('Retrying history download in 5 secs...');
return $timeout(function() {
@ -834,8 +836,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
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');
title = gettextCatalog.getString('Confirm you new spending password');
askPassword(wallet.name, gettextCatalog.getString('Confirm you new spending password'), function(password2) {
if (!password2 || password != password2)
return cb('password mismatch');
@ -849,7 +853,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.decrypt = function(wallet, cb) {
$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');
try {
@ -864,7 +868,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.handleEncryptedWallet = function(wallet, 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 (!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) {
if (err) return cb('Prepare error: ' + err);
if (err) return cb(bwcError.msg(err));
ongoingProcess.set('sendingTx', true, customStatusHandler);
publishFn(wallet, txp, function(err, publishedTxp) {
ongoingProcess.set('sendingTx', false, customStatusHandler);
if (err) return cb('Send Error: ' + err);
if (err) return cb(bwcError.msg(err));
ongoingProcess.set('signingTx', true, customStatusHandler);
root.signTx(wallet, publishedTxp, password, function(err, signedTxp) {
@ -945,10 +949,9 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
if (err) {
$log.warn('sign error:' + err);
// TODO?
var msg = err.message ?
var msg = err && 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);
return cb(msg);
@ -958,7 +961,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
ongoingProcess.set('broadcastingTx', true, customStatusHandler);
root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
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);
var type = root.getViewStatus(wallet, broadcastedTxp);