Wallet/src/js/services/txpModalService.js

34 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-09-01 19:14:18 -03:00
'use strict';
2016-09-21 16:04:25 -03:00
angular.module('copayApp.services').factory('txpModalService', function(configService, profileService, $rootScope, $ionicModal) {
2016-09-01 19:14:18 -03:00
var root = {};
var glideraActive = true; // TODO TODO TODO
// isGlidera flag is a security measure so glidera status is not
// only determined by the tx.message
root.open = function(tx) {
2016-09-21 16:04:25 -03:00
var wallet = tx.wallet ? tx.wallet : profileService.getWallet(tx.walletId);
2016-09-01 19:14:18 -03:00
var config = configService.getSync().wallet;
var scope = $rootScope.$new(true);
scope.tx = tx;
2016-09-21 16:19:00 -03:00
if (!scope.tx.toAddress) scope.tx.toAddress = tx.outputs[0].toAddress;
2016-09-21 16:04:25 -03:00
scope.wallet = wallet;
scope.copayers = wallet ? wallet.copayers : null;
2016-09-01 19:14:18 -03:00
scope.isGlidera = glideraActive;
scope.currentSpendUnconfirmed = config.spendUnconfirmed;
2016-09-20 10:02:28 -03:00
// scope.tx.hasMultiplesOutputs = true; // Uncomment to test multiple outputs
2016-09-01 19:14:18 -03:00
$ionicModal.fromTemplateUrl('views/modals/txp-details.html', {
scope: scope
}).then(function(modal) {
scope.txpDetailsModal = modal;
scope.txpDetailsModal.show();
});
};
return root;
});