diff --git a/src/js/controllers/tab-send-v2.js b/src/js/controllers/tab-send-v2.js deleted file mode 100644 index 5c75957c4..000000000 --- a/src/js/controllers/tab-send-v2.js +++ /dev/null @@ -1,311 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('tabSendV2Controller', function($scope, $rootScope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, platformInfo, bwcError, gettextCatalog, scannerService, configService, bitcoinCashJsService, $ionicNavBarDelegate, clipboardService) { - var clipboardHasAddress = false; - var clipboardHasContent = false; - - $scope.addContact = function() { - $state.go('tabs.settings').then(function() { - $state.go('tabs.addressbook').then(function() { - $state.go('tabs.addressbook.add'); - }); - }); - }; - - $scope.pasteClipboard = function() { - if ($scope.clipboardHasAddress || $scope.clipboardHasContent) { - clipboardService.readFromClipboard(function(text) { - $scope.formData.search = text; - $scope.findContact($scope.formData.search); - }); - } - }; - - $scope.$on("$ionicView.enter", function(event, data) { - clipboardService.readFromClipboard(function(text) { - if (text.length > 200) { - text = text.substring(0, 200); - } - - $scope.clipboardHasAddress = false; - $scope.clipboardHasContent = false; - if ((text.indexOf('bitcoincash:') === 0 || text[0] === 'C' || text[0] === 'H' || text[0] === 'p' || text[0] === 'q') && text.replace('bitcoincash:', '').length === 42) { // CashAddr - $scope.clipboardHasAddress = true; - } else if ((text[0] === "1" || text[0] === "3" || text.substring(0, 3) === "bc1") && text.length >= 26 && text.length <= 35) { // Legacy Addresses - $scope.clipboardHasAddress = true; - } else if (text.length > 1) { - $scope.clipboardHasContent = true; - } - }); - - $ionicNavBarDelegate.showBar(true); - if (!$scope.hasWallets) { - $scope.checkingBalance = false; - return; - } - updateHasFunds(); - updateWalletsList(); - updateContactsList(function() { - updateList(); - }); - }); - - - - - - - - - - - - - - - - - var originalList; - var CONTACTS_SHOW_LIMIT; - var currentContactsPage; - - $scope.sectionDisplay = { - transferToWallet: false - }; - - var hasWallets = function() { - $scope.wallets = profileService.getWallets({ - onlyComplete: true - }); - $scope.hasWallets = lodash.isEmpty($scope.wallets) ? false : true; - }; - - // THIS is ONLY to show the 'buy bitcoins' message - // does not has any other function. - - var updateHasFunds = function() { - - if ($rootScope.everHasFunds) { - $scope.hasFunds = true; - return; - } - - $scope.hasFunds = false; - var index = 0; - lodash.each($scope.wallets, function(w) { - walletService.getStatus(w, {}, function(err, status) { - - ++index; - if (err && !status) { - $log.error(err); - // error updating the wallet. Probably a network error, do not show - // the 'buy bitcoins' message. - - $scope.hasFunds = true; - } else if (status.availableBalanceSat > 0) { - $scope.hasFunds = true; - $rootScope.everHasFunds = true; - } - - if (index == $scope.wallets.length) { - $scope.checkingBalance = false; - $timeout(function() { - $scope.$apply(); - }); - } - }); - }); - }; - - var updateWalletsList = function() { - var config = configService.getSync(); - var networkResult = lodash.countBy($scope.wallets, 'network'); - - $scope.showTransferCard = $scope.hasWallets && (networkResult.livenet > 1 || networkResult.testnet > 1); - - if ($scope.showTransferCard) { - var walletsToTransfer = $scope.wallets; - if (!(networkResult.livenet > 1)) { - walletsToTransfer = lodash.filter(walletsToTransfer, function(item) { - return item.network == 'testnet'; - }); - } - if (!(networkResult.testnet > 1)) { - walletsToTransfer = lodash.filter(walletsToTransfer, function(item) { - return item.network == 'livenet'; - }); - } - - var walletList = []; - lodash.each(walletsToTransfer, function(v) { - var displayBalanceAsFiat = - // BD got v.status as undefined here once during development, just - // after creating a new wallet. - v.status && - v.status.alternativeBalanceAvailable && - config.wallet.settings.priceDisplay === 'fiat'; - - walletList.push({ - color: v.color, - name: v.name, - recipientType: 'wallet', - coin: v.coin, - network: v.network, - balanceString: displayBalanceAsFiat ? - v.status.totalBalanceAlternative + ' ' + v.status.alternativeIsoCode : - v.cachedBalance, - getAddress: function(cb) { - walletService.getAddress(v, false, cb); - }, - }); - }); - originalList = originalList.concat(walletList); - } - } - - var updateContactsList = function(cb) { - var config = configService.getSync(); - var defaults = configService.getDefaults(); - addressbookService.list(function(err, ab) { - if (err) $log.error(err); - - $scope.hasContacts = lodash.isEmpty(ab) ? false : true; - if (!$scope.hasContacts) return cb(); - - var completeContacts = []; - lodash.each(ab, function(v, k) { - completeContacts.push({ - name: lodash.isObject(v) ? v.name : v, - address: k, - email: lodash.isObject(v) ? v.email : null, - recipientType: 'contact', - coin: v.coin, - displayCoin: (v.coin == 'bch' - ? (config.bitcoinCashAlias || defaults.bitcoinCashAlias) - : (config.bitcoinAlias || defaults.bitcoinAlias)).toUpperCase(), - getAddress: function(cb) { - return cb(null, k); - }, - }); - }); - var contacts = completeContacts.slice(0, (currentContactsPage + 1) * CONTACTS_SHOW_LIMIT); - $scope.contactsShowMore = completeContacts.length > contacts.length; - originalList = originalList.concat(contacts); - return cb(); - }); - }; - - var updateList = function() { - $scope.list = lodash.clone(originalList); - $timeout(function() { - $ionicScrollDelegate.resize(); - $scope.$apply(); - }, 10); - }; - - $scope.openScanner = function() { - var isWindowsPhoneApp = platformInfo.isCordova && platformInfo.isWP; - - if (!isWindowsPhoneApp) { - $state.go('tabs.scan'); - return; - } - - scannerService.useOldScanner(function(err, contents) { - if (err) { - popupService.showAlert(gettextCatalog.getString('Error'), err); - return; - } - incomingData.redir(contents); - }); - }; - - $scope.showMore = function() { - currentContactsPage++; - updateWalletsList(); - }; - - $scope.searchInFocus = function() { - $scope.searchFocus = true; - }; - - $scope.searchBlurred = function() { - if ($scope.formData.search == null || $scope.formData.search.length == 0) { - $scope.searchFocus = false; - } - }; - - $scope.findContact = function(search) { - - if (incomingData.redir(search)) { - return; - } - - if (!search || search.length < 2) { - $scope.list = originalList; - $timeout(function() { - $scope.$apply(); - }); - return; - } - - var result = lodash.filter(originalList, function(item) { - var val = item.name; - return lodash.includes(val.toLowerCase(), search.toLowerCase()); - }); - - $scope.list = result; - }; - - $scope.goToAmount = function(item) { - $timeout(function() { - item.getAddress(function(err, addr) { - if (err || !addr) { - //Error is already formated - return popupService.showAlert(err); - } - - if (item.recipientType && item.recipientType == 'contact') { - if (addr.indexOf('bch') == 0 || addr.indexOf('btc') == 0) { - addr = addr.substring(3); - } - } - - $log.debug('Got toAddress:' + addr + ' | ' + item.name); - return $state.transitionTo('tabs.send.amount', { - recipientType: item.recipientType, - displayAddress: item.coin == 'bch' ? bitcoinCashJsService.translateAddresses(addr).cashaddr : addr, - toAddress: addr, - toName: item.name, - toEmail: item.email, - toColor: item.color, - coin: item.coin - }); - }); - }); - }; - - // This could probably be enhanced refactoring the routes abstract states - $scope.createWallet = function() { - $state.go('tabs.home').then(function() { - $state.go('tabs.add.create-personal'); - }); - }; - - $scope.buyBitcoin = function() { - $state.go('tabs.home').then(function() { - $state.go('tabs.buyandsell'); - }); - }; - - $scope.$on("$ionicView.beforeEnter", function(event, data) { - $scope.checkingBalance = true; - $scope.formData = { - search: null - }; - originalList = []; - CONTACTS_SHOW_LIMIT = 10; - currentContactsPage = 0; - hasWallets(); - }); -}); diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 2282ab878..5c75957c4 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -1,11 +1,74 @@ 'use strict'; -angular.module('copayApp.controllers').controller('tabSendController', function($scope, $rootScope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, platformInfo, bwcError, gettextCatalog, scannerService, configService, bitcoinCashJsService, $ionicNavBarDelegate) { +angular.module('copayApp.controllers').controller('tabSendV2Controller', function($scope, $rootScope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, platformInfo, bwcError, gettextCatalog, scannerService, configService, bitcoinCashJsService, $ionicNavBarDelegate, clipboardService) { + var clipboardHasAddress = false; + var clipboardHasContent = false; + + $scope.addContact = function() { + $state.go('tabs.settings').then(function() { + $state.go('tabs.addressbook').then(function() { + $state.go('tabs.addressbook.add'); + }); + }); + }; + + $scope.pasteClipboard = function() { + if ($scope.clipboardHasAddress || $scope.clipboardHasContent) { + clipboardService.readFromClipboard(function(text) { + $scope.formData.search = text; + $scope.findContact($scope.formData.search); + }); + } + }; + + $scope.$on("$ionicView.enter", function(event, data) { + clipboardService.readFromClipboard(function(text) { + if (text.length > 200) { + text = text.substring(0, 200); + } + + $scope.clipboardHasAddress = false; + $scope.clipboardHasContent = false; + if ((text.indexOf('bitcoincash:') === 0 || text[0] === 'C' || text[0] === 'H' || text[0] === 'p' || text[0] === 'q') && text.replace('bitcoincash:', '').length === 42) { // CashAddr + $scope.clipboardHasAddress = true; + } else if ((text[0] === "1" || text[0] === "3" || text.substring(0, 3) === "bc1") && text.length >= 26 && text.length <= 35) { // Legacy Addresses + $scope.clipboardHasAddress = true; + } else if (text.length > 1) { + $scope.clipboardHasContent = true; + } + }); + + $ionicNavBarDelegate.showBar(true); + if (!$scope.hasWallets) { + $scope.checkingBalance = false; + return; + } + updateHasFunds(); + updateWalletsList(); + updateContactsList(function() { + updateList(); + }); + }); + + + + + + + + + + + + + + + var originalList; var CONTACTS_SHOW_LIMIT; var currentContactsPage; - $scope.isChromeApp = platformInfo.isChromeApp; + $scope.sectionDisplay = { transferToWallet: false }; @@ -245,25 +308,4 @@ angular.module('copayApp.controllers').controller('tabSendController', function( currentContactsPage = 0; hasWallets(); }); - - $scope.$on("$ionicView.enter", function(event, data) { - $ionicNavBarDelegate.showBar(true); - if (!$scope.hasWallets) { - $scope.checkingBalance = false; - return; - } - updateHasFunds(); - updateWalletsList(); - updateContactsList(function() { - updateList(); - }); - }); - - $scope.toggle = function(section) { - $scope.sectionDisplay[section] = !$scope.sectionDisplay[section]; - $timeout(function() { - $ionicScrollDelegate.resize(); - $scope.$apply(); - }, 10); - }; }); diff --git a/src/sass/views/tab-send-v2.scss b/src/sass/views/tab-send-v2.scss deleted file mode 100644 index 630828ae0..000000000 --- a/src/sass/views/tab-send-v2.scss +++ /dev/null @@ -1,236 +0,0 @@ -#tab-send2 { - @extend .deflash-blue; - .input { - width: 100%; - input { - width: 100%; - height: 57px; - background: #FFF; - border: 1px #D9D9D9 solid; - &::placeholder { - color: #DCDCDC; - } - } - i { - &.left { - padding-left: 15px; - } - &.qr { - cursor: pointer; - cursor: hand; - padding-right: 5px; - } - } - } - - .send-wrapper { - &:after { - display: block; - position: relative; - height: 1px; - background: #DEDEDE; - bottom: 0; - content: ''; - margin: 20px 6px 0px; - } - margin: 18px 0 0; - padding: 9px; - background-color: #f2f2f2; - border-radius: 3px; - border: none; - &.focus { - .search-input { - padding-left: 30px; - &:focus::-webkit-input-placeholder { - opacity: 0; - } - } - } - .buttons { - margin: auto; - margin-top: 18px; - .button { - &-clipboard-paste { - margin-left: 0; - .address { - display: none; - } - .icon { - background: url(../img/icon-clipboard-paste.svg); - width: 15px; - height: 19px; - display: inline-block; - margin-bottom: 4px; - } - &.contains-address, &.contains-content { - .address { - display: none; - } - background: #FAB915; - color: #FFF !important; - border: 0; - @include button-shadow(); - .icon { - background: url(../img/icon-clipboard-paste-white.svg); - } - &.contains-address { - .address { - display: inline; - } - .non-address { - display: none; - } - } - } - } - span { - font-size: 14px; - } - img { - height: 16px; - width: auto; - margin: 2px 0 4px; - } - height: 60px; - line-height: 16px; - margin-right: 0px; - width: 95%; - max-width: none; - padding: 2px; - &-qr { - font-weight: bold; - max-width: none; - width: 100%; - height: 95px; - margin-top: 20px; - img { - vertical-align: middle; - margin-right: 12px; - width: 43px; - height: 43px; - } - span { - font-size: 19px; - } - } - } - } - } - .search-input { - background-color: transparent; - padding-left: 30px; - } - .sendTip { - padding-top: 5vh; - text-align: center; - .item { - border-style: none; - } - & > .title { - font-size: 20px; - color: $v-dark-gray; - margin: 20px 10px; - } - & > .subtitle { - font-size: 1rem; - line-height: 1.5em; - font-weight: 300; - color: #6F6F70; - margin: 20px 1em 2.5em; - } - .big-icon-svg { - .bg.green { - padding: 0 10px; - box-shadow: none; - } - } - .buttons { - margin-top: 18px; - .button { - font-weight: bold; - font-size: 19px; - } - } - .button-first-contact img { - height: 19px; - width: 19px; - margin-right: 6px; - vertical-align: sub; - } - } - .item-heading { - line-height: 16px; - font-size: 14px; - font-weight: bold; - .subtitle { - color: #B5B2B2; - font-size: 12px; - font-weight: 300; - } - } - .list { - .item { - font-weight: 600; - padding-top: 12px; - padding-bottom: 12px; - p { - font-weight: normal; - } - &.item-icon-left { - padding-left: 64px; - } - color: #444; - //border-top: none; - padding-top: 1.5rem; - padding-bottom: 1.5rem; - .big-icon-svg { - left: 5px; - & > .bg { - width: 30px; - height: 30px; - box-shadow: none; - } - } - &:before { - display: block; - position: absolute; - width: 100%; - height: 1px; - background: rgba(221, 221, 221, 0.3); - top: 0; - right: 0; - content: ''; - } - &.item-divider { - color: rgba(74, 74, 74, .8); - } - &.item-heading { - &:before { - top: 99%; - width: 100%; - } - } - &:nth-child(2) { - &:before { - width: 0; - } - } - .item-note { - color: rgb(58, 58, 58); - } - } - } - .scroll { - height: 100%; - } - - .card.contacts { - margin: 4px; - border-radius: 6px; - box-shadow: 0px 2px 1px 0 #C1C1C1; - .gravatar { - border-radius: 30px; - } - } - -} diff --git a/src/sass/views/tab-send.scss b/src/sass/views/tab-send.scss index a969faedf..aabb76cda 100644 --- a/src/sass/views/tab-send.scss +++ b/src/sass/views/tab-send.scss @@ -1,12 +1,15 @@ #tab-send { @extend .deflash-blue; .input { + width: 100%; input { width: 100%; - height: auto; - } - &.item { - height: 55px; + height: 57px; + background: #FFF; + border: 1px #D9D9D9 solid; + &::placeholder { + color: #DCDCDC; + } } i { &.left { @@ -19,45 +22,23 @@ } } } - .qr-scan-icon { - cursor: pointer; - cursor: hand; - border-left: 1px solid rgb(228, 228, 228); - padding-left: 10px; - } - .qr-icon { - line-height: 20px; - } - .zero-state-cta { - padding-bottom: 3vh; - left: 0; - } - .send-heading { - font-size: 14px; - font-weight: bold; - padding: 0 0 16px 0; - border: none; - } - .send-header-wrapper { - padding: 10px; - background-color: white; - box-shadow: 0px 5px 10px 0px #cccccc; - } - .search-wrapper { + + .send-wrapper { + &:after { + display: block; + position: relative; + height: 1px; + background: #DEDEDE; + bottom: 0; + content: ''; + margin: 20px 6px 0px; + } + margin: 18px 0 0; + padding: 9px; background-color: #f2f2f2; border-radius: 3px; border: none; - .svg#Bitcoin_Symbol { - width: 14px; - .st0 { - fill: #cccccc; - } - } &.focus { - background: none; - .svg#Bitcoin_Symbol { - display: none; - } .search-input { padding-left: 30px; &:focus::-webkit-input-placeholder { @@ -65,57 +46,88 @@ } } } + .buttons { + margin: auto; + margin-top: 18px; + .button { + &-clipboard-paste { + margin-left: 0; + .address { + display: none; + } + .icon { + background: url(../img/icon-clipboard-paste.svg); + width: 15px; + height: 19px; + display: inline-block; + margin-bottom: 4px; + } + &.contains-address, &.contains-content { + .address { + display: none; + } + background: #FAB915; + color: #FFF !important; + border: 0; + @include button-shadow(); + .icon { + background: url(../img/icon-clipboard-paste-white.svg); + } + &.contains-address { + .address { + display: inline; + } + .non-address { + display: none; + } + } + } + } + span { + font-size: 14px; + } + img { + height: 16px; + width: auto; + margin: 2px 0 4px; + } + height: 60px; + line-height: 16px; + margin-right: 0px; + width: 95%; + max-width: none; + padding: 2px; + &-qr { + font-weight: bold; + max-width: none; + width: 100%; + height: 95px; + margin-top: 20px; + img { + vertical-align: middle; + margin-right: 12px; + width: 43px; + height: 43px; + } + span { + font-size: 19px; + } + } + } + } } - .abs-v-center { - position: absolute; - top: 50%; - transform: translateY(-50%); - } .search-input { background-color: transparent; padding-left: 30px; } - .separator-left { - border-left: 1px solid #d9d9df; - padding-left: 10px; - height: 70%; - } - .bitcoin-address { - border-top: none; - padding-bottom: .5rem; - @media(max-width: 480px) { - input { - font-size: 14px; - } - } - .icon { - line-height: 31px; - padding-top: 2px; - padding-bottom: 1px; - } - } - .show-more { - text-align: center; - padding: 20px; - font-size: 16px; - color: #387ef5; - font-weight: bold; - } .sendTip { + padding-top: 5vh; text-align: center; - & > .item-heading { - margin-top: 10px; - background: 0 none; - } - img { - content: $v-tab-send-selected-icon; - } .item { border-style: none; } & > .title { font-size: 20px; - font-weight: bold; color: $v-dark-gray; margin: 20px 10px; } @@ -123,34 +135,66 @@ font-size: 1rem; line-height: 1.5em; font-weight: 300; - color: $v-dark-gray; + color: #6F6F70; margin: 20px 1em 2.5em; } - .big-icon-svg{ - .bg.green{ + .big-icon-svg { + .bg.green { padding: 0 10px; box-shadow: none; } } + .buttons { + margin-top: 18px; + .button { + font-weight: bold; + font-size: 19px; + } + } + .button-first-contact img { + height: 19px; + width: 19px; + margin-right: 6px; + vertical-align: sub; + } + } + .item-heading { + line-height: 16px; + font-size: 14px; + font-weight: bold; + .subtitle { + color: #B5B2B2; + font-size: 12px; + font-weight: 300; + } } .list { .item { + font-weight: 600; + padding-top: 12px; + padding-bottom: 12px; + p { + font-weight: normal; + } + &.item-icon-left { + padding-left: 64px; + } color: #444; - border-top: none; + //border-top: none; padding-top: 1.5rem; padding-bottom: 1.5rem; .big-icon-svg { - left:5px; - & > .bg{ - width:30px; - height:30px; - box-shadow: none; - } + left: 5px; + & > .bg { + width: 30px; + height: 30px; + box-shadow: none; + } } &:before { display: block; position: absolute; - width: 80%; + width: 100%; height: 1px; background: rgba(221, 221, 221, 0.3); top: 0; @@ -163,7 +207,7 @@ &.item-heading { &:before { top: 99%; - width:100%; + width: 100%; } } &:nth-child(2) { @@ -176,5 +220,17 @@ } } } - .scroll{height: 100%;} + .scroll { + height: 100%; + } + + .card.contacts { + margin: 4px; + border-radius: 6px; + box-shadow: 0px 2px 1px 0 #C1C1C1; + .gravatar { + border-radius: 30px; + } + } + } diff --git a/www/views/tab-send-v2.html b/www/views/tab-send-v2.html deleted file mode 100644 index 510633a3a..000000000 --- a/www/views/tab-send-v2.html +++ /dev/null @@ -1,143 +0,0 @@ - - - {{'Send' | translate}} - - -
-
-
-
- -
-
-
-
-
- -
-
- -
-
-
- -
-
-
-
- -
-
-
- Send Bitcoin faster! -
-
-
-

Save frequently used addresses and send them Bitcoin in just one tap

-
- -
-
-
- -
-
-
- Your Bitcoin wallet is empty -
-
-
-

To get started, buy Bitcoin Cash (BCH) or Bitcoin Core (BTC), or share your address.

-

You can receive bitcoin from any wallet or service.

-
-
To get started, you'll need to create a bitcoin wallet and get some - bitcoin. -
-
- - - -
-
-
-
-
-
-
- -
-
Contacts
-
Saved frequently used addresses
- - - -
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/www/views/tab-send.html b/www/views/tab-send.html index 838c04299..a3a0b99d4 100644 --- a/www/views/tab-send.html +++ b/www/views/tab-send.html @@ -3,15 +3,57 @@ {{'Send' | translate}} -
-
-
Recipient
-
- -
- - +
+
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ Send Bitcoin faster! +
+
+
+

Save frequently used addresses and send them Bitcoin in just one tap

+
+
@@ -19,72 +61,83 @@
-
-
- - - -
- Start sending bitcoin + Your Bitcoin wallet is empty
- To get started, buy bitcoin or share your address. You can receive bitcoin from any wallet or service. - To get started, you'll need to create a bitcoin wallet and get some bitcoin. -
- - - +
+

To get started, buy Bitcoin Cash (BCH) or Bitcoin Core (BTC), or share your address.

+

You can receive bitcoin from any wallet or service.

+
+
To get started, you'll need to create a bitcoin wallet and get some + bitcoin. +
+
+ + + +
+
+
+
+
+
+
+ +
+
Contacts
+
Saved frequently used addresses
+ + + +
+
- - -
-
- Transfer to Wallet - - -
- -
+ + + + + + + + + + + + + + + + + + + + +