fix merge conflicts
This commit is contained in:
commit
26fcb27a58
8 changed files with 136 additions and 140 deletions
|
|
@ -87,6 +87,7 @@
|
|||
"start": "npm run build:www && ionic serve --nolivereload --nogulp -s",
|
||||
"start:ios": "npm run build:www && npm run build:ios && npm run open:ios",
|
||||
"start:android": "npm run build:www && npm run build:android && npm run run:android",
|
||||
"start:desktop": "npm start",
|
||||
"watch": "grunt watch",
|
||||
"build:www": "grunt",
|
||||
"build:www-release": "grunt prod",
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ angular.module('copayApp.controllers').controller('copayersController',
|
|||
};
|
||||
|
||||
$scope.goHome = function() {
|
||||
$ionicHistory.removeBackView();
|
||||
$state.go('tabs.home');
|
||||
$ionicHistory.clearHistory();
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $ionicModal, $log, ongoingProcess, platformInfo, $ionicScrollDelegate, txFormatService, fingerprintService, bwcError, gettextCatalog, lodash, walletService, popupService, $state, $ionicHistory) {
|
||||
var self = $scope.self;
|
||||
var tx = $scope.tx;
|
||||
var copayers = $scope.copayers;
|
||||
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $log, ongoingProcess, platformInfo, $ionicScrollDelegate, txFormatService, bwcError, gettextCatalog, lodash, walletService, popupService, $ionicHistory) {
|
||||
var isGlidera = $scope.isGlidera;
|
||||
var GLIDERA_LOCK_TIME = 6 * 60 * 60;
|
||||
var now = Math.floor(Date.now() / 1000);
|
||||
|
|
@ -18,8 +15,8 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
$scope.color = $scope.wallet.color;
|
||||
$scope.data = {};
|
||||
$scope.hasClick = platformInfo.hasClick;
|
||||
$scope.displayAmount = getDisplayAmount(tx.amountStr);
|
||||
$scope.displayUnit = getDisplayUnit(tx.amountStr);
|
||||
$scope.displayAmount = getDisplayAmount($scope.tx.amountStr);
|
||||
$scope.displayUnit = getDisplayUnit($scope.tx.amountStr);
|
||||
initActionList();
|
||||
checkPaypro();
|
||||
}
|
||||
|
|
@ -46,12 +43,12 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
|
||||
$scope.actionList.push({
|
||||
type: 'created',
|
||||
time: tx.createdOn,
|
||||
time: $scope.tx.createdOn,
|
||||
description: actionDescriptions['created'],
|
||||
by: tx.creatorName
|
||||
by: $scope.tx.creatorName
|
||||
});
|
||||
|
||||
lodash.each(tx.actions, function(action) {
|
||||
lodash.each($scope.tx.actions, function(action) {
|
||||
$scope.actionList.push({
|
||||
type: action.type,
|
||||
time: action.createdOn,
|
||||
|
|
@ -61,103 +58,14 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on('accepted', function(event) {
|
||||
$scope.sign();
|
||||
});
|
||||
|
||||
// ToDo: use tx.customData instead of tx.message
|
||||
if (tx.message === 'Glidera transaction' && isGlidera) {
|
||||
tx.isGlidera = true;
|
||||
if (tx.canBeRemoved) {
|
||||
tx.canBeRemoved = (Date.now() / 1000 - (tx.ts || tx.createdOn)) > GLIDERA_LOCK_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
var setSendError = function(msg) {
|
||||
$scope.sendStatus = '';
|
||||
var error = msg || gettextCatalog.getString('Could not send payment');
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), error);
|
||||
}
|
||||
|
||||
$scope.sign = function(onSendStatusChange) {
|
||||
$scope.loading = true;
|
||||
walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) {
|
||||
$scope.$emit('UpdateTx');
|
||||
if (err) return setSendError(err);
|
||||
success();
|
||||
}, onSendStatusChange);
|
||||
};
|
||||
|
||||
function setError(err, prefix) {
|
||||
$scope.loading = false;
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix));
|
||||
};
|
||||
|
||||
$scope.reject = function(txp) {
|
||||
var title = gettextCatalog.getString('Warning!');
|
||||
var msg = gettextCatalog.getString('Are you sure you want to reject this transaction?');
|
||||
popupService.showConfirm(title, msg, null, null, function(res) {
|
||||
if (res) {
|
||||
$scope.loading = true;
|
||||
|
||||
walletService.reject($scope.wallet, $scope.tx, function(err, txpr) {
|
||||
if (err)
|
||||
return setError(err, gettextCatalog.getString('Could not reject payment'));
|
||||
|
||||
$scope.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.remove = function() {
|
||||
$scope.loading = true;
|
||||
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('removeTx', true);
|
||||
walletService.removeTx($scope.wallet, $scope.tx, function(err) {
|
||||
ongoingProcess.set('removeTx', false);
|
||||
|
||||
// Hacky: request tries to parse an empty response
|
||||
if (err && !(err.message && err.message.match(/Unexpected/))) {
|
||||
$scope.$emit('UpdateTx');
|
||||
return setError(err, gettextCatalog.getString('Could not delete payment proposal'));
|
||||
}
|
||||
|
||||
$scope.close();
|
||||
});
|
||||
}, 10);
|
||||
};
|
||||
|
||||
$scope.broadcast = function(txp) {
|
||||
$scope.loading = true;
|
||||
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('broadcastTx', true);
|
||||
walletService.broadcastTx($scope.wallet, $scope.tx, function(err, txpb) {
|
||||
ongoingProcess.set('broadcastTx', false);
|
||||
|
||||
if (err) {
|
||||
return setError(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||
}
|
||||
|
||||
$scope.close();
|
||||
});
|
||||
}, 10);
|
||||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
return $scope.wallet.credentials.networkName.substring(0, 4);
|
||||
};
|
||||
|
||||
function checkPaypro() {
|
||||
if (tx.payProUrl && !platformInfo.isChromeApp) {
|
||||
if ($scope.tx.payProUrl && !platformInfo.isChromeApp) {
|
||||
$scope.wallet.fetchPayPro({
|
||||
payProUrl: tx.payProUrl,
|
||||
payProUrl: $scope.tx.payProUrl,
|
||||
}, function(err, paypro) {
|
||||
if (err) return;
|
||||
tx.paypro = paypro;
|
||||
paymentTimeControl(tx.paypro.expires);
|
||||
$scope.tx.paypro = paypro;
|
||||
paymentTimeControl($scope.tx.paypro.expires);
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
}, 10);
|
||||
|
|
@ -187,32 +95,132 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
};
|
||||
};
|
||||
|
||||
lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy', 'transactionProposalRemoved', 'TxProposalRemoved', 'NewOutgoingTx', 'UpdateTx'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
$scope.wallet.getTx($scope.tx.id, function(err, tx) {
|
||||
if (err) {
|
||||
if (err.message && err.message == 'TX_NOT_FOUND' &&
|
||||
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
|
||||
$scope.tx.removed = true;
|
||||
$scope.tx.canBeRemoved = false;
|
||||
$scope.tx.pendingForUs = false;
|
||||
$scope.$apply();
|
||||
$scope.$on('accepted', function(event) {
|
||||
$scope.sign();
|
||||
});
|
||||
|
||||
// ToDo: use tx.customData instead of tx.message
|
||||
if ($scope.tx.message === 'Glidera transaction' && isGlidera) {
|
||||
$scope.tx.isGlidera = true;
|
||||
if ($scope.tx.canBeRemoved) {
|
||||
$scope.tx.canBeRemoved = (Date.now() / 1000 - ($scope.tx.ts || $scope.tx.createdOn)) > GLIDERA_LOCK_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
var setError = function (err, prefix) {
|
||||
$scope.sendStatus = '';
|
||||
$scope.loading = false;
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix));
|
||||
};
|
||||
|
||||
$scope.sign = function(onSendStatusChange) {
|
||||
$scope.loading = true;
|
||||
walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) {
|
||||
$scope.$emit('UpdateTx');
|
||||
if (err) return setError(err, gettextCatalog.getString('Could not send payment'));
|
||||
success();
|
||||
}, onSendStatusChange);
|
||||
};
|
||||
|
||||
$scope.reject = function(txp) {
|
||||
var title = gettextCatalog.getString('Warning!');
|
||||
var msg = gettextCatalog.getString('Are you sure you want to reject this transaction?');
|
||||
popupService.showConfirm(title, msg, null, null, function(res) {
|
||||
if (res) {
|
||||
$scope.loading = true;
|
||||
|
||||
walletService.reject($scope.wallet, $scope.tx, function(err, txpr) {
|
||||
if (err)
|
||||
return setError(err, gettextCatalog.getString('Could not reject payment'));
|
||||
|
||||
$scope.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.remove = function() {
|
||||
var title = gettextCatalog.getString('Warning!');
|
||||
var msg = gettextCatalog.getString('Are you sure you want to remove this transaction?');
|
||||
popupService.showConfirm(title, msg, null, null, function(res) {
|
||||
if (res) {
|
||||
ongoingProcess.set('removeTx', true);
|
||||
walletService.removeTx($scope.wallet, $scope.tx, function(err) {
|
||||
ongoingProcess.set('removeTx', false);
|
||||
|
||||
// Hacky: request tries to parse an empty response
|
||||
if (err && !(err.message && err.message.match(/Unexpected/))) {
|
||||
$scope.$emit('UpdateTx');
|
||||
return setError(err, gettextCatalog.getString('Could not delete payment proposal'));
|
||||
}
|
||||
return;
|
||||
|
||||
$scope.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.broadcast = function(txp) {
|
||||
$scope.loading = true;
|
||||
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('broadcastTx', true);
|
||||
walletService.broadcastTx($scope.wallet, $scope.tx, function(err, txpb) {
|
||||
ongoingProcess.set('broadcastTx', false);
|
||||
|
||||
if (err) {
|
||||
return setError(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||
}
|
||||
|
||||
var action = lodash.find(tx.actions, {
|
||||
copayerId: $scope.wallet.credentials.copayerId
|
||||
});
|
||||
|
||||
$scope.tx = txFormatService.processTx(tx);
|
||||
|
||||
if (!action && tx.status == 'pending')
|
||||
$scope.tx.pendingForUs = true;
|
||||
|
||||
$scope.updateCopayerList();
|
||||
$scope.$apply();
|
||||
$scope.close();
|
||||
});
|
||||
}, 10);
|
||||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
return $scope.wallet.credentials.networkName.substring(0, 4);
|
||||
};
|
||||
|
||||
var updateTxInfo = function(eventName) {
|
||||
$scope.wallet.getTx($scope.tx.id, function(err, tx) {
|
||||
if (err) {
|
||||
if (err.message && err.message == 'Transaction proposal not found' &&
|
||||
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
|
||||
$scope.tx.removed = true;
|
||||
$scope.tx.canBeRemoved = false;
|
||||
$scope.tx.pendingForUs = false;
|
||||
$scope.$apply();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var action = lodash.find(tx.actions, {
|
||||
copayerId: $scope.wallet.credentials.copayerId
|
||||
});
|
||||
|
||||
$scope.tx = txFormatService.processTx(tx);
|
||||
|
||||
if (!action && tx.status == 'pending')
|
||||
$scope.tx.pendingForUs = true;
|
||||
|
||||
$scope.updateCopayerList();
|
||||
initActionList();
|
||||
$scope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
var bwsEvent = $rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||
lodash.each([
|
||||
'TxProposalRejectedBy',
|
||||
'TxProposalAcceptedBy',
|
||||
'transactionProposalRemoved',
|
||||
'TxProposalRemoved',
|
||||
'NewOutgoingTx',
|
||||
'UpdateTx'
|
||||
], function(eventName) {
|
||||
if (walletId == $scope.wallet.id && type == eventName) {
|
||||
updateTxInfo(eventName);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -252,6 +260,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
};
|
||||
|
||||
$scope.close = function() {
|
||||
bwsEvent();
|
||||
$scope.loading = null;
|
||||
$scope.txpDetailsModal.hide();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,27 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $ionicHistory, $scope, $filter, $stateParams, ongoingProcess, walletService, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) {
|
||||
var config = configService.getSync();
|
||||
var configWallet = config.wallet;
|
||||
var walletSettings = configWallet.settings;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $ionicHistory, $scope, $stateParams, walletService, lodash, gettextCatalog, profileService, configService, externalLinkService, popupService) {
|
||||
|
||||
$scope.wallet = wallet;
|
||||
$scope.title = gettextCatalog.getString('Transaction');
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.title = gettextCatalog.getString('Transaction');
|
||||
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
|
||||
$scope.color = $scope.wallet.color;
|
||||
$scope.copayerId = $scope.wallet.credentials.copayerId;
|
||||
$scope.isShared = $scope.wallet.credentials.n > 1;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode;
|
||||
$scope.color = wallet.color;
|
||||
$scope.copayerId = wallet.credentials.copayerId;
|
||||
$scope.isShared = wallet.credentials.n > 1;
|
||||
walletService.getTx(wallet, $stateParams.txid, function(err, tx) {
|
||||
walletService.getTx($scope.wallet, $stateParams.txid, function(err, tx) {
|
||||
if (err) {
|
||||
$log.warn('Could not get tx');
|
||||
$ionicHistory.goBack();
|
||||
return;
|
||||
}
|
||||
$scope.btx = tx;
|
||||
$scope.btx.feeLevel = walletSettings.feeLevel;
|
||||
if ($scope.btx.action != 'invalid') {
|
||||
if ($scope.btx.action == 'sent') $scope.title = gettextCatalog.getString('Sent Funds');
|
||||
if ($scope.btx.action == 'received') $scope.title = gettextCatalog.getString('Received Funds');
|
||||
|
|
@ -34,7 +28,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
updateMemo();
|
||||
initActionList();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
function getDisplayAmount(amountStr) {
|
||||
return amountStr.split(' ')[0];
|
||||
|
|
@ -45,7 +39,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
}
|
||||
|
||||
function updateMemo() {
|
||||
walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) {
|
||||
walletService.getTxNote($scope.wallet, $scope.btx.txid, function(err, note) {
|
||||
if (err) {
|
||||
$log.warn('Could not fetch transaction note: ' + err);
|
||||
return;
|
||||
|
|
@ -53,18 +47,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
if (!note) return;
|
||||
|
||||
$scope.btx.note = note;
|
||||
|
||||
walletService.getTx(wallet, $scope.btx.txid, function(err, tx) {
|
||||
if (err) {
|
||||
$log.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
tx.note = note;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -109,9 +92,12 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
}
|
||||
if ($scope.btx.note && $scope.btx.note.body) opts.defaultText = $scope.btx.note.body;
|
||||
|
||||
popupService.showPrompt(wallet.name, gettextCatalog.getString('Memo'), opts, function(text) {
|
||||
popupService.showPrompt($scope.wallet.name, gettextCatalog.getString('Memo'), opts, function(text) {
|
||||
if (typeof text == "undefined") return;
|
||||
|
||||
$scope.btx.note = {
|
||||
body: text
|
||||
};
|
||||
$log.debug('Saving memo');
|
||||
|
||||
var args = {
|
||||
|
|
@ -119,17 +105,10 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
body: text
|
||||
};
|
||||
|
||||
walletService.editTxNote(wallet, args, function(err, res) {
|
||||
walletService.editTxNote($scope.wallet, args, function(err, res) {
|
||||
if (err) {
|
||||
$log.debug('Could not save tx comment ' + err);
|
||||
return;
|
||||
}
|
||||
// This is only to refresh the current screen data
|
||||
updateMemo();
|
||||
$scope.btx.searcheableString = null;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
@ -147,7 +126,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
var n = wallet.credentials.network;
|
||||
var n = $scope.wallet.credentials.network;
|
||||
return n.substring(0, 4);
|
||||
};
|
||||
|
||||
|
|
@ -155,5 +134,4 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
$scope.txDetailsModal.hide();
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, profileService, lodash, configService, gettextCatalog, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicHistory, $ionicScrollDelegate, $window) {
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicHistory, profileService, lodash, configService, gettextCatalog, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicScrollDelegate, $window) {
|
||||
|
||||
var HISTORY_SHOW_LIMIT = 10;
|
||||
var currentTxHistoryPage = 0;
|
||||
|
|
@ -87,6 +87,14 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
$scope.close = function() {
|
||||
$scope.searchModal.hide();
|
||||
};
|
||||
|
||||
$scope.openTx = function(tx) {
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$scope.searchModal.hide();
|
||||
$scope.openTxModal(tx);
|
||||
};
|
||||
};
|
||||
|
||||
$scope.openTxModal = function(btx) {
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'txDetailsController',
|
||||
templateUrl: 'views/modals/tx-details.html'
|
||||
templateUrl: 'views/tx-details.html'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
|
||||
<div class="list">
|
||||
<div class="item" ng-repeat="btx in txHistorySearchResults track by btx.txid" ng-click="openTxModal(btx)">
|
||||
<div class="item" ng-repeat="btx in txHistorySearchResults track by btx.txid" ng-click="openTx(btx)">
|
||||
|
||||
<span class="item-note text-right">
|
||||
<span class="size-16" ng-class="{'text-bold': btx.recent}">
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
{{btx.creatorName}} <time>{{ (btx.ts || btx.createdOn ) * 1000 | amDateFormat:'MM/DD/YYYY hh:mm a'}}</time>
|
||||
</span>
|
||||
</div>
|
||||
<a class="item item-icon-right" ng-class="{'single-line': !btx.note.body && !btx.message}" ng-hide="insuffientFunds" ng-click="showCommentPopup()">
|
||||
<a class="item item-icon-right" ng-class="{'single-line': !btx.note.body && !btx.message}" ng-click="showCommentPopup()">
|
||||
<span class="label" translate>Memo</span>
|
||||
<div class="item-note" style="display: block; float: none; margin-bottom: .25rem;">
|
||||
{{btx.note.body || btx.message}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue