Merge pull request #153 from gabrielbazan7/feat/addEntrySend

add addressbook entry when send success
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-21 19:18:55 -03:00 committed by GitHub
commit 912789ccb6
8 changed files with 123 additions and 35 deletions

View file

@ -1,10 +1,16 @@
<ion-view>
<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-title>
<span translate>Add entry</span>
</ion-nav-title>
<ion-nav-buttons side="secondary">
<button class="button back-button" ng-click="goHome()" ng-if="fromSendTab">
{{'Cancel' | translate}}
</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

@ -261,8 +261,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);
@ -303,8 +301,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

@ -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'
}
}
})
/*
*
@ -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

@ -1000,3 +1000,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%;
}
}