Merge pull request #151 from JDonadio/bug/memo

Txp/Tx Modal
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-21 19:17:57 -03:00 committed by GitHub
commit 745babcc1f
7 changed files with 75 additions and 38 deletions

View file

@ -37,7 +37,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
inputPlaceholder: opts.inputPlaceholder,
defaultText: opts.defaultText
}).then(function(res) {
return cb(res)
return cb(res);
});
};
@ -58,12 +58,12 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
navigator.notification.confirm(message, onConfirm, title, [okText, cancelText]);
};
var _cordovaPrompt = function(title, message, cb) {
var _cordovaPrompt = function(title, message, opts, cb) {
var onPrompt = function(results) {
if (results.buttonIndex == 1) return cb(results.input1);
else return cb();
}
navigator.notification.prompt(message, onPrompt, title);
navigator.notification.prompt(message, onPrompt, title, null, opts.defaultText);
};
/**
@ -118,7 +118,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
$log.warn(title + ": " + message);
if (isCordova)
_cordovaPrompt(title, message, cb);
_cordovaPrompt(title, message, opts, cb);
else
_ionicPrompt(title, message, opts, cb);
};

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('txpModalService', function(configService, $rootScope, $ionicModal) {
angular.module('copayApp.services').factory('txpModalService', function(configService, profileService, $rootScope, $ionicModal) {
var root = {};
@ -11,11 +11,13 @@ angular.module('copayApp.services').factory('txpModalService', function(configSe
root.open = function(tx) {
var wallet = tx.wallet ? tx.wallet : profileService.getWallet(tx.walletId);
var config = configService.getSync().wallet;
var scope = $rootScope.$new(true);
scope.tx = tx;
scope.wallet = tx.wallet;
scope.copayers = tx.wallet ? tx.wallet.copayers : null;
if (!scope.tx.toAddress) scope.tx.toAddress = tx.outputs[0].toAddress;
scope.wallet = wallet;
scope.copayers = wallet ? wallet.copayers : null;
scope.isGlidera = glideraActive;
scope.currentSpendUnconfirmed = config.spendUnconfirmed;
// scope.tx.hasMultiplesOutputs = true; // Uncomment to test multiple outputs

View file

@ -502,6 +502,22 @@ 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);
return cb(null, txp);
});
};
root.getTx = function(wallet, txid, cb) {
var tx;