Merge pull request #3497 from bitpay/v1.5

Update v1.6 with changes on v1.5
This commit is contained in:
Matias Alejo Garcia 2015-11-19 16:27:19 -03:00
commit bbec74dcb9
15 changed files with 196 additions and 60 deletions

View file

@ -358,6 +358,15 @@ ul.tx-copayers {
background-color: #C0392B;
}
.circle-icon {
background: #F1F3F5;
border-radius: 100%;
padding: 1.5rem;
width: 80px;
height: 80px;
margin: 0 auto;
}
.date-message {
background-color: #213140;
border-radius: 3px;

View file

@ -170,11 +170,6 @@ angular.module('copayApp.controllers').controller('createController',
return;
}
if (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey) {
if (opts.n == 1) {
$rootScope.$emit('Local/WalletImported', walletId);
}
}
});
}, 100);
}

View file

@ -786,11 +786,32 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateLocalTxHistory = function(client, cb) {
var requestLimit = 6;
var walletId = client.credentials.walletId;
var config = configService.getSync().wallet.settings;
var fixTxsUnit = function(txs) {
if (!txs || !txs[0]) return;
var cacheUnit = txs[0].amountStr.split(' ')[1];
if (cacheUnit == config.unitName)
return;
var name = ' ' + config.unitName;
$log.debug('Fixing Tx Cache Unit to:' + name)
lodash.each(txs, function(tx) {
tx.amountStr = profileService.formatAmount(tx.amount, config.unitName) + name;
tx.feeStr = profileService.formatAmount(tx.fees, config.unitName) + name;
});
};
self.getConfirmedTxs(walletId, function(err, txsFromLocal) {
if (err) return cb(err);
var endingTxid = txsFromLocal[0] ? txsFromLocal[0].txid : null;
fixTxsUnit(txsFromLocal);
function getNewTxs(newTxs, skip, i_cb) {
self.getTxsFromServer(client, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
@ -924,9 +945,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}
profileService.setWalletClients();
$timeout(function() {
$rootScope.$emit('Local/WalletImported', self.walletId);
}, 100);
self.startScan(self.walletId);
});
};
@ -1140,8 +1159,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
self.updateAll();
self.updateTxHistory();
self.updateAll({
triggerTxUpdate: true,
});
self.updateRemotePreferences({
saveAll: true
}, function() {
@ -1177,10 +1197,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.debouncedUpdate();
});
$rootScope.$on('Local/BackupDone', function(event) {
$rootScope.$on('Local/BackupDone', function(event, walletId) {
self.needsBackup = false;
$log.debug('Backup done');
storageService.setBackupFlag(self.walletId, function(err) {
storageService.setBackupFlag(walletId || self.walletId, function(err) {
$log.debug('Backup done stored');
});
});

View file

@ -129,11 +129,6 @@ angular.module('copayApp.controllers').controller('joinController',
return;
}
$timeout(function() {
var fc = profileService.focusedClient;
if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey))
$rootScope.$emit('Local/WalletImported', fc.credentials.walletId);
}, 2000);
});
}, 100);
};

View file

@ -28,8 +28,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.switchWallet = function(selectedWalletId, currentWalletId) {
if (selectedWalletId == currentWalletId) return;
self.walletSelection = false;
profileService.setAndStoreFocus(selectedWalletId, function() {
});
profileService.setAndStoreFocus(selectedWalletId, function() {});
};
self.toggleWalletSelection = function() {
@ -40,10 +39,14 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.setWallets = function() {
if (!profileService.profile) return;
var config = configService.getSync();
config.colorFor = config.colorFor || {};
config.aliasFor = config.aliasFor || {};
var ret = lodash.map(profileService.profile.credentials, function(c) {
// Sanitize empty wallets (fixed in BWC 1.8.1, and auto fixed when wallets completes)
var credentials = lodash.filter(profileService.profile.credentials, 'walletName');
var ret = lodash.map(credentials, function(c) {
return {
m: c.m,
n: c.n,
@ -52,6 +55,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
color: config.colorFor[c.walletId] || '#4A90E2',
};
});
self.wallets = lodash.sortBy(ret, 'name');
};

View file

@ -271,6 +271,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.canSign = fc.canSign() || fc.isPrivKeyExternal();
$scope.loading = null;
$scope.color = fc.backgroundColor;
$scope.isShared = fc.credentials.n > 1;
// ToDo: use tx.customData instead of tx.message
if (tx.message === 'Glidera transaction' && isGlidera) {
@ -951,6 +952,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
profileService.signTxProposal(txp, function(err, signedTx) {
self.setOngoingProcess();
if (err) {
if (!lodash.isObject(err)) {
err = { message: err};
}
err.message = bwsError.msg(err, gettextCatalog.getString('The payment was created but could not be signed. Please try again from home screen'));
return cb(err);
}

View file

@ -20,7 +20,7 @@ angular
$urlRouterProvider.otherwise('/');
$logProvider.debugEnabled(true);
$provide.decorator('$log', ['$delegate',
$provide.decorator('$log', ['$delegate', 'isDevel',
function($delegate, isDevel) {
var historicLog = historicLogProvider.$get();

View file

@ -373,9 +373,26 @@ angular.module('copayApp.services')
root.profile.credentials.push(JSON.parse(walletClient.export()));
root.setWalletClients();
root.setAndStoreFocus(walletId, function() {
storageService.storeProfile(root.profile, function(err) {
return cb(err, walletId);
var handleImport = function(cb) {
var isImport = opts.mnemonic || opts.externalSource || opts.extendedPrivateKey;
if (!isImport)
return cb();
$rootScope.$emit('Local/BackupDone', walletId);
if (!walletClient.isComplete())
return cb();
storageService.setCleanAndScanAddresses(walletId, cb);
};
handleImport(function() {
root.setAndStoreFocus(walletId, function() {
storageService.storeProfile(root.profile, function(err) {
return cb(err, walletId);
});
});
});
});