2016-09-12 11:57:20 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2017-05-30 12:58:41 -03:00
|
|
|
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory, platformInfo, gettextCatalog) {
|
2017-01-05 16:58:58 -03:00
|
|
|
$scope.isChromeApp = platformInfo.isChromeApp;
|
2016-10-13 16:53:15 -03:00
|
|
|
$scope.addressbookEntry = {};
|
|
|
|
|
$scope.addressbookEntry.name = $stateParams.name;
|
|
|
|
|
$scope.addressbookEntry.email = $stateParams.email;
|
|
|
|
|
$scope.addressbookEntry.address = $stateParams.address;
|
2016-09-12 11:57:20 -03:00
|
|
|
|
|
|
|
|
$scope.sendTo = function() {
|
2016-09-22 16:43:35 -03:00
|
|
|
$ionicHistory.removeBackView();
|
2016-09-17 18:04:54 -03:00
|
|
|
$state.go('tabs.send');
|
2016-09-12 11:57:20 -03:00
|
|
|
$timeout(function() {
|
2016-09-17 18:04:54 -03:00
|
|
|
$state.transitionTo('tabs.send.amount', {
|
2016-09-12 11:57:20 -03:00
|
|
|
toAddress: $scope.addressbookEntry.address,
|
2016-09-16 21:01:19 -03:00
|
|
|
toName: $scope.addressbookEntry.name,
|
|
|
|
|
toEmail: $scope.addressbookEntry.email
|
2016-09-12 11:57:20 -03:00
|
|
|
});
|
|
|
|
|
}, 100);
|
|
|
|
|
};
|
|
|
|
|
|
2017-05-24 16:40:07 -03:00
|
|
|
$scope.remove = function(addr) {
|
2017-05-30 12:58:41 -03:00
|
|
|
var title = gettextCatalog.getString('Warning!');
|
|
|
|
|
var message = gettextCatalog.getString('Are you sure you want to delete this contact?');
|
|
|
|
|
popupService.showConfirm(title, message, null, null, function(res) {
|
|
|
|
|
if (!res) return;
|
|
|
|
|
addressbookService.remove(addr, function(err, ab) {
|
|
|
|
|
if (err) {
|
|
|
|
|
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$ionicHistory.goBack();
|
|
|
|
|
});
|
|
|
|
|
});
|
2017-05-24 16:40:07 -03:00
|
|
|
};
|
|
|
|
|
|
2016-09-12 11:57:20 -03:00
|
|
|
});
|