commit
745babcc1f
7 changed files with 75 additions and 38 deletions
|
|
@ -139,10 +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>
|
||||||
<i class="icon nav-item-arrow-right"></i>
|
<div ng-if="btx.note && btx.note.body">
|
||||||
<div ng-show="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>,
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
@ -81,7 +76,12 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showCommentPopup = function() {
|
$scope.showCommentPopup = function() {
|
||||||
popupService.showPrompt(gettextCatalog.getString('Memo'), ' ', {}, function(text) {
|
var opts = {};
|
||||||
|
if ($scope.btx.note && $scope.btx.note.body) opts.defaultText = $scope.btx.note.body;
|
||||||
|
|
||||||
|
popupService.showPrompt(null, gettextCatalog.getString('Memo'), opts, function(text) {
|
||||||
|
if (typeof text == "undefined") return;
|
||||||
|
|
||||||
$log.debug('Saving memo');
|
$log.debug('Saving memo');
|
||||||
|
|
||||||
var args = {
|
var args = {
|
||||||
|
|
@ -103,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();
|
||||||
});
|
});
|
||||||
|
|
@ -127,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();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window) {
|
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window) {
|
||||||
|
var wallet;
|
||||||
$scope.externalServices = {};
|
$scope.externalServices = {};
|
||||||
$scope.bitpayCardEnabled = true; // TODO
|
$scope.bitpayCardEnabled = true; // TODO
|
||||||
$scope.openTxpModal = txpModalService.open;
|
$scope.openTxpModal = txpModalService.open;
|
||||||
|
|
@ -17,22 +18,33 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.openNotificationModal = function(n) {
|
$scope.openNotificationModal = function(n) {
|
||||||
|
wallet = profileService.getWallet(n.walletId);
|
||||||
|
|
||||||
if (n.txid) {
|
if (n.txid) {
|
||||||
openTxModal(n);
|
openTxModal(n);
|
||||||
} else {
|
} else {
|
||||||
var txp = lodash.find($scope.txps, {
|
var txp = lodash.find($scope.txps, {
|
||||||
id: n.txpId
|
id: n.txpId
|
||||||
});
|
});
|
||||||
if (txp) txpModalService.open(txp);
|
if (txp) {
|
||||||
else {
|
txpModalService.open(txp);
|
||||||
$log.warn('No txp found');
|
} else {
|
||||||
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
|
ongoingProcess.set('loadingTxInfo', true);
|
||||||
|
walletService.getTxp(wallet, n.txpId, function(err, txp) {
|
||||||
|
var _txp = txp;
|
||||||
|
ongoingProcess.set('loadingTxInfo', false);
|
||||||
|
if (err) {
|
||||||
|
$log.warn('No txp found');
|
||||||
|
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
|
||||||
|
}
|
||||||
|
txpModalService.open(_txp);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var openTxModal = function(n) {
|
var openTxModal = function(n) {
|
||||||
var wallet = profileService.getWallet(n.walletId);
|
wallet = profileService.getWallet(n.walletId);
|
||||||
|
|
||||||
ongoingProcess.set('loadingTxInfo', true);
|
ongoingProcess.set('loadingTxInfo', true);
|
||||||
walletService.getTx(wallet, n.txid, function(err, tx) {
|
walletService.getTx(wallet, n.txid, function(err, tx) {
|
||||||
|
|
@ -48,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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
|
||||||
inputPlaceholder: opts.inputPlaceholder,
|
inputPlaceholder: opts.inputPlaceholder,
|
||||||
defaultText: opts.defaultText
|
defaultText: opts.defaultText
|
||||||
}).then(function(res) {
|
}).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]);
|
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) {
|
var onPrompt = function(results) {
|
||||||
if (results.buttonIndex == 1) return cb(results.input1);
|
if (results.buttonIndex == 1) return cb(results.input1);
|
||||||
else return cb();
|
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);
|
$log.warn(title + ": " + message);
|
||||||
|
|
||||||
if (isCordova)
|
if (isCordova)
|
||||||
_cordovaPrompt(title, message, cb);
|
_cordovaPrompt(title, message, opts, cb);
|
||||||
else
|
else
|
||||||
_ionicPrompt(title, message, opts, cb);
|
_ionicPrompt(title, message, opts, cb);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'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 = {};
|
var root = {};
|
||||||
|
|
||||||
|
|
@ -11,11 +11,13 @@ angular.module('copayApp.services').factory('txpModalService', function(configSe
|
||||||
|
|
||||||
|
|
||||||
root.open = function(tx) {
|
root.open = function(tx) {
|
||||||
|
var wallet = tx.wallet ? tx.wallet : profileService.getWallet(tx.walletId);
|
||||||
var config = configService.getSync().wallet;
|
var config = configService.getSync().wallet;
|
||||||
var scope = $rootScope.$new(true);
|
var scope = $rootScope.$new(true);
|
||||||
scope.tx = tx;
|
scope.tx = tx;
|
||||||
scope.wallet = tx.wallet;
|
if (!scope.tx.toAddress) scope.tx.toAddress = tx.outputs[0].toAddress;
|
||||||
scope.copayers = tx.wallet ? tx.wallet.copayers : null;
|
scope.wallet = wallet;
|
||||||
|
scope.copayers = wallet ? wallet.copayers : null;
|
||||||
scope.isGlidera = glideraActive;
|
scope.isGlidera = glideraActive;
|
||||||
scope.currentSpendUnconfirmed = config.spendUnconfirmed;
|
scope.currentSpendUnconfirmed = config.spendUnconfirmed;
|
||||||
// scope.tx.hasMultiplesOutputs = true; // Uncomment to test multiple outputs
|
// scope.tx.hasMultiplesOutputs = true; // Uncomment to test multiple outputs
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
root.getTx = function(wallet, txid, cb) {
|
||||||
var tx;
|
var tx;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue