Merge branch 'master' of https://github.com/bitpay/copay into feat/app-identity

This commit is contained in:
Andy Phillipson 2017-01-03 14:08:41 -05:00
commit 189117433a
85 changed files with 1252 additions and 1224 deletions

View file

@ -0,0 +1,5 @@
'use strict';
angular.module('copayApp.services').factory('appConfigService', function($window) {
return $window.appConfig;
});

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('backupService', function backupServiceFactory($log, $timeout, $stateParams, profileService, sjcl, $window) {
.factory('backupService', function backupServiceFactory($log, $timeout, $stateParams, profileService, sjcl, appConfigService) {
var root = {};
@ -80,7 +80,7 @@ angular.module('copayApp.services')
var walletName = (wallet.alias || '') + (wallet.alias ? '-' : '') + wallet.credentials.walletName;
if (opts.noSign) walletName = walletName + '-noSign'
var filename = walletName + '-' + $window.appConfig.nameCase + 'backup.aes.json';
var filename = walletName + '-' + appConfigService.nameCase + 'backup.aes.json';
_download(ew, filename, cb)
};
return root;

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('incomingData', function($log, $state, $window, $timeout, bitcore, $rootScope, payproService, scannerService) {
angular.module('copayApp.services').factory('incomingData', function($log, $state, $timeout, bitcore, $rootScope, payproService, scannerService, appConfigService) {
var root = {};
@ -121,17 +121,17 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
} else {
goToAmountPage(data);
}
} else if (data && data.indexOf($window.appConfig.name + '://glidera') === 0) {
} else if (data && data.indexOf(appConfigService.name + '://glidera') === 0) {
return $state.go('uriglidera', {
url: data
});
} else if (data && data.indexOf($window.appConfig.name + '://coinbase') === 0) {
} else if (data && data.indexOf(appConfigService.name + '://coinbase') === 0) {
return $state.go('uricoinbase', {
url: data
});
// BitPay Authentication
} else if (data && data.indexOf($window.appConfig.name + '://') === 0) {
// BitPayCard Authentication
} else if (data && data.indexOf(appConfigService.name + '://') === 0) {
var secret = getParameterByName('secret', data);
var email = getParameterByName('email', data);
var otp = getParameterByName('otp', data);

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.services')
.factory('logHeader', function($window, $log, platformInfo) {
$log.info($window.appConfig.nameCase + ' v' + window.version + ' #' + window.commitHash);
$log.info('Client: '+ JSON.stringify(platformInfo) );
.factory('logHeader', function($window, appConfigService, $log, platformInfo) {
$log.info(appConfigService.nameCase + ' v' + $window.version + ' #' + $window.commitHash);
$log.info('Client: ' + JSON.stringify(platformInfo));
return {};
});

View file

@ -39,7 +39,11 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
'sendingByEmail': gettext('Preparing addresses...'),
'sending2faCode': gettext('Sending 2FA code...'),
'buyingBitcoin': gettext('Buying Bitcoin...'),
'sellingBitcoin': gettext('Selling Bitcoin...')
'sellingBitcoin': gettext('Selling Bitcoin...'),
'updatingGiftCards': 'Updating Gift Cards...',
'updatingGiftCard': 'Updating Gift Card...',
'cancelingGiftCard': 'Canceling Gift Card...',
'creatingGiftCard': 'Creating Gift Card...'
};
root.clear = function() {

View file

@ -712,7 +712,7 @@ angular.module('copayApp.services')
var opts = {};
opts.m = 1;
opts.n = 1;
opts.network = 'livenet';
opts.networkName = 'livenet';
root.createWallet(opts, cb);
};

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('txFormatService', function(bwcService, rateService, configService, lodash) {
angular.module('copayApp.services').factory('txFormatService', function($filter, bwcService, rateService, configService, lodash) {
var root = {};
root.Utils = bwcService.getUtils();
@ -48,10 +48,11 @@ angular.module('copayApp.services').factory('txFormatService', function(bwcServi
var config = configService.getSync().wallet.settings;
var val = function() {
var v1 = rateService.toFiat(satoshis, config.alternativeIsoCode);
var v1 = parseFloat((rateService.toFiat(satoshis, config.alternativeIsoCode)).toFixed(2));
v1 = $filter('formatFiatAmount')(v1);
if (!v1) return null;
return v1.toFixed(2) + ' ' + config.alternativeIsoCode;
return v1 + ' ' + config.alternativeIsoCode;
};
// Async version

View file

@ -12,23 +12,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
var errors = bwcService.getErrors();
// UI Related
root.openStatusModal = function(type, txp, cb) {
var scope = $rootScope.$new(true);
scope.type = type;
scope.tx = txFormatService.processTx(txp);
scope.color = txp.color;
scope.cb = cb;
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {
scope: scope,
animation: 'slide-in-up'
}).then(function(modal) {
scope.txStatusModal = modal;
scope.txStatusModal.show();
});
};
var _signWithLedger = function(wallet, txp, cb) {
$log.info('Requesting Ledger Chrome app to sign the transaction');
@ -961,23 +944,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
if (err) return cb(bwcError.msg(err));
$rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, broadcastedTxp);
if (!customStatusHandler) {
root.openStatusModal(type, broadcastedTxp, function() {});
}
return cb(null, broadcastedTxp);
});
} else {
$rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, signedTxp);
if (!customStatusHandler) {
root.openStatusModal(type, signedTxp, function() {});
}
return cb(null, signedTxp);
}
});
@ -1053,38 +1023,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
} catch (e) {}
}
root.getViewStatus = function(wallet, txp) {
var status = txp.status;
var type;
var INMEDIATE_SECS = 10;
if (status == 'broadcasted') {
type = 'broadcasted';
} else {
var n = txp.actions.length;
var action = lodash.find(txp.actions, {
copayerId: wallet.credentials.copayerId
});
if (!action) {
type = 'created';
} else if (action.type == 'accept') {
// created and accepted at the same time?
if (n == 1 && action.createdOn - txp.createdOn < INMEDIATE_SECS) {
type = 'created';
} else {
type = 'accepted';
}
} else if (action.type == 'reject') {
type = 'rejected';
} else {
throw new Error('Unknown type:' + type);
}
}
return type;
};
root.getSendMaxInfo = function(wallet, opts, cb) {
opts = opts || {};
wallet.getSendMaxInfo(opts, function(err, res) {