Adds qrcode scanner and uses a copy-pasted address
This commit is contained in:
parent
5c42f54e96
commit
b2d933527f
3 changed files with 38 additions and 11 deletions
|
|
@ -1,13 +1,13 @@
|
|||
<div ng-init="wallets[0] ? selectedWalletsOpt = true : selectedWalletsOpts = false">
|
||||
<nav class="tab-bar">
|
||||
<section class="left-small">
|
||||
<a ng-show="!editAddressbook" ng-click="cancel()" class="p10">
|
||||
<a ng-show="!editAddressbook && !addAddressbookEntry" ng-click="cancel()" class="p10">
|
||||
<span class="text-close" translate>Close</span>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<section class="middle tab-bar-section">
|
||||
<ul class="button-group round even-2" ng-show="!editAddressbook && wallets[0]">
|
||||
<ul class="button-group round even-2" ng-show="!editAddressbook && wallets[0] && !addAddressbookEntry">
|
||||
<li ng-class="{'selected':selectedWalletsOpt}" ng-click="selectedWalletsOpt = true"
|
||||
translate>
|
||||
Wallets
|
||||
|
|
@ -16,18 +16,21 @@
|
|||
Addressbook
|
||||
</li>
|
||||
</ul>
|
||||
<h1 ng-show="editAddressbook || !wallets[0]" class="title ellipsis" ng-style="{'color':color}" translate>
|
||||
<h1 ng-show="(editAddressbook || !wallets[0]) && !addAddressbookEntry" class="title ellipsis" ng-style="{'color':color}" translate>
|
||||
Addressbook
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
<section class="right-small" ng-show="!selectedWalletsOpt" ng-click="toggleEditAddressbook()">
|
||||
<a ng-show="!editAddressbook" href class="p10">
|
||||
<a ng-show="!editAddressbook && !addAddressbookEntry" href class="p10">
|
||||
<span class="text-close" translate>Edit</span>
|
||||
</a>
|
||||
<a ng-show="editAddressbook && !addAddressbookEntry" href class="p10">
|
||||
<span class="text-close" translate>Done</span>
|
||||
</a>
|
||||
<qr-scanner ng-show="addAddressbookEntry"
|
||||
on-scan="onQrCodeScanned(data, addressbookForm)"
|
||||
before-scan="beforeQrCodeScann()"></qr-scanner>
|
||||
</section>
|
||||
</nav>
|
||||
|
||||
|
|
@ -81,12 +84,13 @@
|
|||
<li class="m10t" ng-show="!editAddressbook">
|
||||
<a ng-click="toggleAddAddressbookEntry()" class="p10">
|
||||
<i class="fi-plus size-18 m10r"></i>
|
||||
<span class="text-close size-12" translate>Add a new entry</span>
|
||||
<span class="text-close size-12" translate>Add a new entry</span>
|
||||
<span ng-show="!list[newAddress]">({{newAddress}})</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div ng-if="addAddressbookEntry" ng-init="addressbook.address = ''; addressbook.label = ''">
|
||||
<div ng-show="addAddressbookEntry">
|
||||
<h4 class="title m0" translate>Add a new entry</h4>
|
||||
<form name="addressbookForm" class="p10" no-validate>
|
||||
<div class="text-warning size-12 m10b" ng-show="error">{{error|translate}}</div>
|
||||
|
|
@ -107,7 +111,7 @@
|
|||
<div class="columns large-6 medium-6 small-6">
|
||||
<input type="button"
|
||||
class="button expand round"
|
||||
ng-click="toggleAddAddressbookEntry()"
|
||||
ng-click="newAddress = ''; toggleAddAddressbookEntry()"
|
||||
value="{{'Cancel'|translate}}">
|
||||
</div>
|
||||
<div class="columns large-6 medium-6 small-6">
|
||||
|
|
@ -116,7 +120,7 @@
|
|||
value="{{'Save'|translate}}"
|
||||
ng-disabled="!addressbookForm.$valid"
|
||||
ng-style="{'background-color':color}"
|
||||
ng-click="add(addressbook)">
|
||||
ng-click="newAddress = ''; add(addressbook)">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -322,7 +322,8 @@
|
|||
<div class="input">
|
||||
<input ng-show="sendForm.address.$invalid" class="m0" type="text" id="address" name="address" ng-disabled="home.blockUx || home.lockAddress" ng-attr-placeholder="{{'Bitcoin address'|translate}}" ng-model="_address" valid-address required ng-focus="home.formFocus('address')" ng-blur="home.formFocus(false)">
|
||||
<contact class="addressbook-input" ng-if="!sendForm.address.$invalid && _address" address="{{_address}}"></contact>
|
||||
<a class="postfix size-12 m0 text-gray" ng-click="openDestinationAddressModal(index.otherWallets)">
|
||||
<a class="postfix size-12 m0 text-gray"
|
||||
ng-click="openDestinationAddressModal(index.otherWallets, _address)">
|
||||
<i class="icon-wallet size-18"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
});
|
||||
};
|
||||
|
||||
$scope.openDestinationAddressModal = function(wallets, address, label) {
|
||||
$scope.openDestinationAddressModal = function(wallets, address) {
|
||||
$rootScope.modalOpened = true;
|
||||
var fc = profileService.focusedClient;
|
||||
self.resetForm();
|
||||
|
|
@ -146,9 +146,29 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.editAddressbook = false;
|
||||
$scope.addAddressbookEntry = false;
|
||||
$scope.selectedAddressbook = {};
|
||||
$scope.addressbook = { 'address' : address, 'label' : label};
|
||||
$scope.newAddress = address;
|
||||
$scope.addressbook = { 'address' : ($scope.newAddress || '') , 'label' : ''};
|
||||
$scope.color = fc.backgroundColor;
|
||||
|
||||
$scope.beforeQrCodeScann = function() {
|
||||
$scope.error = null;
|
||||
$scope.addAddressbookEntry = true;
|
||||
$scope.editAddressbook = false;
|
||||
};
|
||||
|
||||
$scope.onQrCodeScanned = function(data, addressbookForm) {
|
||||
$timeout(function() {
|
||||
var form = addressbookForm;
|
||||
if (data && form) {
|
||||
data = data.replace('bitcoin:', '');
|
||||
form.address.$setViewValue(data);
|
||||
form.address.$isValid = true;
|
||||
form.address.$render();
|
||||
}
|
||||
$scope.$digest();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.selectAddressbook = function(addr) {
|
||||
$modalInstance.close(addr);
|
||||
};
|
||||
|
|
@ -164,6 +184,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
};
|
||||
|
||||
$scope.toggleAddAddressbookEntry = function() {
|
||||
$scope.error = null;
|
||||
$scope.addressbook = { 'address' : ($scope.newAddress || '') , 'label' : ''};
|
||||
$scope.addAddressbookEntry = !$scope.addAddressbookEntry;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue