Merge pull request #176 from cmgustavo/ref/design-48

Fix amazon
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-23 13:13:51 -03:00 committed by GitHub
commit 279b1c274f
4 changed files with 14 additions and 10 deletions

View File

@ -42,7 +42,7 @@
ng-attr-placeholder="{{'Amount in USD'}}"
min="0.01"
max="500"
ng-model="fiat"
ng-model="formData.fiat"
ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/"
step="0.01"
autocomplete="off" ignore-mouse-wheel required>
@ -53,7 +53,7 @@
<wallets ng-if="wallets[0]" wallets="wallets"></wallets>
<button class="button button-block button-positive"
ng-disabled="!fiat"
ng-disabled="!formData.fiat"
type="submit">
Buy now
</button>

View File

@ -3,12 +3,13 @@
angular.module('copayApp.controllers').controller('amazonController',
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, externalLinkService, popupService) {
$scope.network = amazonService.getEnvironment();
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
};
var initAmazon = function() {
$scope.network = amazonService.getEnvironment();
amazonService.getPendingGiftCards(function(err, gcds) {
if (err) {
popupService.showAlert(err);
@ -82,7 +83,7 @@ angular.module('copayApp.controllers').controller('amazonController',
});
};
$scope.$on("$ionicView.enter", function(event, data){
$scope.$on("$ionicView.beforeEnter", function(event, data){
initAmazon();
});
});

View File

@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, externalLinkService, popupService) {
var self = this;
var network = amazonService.getEnvironment();
var wallet;
$scope.$on('Wallet/Changed', function(event, w) {
@ -20,7 +21,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
};
this.confirm = function() {
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {amount: $scope.fiat});
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {amount: $scope.formData.fiat});
var ok = gettextCatalog.getString('Buy');
popupService.showConfirm(null, message, ok, null, function(res) {
if (res) self.createTx();
@ -40,7 +41,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
var dataSrc = {
currency: 'USD',
amount: $scope.fiat,
amount: $scope.formData.fiat,
uuid: wallet.id
};
var outputs = [];
@ -209,7 +210,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
};
$scope.$on("$ionicView.enter", function(event, data){
var network = amazonService.getEnvironment();
$scope.formData = { fiat: null };
$scope.wallets = profileService.getWallets({
network: network,
onlyComplete: true

View File

@ -3,11 +3,14 @@
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout, $state, $ionicHistory, $log, addressbookService) {
if ($scope.cb) $timeout($scope.cb, 100);
$scope.fromSendTab = $ionicHistory.viewHistory().backView.stateName === "tabs.send.amount";
$scope.cancel = function() {
$ionicHistory.removeBackView();
$state.go('tabs.home');
$scope.txStatusModal.hide();
if ($scope.fromSendTab) {
$ionicHistory.removeBackView();
$state.go('tabs.home');
}
};
$scope.save = function(addressbookEntry) {
@ -23,7 +26,6 @@ angular.module('copayApp.controllers').controller('txStatusController', function
});
}
$scope.fromSendTab = $ionicHistory.viewHistory().backView.stateName === "tabs.send.amount";
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
if (ab[$scope.tx.toAddress]) {