Merge pull request #5226 from JDonadio/fix/proposal-view

Use contact name in proposal card
This commit is contained in:
Gustavo Maximiliano Cortez 2016-12-14 16:28:22 -03:00 committed by GitHub
commit 80346f20e7
2 changed files with 29 additions and 13 deletions

View file

@ -1,24 +1,34 @@
'use strict';
angular.module('copayApp.controllers').controller('proposalsController',
function($timeout, $scope, profileService, $log, txpModalService) {
function($timeout, $scope, profileService, $log, txpModalService, addressbookService) {
$scope.fetchingProposals = true;
$scope.$on("$ionicView.enter", function(event, data){
profileService.getTxps(50, function(err, txps) {
$scope.fetchingProposals = false;
if (err) {
$log.error(err);
return;
}
$scope.txps = txps;
$timeout(function() {
$scope.$apply();
}, 1);
$scope.$on("$ionicView.enter", function(event, data) {
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
$scope.addressbook = ab || {};
profileService.getTxps(50, function(err, txps) {
$scope.fetchingProposals = false;
if (err) {
$log.error(err);
return;
}
$scope.txps = txps;
$timeout(function() {
$scope.$apply();
});
});
});
});
$scope.openTxpModal = txpModalService.open;
$scope.createdWithinPastDay = function(time) {
var now = new Date();
var date = new Date(time * 1000);
return (now.getTime() - date.getTime()) < (1000 * 60 * 60 * 24);
};
});

View file

@ -126,6 +126,12 @@ angular.module('copayApp.controllers').controller('tabHomeController',
});
});
$scope.createdWithinPastDay = function(time) {
var now = new Date();
var date = new Date(time * 1000);
return (now.getTime() - date.getTime()) < (1000 * 60 * 60 * 24);
};
$scope.openExternalLink = function() {
var url = 'https://github.com/bitpay/copay/releases/latest';
var optIn = true;