finished refactor
This commit is contained in:
parent
098ed70765
commit
324dfbc36a
3 changed files with 15 additions and 3 deletions
|
|
@ -168,7 +168,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
qrcode.imagedata = context.getImageData(0, 0, qrcode.width, qrcode.height);
|
||||
|
||||
try {
|
||||
//alert(JSON.stringify(qrcode.process(context)));
|
||||
qrcode.decode();
|
||||
} catch (e) {
|
||||
// error decoding QR
|
||||
|
|
@ -403,6 +402,19 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
$scope.onChanged = function() {
|
||||
var scope = $scope;
|
||||
var value = scope.address;
|
||||
var uri;
|
||||
|
||||
if (/^https?:\/\//.test(value)) {
|
||||
uri = {
|
||||
merchant: value
|
||||
};
|
||||
} else {
|
||||
uri = copay.HDPath.parseBitcoinURI(value);
|
||||
}
|
||||
if (!uri || !uri.merchant) {
|
||||
return;
|
||||
}
|
||||
notification.info('Fetching Payment',
|
||||
'Retrieving Payment Request from ' + uri.merchant);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ angular.module('copayApp.directives')
|
|||
|
||||
|
||||
ctrl.$setValidity('validAddress', true);
|
||||
return 'Merchant: ' + uri.merchant;
|
||||
return uri.merchant;
|
||||
};
|
||||
|
||||
ctrl.$parsers.unshift(validator);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
</label>
|
||||
<div class="small-10 columns">
|
||||
<input type="text" id="address" name="address" ng-disabled="loading"
|
||||
placeholder="Send to" ng-model="address" ngChange="onChanged()" valid-address required>
|
||||
placeholder="Send to" ng-model="address" ng-change="onChanged()" valid-address required>
|
||||
<small class="icon-input" ng-show="!sendForm.address.$invalid && address"><i class="fi-check"></i></small>
|
||||
<small class="icon-input" ng-show="sendForm.address.$invalid && address"><i class="fi-x"></i></small>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue