Merge branch 'master' of https://github.com/bitpay/copay into feat/balance-modal
This commit is contained in:
commit
58478b8113
60 changed files with 4475 additions and 2636 deletions
|
|
@ -305,6 +305,15 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
|
|||
});
|
||||
};
|
||||
|
||||
root.getRates = function(currency, cb) {
|
||||
$http(_get('/rates/' + currency)).then(function(data) {
|
||||
$log.info('BitPay Get Rates: SUCCESS');
|
||||
return cb(data.data.error, data.data.data);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Error: Get Rates', data));
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* CONSTANTS
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -21,14 +21,10 @@ angular.module('copayApp.services').service('externalLinkService', function(plat
|
|||
_restoreHandleOpenURL(old);
|
||||
} else {
|
||||
if (optIn) {
|
||||
var message = gettextCatalog.getString(message),
|
||||
title = gettextCatalog.getString(title),
|
||||
okText = gettextCatalog.getString(okText),
|
||||
cancelText = gettextCatalog.getString(cancelText),
|
||||
openBrowser = function(res) {
|
||||
if (res) window.open(url, '_system');
|
||||
_restoreHandleOpenURL(old);
|
||||
};
|
||||
var openBrowser = function(res) {
|
||||
if (res) window.open(url, '_system');
|
||||
_restoreHandleOpenURL(old);
|
||||
};
|
||||
popupService.showConfirm(title, message, okText, cancelText, openBrowser);
|
||||
} else {
|
||||
window.open(url, '_system');
|
||||
|
|
|
|||
|
|
@ -765,6 +765,12 @@ angular.module('copayApp.services')
|
|||
});
|
||||
}
|
||||
|
||||
if (opts.m) {
|
||||
ret = lodash.filter(ret, function(w) {
|
||||
return (w.credentials.m == opts.m);
|
||||
});
|
||||
}
|
||||
|
||||
if (opts.onlyComplete) {
|
||||
ret = lodash.filter(ret, function(w) {
|
||||
return w.isComplete();
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -8,42 +8,39 @@ angular.module('copayApp.services')
|
|||
root.availableLanguages = [{
|
||||
name: 'English',
|
||||
isoCode: 'en',
|
||||
}, {
|
||||
name: 'Český',
|
||||
isoCode: 'cs',
|
||||
}, {
|
||||
name: 'Français',
|
||||
isoCode: 'fr',
|
||||
}, {
|
||||
name: 'Italiano',
|
||||
isoCode: 'it',
|
||||
}, {
|
||||
name: 'Deutsch',
|
||||
isoCode: 'de',
|
||||
}, {
|
||||
name: 'Español',
|
||||
isoCode: 'es',
|
||||
}, {
|
||||
name: '日本語',
|
||||
isoCode: 'ja',
|
||||
useIdeograms: true,
|
||||
}, {
|
||||
name: '中文(简体)',
|
||||
isoCode: 'zh',
|
||||
useIdeograms: true,
|
||||
}, {
|
||||
name: 'Polski',
|
||||
isoCode: 'pl',
|
||||
}, {
|
||||
name: 'Pусский',
|
||||
isoCode: 'ru',
|
||||
name: 'Français',
|
||||
isoCode: 'fr',
|
||||
// }, {
|
||||
// name: 'Český',
|
||||
// isoCode: 'cs',
|
||||
// }, {
|
||||
// name: 'Italiano',
|
||||
// isoCode: 'it',
|
||||
// }, {
|
||||
// name: 'Deutsch',
|
||||
// isoCode: 'de',
|
||||
// }, {
|
||||
// name: '日本語',
|
||||
// isoCode: 'ja',
|
||||
// useIdeograms: true,
|
||||
// }, {
|
||||
// name: '中文(简体)',
|
||||
// isoCode: 'zh',
|
||||
// useIdeograms: true,
|
||||
// }, {
|
||||
// name: 'Polski',
|
||||
// isoCode: 'pl',
|
||||
// }, {
|
||||
// name: 'Pусский',
|
||||
// isoCode: 'ru',
|
||||
}];
|
||||
|
||||
|
||||
root._detect = function(cb) {
|
||||
|
||||
return cb('en'); //disable auto detection for release;
|
||||
|
||||
var userLang, androidLang;
|
||||
if (navigator && navigator.globalization) {
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
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);
|
||||
});
|
||||
|
|
@ -405,7 +405,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() {
|
||||
|
|
@ -835,9 +835,11 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
|
||||
root.encrypt = function(wallet, cb) {
|
||||
askPassword(wallet.name, gettext('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');
|
||||
askPassword(wallet.name, gettext('Confirm you new spending password'), function(password2) {
|
||||
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');
|
||||
|
||||
|
|
@ -850,7 +852,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 {
|
||||
|
|
@ -865,7 +867,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');
|
||||
|
||||
|
|
@ -930,13 +932,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) {
|
||||
|
|
@ -946,10 +948,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);
|
||||
|
|
@ -959,7 +960,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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue