This commit is contained in:
Javier 2016-09-20 12:02:45 -03:00
commit ae266e397b
6 changed files with 95 additions and 56 deletions

View file

@ -1,65 +1,65 @@
<span class="wallet-activity"> <span class="wallet-activity">
<div ng-if="x.type == 'NewCopayer' && x.wallet.n>1" translate> <div ng-if="notification.type == 'NewCopayer' && notification.wallet.n>1" translate>
Copayer joined Copayer joined
</div> </div>
<div ng-if="x.type == 'NewCopayer' && x.wallet.n==1" translate> <div ng-if="notification.type == 'NewCopayer' && notification.wallet.n==1" translate>
Wallet created Wallet created
</div> </div>
<div ng-if="x.type == 'NewOutgoingTx'"> <div ng-if="notification.type == 'NewOutgoingTx'">
<span translate>Payment Sent </span> <span translate>Payment Sent </span>
<div class="wallet-activity-amount"> <div class="wallet-activity-amount">
{{x.amountStr}} {{notification.amountStr}}
</div> </div>
</div> </div>
<div ng-if="x.type == 'NewIncomingTx'"> <div ng-if="notification.type == 'NewIncomingTx'">
<span translate>Payment Received</span> <span translate>Payment Received</span>
<div class="wallet-activity-amount"> <div class="wallet-activity-amount">
{{x.amountStr}} {{notification.amountStr}}
</div> </div>
</div> </div>
<div ng-if="x.type == 'TxProposalRemoved'"> <div ng-if="notification.type == 'TxProposalRemoved'">
<span translate>Proposal Deleted</span>: <span translate>Proposal Deleted</span>:
<b>{{x.message}}</b> <b>{{notification.message}}</b>
<div class="wallet-activity-amount"> <div class="wallet-activity-amount">
{{x.amountStr}}: {{notification.amountStr}}:
</div> </div>
</div> </div>
<div ng-if="x.type == 'TxProposalRejectedBy'"> <div ng-if="notification.type == 'TxProposalRejectedBy'">
<span translate>Proposal Rejected</span>: <span translate>Proposal Rejected</span>:
<b>{{x.message}}</b> <b>{{notification.message}}</b>
<div class="wallet-activity-amount"> <div class="wallet-activity-amount">
{{x.amountStr}}: {{notification.amountStr}}:
</div> </div>
</div> </div>
<span ng-if="x.type == 'NewTxProposal'"> <span ng-if="notification.type == 'NewTxProposal'">
<span translate>New Proposal</span>: <span translate>New Proposal</span>:
<b>{{x.message}}</b> <b>{{notification.message}}</b>
<div class="wallet-activity-amount"> <div class="wallet-activity-amount">
{{x.amountStr}} {{notification.amountStr}}
</div> </div>
</span> </span>
<span ng-if="x.type == 'TxProposalAcceptedBy'"> <span ng-if="notification.type == 'TxProposalAcceptedBy'">
<span translate>Proposal Accepted</span>: <span translate>Proposal Accepted</span>:
<b>{{x.message}}</b> <b>{{notification.message}}</b>
<div class="wallet-activity-amount"> <div class="wallet-activity-amount">
{{x.amountStr}} {{notification.amountStr}}
</div> </div>
</span> </span>
<p class="wallet-activity-note"> <p class="wallet-activity-note">
<!-- {{x.types}} --> <!-- {{notification.types}} -->
<i class="icon ion-record wallet-activity-note-child" ng-style="{'color':x.wallet.color}"></i> <i class="icon ion-record wallet-activity-note-child" ng-style="{'color':notification.wallet.color}"></i>
<span ng-if="x.creatorName" class="wallet-activity-note-child">{{ x.creatorName}}@</span> <span ng-if="notification.creatorName" class="wallet-activity-note-child">{{ notification.creatorName}}@</span>
<span class="wallet-activity-note-child">{{x.wallet.name}}</span> <span class="wallet-activity-note-child">{{notification.wallet.name}}</span>
<time class="wallet-activity-note-child">{{ x.createdOn * 1000 | amTimeAgo}}</time> <time class="wallet-activity-note-child">{{ notification.createdOn * 1000 | amTimeAgo}}</time>
</p> </p>
</span> </span>

View file

@ -9,11 +9,11 @@
</ion-header-bar> </ion-header-bar>
<ion-content> <ion-content>
<div class="header-modal text-center" ng-init="getAlternativeAmount(btx); showRate = false"> <div class="header-modal text-center" ng-init="showRate = false">
<div ng-show="btx.action != 'invalid'"> <div ng-show="btx.action != 'invalid'">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg" ng-if="color">
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/> <img src="img/icon-wallet.svg" ng-style="{'background-color': color}" class="bg"/>
</i> </i>
<div class="size-36" copy-to-clipboard="btx.amountStr"> <div class="size-36" copy-to-clipboard="btx.amountStr">

View file

@ -35,7 +35,7 @@
</a> </a>
</div> </div>
<div class="list card" ng-if="notifications.length > 0"> <div class="list card" ng-if="notifications[0]">
<a class="item item-icon-right item-heading" ui-sref="tabs.activity" translate> <a class="item item-icon-right item-heading" ui-sref="tabs.activity" translate>
Recent Activity Recent Activity
<i class="icon nav-item-arrow-right"></i> <i class="icon nav-item-arrow-right"></i>
@ -44,7 +44,7 @@
<ion-spinner icon="lines"></ion-spinner> <ion-spinner icon="lines"></ion-spinner>
<div translate>Updating activity. Please stand by</div> <div translate>Updating activity. Please stand by</div>
</span> </span>
<a class="item" ng-repeat="x in notifications" ng-click="x.action()"> <a class="item" ng-repeat="notification in notifications" ng-click="openTxModal(notification)">
<span ng-include="'views/includes/walletActivity.html'"></span> <span ng-include="'views/includes/walletActivity.html'"></span>
</a> </a>
</div> </div>

