Merge branch 'ref/design' of https://github.com/bitpay/bitpay-wallet into feature/external_link_open_system_browser

# Conflicts:
#	www/views/tab-settings.html
This commit is contained in:
Jamal Jackson 2016-10-13 11:57:24 -04:00
commit 794e0a304e
78 changed files with 1066 additions and 678 deletions

View file

@ -36,10 +36,12 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.data = {};
var config = configService.getSync().wallet;
$scope.feeLevel = config.settings ? config.settings.feeLevel : '';
$scope.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
$scope.toAmount = parseInt($scope.toAmount);
$scope.amountStr = txFormatService.formatAmountStr($scope.toAmount);
$scope.displayAmount = getDisplayAmount($scope.amountStr);
$scope.displayUnit = getDisplayUnit($scope.amountStr);
var networkName = (new bitcore.Address($scope.toAddress)).network.name;
$scope.network = networkName;
@ -65,6 +67,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (err || !status) {
$log.error(err);
} else {
w.status = status;
if (!status.availableBalanceSat) $log.debug('No balance available in: ' + w.name);
if (status.availableBalanceSat > $scope.toAmount) {
filteredWallets.push(w);
@ -75,6 +78,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (++index == wallets.length) {
if (!lodash.isEmpty(filteredWallets)) {
$scope.wallets = lodash.clone(filteredWallets);
setWallet($scope.wallets[0]);
} else {
if (!enoughFunds)
@ -108,6 +112,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
setWallet(wallet, true);
});
$scope.showWalletSelector = function() {
$scope.showWallets = true;
};
$scope.onWalletSelect = function(wallet) {
setWallet(wallet);
};
$scope.showDescriptionPopup = function() {
var message = gettextCatalog.getString('Add description');
@ -123,6 +135,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
});
};
function getDisplayAmount(amountStr) {
return amountStr.split(' ')[0];
}
function getDisplayUnit(amountStr) {
return amountStr.split(' ')[1];
}
var setFromPayPro = function(uri, cb) {
if (!cb) cb = function() {};
@ -254,7 +274,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
txp.message = description;
txp.payProUrl = paypro;
txp.excludeUnconfirmedUtxos = config.spendUnconfirmed ? false : true;
txp.feeLevel = config.settings.feeLevel || 'normal';
txp.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
txp.dryRun = dryRun;
walletService.createTx(wallet, txp, function(err, ctxp) {

View file

@ -3,15 +3,11 @@
angular.module('copayApp.controllers').controller('copayersController',
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, lodash, profileService, walletService, popupService, platformInfo, gettextCatalog, ongoingProcess) {
$scope.isCordova = platformInfo.isCordova;
$scope.$on("$ionicView.beforeEnter", function(event, data) {
init();
});
var init = function() {
$scope.isCordova = platformInfo.isCordova;
$scope.wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
updateWallet();
};
});
$rootScope.$on('bwsEvent', function() {
updateWallet();
@ -40,7 +36,9 @@ angular.module('copayApp.controllers').controller('copayersController',
};
$scope.showDeletePopup = function() {
popupService.showConfirm(gettextCatalog.getString('Confirm'), gettextCatalog.getString('Are you sure you want to delete this wallet?'), null, null, function(res) {
var title = gettextCatalog.getString('Confirm');
var msg = gettextCatalog.getString('Are you sure you want to cancel and delete this wallet?');
popupService.showConfirm(title, msg, null, null, function(res) {
if (res) deleteWallet();
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('importController',
function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, 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) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -350,4 +350,16 @@ angular.module('copayApp.controllers').controller('importController',
fromOnboarding: $stateParams.fromOnboarding
});
};
$scope.showAdvChange = function() {
$scope.showAdv = !$scope.showAdv;
$scope.resizeView();
};
$scope.resizeView = function() {
$timeout(function() {
$ionicScrollDelegate.resize();
});
};
});

View file

@ -1,6 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $state, $log, $ionicModal, profileService, uxLanguage, externalLinkService, storageService, $stateParams) {
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $state, $log, $ionicModal, profileService, uxLanguage, externalLinkService, storageService, $stateParams, startupService) {
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
$scope.init = function() {
$scope.lang = uxLanguage.currentLanguage;
$scope.terms = {};

View file

@ -34,6 +34,9 @@ angular.module('copayApp.controllers').controller('tourController',
var rate = rateService.toFiat(btcAmount * 1e8, localCurrency);
$scope.localCurrencySymbol = '$';
$scope.localCurrencyPerBtc = $filter('formatFiatAmount')(parseFloat(rate.toFixed(2), 10));
$timeout(function() {
$scope.$apply();
})
});
});
@ -50,7 +53,7 @@ angular.module('copayApp.controllers').controller('tourController',
ongoingProcess.set('creatingWallet', false);
popupService.showAlert(
gettextCatalog.getString('Cannot Create Wallet'), err,
function() {
function() {
retryCount = 0;
return $scope.createDefaultWallet();
}, gettextCatalog.getString('Retry'));

View file

@ -1,9 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService) {
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService, startupService) {
$ionicConfig.views.swipeBackEnabled(false);
$scope.$parent.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
$scope.goImport = function(code) {
$state.go('onboarding.import', {
fromOnboarding: true,

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService) {
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService) {
var wallet;
var listeners = [];
var notifications = [];
@ -13,6 +13,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.homeTip = $stateParams.fromOnboarding;
$scope.isCordova = platformInfo.isCordova;
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
if (!$scope.homeTip) {
storageService.getHomeTipAccepted(function(error, value) {
$scope.homeTip = (value == 'false') ? false : true;

View file

@ -59,6 +59,10 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
});
};
$scope.openScanner = function() {
$state.go('tabs.scan');
}
$scope.showMore = function() {
currentContactsPage++;
updateList();
@ -106,7 +110,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
var updateHasFunds = function() {
$scope.hasFunds = true;
$scope.hasFunds = null;
var wallets = profileService.getWallets({
onlyComplete: true,
@ -127,16 +131,16 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$log.error(err);
return;
}
if (status.availableBalanceSat && status.availableBalanceSat > 0) {
if (status.availableBalanceSat) {
$scope.hasFunds = true;
}
else $scope.hasFunds = false;
if (index == wallets.length) {
$scope.hasFunds = $scope.hasFunds || false;
$timeout(function() {
$scope.$apply();
});
}
$timeout(function() {
$scope.$apply();
})
});
});
};