mv txps to walletDetails
This commit is contained in:
parent
c83c2e7550
commit
55f6d9f3f6
5 changed files with 133 additions and 100 deletions
|
|
@ -5,46 +5,31 @@
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
<ion-content class="padding" ng-controller="tabHomeController">
|
<ion-content class="padding" ng-controller="tabHomeController">
|
||||||
|
|
||||||
<div ng-if="txps[0]">
|
|
||||||
<h3 class="title m0" translate>Payment Proposals</h3>
|
<div ng-if="events[0]">
|
||||||
|
<h3 class="title m0" translate>Activity</h3>
|
||||||
<div class="list card">
|
<div class="list card">
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="tx in txps" class="item item-icon-left"
|
<li ng-repeat="tx in txps" class="item item-icon-left" ng-click="xxx(tx)">
|
||||||
ng-click="openTxpModal(tx)">
|
<span >
|
||||||
<i class="icon ion-ios-circle-filled" ng-show="tx.pendingForUs" ng-style="{'color':tx.wallet.color}"></i>
|
bla bla
|
||||||
<span ng-show="!tx.merchant">
|
|
||||||
<span ng-show="addressbook[tx.toAddress] && !tx.message">
|
|
||||||
{{addressbook[tx.toAddress]}}
|
|
||||||
</span>
|
|
||||||
<span class="ellipsis" ng-show="!addressbook[tx.toAddress] && tx.message">
|
|
||||||
{{tx.message}}
|
|
||||||
</span>
|
|
||||||
<span ng-show="!addressbook[tx.toAddress] && !tx.message" translate>
|
|
||||||
Sending
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span ng-show="tx.merchant">
|
|
||||||
<span ng-show="tx.merchant.pr.ca"><i class="fi-lock"></i> {{tx.merchant.domain}}</span>
|
|
||||||
<span ng-show="!tx.merchant.pr.ca"><i class="fi-unlock"></i> {{tx.merchant.domain}}</span>
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
- {{tx.amountStr}}
|
|
||||||
</span>
|
</span>
|
||||||
<div class="item-note">
|
<div class="item-note">
|
||||||
{{tx.wallet.name}} · <time>{{ (tx.ts || tx.createdOn ) * 1000 | amTimeAgo}}</time>
|
blo blo · <time>{{ (tx.ts || tx.createdOn ) * 1000 | amTimeAgo}}</time>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="item " ng-click="xxx(tx)" ng-show="1">
|
||||||
|
<button class="button button-block button-passive">
|
||||||
|
More (5)
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<div ng-show="lockedBalanceSat">
|
|
||||||
<span translate>Total Locked Balance</span>:
|
|
||||||
<b>{{lockedBalanceStr}} </b>
|
|
||||||
<span> {{lockedBalanceAlternative}} {{alternativeIsoCode}} </span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-80">
|
<div class="col col-80">
|
||||||
<h2>Wallets </h2>
|
<h2>Wallets </h2>
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,49 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div ng-if="txps[0]">
|
||||||
|
<h3 class="title m0" translate>Payment Proposals</h3>
|
||||||
|
<div class="list card">
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="tx in txps" class="item item-icon-left"
|
||||||
|
ng-click="openTxpModal(tx)">
|
||||||
|
<i class="icon ion-ios-circle-filled" ng-show="tx.pendingForUs" ng-style="{'color':tx.wallet.color}"></i>
|
||||||
|
<span ng-show="!tx.merchant">
|
||||||
|
<span ng-show="addressbook[tx.toAddress] && !tx.message">
|
||||||
|
{{addressbook[tx.toAddress]}}
|
||||||
|
</span>
|
||||||
|
<span class="ellipsis" ng-show="!addressbook[tx.toAddress] && tx.message">
|
||||||
|
{{tx.message}}
|
||||||
|
</span>
|
||||||
|
<span ng-show="!addressbook[tx.toAddress] && !tx.message" translate>
|
||||||
|
Sending
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span ng-show="tx.merchant">
|
||||||
|
<span ng-show="tx.merchant.pr.ca"><i class="fi-lock"></i> {{tx.merchant.domain}}</span>
|
||||||
|
<span ng-show="!tx.merchant.pr.ca"><i class="fi-unlock"></i> {{tx.merchant.domain}}</span>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
- {{tx.amountStr}}
|
||||||
|
</span>
|
||||||
|
<div class="item-note">
|
||||||
|
{{tx.wallet.name}} · <time>{{ (tx.ts || tx.createdOn ) * 1000 | amTimeAgo}}</time>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<div ng-show="lockedBalanceSat">
|
||||||
|
<span translate>Total Locked Balance</span>:
|
||||||
|
<b>{{lockedBalanceStr}} </b>
|
||||||
|
<span> {{lockedBalanceAlternative}} {{alternativeIsoCode}} </span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Transactions -->
|
<!-- Transactions -->
|
||||||
<h4 class="title" ng-click="startSearch(); openSearchModal()" ng-show="!notAuthorized">
|
<h4 class="title" ng-click="startSearch(); openSearchModal()" ng-show="!notAuthorized">
|
||||||
<span translate>Activity</span>
|
<span translate>Activity</span>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
||||||
$scope.error = msg || gettextCatalog.getString('Could not send payment');
|
$scope.error = msg || gettextCatalog.getString('Could not send payment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.sign = function() {
|
$scope.sign = function() {
|
||||||
$scope.error = null;
|
$scope.error = null;
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
|
|
||||||
|
|
@ -3,27 +3,14 @@
|
||||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
|
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
|
||||||
var self = this;
|
var self = this;
|
||||||
$scope.txps = [];
|
|
||||||
|
|
||||||
self.setWallets = function() {
|
self.setWallets = function() {
|
||||||
$scope.wallets = profileService.getWallets();
|
$scope.wallets = profileService.getWallets();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var setPendingTxps = function(txps) {
|
|
||||||
if (!txps) {
|
|
||||||
$scope.txps = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.txps = lodash.sortBy(txps, 'createdOn').reverse();
|
|
||||||
|
|
||||||
console.log('[tab-home.js.18]', $scope.txps); //TODO
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateAllWallets = function() {
|
self.updateAllWallets = function() {
|
||||||
$scope.wallets = profileService.getWallets();
|
$scope.wallets = profileService.getWallets();
|
||||||
|
|
||||||
var txps = [];
|
|
||||||
var i = $scope.wallets.length;
|
var i = $scope.wallets.length;
|
||||||
lodash.each($scope.wallets, function(wallet) {
|
lodash.each($scope.wallets, function(wallet) {
|
||||||
walletService.getStatus(wallet, {}, function(err, status) {
|
walletService.getStatus(wallet, {}, function(err, status) {
|
||||||
|
|
@ -31,13 +18,6 @@ console.log('[tab-home.js.18]', $scope.txps); //TODO
|
||||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.pendingTxps && status.pendingTxps[0]) {
|
|
||||||
txps = txps.concat(status.pendingTxps);
|
|
||||||
}
|
|
||||||
if (--i == 0) {
|
|
||||||
setPendingTxps(txps);
|
|
||||||
}
|
|
||||||
wallet.status = status;
|
wallet.status = status;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -51,16 +31,6 @@ console.log('[tab-home.js.18]', $scope.txps); //TODO
|
||||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var txps = lodash.filter($scope.txps, function(x) {
|
|
||||||
return x.walletId != wallet.id;
|
|
||||||
});
|
|
||||||
|
|
||||||
var wasAny = txps.length != $scope.txps.length;
|
|
||||||
|
|
||||||
if ( (status.pendingTxps && status.pendingTxps[0]) || wasAny ) {
|
|
||||||
txps = txps.concat(status.pendingTxps);
|
|
||||||
setPendingTxps(txps);
|
|
||||||
}
|
|
||||||
wallet.status = status;
|
wallet.status = status;
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
@ -88,28 +58,6 @@ console.log('[tab-home.js.18]', $scope.txps); //TODO
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var GLIDERA_LOCK_TIME = 6 * 60 * 60;
|
|
||||||
|
|
||||||
var glideraActive = true; // TODO TODO TODO
|
|
||||||
// isGlidera flag is a security measure so glidera status is not
|
|
||||||
// only determined by the tx.message
|
|
||||||
$scope.openTxpModal = function(tx) {
|
|
||||||
var config = configService.getSync().wallet;
|
|
||||||
var scope = $rootScope.$new(true);
|
|
||||||
scope.tx = tx;
|
|
||||||
scope.wallet = tx.wallet;
|
|
||||||
scope.copayers = tx.wallet.copayers;
|
|
||||||
scope.isGlidera = glideraActive;
|
|
||||||
scope.currentSpendUnconfirmed = config.spendUnconfirmed;
|
|
||||||
|
|
||||||
$ionicModal.fromTemplateUrl('views/modals/txp-details.html', {
|
|
||||||
scope: scope
|
|
||||||
}).then(function(modal) {
|
|
||||||
scope.txpDetailsModal = modal;
|
|
||||||
scope.txpDetailsModal.show();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
configService.whenAvailable(function() {
|
configService.whenAvailable(function() {
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
var glideraEnabled = config.glidera.enabled;
|
var glideraEnabled = config.glidera.enabled;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,79 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
var errorPopup;
|
var errorPopup;
|
||||||
|
|
||||||
var HISTORY_SHOW_LIMIT = 10;
|
var HISTORY_SHOW_LIMIT = 10;
|
||||||
|
$scope.txps = [];
|
||||||
|
|
||||||
|
|
||||||
|
var setPendingTxps = function(txps) {
|
||||||
|
if (!txps) {
|
||||||
|
$scope.txps = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.txps = lodash.sortBy(txps, 'createdOn').reverse();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.updateStatus = function(force) {
|
||||||
|
$scope.updatingStatus = true;
|
||||||
|
$scope.updateStatusError = false;
|
||||||
|
|
||||||
|
walletService.getStatus(wallet, {
|
||||||
|
force: !!force,
|
||||||
|
}, function(err, status) {
|
||||||
|
$scope.updatingStatus = false;
|
||||||
|
if (err) {
|
||||||
|
$scope.status = null;
|
||||||
|
$scope.updateStatusError = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setPendingTxps(status.pendingTxps);
|
||||||
|
|
||||||
|
$scope.status = status;
|
||||||
|
$scope.$apply();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var glideraActive = true; // TODO TODO TODO
|
||||||
|
// isGlidera flag is a security measure so glidera status is not
|
||||||
|
// only determined by the tx.message
|
||||||
|
$scope.openTxpModal = function(tx) {
|
||||||
|
var config = configService.getSync().wallet;
|
||||||
|
var scope = $rootScope.$new(true);
|
||||||
|
scope.tx = tx;
|
||||||
|
scope.wallet = tx.wallet;
|
||||||
|
scope.copayers = tx.wallet.copayers;
|
||||||
|
scope.isGlidera = glideraActive;
|
||||||
|
scope.currentSpendUnconfirmed = config.spendUnconfirmed;
|
||||||
|
|
||||||
|
$ionicModal.fromTemplateUrl('views/modals/txp-details.html', {
|
||||||
|
scope: scope
|
||||||
|
}).then(function(modal) {
|
||||||
|
scope.txpDetailsModal = modal;
|
||||||
|
scope.txpDetailsModal.show();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var listeners = [
|
||||||
|
$rootScope.$on('bwsEvent', function(e, walletId) {
|
||||||
|
if (walletId == wallet.id)
|
||||||
|
$scope.updateStatus();
|
||||||
|
}),
|
||||||
|
$rootScope.$on('Local/TxAction', function(e, walletId) {
|
||||||
|
var wallet = profileService.getWallet(walletId);
|
||||||
|
if (walletId == wallet.id)
|
||||||
|
$scope.updateStatus();
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function() {
|
||||||
|
lodash.each(listeners, function(x){
|
||||||
|
x();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$scope.openSearchModal = function() {
|
$scope.openSearchModal = function() {
|
||||||
$scope.color = wallet.color;
|
$scope.color = wallet.color;
|
||||||
|
|
@ -42,24 +115,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
walletService.recreate();
|
walletService.recreate();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.updateStatus = function(force) {
|
|
||||||
$scope.updatingStatus = true;
|
|
||||||
$scope.updateStatusError = false;
|
|
||||||
$timeout(function() {
|
|
||||||
walletService.getStatus(wallet, {
|
|
||||||
force: !!force,
|
|
||||||
}, function(err, status) {
|
|
||||||
$scope.updatingStatus = false;
|
|
||||||
if (err) {
|
|
||||||
$scope.status = null;
|
|
||||||
$scope.updateStatusError = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.status = status;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.updateTxHistory = function() {
|
$scope.updateTxHistory = function() {
|
||||||
|
|
||||||
if ($scope.updatingTxHistory) return;
|
if ($scope.updatingTxHistory) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue