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>
<div class="item item-icon-right" ng-click="showCommentPopup()"> <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-if="!btx.note">Add Memo</i></span>
<span class="text-gray" translate ng-show="btx.note">Memo</span> <span class="text-gray" translate ng-if="btx.note">Memo</span>
<div ng-show="btx.note && btx.note.body"> <div ng-if="btx.note && btx.note.body">
<span class="enable_text_select">{{btx.note.body}}</span><br> <span class="enable_text_select">{{btx.note.body}}</span><br>
<span class="text-italic item-note size-12"> <span class="text-italic item-note size-12">
<span translate>Edited by</span> <span>{{btx.note.editedByName}}</span>, <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')); return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
} }
$scope.wallet = wallet; walletService.getTxNote(wallet, n.txid, function(err, note) {
$scope.btx = lodash.cloneDeep(tx); if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope $scope.wallet = wallet;
}).then(function(modal) { $scope.btx = lodash.cloneDeep(tx);
$scope.txDetailsModal = modal; $scope.btx.note = note;
$scope.txDetailsModal.show(); $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(); updateMemo();
initActionList(); initActionList();
getAlternativeAmount(); getAlternativeAmount();
$timeout(function() {
$scope.$apply();
});
}; };
function updateMemo() { function updateMemo() {
@ -38,7 +34,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$log.debug(gettextCatalog.getString('Could not fetch transaction note')); $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
return; return;
} }
$scope.note = note; $scope.note = note;
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
@ -108,7 +103,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.btx.note.editedOn = Math.floor(Date.now() / 1000); $scope.btx.note.editedOn = Math.floor(Date.now() / 1000);
} }
$scope.btx.searcheableString = null; $scope.btx.searcheableString = null;
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -132,7 +126,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.rateDate = res.fetchedOn; $scope.rateDate = res.fetchedOn;
$scope.rateStr = res.rate + ' ' + $scope.alternativeIsoCode; $scope.rateStr = res.rate + ' ' + $scope.alternativeIsoCode;
$scope.alternativeAmountStr = $filter('formatFiatAmount')(alternativeAmountBtc * 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')); return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
} }
$scope.wallet = wallet; walletService.getTxNote(wallet, n.txid, function(err, note) {
$scope.btx = lodash.cloneDeep(tx); if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope $scope.wallet = wallet;
}).then(function(modal) { $scope.btx = lodash.cloneDeep(tx);
$scope.txDetailsModal = modal; $scope.btx.note = note;
$scope.txDetailsModal.show(); $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) { root.getTxp = function(wallet, txpid, cb) {
wallet.getTx(txpid, function(err, txp) { wallet.getTx(txpid, function(err, txp) {
if (err) return cb(err); if (err) return cb(err);