mirror of https://github.com/BTCPrivate/copay.git
commit
e4e388f7bd
|
@ -42,7 +42,7 @@
|
|||
"url": "https://github.com/bitpay/copay/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"bitcore-wallet-client": "4.1.0",
|
||||
"bitcore-wallet-client": "4.2.0",
|
||||
"coveralls": "^2.11.9",
|
||||
"express": "^4.11.2",
|
||||
"fs": "0.0.2",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"url": "https://github.com/bitpay/copay/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"bitcore-wallet-client": "4.1.0",
|
||||
"bitcore-wallet-client": "4.2.0",
|
||||
"coveralls": "^2.11.9",
|
||||
"express": "^4.11.2",
|
||||
"fs": "0.0.2",
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<button class="item button button-block button-balanced" ng-click="approve()" ng-disabled="!txp">
|
||||
<button class="item button button-block button-balanced" ng-click="approve()">
|
||||
<span translate>Send</span>
|
||||
</button>
|
||||
</ion-content>
|
||||
|
|
|
@ -1,23 +1,31 @@
|
|||
<i class="icon ion-ios-circle-filled" ng-show="tx.pendingForUs" ng-style="{'color':tx.wallet.color}"></i>
|
||||
<span ng-show="!tx.merchant">
|
||||
<span ng-show="addressbook[tx.toAddress] && !tx.message">
|
||||
{{addressbook[tx.toAddress]}}
|
||||
</span>
|
||||
<span class="ellipsis" ng-show="!addressbook[tx.toAddress] && tx.message">
|
||||
{{tx.message}}
|
||||
</span>
|
||||
<span ng-show="!addressbook[tx.toAddress] && !tx.message" translate>
|
||||
Sending
|
||||
</span>
|
||||
</span>
|
||||
<span ng-show="tx.merchant">
|
||||
<span ng-show="tx.merchant.pr.ca"><i class="fi-lock"></i> {{tx.merchant.domain}}</span>
|
||||
<span ng-show="!tx.merchant.pr.ca"><i class="fi-unlock"></i> {{tx.merchant.domain}}</span>
|
||||
</span>
|
||||
<span>
|
||||
- {{tx.amountStr}}
|
||||
</span>
|
||||
<div class="item-note">
|
||||
{{tx.wallet.name}} · <time>{{ (tx.ts || tx.createdOn ) * 1000 | amTimeAgo}}</time>
|
||||
</div>
|
||||
|
||||
<div class="wallet-activity" ng-class="{'wallet-activity-not-pending':!tx.pendingForUs}">
|
||||
<span ng-show="!tx.merchant">
|
||||
<span ng-show="addressbook[tx.toAddress] && !tx.message">
|
||||
{{addressbook[tx.toAddress]}}
|
||||
</span>
|
||||
<span class="ellipsis" ng-show="!addressbook[tx.toAddress] && tx.message">
|
||||
{{tx.message}}
|
||||
</span>
|
||||
<span ng-show="!addressbook[tx.toAddress] && !tx.message" translate>
|
||||
Sending
|
||||
</span>
|
||||
</span>
|
||||
<span ng-show="tx.merchant">
|
||||
<span ng-show="tx.merchant.pr.ca"><i class="fi-lock"></i> {{tx.merchant.domain}}</span>
|
||||
<span ng-show="!tx.merchant.pr.ca"><i class="fi-unlock"></i> {{tx.merchant.domain}}</span>
|
||||
</span>
|
||||
<span>
|
||||
</span>
|
||||
|
||||
<div class="wallet-activity-amount">
|
||||
{{tx.amountStr}}
|
||||
</div>
|
||||
|
||||
|
||||
<p class="wallet-activity-note">
|
||||
<i class="icon ion-record wallet-activity-note-child" ng-style="{'color':tx.wallet.color}"></i>
|
||||
<span class="wallet-activity-note-child">{{tx.wallet.name}}</span>
|
||||
<time class="wallet-activity-note-child">{{tx.createdOn * 1000 | amTimeAgo}}</time>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
<i class="icon ion-ios-film-outline"></i>
|
||||
<span translate>Version</span>
|
||||
<span class="item-note">
|
||||
v{{v.version}}
|
||||
v{{version}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item item-icon-left" ng-click="$root.openExternalLink('https://github.com/bitpay/copay/tree/'+v.commitHash)">
|
||||
<div class="item item-icon-left" ng-click="$root.openExternalLink('https://github.com/bitpay/copay/tree/'+commitHash)">
|
||||
<i class="icon ion-ios-film-outline"></i>
|
||||
<span translate>Commit hash</span>
|
||||
<span class="item-note">
|
||||
#{{v.commitHash}}
|
||||
#{{commitHash}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item item-divider">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<ion-content class="padding" ng-controller="proposalsController" ng-init="init()">
|
||||
|
||||
<div class="list card">
|
||||
<a ng-repeat="tx in txps" class="item item-icon-left" ng-click="openTxpModal(tx)">
|
||||
<a ng-repeat="tx in txps" class="item" ng-click="openTxpModal(tx)">
|
||||
<span ng-include="'views/includes/txp.html'"></span>
|
||||
</a>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<span class="badge badge-assertive" ng-show="txpsN>3" translate> {{txpsN}}</span>
|
||||
</a>
|
||||
|
||||
<a ng-repeat="tx in txps" class="item item-icon-left" ng-click="openTxpModal(tx)">
|
||||
<a ng-repeat="tx in txps" class="item" ng-click="openTxpModal(tx)">
|
||||
<span ng-include="'views/includes/txp.html'"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<ion-spinner icon="lines"></ion-spinner>
|
||||
<div translate>Updating activity. Please stand by</div>
|
||||
</span>
|
||||
<a ng-if="!fetchingNotifications" class="item" ng-repeat="x in notifications" ng-click="x.action()">
|
||||
<a ng-if="notifications[0]" class="item" ng-repeat="x in notifications" ng-click="x.action()">
|
||||
<span ng-include="'views/includes/walletActivity.html'"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -118,5 +118,9 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
<p class="padding" style="text-align:center; color:#999">
|
||||
{{name}} v{{version}}
|
||||
</p>
|
||||
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
|
|
|
@ -5,6 +5,17 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
var cachedTxp = {};
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
|
||||
|
||||
$scope.$on('Wallet/Changed', function(event, wallet) {
|
||||
if (lodash.isEmpty(wallet)) {
|
||||
$log.debug('No wallet provided');
|
||||
return;
|
||||
}
|
||||
$log.debug('Wallet changed: ' + wallet.name);
|
||||
setWallet(wallet, true);
|
||||
});
|
||||
|
||||
|
||||
$scope.showDescriptionPopup = function() {
|
||||
var commentPopup = $ionicPopup.show({
|
||||
templateUrl: "views/includes/note.html",
|
||||
|
@ -17,13 +28,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$scope.commentPopupSave = function(description) {
|
||||
$log.debug('Saving description: ' + description);
|
||||
$scope.description = description;
|
||||
$scope.txp = null;
|
||||
|
||||
createTx($scope.wallet, function(err, txp) {
|
||||
if (err) return;
|
||||
cachedTxp[$scope.wallet.id] = txp;
|
||||
apply(txp);
|
||||
});
|
||||
commentPopup.close();
|
||||
};
|
||||
};
|
||||
|
@ -137,15 +141,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on('Wallet/Changed', function(event, wallet) {
|
||||
if (lodash.isEmpty(wallet)) {
|
||||
$log.debug('No wallet provided');
|
||||
return;
|
||||
}
|
||||
$log.debug('Wallet changed: ' + wallet.name);
|
||||
setWallet(wallet, true);
|
||||
});
|
||||
|
||||
function setWallet(wallet, delayed) {
|
||||
var stop;
|
||||
$scope.wallet = wallet;
|
||||
|
@ -165,7 +160,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
apply(cachedTxp[wallet.id]);
|
||||
} else {
|
||||
stop = $timeout(function() {
|
||||
createTx(wallet, function(err, txp) {
|
||||
createTx(wallet, true, function(err, txp) {
|
||||
if (err) return;
|
||||
cachedTxp[wallet.id] = txp;
|
||||
apply(txp);
|
||||
|
@ -184,7 +179,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$scope.$apply();
|
||||
};
|
||||
|
||||
var createTx = function(wallet, cb) {
|
||||
var createTx = function(wallet, dryRun, cb) {
|
||||
var config = configService.getSync().wallet;
|
||||
var currentSpendUnconfirmed = config.spendUnconfirmed;
|
||||
var outputs = [];
|
||||
|
@ -227,6 +222,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
txp.payProUrl = paypro;
|
||||
txp.excludeUnconfirmedUtxos = config.spendUnconfirmed ? false : true;
|
||||
txp.feeLevel = config.settings.feeLevel || 'normal';
|
||||
txp.dryRun = dryRun;
|
||||
|
||||
walletService.createTx(wallet, txp, function(err, ctxp) {
|
||||
if (err) {
|
||||
|
@ -247,14 +243,10 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
$scope.approve = function() {
|
||||
var wallet = $scope.wallet;
|
||||
var txp = $scope.txp;
|
||||
if (!wallet) {
|
||||
return setSendError(gettextCatalog.getString('No wallet selected'));
|
||||
};
|
||||
|
||||
if (!txp) {
|
||||
return setSendError(gettextCatalog.getString('No transaction'));
|
||||
};
|
||||
|
||||
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
|
||||
$log.info('No signing proposal: No private key');
|
||||
|
@ -265,9 +257,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
});
|
||||
}
|
||||
|
||||
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
||||
if (err) return setSendError(err);
|
||||
$state.transitionTo('tabs.home');
|
||||
ongoingProcess.set('creatingTx', true);
|
||||
createTx(wallet, false, function(err, txp) {
|
||||
ongoingProcess.set('creatingTx', false);
|
||||
if (err) return;
|
||||
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
||||
if (err) return setSendError(err);
|
||||
$state.transitionTo('tabs.home');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -32,12 +32,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
$scope.sign = function() {
|
||||
$scope.loading = true;
|
||||
walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) {
|
||||
|
||||
console.log('[txpDetails.js.35] AFTER publush'); //TODO
|
||||
|
||||
$scope.$emit('UpdateTx');
|
||||
if (err) return setSendError(err);
|
||||
$scope.close(txp);
|
||||
$scope.close();
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -53,7 +50,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO
|
|||
if (err)
|
||||
return setError(err, gettextCatalog.getString('Could not reject payment'));
|
||||
|
||||
$scope.close(txpr);
|
||||
$scope.close();
|
||||
});
|
||||
|
||||
|
||||
|
@ -90,7 +87,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO
|
|||
return setError(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||
}
|
||||
|
||||
$scope.close(txpb);
|
||||
$scope.close();
|
||||
});
|
||||
}, 10);
|
||||
};
|
||||
|
@ -175,7 +172,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO
|
|||
});
|
||||
};
|
||||
|
||||
$scope.close = function(txp) {
|
||||
$scope.close = function() {
|
||||
$scope.loading = null;
|
||||
$scope.txpDetailsModal.hide();
|
||||
};
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesAbout',
|
||||
function($ionicNavBarDelegate, gettextCatalog) {
|
||||
function($scope, $window, $ionicNavBarDelegate, gettextCatalog) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('About Copay'));
|
||||
|
||||
$scope.version = $window.version;
|
||||
$scope.commitHash = $window.commitHash;
|
||||
});
|
||||
|
|
|
@ -1,23 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
||||
function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService, txpModalService) {
|
||||
function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService, txpModalService, $window) {
|
||||
|
||||
$scope.externalServices = {};
|
||||
$scope.bitpayCardEnabled = true; // TODO
|
||||
|
||||
|
||||
function updateTxps() {
|
||||
profileService.getTxps({
|
||||
limit: 3
|
||||
}, function(err, txps, n) {
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
}
|
||||
$scope.txps = txps;
|
||||
$scope.txpsN = n;
|
||||
$ionicScrollDelegate.resize();
|
||||
|
||||
var setPendingTxps = function(txps) {
|
||||
if (!txps) {
|
||||
$scope.txps = [];
|
||||
return;
|
||||
}
|
||||
$scope.txps = lodash.sortBy(txps, 'createdOn').reverse();
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.updateAllWallets = function() {
|
||||
$scope.wallets = profileService.getWallets();
|
||||
if (lodash.isEmpty($scope.wallets)) return;
|
||||
|
@ -35,20 +42,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
wallet.status = status;
|
||||
}
|
||||
if (++j==i) {
|
||||
profileService.getTxps({
|
||||
limit: 3
|
||||
}, function(err, txps, n) {
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
}
|
||||
$scope.txps = txps;
|
||||
$scope.txpsN = n;
|
||||
$ionicScrollDelegate.resize();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
});
|
||||
updateTxps();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -81,29 +75,18 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
}
|
||||
wallet.status = status;
|
||||
|
||||
$scope.fetchingNotifications = true;
|
||||
profileService.getNotifications({
|
||||
limit: 3
|
||||
}, function(err, notifications) {
|
||||
$scope.fetchingNotifications = false;
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
return;
|
||||
}
|
||||
$scope.notifications = notifications;
|
||||
|
||||
profileService.getTxps({
|
||||
limit: 3
|
||||
}, function(err, txps, n) {
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
}
|
||||
$scope.txps = txps;
|
||||
$scope.txpsN = n;
|
||||
$ionicScrollDelegate.resize();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
})
|
||||
updateTxps();
|
||||
})
|
||||
});
|
||||
};
|
||||
|
@ -123,6 +106,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
$scope.updateWallet(wallet);
|
||||
}),
|
||||
$rootScope.$on('Local/TxAction', function(e, walletId) {
|
||||
$log.debug('Got action for wallet '+ walletId);
|
||||
var wallet = profileService.getWallet(walletId);
|
||||
$scope.updateWallet(wallet);
|
||||
}),
|
||||
|
@ -143,5 +127,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
|
||||
$scope.openTxpModal = txpModalService.open;
|
||||
|
||||
$scope.version = $window.version;
|
||||
$scope.name = $window.appConfig.nameCase;
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -123,7 +123,6 @@ angular.module('copayApp.services')
|
|||
if (wallet.cachedActivity)
|
||||
wallet.cachedActivity.isValid = false;
|
||||
|
||||
|
||||
if (wallet.cachedTxps)
|
||||
wallet.cachedTxps.isValid = false;
|
||||
|
||||
|
@ -908,22 +907,14 @@ angular.module('copayApp.services')
|
|||
|
||||
var txps = [];
|
||||
|
||||
function process(notifications) {
|
||||
if (!notifications) return [];
|
||||
|
||||
var shown = lodash.sortBy(notifications, 'createdOn').reverse();
|
||||
shown = shown.splice(0, opts.limit || MAX);
|
||||
return shown;
|
||||
};
|
||||
|
||||
lodash.each(w, function(x) {
|
||||
if (x.pendingTxps)
|
||||
txps = txps.concat(x.pendingTxps);
|
||||
});
|
||||
txps = lodash.sortBy(txps, 'createdOn');
|
||||
txps = lodash.sortBy(txps, 'pendingForUs', 'createdOn');
|
||||
txps = lodash.compact(lodash.flatten(txps)).slice(0,MAX);
|
||||
var n = txps.length;
|
||||
return cb(null, process(txps), n);
|
||||
return cb(null, txps, n);
|
||||
};
|
||||
|
||||
return root;
|
||||
|
|
|
@ -92,13 +92,17 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
|
||||
root.invalidateCache = function(wallet) {
|
||||
if (wallet.cachedStatus) {
|
||||
if (wallet.cachedStatus)
|
||||
wallet.cachedStatus.isValid = false;
|
||||
}
|
||||
|
||||
if (wallet.completeHistory) {
|
||||
if (wallet.completeHistory)
|
||||
wallet.completeHistory.isValid = false;
|
||||
}
|
||||
|
||||
if (wallet.cachedActivity)
|
||||
wallet.cachedActivity.isValid = false;
|
||||
|
||||
if (wallet.cachedTxps)
|
||||
wallet.cachedTxps.isValid = false;
|
||||
};
|
||||
|
||||
root.getStatus = function(wallet, opts, cb) {
|
||||
|
@ -623,6 +627,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
wallet.removeTxProposal(txp, function(err) {
|
||||
$log.debug('Transaction removed');
|
||||
|
||||
root.invalidateCache(wallet);
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
@ -852,6 +860,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
askPassword(wallet.name, gettext('Enter Spending Password'), function(password) {
|
||||
if (!password) return cb('no password');
|
||||
if (!wallet.checkPassword(password)) return cb('wrong password');
|
||||
|
||||
|
||||
return cb(null, password);
|
||||
});
|
||||
|
@ -862,8 +872,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
ongoingProcess.set('rejectTx', true);
|
||||
root.rejectTx(wallet, txp, function(err, txpr) {
|
||||
root.invalidateCache(wallet);
|
||||
|
||||
ongoingProcess.set('rejectTx', false);
|
||||
|
||||
if (err) return cb(err);
|
||||
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
|
@ -933,6 +943,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
var msg = err.message ?
|
||||
err.message :
|
||||
gettext('The payment was created but could not be completed. Please try again from home screen');
|
||||
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
return cb(msg);
|
||||
}
|
||||
|
@ -943,18 +954,18 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
ongoingProcess.set('broadcastingTx', false);
|
||||
if (err) return cb('sign error' + err);
|
||||
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
var type = root.getViewStatus(wallet, broadcastedTxp);
|
||||
root.openStatusModal(type, broadcastedTxp, function() {
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
});
|
||||
|
||||
return cb(null, broadcastedTxp)
|
||||
});
|
||||
} else {
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
|
||||
var type = root.getViewStatus(wallet, signedTxp);
|
||||
root.openStatusModal(type, signedTxp, function() {
|
||||
root.invalidateCache(wallet);
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
});
|
||||
return cb(null, signedTxp);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
.wallet-activity {
|
||||
|
||||
&-not-pending {
|
||||
background-color:#eee;
|
||||
}
|
||||
|
||||
&-amount {
|
||||
float: right;
|
||||
font-size: 18px;
|
||||
|
|
Loading…
Reference in New Issue