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 4baa76831..250d9eec5 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,12 @@ 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() { + $scope.showSendMax = false; $state.transitionTo('tabs.send.confirm', { isWallet: $scope.isWallet, toAmount: null, @@ -205,11 +192,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/itemSelector.js b/src/js/directives/itemSelector.js new file mode 100644 index 000000000..0d99c4c66 --- /dev/null +++ b/src/js/directives/itemSelector.js @@ -0,0 +1,25 @@ +'use strict'; + +angular.module('copayApp.directives') + .directive('itemSelector', function($timeout) { + return { + restrict: 'E', + templateUrl: 'views/includes/itemSelector.html', + transclude: true, + scope: { + show: '=itemSelectorShow', + onSelect: '=itemSelectorOnSelect' + }, + 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/itemSelector.scss b/src/sass/views/includes/itemSelector.scss new file mode 100644 index 000000000..e059907a4 --- /dev/null +++ b/src/sass/views/includes/itemSelector.scss @@ -0,0 +1,61 @@ +item-selector { + + $border-color: #EFEFEF; + + .bp-action-sheet__sheet { + padding-left: 2rem; + padding-right: .75rem; + } + + .item-selector { + .option { + border: 0; + padding-right: 0; + padding-top: 0; + padding-bottom: 0; + margin-bottom: 1px; + overflow: visible; + + > i { + color: #647ce8; + padding: 0 0 5px 0; + margin-left: -5px; + + > img { + height: 39px; + width: 39px; + padding: 4px; + } + } + } + .item-selector-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; + } + } + .item-selector-details { + flex-grow: 1; + + .item-selector-name { + padding-bottom: 5px; + } + } + } + +} diff --git a/src/sass/views/views.scss b/src/sass/views/views.scss index 8e241aba7..351a93298 100644 --- a/src/sass/views/views.scss +++ b/src/sass/views/views.scss @@ -39,6 +39,7 @@ @import "includes/tx-details"; @import "includes/txp-details"; @import "includes/tx-status"; +@import "includes/itemSelector"; @import "includes/walletSelector"; @import "integrations/coinbase"; @import "integrations/glidera"; diff --git a/www/views/addresses.html b/www/views/addresses.html index f12e3aba5..07596d3fa 100644 --- a/www/views/addresses.html +++ b/www/views/addresses.html @@ -3,11 +3,6 @@ {{'Wallet Addresses' | translate}} - - - @@ -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..d535cb079 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/itemSelector.html b/www/views/includes/itemSelector.html new file mode 100644 index 000000000..476814e33 --- /dev/null +++ b/www/views/includes/itemSelector.html @@ -0,0 +1,12 @@ + + +
{{title}}
+ + +
+
+
Send max amount
+
+
+
+
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}} -
-
-
-