From 172f8a8021fac779eddd2181b0d308065aaa5726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 24 Nov 2016 11:46:49 -0300 Subject: [PATCH] little fixes --- src/js/controllers/amount.js | 3 +- src/js/controllers/modals/customAmount.js | 79 -------------------- www/views/amount.html | 2 +- www/views/modals/customAmount.html | 88 ----------------------- 4 files changed, 2 insertions(+), 170 deletions(-) delete mode 100644 src/js/controllers/modals/customAmount.js delete mode 100644 www/views/modals/customAmount.html diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 32729e054..73c53515d 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -26,8 +26,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.customAmount = data.stateParams.customAmount; - $scope.title = $scope.customAmount ? gettextCatalog.getString('Request Specific Amount') : gettextCatalog.getString('Enter Amount'); - if (!$scope.cardId && !data.stateParams.toAddress && !data.stateParams.customAmount) { + if (!$scope.cardId && !data.stateParams.toAddress) { $log.error('Bad params at amount') throw ('bad params'); } diff --git a/src/js/controllers/modals/customAmount.js b/src/js/controllers/modals/customAmount.js deleted file mode 100644 index 38048a9c6..000000000 --- a/src/js/controllers/modals/customAmount.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('custommAmountController', function($scope, $timeout, $filter, platformInfo, rateService) { - var self = $scope.self; - - $scope.unitName = self.unitName; - $scope.alternativeAmount = self.alternativeAmount; - $scope.alternativeName = self.alternativeName; - $scope.alternativeIsoCode = self.alternativeIsoCode; - $scope.isRateAvailable = self.isRateAvailable; - $scope.unitToSatoshi = self.unitToSatoshi; - $scope.unitDecimals = self.unitDecimals; - var satToUnit = 1 / self.unitToSatoshi; - $scope.showAlternative = false; - $scope.isCordova = platformInfo.isCordova; - - Object.defineProperty($scope, - "_customAlternative", { - get: function() { - return $scope.customAlternative; - }, - set: function(newValue) { - $scope.customAlternative = newValue; - if (typeof(newValue) === 'number' && $scope.isRateAvailable) { - $scope.customAmount = parseFloat((rateService.fromFiat(newValue, $scope.alternativeIsoCode) * satToUnit).toFixed($scope.unitDecimals), 10); - } else { - $scope.customAmount = null; - } - }, - enumerable: true, - configurable: true - }); - - Object.defineProperty($scope, - "_customAmount", { - get: function() { - return $scope.customAmount; - }, - set: function(newValue) { - $scope.customAmount = newValue; - if (typeof(newValue) === 'number' && $scope.isRateAvailable) { - $scope.customAlternative = parseFloat((rateService.toFiat(newValue * $scope.unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2), 10); - } else { - $scope.customAlternative = null; - } - $scope.alternativeAmount = $scope.customAlternative; - }, - enumerable: true, - configurable: true - }); - - $scope.submitForm = function(form) { - var satToBtc = 1 / 100000000; - var amount = form.amount.$modelValue; - var amountSat = parseInt((amount * $scope.unitToSatoshi).toFixed(0)); - $timeout(function() { - $scope.customizedAmountUnit = amount + ' ' + $scope.unitName; - $scope.customizedAlternativeUnit = $filter('formatFiatAmount')(form.alternative.$modelValue) + ' ' + $scope.alternativeIsoCode; - if ($scope.unitName == 'bits') { - amount = (amountSat * satToBtc).toFixed(8); - } - $scope.customizedAmountBtc = amount; - }, 1); - }; - - $scope.toggleAlternative = function() { - $scope.showAlternative = !$scope.showAlternative; - }; - - $scope.shareAddress = function(uri) { - if (platformInfo.isCordova) { - window.plugins.socialsharing.share(uri, null, null, null); - } - }; - - $scope.cancel = function() { - $scope.customAmountModal.hide(); - }; -}); diff --git a/www/views/amount.html b/www/views/amount.html index cbfaf49ae..d18346423 100644 --- a/www/views/amount.html +++ b/www/views/amount.html @@ -1,7 +1,7 @@ - {{title}} + {{'Enter Amount'}} diff --git a/www/views/modals/customAmount.html b/www/views/modals/customAmount.html deleted file mode 100644 index 2f33a3158..000000000 --- a/www/views/modals/customAmount.html +++ /dev/null @@ -1,88 +0,0 @@ - - - -

Request a specific amount

-
- - -
-
-

QR Code

-
    -
  • - -
    - - - Share address - -
    -
  • -
- -

Details

-
    -
  • - Address: - - {{addr}} - -
  • -
  • - Amount: - - {{customizedAmountUnit}} - {{customizedAlternativeUnit}} - -
  • -
-
- -
-
-
-
- - - Not valid - - - - -
-
- -
- - - {{unitName}} -
-
-
- - -
- - -
-
-
-
-
-