Merge pull request #153 from gabrielbazan7/feat/addEntrySend
add addressbook entry when send success
This commit is contained in:
commit
912789ccb6
8 changed files with 123 additions and 35 deletions
|
|
@ -1,10 +1,16 @@
|
||||||
<ion-view>
|
<ion-view>
|
||||||
<ion-nav-bar class="bar-royal">
|
<ion-nav-bar class="bar-royal">
|
||||||
|
<ion-nav-title>
|
||||||
|
<span translate>Add Contact</span>
|
||||||
|
</ion-nav-title>
|
||||||
<ion-nav-back-button>
|
<ion-nav-back-button>
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
<ion-nav-title>
|
<ion-nav-buttons side="secondary">
|
||||||
<span translate>Add entry</span>
|
<button class="button back-button" ng-click="goHome()" ng-if="fromSendTab">
|
||||||
</ion-nav-title>
|
{{'Cancel' | translate}}
|
||||||
|
</button>
|
||||||
|
</ion-nav-buttons>
|
||||||
|
</ion-nav-bar>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<ion-modal-view ng-controller="txStatusController">
|
<ion-modal-view id="tx-status" ng-controller="txStatusController">
|
||||||
<div ng-if="type == 'broadcasted'" class="popup-txsent text-center m30tp">
|
<div ng-if="type == 'broadcasted'" class="popup-txsent text-center m30tp">
|
||||||
<i class="icon ion-checkmark-round"></i>
|
<i class="icon ion-checkmark-round"></i>
|
||||||
<div ng-show="tx.amountStr" class="m20t size-36">
|
<div ng-show="tx.amountStr" class="m20t size-36">
|
||||||
|
|
@ -7,9 +7,34 @@
|
||||||
<div class="size-16 text-gray m10v">
|
<div class="size-16 text-gray m10v">
|
||||||
<span translate>Sent</span>
|
<span translate>Sent</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center m20t">
|
<div class="text-center m20t" ng-if="entryExist">
|
||||||
<a class="button button-positive" ng-click="cancel()" translate>OKAY</a>
|
<a class="button button-positive" ng-click="cancel()" translate>OKAY</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="collect-address" ng-if="!entryExist">
|
||||||
|
<div class="row">
|
||||||
|
<p translate class="col">Would you like to add this address to your address book?</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<span class="address">
|
||||||
|
<i class="icon ion-social-bitcoin"></i>
|
||||||
|
<contact class="enable_text_select ellipsis" address="{{tx.toAddress}}"></contact>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col col-50">
|
||||||
|
<button class="button button-block button-stable" ng-click="cancel()">
|
||||||
|
{{'Skip' | translate}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="col col-50">
|
||||||
|
<button class="button button-block button-stable" ng-click="save(tx.toAddress)">
|
||||||
|
{{'Add Address' | translate}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('addressbookAddController', function($scope, $state, $timeout, addressbookService, popupService) {
|
angular.module('copayApp.controllers').controller('addressbookAddController', function($scope, $state, $stateParams, $timeout, $ionicHistory, addressbookService, popupService) {
|
||||||
|
|
||||||
|
$scope.fromSendTab = $stateParams.fromSendTab;
|
||||||
|
|
||||||
$scope.addressbookEntry = {
|
$scope.addressbookEntry = {
|
||||||
'address': '',
|
'address': $stateParams.addressbookEntry || '',
|
||||||
'name': '',
|
'name': '',
|
||||||
'email': ''
|
'email': ''
|
||||||
};
|
};
|
||||||
|
|
@ -28,9 +30,15 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
|
||||||
popupService.showAlert(err);
|
popupService.showAlert(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$state.go('tabs.addressbook');
|
if ($scope.fromSendTab) $scope.goHome();
|
||||||
|
else $state.go('tabs.addressbook');
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.goHome = function() {
|
||||||
|
$ionicHistory.clearHistory();
|
||||||
|
$state.go('tabs.home');
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -261,8 +261,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
|
|
||||||
return walletService.onlyPublish(wallet, txp, function(err, txp) {
|
return walletService.onlyPublish(wallet, txp, function(err, txp) {
|
||||||
if (err) return setSendError(err);
|
if (err) return setSendError(err);
|
||||||
$ionicHistory.clearHistory();
|
|
||||||
$state.go('tabs.home');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ongoingProcess.set('creatingTx', true);
|
ongoingProcess.set('creatingTx', true);
|
||||||
|
|
@ -303,8 +301,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
function publishAndSign(wallet, txp) {
|
function publishAndSign(wallet, txp) {
|
||||||
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
||||||
if (err) return setSendError(err);
|
if (err) return setSendError(err);
|
||||||
$ionicHistory.clearHistory();
|
|
||||||
$state.go('tabs.home');
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,27 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout) {
|
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout, $state, $log, addressbookService) {
|
||||||
|
|
||||||
if ($scope.cb) $timeout($scope.cb, 100);
|
if ($scope.cb) $timeout($scope.cb, 100);
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$scope.txStatusModal.hide();
|
$scope.txStatusModal.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.save = function(addressbookEntry) {
|
||||||
|
$scope.txStatusModal.hide();
|
||||||
|
$state.go('tabs.send.addressbook', {
|
||||||
|
fromSendTab: true,
|
||||||
|
addressbookEntry: addressbookEntry
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
addressbookService.list(function(err, ab) {
|
||||||
|
if (err) $log.error(err);
|
||||||
|
if (ab[$scope.tx.toAddress]) {
|
||||||
|
$scope.entryExist = true;
|
||||||
|
$log.debug('Entry already exist');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('tabs.send.addressbook', {
|
||||||
|
url: '/addressbook/add/:fromSendTab/:addressbookEntry',
|
||||||
|
views: {
|
||||||
|
'tab-send@tabs': {
|
||||||
|
templateUrl: 'views/addressbook.add.html',
|
||||||
|
controller: 'addressbookAddController'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1000,3 +1000,4 @@ input[type=number] {
|
||||||
@import "views/includes/modals/modals";
|
@import "views/includes/modals/modals";
|
||||||
@import "views/includes/tx-details";
|
@import "views/includes/tx-details";
|
||||||
@import "views/includes/txp-details";
|
@import "views/includes/txp-details";
|
||||||
|
@import "views/includes/tx-status";
|
||||||
|
|
|
||||||
27
src/sass/views/includes/tx-status.scss
Normal file
27
src/sass/views/includes/tx-status.scss
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#tx-status {
|
||||||
|
.address {
|
||||||
|
display: flex;
|
||||||
|
padding: 5px 15px;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
margin-top: 10px;
|
||||||
|
i {
|
||||||
|
color: grey;
|
||||||
|
padding-right: 10px;
|
||||||
|
border-right: 1px solid;
|
||||||
|
border-color: grey;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
contact {
|
||||||
|
margin-left: 15px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.collect-address{
|
||||||
|
bottom: 0;
|
||||||
|
background: #fff;
|
||||||
|
color: #6c6c6c;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue