sync memo

This commit is contained in:
Javier 2016-09-21 17:28:59 -03:00
commit 93d694d048
5 changed files with 36 additions and 24 deletions

View file

@ -139,9 +139,9 @@
</div>
<div class="item item-icon-right" ng-click="showCommentPopup()">
<span class="text-gray" translate ng-show="!btx.note">Add Memo</i></span>
<span class="text-gray" translate ng-show="btx.note">Memo</span>
<div ng-show="btx.note && btx.note.body">
<span class="text-gray" translate ng-if="!btx.note">Add Memo</i></span>
<span class="text-gray" translate ng-if="btx.note">Memo</span>
<div ng-if="btx.note && btx.note.body">
<span class="enable_text_select">{{btx.note.body}}</span><br>
<span class="text-italic item-note size-12">
<span translate>Edited by</span> <span>{{btx.note.editedByName}}</span>,

View file

@ -56,13 +56,18 @@ angular.module('copayApp.controllers').controller('activityController',
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
}
$scope.wallet = wallet;
$scope.btx = lodash.cloneDeep(tx);
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope
}).then(function(modal) {
$scope.txDetailsModal = modal;
$scope.txDetailsModal.show();
walletService.getTxNote(wallet, n.txid, function(err, note) {
if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
$scope.wallet = wallet;
$scope.btx = lodash.cloneDeep(tx);
$scope.btx.note = note;
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope
}).then(function(modal) {
$scope.txDetailsModal = modal;
$scope.txDetailsModal.show();
});
});
});
};

View file

@ -24,10 +24,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
updateMemo();
initActionList();
getAlternativeAmount();
$timeout(function() {
$scope.$apply();
});
};
function updateMemo() {
@ -38,7 +34,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$log.debug(gettextCatalog.getString('Could not fetch transaction note'));
return;
}
$scope.note = note;
$timeout(function() {
$scope.$apply();
@ -108,7 +103,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.btx.note.editedOn = Math.floor(Date.now() / 1000);
}
$scope.btx.searcheableString = null;
$timeout(function() {
$scope.$apply();
});
@ -132,7 +126,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.rateDate = res.fetchedOn;
$scope.rateStr = res.rate + ' ' + $scope.alternativeIsoCode;
$scope.alternativeAmountStr = $filter('formatFiatAmount')(alternativeAmountBtc * res.rate) + ' ' + $scope.alternativeIsoCode;
$scope.$apply();
}
});
};

View file

@ -60,13 +60,18 @@ angular.module('copayApp.controllers').controller('tabHomeController',
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
}
$scope.wallet = wallet;
$scope.btx = lodash.cloneDeep(tx);
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope
}).then(function(modal) {
$scope.txDetailsModal = modal;
$scope.txDetailsModal.show();
walletService.getTxNote(wallet, n.txid, function(err, note) {
if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
$scope.wallet = wallet;
$scope.btx = lodash.cloneDeep(tx);
$scope.btx.note = note;
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope
}).then(function(modal) {
$scope.txDetailsModal = modal;
$scope.txDetailsModal.show();
});
});
});
};

View file

@ -502,6 +502,15 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
});
};
root.getTxNote = function(wallet, txid, cb) {
wallet.getTxNote({
txid: txid
}, function(err, note) {
if (err || !note) return cb(true);
return cb(null, note);
});
};
root.getTxp = function(wallet, txpid, cb) {
wallet.getTx(txpid, function(err, txp) {
if (err) return cb(err);