add logic to txp modal related to glidera

This commit is contained in:
Matias Alejo Garcia 2015-09-08 22:39:33 -03:00
commit 666eee4321
4 changed files with 22 additions and 14 deletions

View file

@ -839,6 +839,8 @@ console.log('[index.js:395]',txps); //TODO
self.initGlidera = function(accessToken) {
if (self.isShared) return;
self.glideraStatus = null;
glideraService.setCredentials(self.network);
var getToken = function(cb) {

View file

@ -173,28 +173,30 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
});
};
var GLIDERA_LOCK_TIME = 6 * 60 * 60 * 1000;
this.openTxpModal = function(tx, copayers) {
var GLIDERA_LOCK_TIME = 6 * 60 * 60 ;
// isGlidera flag is a security mesure so glidera status is not
// only determined by the tx.message
this.openTxpModal = function(tx, copayers, isGlidera) {
var fc = profileService.focusedClient;
var refreshUntilItChanges = false;
var currentSpendUnconfirmed = $scope.currentSpendUnconfirmed;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.error = null;
$scope.tx = tx;
$scope.copayers = copayers
$scope.copayerId = fc.credentials.copayerId;
$scope.canSign = fc.canSign();
$scope.loading = null;
$scope.color = fc.backgroundColor;
// ToDo: use custom data
$scope.isGlidera = false;
if (tx.message === 'Glidera transaction') {
$scope.isGlidera = true;
if ($scope.tx.canBeRemoved)
$scope.tx.canBeRemoved = (Date.now() - (tx.ts || tx.createdOn)) > GLIDERA_LOCK_TIME;
// ToDo: use tx.customData instead of tx.message
if (tx.message === 'Glidera transaction' && isGlidera) {
tx.isGlidera = true;
if (tx.canBeRemoved) {
tx.canBeRemoved = (Date.now()/1000 - (tx.ts || tx.createdOn)) > GLIDERA_LOCK_TIME;
}
}
$scope.tx = tx;
refreshUntilItChanges = false;
$scope.currentSpendUnconfirmed = currentSpendUnconfirmed;