add addressbook entry when send success

This commit is contained in:
Gabriel Bazán 2016-09-21 15:13:22 -03:00
parent 89362ef929
commit ef90113dd8
9 changed files with 126 additions and 37 deletions

View File

@ -1,10 +1,16 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-title>
<span translate>Add entry</span>
<span translate>Add Contact</span>
</ion-nav-title>
<ion-nav-back-button ng-if="!fromSendTab">
</ion-nav-back-button>
<ion-nav-buttons side="secondary">
<button class="button back-button" ng-click="goHome()" ng-if="fromSendTab">
Cancel
</button>
</ion-nav-buttons>
</ion-nav-bar>
</ion-nav-bar>
<ion-content>

View File

@ -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">
<i class="icon ion-checkmark-round"></i>
<div ng-show="tx.amountStr" class="m20t size-36">
@ -7,9 +7,34 @@
<div class="size-16 text-gray m10v">
<span translate>Sent</span>
</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>
</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>

View File

@ -1,9 +1,11 @@
'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 = {
'address': '',
'address': $stateParams.addressbookEntry || '',
'name': '',
'email': ''
};
@ -28,9 +30,15 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
popupService.showAlert(err);
return;
}
$state.go('tabs.addressbook');
if ($scope.fromSendTab) $scope.goHome();
else $state.go('tabs.addressbook');
});
}, 100);
};
$scope.goHome = function() {
$ionicHistory.clearHistory();
$state.go('tabs.home');
};
});

View File

@ -262,8 +262,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
return walletService.onlyPublish(wallet, txp, function(err, txp) {
if (err) return setSendError(err);
$ionicHistory.clearHistory();
$state.go('tabs.home');
});
}
ongoingProcess.set('creatingTx', true);
@ -304,8 +302,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
function publishAndSign(wallet, txp) {
walletService.publishAndSign(wallet, txp, function(err, txp) {
if (err) return setSendError(err);
$ionicHistory.clearHistory();
$state.go('tabs.home');
});
};

View File

@ -83,7 +83,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.showCommentPopup = function() {
popupService.showPrompt(gettextCatalog.getString('Memo'), ' ', {}, function(text) {
$log.debug('Saving memo');
console.log("#######################");
console.log(text);
var args = {
txid: $scope.btx.txid,
body: text

View File

@ -1,10 +1,27 @@
'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);
$scope.cancel = function() {
$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');
}
})
});

View File

@ -222,13 +222,13 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
/*
*
* Send
*
*/
/*
*
* Send
*
*/
.state('tabs.send.amount', {
.state('tabs.send.amount', {
url: '/amount/:toAddress/:toName/:toEmail',
views: {
'tab-send@tabs': {
@ -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'
}
}
})
/*
*
@ -501,7 +509,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('tabs.addressbook.add', {
url: '/add',
url: '/add/:addressbookEntry',
views: {
'tab-settings@tabs': {
templateUrl: 'views/addressbook.add.html',
@ -709,24 +717,24 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
templateUrl: 'views/sellCoinbase.html'
})
/*
*
* Gift Cards
*
*/
/*
*
* Gift Cards
*
*/
.state('tabs.giftcards', {
url: '/giftcards',
abstract: true
})
.state('tabs.giftcards', {
url: '/giftcards',
abstract: true
})
/*
*
* Amazon.com Gift Card
*
*/
/*
*
* Amazon.com Gift Card
*
*/
.state('tabs.giftcards.amazon', {
.state('tabs.giftcards.amazon', {
url: '/amazon',
views: {
'tab-home@tabs': {

View File

@ -999,3 +999,4 @@ input[type=number] {
@import "views/includes/modals/modals";
@import "views/includes/tx-details";
@import "views/includes/txp-details";
@import "views/includes/tx-status";

View 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%;
}
}