Merge branch 'master' of https://github.com/bitpay/copay into bug/android-balance-view

This commit is contained in:
Andy Phillipson 2016-12-15 15:39:08 -05:00
commit dd00604edc
20 changed files with 229 additions and 129 deletions

View file

@ -104,14 +104,14 @@ angular.module('copayApp.controllers').controller('addressesController', functio
$timeout(function() { $timeout(function() {
$scope.showInfo = !$scope.showInfo; $scope.showInfo = !$scope.showInfo;
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}); }, 10);
}; };
$scope.readMore = function() { $scope.readMore = function() {
$timeout(function() { $timeout(function() {
$scope.showMore = !$scope.showMore; $scope.showMore = !$scope.showMore;
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}); }, 10);
}; };
$scope.showMenu = function(allAddresses, $event) { $scope.showMenu = function(allAddresses, $event) {

View file

@ -30,22 +30,24 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
}; };
$scope.global = $rootScope; $scope.global = $rootScope;
if(!$scope.global.developmentUtilitiesEnabled){ if (!$scope.global.developmentUtilitiesEnabled) {
$scope.global.developmentUtilitiesEnabled = { $scope.global.developmentUtilitiesEnabled = {
value: false value: false
}; };
} }
$scope.toggledDevelopmentUtils = function (){ $scope.toggledDevelopmentUtils = function() {
if($scope.global.developmentUtilitiesEnabled.value){ if ($scope.global.developmentUtilitiesEnabled.value) {
$log.debug('User enabled development utilities.'); $log.debug('User enabled development utilities.');
$ionicScrollDelegate.resize(); $timeout(function() {
$ionicScrollDelegate.resize();
}, 10);
} else { } else {
$log.debug('User disabled development utilities.'); $log.debug('User disabled development utilities.');
} }
} }
$scope.activateFeedbackCard = function () { $scope.activateFeedbackCard = function() {
$scope.feedbackCardActivating = true; $scope.feedbackCardActivating = true;
storageService.getFeedbackInfo(function(error, info) { storageService.getFeedbackInfo(function(error, info) {
var feedbackInfo = JSON.parse(info); var feedbackInfo = JSON.parse(info);
@ -56,10 +58,10 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() { storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() {
$log.debug('Activated feedback card with: ' + JSON.stringify(feedbackInfo)); $log.debug('Activated feedback card with: ' + JSON.stringify(feedbackInfo));
$ionicHistory.clearCache(); $ionicHistory.clearCache();
$timeout(function(){ $timeout(function() {
$scope.feedbackCardActivating = false; $scope.feedbackCardActivating = false;
$scope.feedbackCardActivated = true; $scope.feedbackCardActivated = true;
$timeout(function(){ $timeout(function() {
$scope.feedbackCardActivated = false; $scope.feedbackCardActivated = false;
}, 10000); }, 10000);
}, 500); }, 500);
@ -67,7 +69,7 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
}); });
} }
$scope.resetActivateFeedbackCard = function(){ $scope.resetActivateFeedbackCard = function() {
$scope.feedbackCardActivated = false; $scope.feedbackCardActivated = false;
} }

View file

@ -483,20 +483,12 @@ angular.module('copayApp.controllers').controller('confirmController', function(
} }
}); });
return; return;
} }
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
return walletService.onlyPublish(wallet, txp, function(err, txp) {
if (err) return setSendError(err);
});
}
ongoingProcess.set('creatingTx', true, onSendStatusChange); ongoingProcess.set('creatingTx', true, onSendStatusChange);
createTx(wallet, false, function(err, txp) { createTx(wallet, false, function(err, txp) {
ongoingProcess.set('creatingTx', false, onSendStatusChange); ongoingProcess.set('creatingTx', false, onSendStatusChange);
if (err) return; if (err) return;
var config = configService.getSync(); var config = configService.getSync();
var spendingPassEnabled = walletService.isEncrypted(wallet); var spendingPassEnabled = walletService.isEncrypted(wallet);
@ -539,7 +531,12 @@ angular.module('copayApp.controllers').controller('confirmController', function(
function statusChangeHandler(processName, showName, isOn) { function statusChangeHandler(processName, showName, isOn) {
$log.debug('statusChangeHandler: ', processName, showName, isOn); $log.debug('statusChangeHandler: ', processName, showName, isOn);
if ((processName === 'broadcastingTx' || ((processName === 'signingTx') && $scope.wallet.m > 1)) && !isOn) { if (
(
processName === 'broadcastingTx' ||
((processName === 'signingTx') && $scope.wallet.m > 1) ||
(processName == 'sendingTx' && !$scope.wallet.canSign() && !$scope.wallet.isPrivKeyExternal())
) && !isOn) {
$scope.sendStatus = 'success'; $scope.sendStatus = 'success';
$scope.$digest(); $scope.$digest();
} else if (showName) { } else if (showName) {
@ -760,6 +757,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}; };
function publishAndSign(wallet, txp, onSendStatusChange) { function publishAndSign(wallet, txp, onSendStatusChange) {
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
return walletService.onlyPublish(wallet, txp, function(err) {
if (err) setSendError(err);
}, onSendStatusChange);
}
walletService.publishAndSign(wallet, txp, function(err, txp) { walletService.publishAndSign(wallet, txp, function(err, txp) {
if (err) return setSendError(err); if (err) return setSendError(err);

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, 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, $window) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
@ -33,7 +33,6 @@ angular.module('copayApp.controllers').controller('createController',
$scope.formData.derivationPath = derivationPathHelper.default; $scope.formData.derivationPath = derivationPathHelper.default;
$scope.setTotalCopayers(tc); $scope.setTotalCopayers(tc);
updateRCSelect(tc); updateRCSelect(tc);
updateSeedSourceSelect(tc);
}; };
$scope.showAdvChange = function() { $scope.showAdvChange = function() {
@ -44,7 +43,7 @@ angular.module('copayApp.controllers').controller('createController',
$scope.resizeView = function() { $scope.resizeView = function() {
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}); }, 10);
checkPasswordFields(); checkPasswordFields();
}; };
@ -75,18 +74,27 @@ angular.module('copayApp.controllers').controller('createController',
$scope.seedSource = seedOptions[0]; $scope.seedSource = seedOptions[0];
if (n > 1 && isChromeApp) /*
seedOptions.push({
id: 'ledger',
label: 'Ledger Hardware Wallet',
});
if (isChromeApp || isDevel) { Disable Hardware Wallets for BitPay distribution
seedOptions.push({
id: 'trezor', */
label: 'Trezor Hardware Wallet',
}); if ($window.appConfig.name == 'copay') {
if (n > 1 && isChromeApp) {
seedOptions.push({
id: 'ledger',
label: 'Ledger Hardware Wallet',
});
}
if (isChromeApp || isDevel) {
seedOptions.push({
id: 'trezor',
label: 'Trezor Hardware Wallet',
});
}
} }
$scope.seedOptions = seedOptions; $scope.seedOptions = seedOptions;
}; };

View file

@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.resizeView = function() { $scope.resizeView = function() {
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}); }, 10);
}; };
function getPassword(cb) { function getPassword(cb) {

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('importController', angular.module('copayApp.controllers').controller('importController',
function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, profileService, configService, sjcl, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog) { function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, profileService, configService, sjcl, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog, $window) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
@ -17,6 +17,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.formData.derivationPath = derivationPathHelper.default; $scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.account = 1; $scope.formData.account = 1;
$scope.importErr = false; $scope.importErr = false;
$scope.showHardwareWallet = $window.appConfig.name == 'copay';
if ($stateParams.code) if ($stateParams.code)
$scope.processWalletInfo($stateParams.code); $scope.processWalletInfo($stateParams.code);
@ -359,7 +360,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.resizeView = function() { $scope.resizeView = function() {
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}); }, 10);
}; };
}); });

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, 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, $window) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
@ -20,7 +20,7 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.resizeView = function() { $scope.resizeView = function() {
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}); }, 10);
checkPasswordFields(); checkPasswordFields();
}; };
@ -57,19 +57,26 @@ angular.module('copayApp.controllers').controller('joinController',
}]; }];
$scope.seedSource = self.seedOptions[0]; $scope.seedSource = self.seedOptions[0];
/*
if (isChromeApp) { Disable Hardware Wallets
self.seedOptions.push({
id: 'ledger',
label: 'Ledger Hardware Wallet',
});
}
if (isChromeApp || isDevel) { */
self.seedOptions.push({
id: 'trezor', if ($window.appConfig.name == 'copay') {
label: 'Trezor Hardware Wallet', if (isChromeApp) {
}); self.seedOptions.push({
id: 'ledger',
label: 'Ledger Hardware Wallet',
});
}
if (isChromeApp || isDevel) {
self.seedOptions.push({
id: 'trezor',
label: 'Trezor Hardware Wallet',
});
}
} }
}; };

View file

@ -9,8 +9,8 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun
$scope.openPopup = function() { $scope.openPopup = function() {
$ionicModal.fromTemplateUrl('views/includes/screenshotWarningModal.html', { $ionicModal.fromTemplateUrl('views/includes/screenshotWarningModal.html', {
scope: $scope, scope: $scope,
backdropClickToClose: false, backdropClickToClose: true,
hardwareBackButtonClose: false hardwareBackButtonClose: true
}).then(function(modal) { }).then(function(modal) {
$scope.warningModal = modal; $scope.warningModal = modal;
$scope.warningModal.show(); $scope.warningModal.show();

View file

@ -1,29 +1,35 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController', angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
function($scope, $log, $timeout, $ionicHistory, configService, rateService, lodash, profileService, walletService) { function($scope, $log, $timeout, $ionicHistory, configService, rateService, lodash, profileService, walletService, storageService) {
var next = 10; var next = 10;
var completeAlternativeList; var completeAlternativeList;
var config = configService.getSync(); function init() {
$scope.currentCurrency = config.wallet.settings.alternativeIsoCode; var unusedCurrencyList = [{
$scope.listComplete = false; isoCode: 'LTL'
}, {
isoCode: 'BTC'
}];
rateService.whenAvailable(function() {
var unusedCurrencyList = [{ $scope.listComplete = false;
isoCode: 'LTL'
}, {
isoCode: 'BTC'
}];
var idx = lodash.indexBy(unusedCurrencyList, 'isoCode'); var idx = lodash.indexBy(unusedCurrencyList, 'isoCode');
var idx2 = lodash.indexBy($scope.lastUsedAltCurrencyList, 'isoCode');
rateService.whenAvailable(function() { completeAlternativeList = lodash.reject(rateService.listAlternatives(true), function(c) {
completeAlternativeList = lodash.reject(rateService.listAlternatives(), function(c) { return idx[c.isoCode] || idx2[c.isoCode];
return idx[c.isoCode]; });
$scope.altCurrencyList = completeAlternativeList.slice(0, 10);
$timeout(function() {
$scope.$apply();
});
}); });
$scope.altCurrencyList = completeAlternativeList.slice(0, next); }
});
$scope.loadMore = function() { $scope.loadMore = function() {
$timeout(function() { $timeout(function() {
@ -34,6 +40,17 @@ angular.module('copayApp.controllers').controller('preferencesAltCurrencyControl
}, 100); }, 100);
}; };
$scope.findCurrency = function(search) {
if (!search) init();
$scope.altCurrencyList = lodash.filter(completeAlternativeList, function(item) {
var val = item.name;
return lodash.includes(val.toLowerCase(), search.toLowerCase());
});
$timeout(function() {
$scope.$apply();
});
};
$scope.save = function(newAltCurrency) { $scope.save = function(newAltCurrency) {
var opts = { var opts = {
wallet: { wallet: {
@ -48,9 +65,27 @@ angular.module('copayApp.controllers').controller('preferencesAltCurrencyControl
if (err) $log.warn(err); if (err) $log.warn(err);
$ionicHistory.goBack(); $ionicHistory.goBack();
saveLastUsed(newAltCurrency);
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() { walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved'); $log.debug('Remote preferences saved');
}); });
}); });
}; };
function saveLastUsed(newAltCurrency) {
$scope.lastUsedAltCurrencyList.unshift(newAltCurrency);
$scope.lastUsedAltCurrencyList = lodash.uniq($scope.lastUsedAltCurrencyList, 'isoCode');
$scope.lastUsedAltCurrencyList = $scope.lastUsedAltCurrencyList.slice(0, 3);
storageService.setLastCurrencyUsed(JSON.stringify($scope.lastUsedAltCurrencyList), function() {});
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
var config = configService.getSync();
$scope.currentCurrency = config.wallet.settings.alternativeIsoCode;
storageService.getLastCurrencyUsed(function(err, lastUsedAltCurrency) {
$scope.lastUsedAltCurrencyList = lastUsedAltCurrency ? JSON.parse(lastUsedAltCurrency) : [];
init();
});
});
}); });

View file

@ -1,24 +1,34 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('proposalsController', angular.module('copayApp.controllers').controller('proposalsController',
function($timeout, $scope, profileService, $log, txpModalService) { function($timeout, $scope, profileService, $log, txpModalService, addressbookService) {
$scope.fetchingProposals = true; $scope.fetchingProposals = true;
$scope.$on("$ionicView.enter", function(event, data){ $scope.$on("$ionicView.enter", function(event, data) {
profileService.getTxps(50, function(err, txps) { addressbookService.list(function(err, ab) {
$scope.fetchingProposals = false; if (err) $log.error(err);
if (err) { $scope.addressbook = ab || {};
$log.error(err);
return; profileService.getTxps(50, function(err, txps) {
} $scope.fetchingProposals = false;
$scope.txps = txps; if (err) {
$timeout(function() { $log.error(err);
$scope.$apply(); return;
}, 1); }
$scope.txps = txps;
$timeout(function() {
$scope.$apply();
});
});
}); });
}); });
$scope.openTxpModal = txpModalService.open; $scope.openTxpModal = txpModalService.open;
$scope.createdWithinPastDay = function(time) {
var now = new Date();
var date = new Date(time * 1000);
return (now.getTime() - date.getTime()) < (1000 * 60 * 60 * 24);
};
}); });

View file

@ -126,6 +126,12 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}); });
}); });
$scope.createdWithinPastDay = function(time) {
var now = new Date();
var date = new Date(time * 1000);
return (now.getTime() - date.getTime()) < (1000 * 60 * 60 * 24);
};
$scope.openExternalLink = function() { $scope.openExternalLink = function() {
var url = 'https://github.com/bitpay/copay/releases/latest'; var url = 'https://github.com/bitpay/copay/releases/latest';
var optIn = true; var optIn = true;
@ -187,7 +193,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
$scope.$apply(); $scope.$apply();
}, 100); }, 10);
}) })
}; };
@ -240,7 +246,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
$scope.$apply(); $scope.$apply();
}, 100); }, 10);
}); });
}; };
@ -269,7 +275,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
$scope.$apply(); $scope.$apply();
}, 100); }, 10);
}; };
var bitpayCardCache = function() { var bitpayCardCache = function() {

View file

@ -86,7 +86,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
$scope.setWallet = function(index) { $scope.setWallet = function(index) {
$scope.wallet = $scope.wallets[index]; $scope.wallet = $scope.wallets[index];
$scope.walletIndex = index; $scope.walletIndex = index;
if ($scope.walletAddrs[$scope.walletIndex].addr) $scope.addr = $scope.walletAddrs[$scope.walletIndex].addr; if ($scope.walletAddrs[$scope.wallet.id].addr) $scope.addr = $scope.walletAddrs[$scope.walletIndex].addr;
else $scope.setAddress(false); else $scope.setAddress(false);
} }

View file

@ -55,7 +55,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
$scope.$apply(); $scope.$apply();
}); }, 10);
}); });
}; };
@ -145,15 +145,15 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
if (index == wallets.length) { if (index == wallets.length) {
$scope.checkingBalance = false; $scope.checkingBalance = false;
if ($scope.hasFunds != true) {
$ionicScrollDelegate.freezeScroll(true);
}
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
} }
}); });
}); });
if ($scope.hasFunds != true) {
$ionicScrollDelegate.freezeScroll(true);
}
}; };
$scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.$on("$ionicView.beforeEnter", function(event, data) {

View file

@ -111,18 +111,24 @@ RateService.prototype.fromFiat = function(amount, code) {
return amount / this.getRate(code) * this.BTC_TO_SAT; return amount / this.getRate(code) * this.BTC_TO_SAT;
}; };
RateService.prototype.listAlternatives = function() { RateService.prototype.listAlternatives = function(sort) {
var self = this; var self = this;
if (!this.isAvailable()) { if (!this.isAvailable()) {
return []; return [];
} }
return self.lodash.map(this.getAlternatives(), function(item) { var alternatives = self.lodash.map(this.getAlternatives(), function(item) {
return { return {
name: item.name, name: item.name,
isoCode: item.isoCode isoCode: item.isoCode
} }
}); });
if (sort) {
alternatives.sort(function(a, b) {
return a.name.toLowerCase() > b.name.toLowerCase() ? 1 : -1;
});
}
return self.lodash.uniq(alternatives, 'isoCode');
}; };
angular.module('copayApp.services').factory('rateService', function($http, lodash) { angular.module('copayApp.services').factory('rateService', function($http, lodash) {

View file

@ -77,25 +77,25 @@ angular.module('copayApp.services')
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// UPGRADING STORAGE // UPGRADING STORAGE
// //
// 1. Write a function to upgrade the desired storage key(s). The function should have the protocol: // 1. Write a function to upgrade the desired storage key(s). The function should have the protocol:
// //
// _upgrade_x(key, network, cb), where: // _upgrade_x(key, network, cb), where:
// //
// `x` is the name of the storage key // `x` is the name of the storage key
// `key` is the name of the storage key being upgraded // `key` is the name of the storage key being upgraded
// `network` is one of 'livenet', 'testnet' // `network` is one of 'livenet', 'testnet'
// //
// 2. Add the storage key to `_upgraders` object using the name of the key as the `_upgrader` object key // 2. Add the storage key to `_upgraders` object using the name of the key as the `_upgrader` object key
// with the value being the name of the upgrade function (e.g., _upgrade_x). In order to avoid conflicts // with the value being the name of the upgrade function (e.g., _upgrade_x). In order to avoid conflicts
// when a storage key is involved in multiple upgraders as well as predicte the order in which upgrades // when a storage key is involved in multiple upgraders as well as predicte the order in which upgrades
// occur the `_upgrader` object key should be prefixed with '##_' (e.g., '01_') to create a unique and // occur the `_upgrader` object key should be prefixed with '##_' (e.g., '01_') to create a unique and
// sortable name. This format is interpreted by the _upgrade() function. // sortable name. This format is interpreted by the _upgrade() function.
// //
// Upgraders are executed in numerical order per the '##_' object key prefix. // Upgraders are executed in numerical order per the '##_' object key prefix.
// //
var _upgraders = { var _upgraders = {
'00_bitpayDebitCards' : _upgrade_bitpayDebitCards // 2016-11: Upgrade bitpayDebitCards-x to bitpayAccounts-x '00_bitpayDebitCards': _upgrade_bitpayDebitCards // 2016-11: Upgrade bitpayDebitCards-x to bitpayAccounts-x
}; };
function _upgrade_bitpayDebitCards(key, network, cb) { function _upgrade_bitpayDebitCards(key, network, cb) {
@ -375,6 +375,14 @@ angular.module('copayApp.services')
storage.remove('nextStep-' + service, cb); storage.remove('nextStep-' + service, cb);
}; };
root.setLastCurrencyUsed = function(lastCurrencyUsed, cb) {
storage.set('lastCurrencyUsed', lastCurrencyUsed, cb)
};
root.getLastCurrencyUsed = function(cb) {
storage.get('lastCurrencyUsed', cb)
};
root.checkQuota = function() { root.checkQuota = function() {
var block = ''; var block = '';
// 50MB // 50MB
@ -487,12 +495,14 @@ angular.module('copayApp.services')
bitpayAccounts = bitpayAccounts || {}; bitpayAccounts = bitpayAccounts || {};
Object.keys(bitpayAccounts).forEach(function(userId) { Object.keys(bitpayAccounts).forEach(function(userId) {
var data = bitpayAccounts[userId]['bitpayDebitCards-' + network]; var data = bitpayAccounts[userId]['bitpayDebitCards-' + network];
var newCards = lodash.reject(data.cards, {'eid': card.eid}); var newCards = lodash.reject(data.cards, {
'eid': card.eid
});
data.cards = newCards; data.cards = newCards;
root.setBitpayDebitCards(network, data, function(err) { root.setBitpayDebitCards(network, data, function(err) {
if (err) cb(err); if (err) cb(err);
// If there are no more cards in storage then re-enable the next step entry. // If there are no more cards in storage then re-enable the next step entry.
root.getBitpayDebitCards(network, function(err, cards){ root.getBitpayDebitCards(network, function(err, cards) {
if (err) cb(err); if (err) cb(err);
if (cards.length == 0) { if (cards.length == 0) {
root.removeNextStep('BitpayCard', cb); root.removeNextStep('BitpayCard', cb);

View file

@ -891,20 +891,14 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
}; };
root.onlyPublish = function(wallet, txp, cb) { root.onlyPublish = function(wallet, txp, cb, customStatusHandler) {
ongoingProcess.set('sendingTx', true); ongoingProcess.set('sendingTx', true, customStatusHandler);
root.publishTx(wallet, txp, function(err, publishedTxp) { root.publishTx(wallet, txp, function(err, publishedTxp) {
root.invalidateCache(wallet); root.invalidateCache(wallet);
ongoingProcess.set('sendingTx', false, customStatusHandler);
ongoingProcess.set('sendingTx', false); if (err) return cb(bwcError.msg(err));
if (err) return cb(err); $rootScope.$emit('Local/TxAction', wallet.id);
return cb();
var type = root.getViewStatus(wallet, createdTxp);
root.openStatusModal(type, createdTxp, function() {
$rootScope.$emit('Local/TxAction', wallet.id);
return;
});
return cb(null, publishedTxp);
}); });
}; };

View file

@ -58,8 +58,8 @@
</div> </div>
<a class="item item-icon-right" ng-hide="!useSendMax && (insufficientFunds || noMatchingWallet)" ng-click="showWalletSelector()"> <a class="item item-icon-right" ng-hide="!useSendMax && (insufficientFunds || noMatchingWallet)" ng-click="showWalletSelector()">
<span class="label" ng-if="!isGlidera" translate>From</span> <span class="label" ng-if="!isGlidera" translate>From</span>
<span class="label" ng-if="isGlidera == 'buy'" translate>To</span> <span class="label" ng-if="isGlidera == 'buy'">To</span>
<span class="label" ng-if="isGlidera == 'sell'" translate>From</span> <span class="label" ng-if="isGlidera == 'sell'">From</span>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/> <img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/>
@ -123,7 +123,7 @@
ng-if="!isCordova && wallets[0] && !insufficientFunds && !noMatchingWallet" ng-if="!isCordova && wallets[0] && !insufficientFunds && !noMatchingWallet"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="wallet"> has-wallet-chosen="wallet">
Click to pay {{'Accept' | translate}}
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-disabled="!wallet" ng-disabled="!wallet"
@ -131,14 +131,15 @@
slide-on-confirm="onConfirm()" slide-on-confirm="onConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="wallet"> has-wallet-chosen="wallet">
Slide to pay {{'Accept' | translate}}
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success
slide-success-show="sendStatus === 'success'" slide-success-show="sendStatus === 'success'"
slide-success-on-confirm="onSuccessConfirm()" slide-success-on-confirm="onSuccessConfirm()"
slide-success-hide-on-confirm="true"> slide-success-hide-on-confirm="true">
<span ng-hide="wallet.m > 1">Payment Sent</span> <span ng-show="wallet.m == 1 && (wallet.canSign() || wallet.isPrivKeyExternal())" translate>Payment Sent</span>
<span ng-show="wallet.m > 1">Proposal Created</span> <span ng-show="wallet.m > 1 && (wallet.canSign() || wallet.isPrivKeyExternal())" translate>Proposal Created</span>
<span ng-show="!wallet.canSign() && !wallet.isPrivKeyExternal()" translate>Transaction created</span>
<div ng-show="isGlidera" class="glidera-success"> <div ng-show="isGlidera" class="glidera-success">
<span ng-show="isGlidera == 'buy'">A transfer has been initiated from your bank account. Your bitcoins should arrive to your wallet in 2-4 business day</span> <span ng-show="isGlidera == 'buy'">A transfer has been initiated from your bank account. Your bitcoins should arrive to your wallet in 2-4 business day</span>
<span ng-show="isGlidera == 'sell'">A transfer has been initiated to your bank account. Should arrive in 4-6 business days</span> <span ng-show="isGlidera == 'sell'">A transfer has been initiated to your bank account. Should arrive in 4-6 business days</span>

View file

@ -16,7 +16,7 @@
<span translate>File/Text</span> <span translate>File/Text</span>
</div> </div>
<div class="col" ng-click="hardware = true; phrase = file = false; showAdv = false" ng-style="hardware && <div class="col" ng-click="hardware = true; phrase = file = false; showAdv = false" ng-style="hardware &&
{'border-bottom-style': 'solid'}"> {'border-bottom-style': 'solid'}" ng-show="showHardwareWallet">
<span translate>Hardware wallet</span> <span translate>Hardware wallet</span>
</div> </div>
</div> </div>

View file

@ -166,19 +166,19 @@
ng-if="tx.pendingForUs && canSign && !paymentExpired && hasClick" ng-if="tx.pendingForUs && canSign && !paymentExpired && hasClick"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="true"> has-wallet-chosen="true">
Click to accept {{'Accept'| translate}}
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-if="tx.pendingForUs && canSign && !paymentExpired && !hasClick" ng-if="tx.pendingForUs && canSign && !paymentExpired && !hasClick"
slide-on-confirm="onConfirm()" slide-on-confirm="onConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="true"> has-wallet-chosen="true">
Slide to accept {{'Accept'| translate}}
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success
slide-success-show="sendStatus === 'success'" slide-success-show="sendStatus === 'success'"
slide-success-on-confirm="onSuccessConfirm()" slide-success-on-confirm="onSuccessConfirm()"
> >
Payment Sent {{'Payment Sent' | translate}}
</slide-to-accept-success> </slide-to-accept-success>
</ion-modal-view> </ion-modal-view>

View file

@ -7,13 +7,27 @@
</ion-nav-back-button> </ion-nav-back-button>
</ion-nav-bar> </ion-nav-bar>
<ion-content> <ion-content>
<ion-radio ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency" <div class="bar bar-header item-input-inset m20b">
ng-click="save(altCurrency)">{{altCurrency.name}} <label class="item-input-wrapper">
</ion-radio> <i class="icon ion-ios-search placeholder-icon"></i>
<input type="search" ng-init="searchedAltCurrency = ''" ng-model="searchedAltCurrency" ng-change="findCurrency(searchedAltCurrency)"
placeholder="{{'Search your currency' | translate}}">
</label>
</div>
<div class="list" ng-if="lastUsedAltCurrencyList[0]">
<ion-radio ng-repeat="lastUsedAltCurrency in lastUsedAltCurrencyList" ng-value="lastUsedAltCurrency.isoCode" ng-model="currentCurrency"
ng-click="save(lastUsedAltCurrency)">{{lastUsedAltCurrency.name}}
</ion-radio>
</div>
<div class="list">
<ion-radio ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"
ng-click="save(altCurrency)">{{altCurrency.name}}
</ion-radio>
</div>
<ion-infinite-scroll <ion-infinite-scroll
ng-if="!listComplete" ng-if="!listComplete"
on-infinite="loadMore()" on-infinite="loadMore()"
distance="1%"> distance="50%">
</ion-infinite-scroll> </ion-infinite-scroll>
</ion-content> </ion-content>
</ion-view> </ion-view>