diff --git a/src/js/controllers/addresses.js b/src/js/controllers/addresses.js index d5289295d..fb8ba5dc0 100644 --- a/src/js/controllers/addresses.js +++ b/src/js/controllers/addresses.js @@ -1,9 +1,8 @@ 'use strict'; -angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicHistory, $ionicPopover, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, platformInfo) { +angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, platformInfo) { var UNUSED_ADDRESS_LIMIT = 5; var BALANCE_ADDRESS_LIMIT = 5; - var MENU_ITEM_HEIGHT = 55; var config; var unitName; var unitToSatoshi; @@ -121,36 +120,13 @@ angular.module('copayApp.controllers').controller('addressesController', functio }, 10); }; - $scope.showMenu = function(allAddresses, $event) { - var scanObj = { - text: gettextCatalog.getString('Scan addresses for funds'), - action: scan, - }; - - var sendAddressesObj = { - text: gettextCatalog.getString('Send addresses by email'), - action: sendByEmail, - } - - $scope.items = allAddresses ? [sendAddressesObj] : [scanObj]; - $scope.height = $scope.items.length * MENU_ITEM_HEIGHT; - - $ionicPopover.fromTemplateUrl('views/includes/menu-popover.html', { - scope: $scope - }).then(function(popover) { - $scope.menu = popover; - $scope.menu.show($event); - }); - }; - - var scan = function() { + $scope.scan = function() { walletService.startScan($scope.wallet); - $scope.menu.hide(); $ionicHistory.clearHistory(); $state.go('tabs.home'); }; - var sendByEmail = function() { + $scope.sendByEmail = function() { function formatDate(ts) { var dateObj = new Date(ts * 1000); if (!dateObj) { diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 7f642f3b2..dd2f7ae6b 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -1,13 +1,12 @@ 'use strict'; -angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, $ionicPopover, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService, glideraService) { +angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService, glideraService) { var unitToSatoshi; var satToUnit; var unitDecimals; var satToBtc; var SMALL_FONT_SIZE_LIMIT = 10; var LENGTH_EXPRESSION_LIMIT = 19; - var MENU_ITEM_HEIGHT = 55; $scope.$on('$ionicView.leave', function() { angular.element($window).off('keydown'); @@ -29,6 +28,7 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.toEmail = data.stateParams.toEmail; $scope.showAlternativeAmount = !!$scope.cardId || !!$scope.isGiftCard || !!$scope.isGlidera; $scope.toColor = data.stateParams.toColor; + $scope.showSendMax = false; $scope.customAmount = data.stateParams.customAmount; @@ -93,25 +93,11 @@ angular.module('copayApp.controllers').controller('amountController', function($ }, 10); }); - $scope.showSendMaxMenu = function($event) { - var sendMaxObj = { - text: gettextCatalog.getString('Send max amount'), - action: setSendMax, - }; - - $scope.items = [sendMaxObj]; - $scope.height = $scope.items.length * MENU_ITEM_HEIGHT; - - $ionicPopover.fromTemplateUrl('views/includes/menu-popover.html', { - scope: $scope - }).then(function(popover) { - $scope.menu = popover; - $scope.menu.show($event); - }); + $scope.showSendMaxMenu = function() { + $scope.showSendMax = true; }; - function setSendMax() { - $scope.menu.hide(); + $scope.sendMax = function() { $state.transitionTo('tabs.send.confirm', { isWallet: $scope.isWallet, toAmount: null, @@ -205,11 +191,11 @@ angular.module('copayApp.controllers').controller('amountController', function($ }; function fromFiat(val) { - return parseFloat((rateService.fromFiat(val, $scope.alternativeIsoCode) * satToUnit).toFixed(unitDecimals), 10); + return parseFloat((rateService.fromFiat(val, $scope.alternativeIsoCode) * satToUnit).toFixed(unitDecimals)); }; function toFiat(val) { - return parseFloat((rateService.toFiat(val * unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2), 10); + return parseFloat((rateService.toFiat(val * unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2)); }; function evaluate(val) { diff --git a/src/js/directives/sendMax.js b/src/js/directives/sendMax.js new file mode 100644 index 000000000..26e5b4832 --- /dev/null +++ b/src/js/directives/sendMax.js @@ -0,0 +1,25 @@ +'use strict'; + +angular.module('copayApp.directives') + .directive('sendMax', function($timeout) { + return { + restrict: 'E', + templateUrl: 'views/includes/sendMax.html', + transclude: true, + scope: { + show: '=sendMaxShow', + onSelect: '=sendMaxOnSelect' + }, + link: function(scope, element, attrs) { + scope.hide = function() { + scope.show = false; + }; + scope.sendMax = function() { + $timeout(function() { + scope.hide(); + }, 100); + scope.onSelect(); + }; + } + }; + }); diff --git a/src/sass/views/includes/send-max.scss b/src/sass/views/includes/send-max.scss new file mode 100644 index 000000000..86213ceb8 --- /dev/null +++ b/src/sass/views/includes/send-max.scss @@ -0,0 +1,61 @@ +send-max-selector { + + $border-color: #EFEFEF; + + .bp-action-sheet__sheet { + padding-left: 2rem; + padding-right: .75rem; + } + + .send-max-selector { + .option { + border: 0; + padding-right: 0; + padding-top: 0; + padding-left: 65px; + padding-bottom: 0; + margin-bottom: 1px; + overflow: visible; + + > i { + padding: 0; + margin-left: -5px; + + > img { + height: 39px; + width: 39px; + padding: 4px; + } + } + } + .send-max-inner { + display: flex; + position: relative; + padding-top: 16px; + padding-bottom: 16px; + + &::after { + display: block; + position: absolute; + width: 100%; + height: 1px; + background: $border-color; + bottom: 0; + right: 0; + content: ''; + } + + .check { + padding: 0 1.2rem; + } + } + .send-max-details { + flex-grow: 1; + + .send-max-name { + padding-bottom: 5px; + } + } + } + +} diff --git a/www/views/addresses.html b/www/views/addresses.html index 30c4a2371..07596d3fa 100644 --- a/www/views/addresses.html +++ b/www/views/addresses.html @@ -3,11 +3,6 @@ {{'Wallet Addresses' | translate}} - - - @@ -31,7 +26,7 @@
-
+
Request Specific amount
@@ -39,6 +34,9 @@ View All Addresses
+
+ Scan addresses for funds +
Unused Addresses diff --git a/www/views/allAddresses.html b/www/views/allAddresses.html index 8ece9164d..8f7a1f345 100644 --- a/www/views/allAddresses.html +++ b/www/views/allAddresses.html @@ -3,17 +3,20 @@ {{'All Addresses' | translate}} - - -
+
+
+ Send addresses by email +
+ +
+
+
{{a.address}}
diff --git a/www/views/amount.html b/www/views/amount.html index 0af2b12e5..e6b3bd887 100644 --- a/www/views/amount.html +++ b/www/views/amount.html @@ -6,7 +6,7 @@ - @@ -120,4 +120,8 @@
+ + diff --git a/www/views/includes/menu-popover.html b/www/views/includes/menu-popover.html deleted file mode 100644 index f5acfe6ab..000000000 --- a/www/views/includes/menu-popover.html +++ /dev/null @@ -1,9 +0,0 @@ - - -
-
- {{i.text}} -
-
-
-
diff --git a/www/views/includes/sendMax.html b/www/views/includes/sendMax.html new file mode 100644 index 000000000..5f23b4f3d --- /dev/null +++ b/www/views/includes/sendMax.html @@ -0,0 +1,14 @@ + + + + +
+
+
Send max amount
+
+ + + +
+
+