View file

@ -1,28 +1,54 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $scope, $filter, $stateParams, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) { angular.module('copayApp.controllers').controller('txDetailsController', function($log, $timeout, $scope, $filter, $stateParams, walletService, lodash, gettextCatalog, profileService, configService, txFormatService, externalLinkService, popupService) {
var self = $scope.self; var self = $scope.self;
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId || $scope.walletId);
var config = configService.getSync(); var config = configService.getSync();
var configWallet = config.wallet; var configWallet = config.wallet;
var walletSettings = configWallet.settings; var walletSettings = configWallet.settings;
$scope.init = function() { $scope.init = function() {
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode; findTx($scope.txid, function(err, tx) {
$scope.color = wallet.color; if (err) {
$scope.copayerId = wallet.credentials.copayerId; $log.error(err);
$scope.isShared = wallet.credentials.n > 1; return;
}
console.log('TX FOUND', tx);
$scope.btx = lodash.cloneDeep(tx);
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode;
$scope.color = wallet.color;
$scope.copayerId = wallet.credentials.copayerId;
$scope.isShared = wallet.credentials.n > 1;
// $scope.btx.amountStr = txFormatService.formatAmount($scope.btx.amount, true) + ' ' + walletSettings.unitName;
// $scope.btx.feeStr = txFormatService.formatAmount($scope.btx.fees, true) + ' ' + walletSettings.unitName;
$scope.btx.feeLevel = walletSettings.feeLevel;
$scope.btx.amountStr = txFormatService.formatAmount($scope.btx.amount, true) + ' ' + walletSettings.unitName; if ($scope.btx.action != 'invalid') {
$scope.btx.feeStr = txFormatService.formatAmount($scope.btx.fees, true) + ' ' + walletSettings.unitName; if ($scope.btx.action == 'sent') $scope.title = gettextCatalog.getString('Sent Funds');
$scope.btx.feeLevel = walletSettings.feeLevel; if ($scope.btx.action == 'received') $scope.title = gettextCatalog.getString('Received Funds');
if ($scope.btx.action == 'moved') $scope.title = gettextCatalog.getString('Moved Funds');
}
if ($scope.btx.action != 'invalid') { initActionList();
if ($scope.btx.action == 'sent') $scope.title = gettextCatalog.getString('Sent Funds'); getAlternativeAmount();
if ($scope.btx.action == 'received') $scope.title = gettextCatalog.getString('Received Funds');
if ($scope.btx.action == 'moved') $scope.title = gettextCatalog.getString('Moved Funds'); $timeout(function() {
} $scope.$apply();
initActionList(); }, 10);
});
};
function findTx(txid, cb) {
walletService.getTxHistory(wallet, {}, function(err, txHistory) {
if (err) return cb(err);
var tx = lodash.find(txHistory, {
txid: txid
});
if (tx) return cb(null, tx);
else return cb();
});
}; };
function initActionList() { function initActionList() {
@ -90,7 +116,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
}); });
}; };
$scope.getAlternativeAmount = function() { var getAlternativeAmount = function() {
var satToBtc = 1 / 100000000; var satToBtc = 1 / 100000000;
wallet.getFiatRate({ wallet.getFiatRate({
@ -123,5 +149,4 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.cancel = function() { $scope.cancel = function() {
$scope.txDetailsModal.hide(); $scope.txDetailsModal.hide();
}; };
}); });

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tabHomeController', angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicScrollDelegate, lodash, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window) { function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, lodash, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window) {
$scope.externalServices = {}; $scope.externalServices = {};
$scope.bitpayCardEnabled = true; // TODO $scope.bitpayCardEnabled = true; // TODO
$scope.openTxpModal = txpModalService.open; $scope.openTxpModal = txpModalService.open;
@ -16,6 +16,18 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp; $scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
}); });
$scope.openTxModal = function(n) {
console.log(n);
$scope.txid = n.txid;
$scope.walletId = n.walletId;
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
scope: $scope
}).then(function(modal) {
$scope.txDetailsModal = modal;
$scope.txDetailsModal.show();
});
};
$scope.openWallet = function(wallet) { $scope.openWallet = function(wallet) {
if (!wallet.isComplete()) { if (!wallet.isComplete()) {
return $state.go('tabs.copayers', { return $state.go('tabs.copayers', {
@ -112,7 +124,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.hideHomeTip = function() { $scope.hideHomeTip = function() {
$scope.homeTip = null; $scope.homeTip = null;
$state.transitionTo($state.current, null, { $state.transitionTo($state.current, null, {
reload: false, inherit: false, notify: false reload: false,
inherit: false,
notify: false
}); });
}; };

View file

@ -822,11 +822,11 @@ angular.module('copayApp.services')
x.action = function() { x.action = function() {
// TODO? // TODO?
$state.go('tabs.details', { // $state.go('tabs.details', {
walletId: x.walletId, // walletId: x.walletId,
txpId: x.txpId, // txpId: x.txpId,
txid: x.txid, // txid: x.txid,
}); // });
}; };
}); });