open txp modal from recent activity

This commit is contained in:
Javier 2016-09-21 11:38:38 -03:00
commit b146d40539
4 changed files with 38 additions and 9 deletions

View file

@ -19,7 +19,7 @@
<div ng-if="!fetchingNotifications"> <div ng-if="!fetchingNotifications">
<div class="list card"> <div class="list card">
<div class="item" ng-repeat="notification in notifications" ng-click="openTxModal(notification)"> <div class="item" ng-repeat="notification in notifications" ng-click="openNotificationModal(notification)">
<span ng-include="'views/includes/walletActivity.html'"></span> <span ng-include="'views/includes/walletActivity.html'"></span>
</div> </div>

View file

@ -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="notification in notifications" ng-click="openTxModal(notification)"> <a class="item" ng-repeat="notification in notifications" ng-click="openNotificationModal(notification)">
<span ng-include="'views/includes/walletActivity.html'"></span> <span ng-include="'views/includes/walletActivity.html'"></span>
</a> </a>
</div> </div>

View file

@ -1,7 +1,9 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('activityController', angular.module('copayApp.controllers').controller('activityController',
function($timeout, $scope, $log, $ionicModal, lodash, profileService, walletService, ongoingProcess, popupService, gettextCatalog) { function($timeout, $scope, $log, $ionicModal, lodash, txpModalService, profileService, walletService, ongoingProcess, popupService, gettextCatalog) {
$scope.openTxpModal = txpModalService.open;
$scope.init = function() { $scope.init = function() {
$scope.fetchingNotifications = true; $scope.fetchingNotifications = true;
profileService.getNotifications(50, function(err, n) { profileService.getNotifications(50, function(err, n) {
@ -11,13 +13,29 @@ angular.module('copayApp.controllers').controller('activityController',
} }
$scope.fetchingNotifications = false; $scope.fetchingNotifications = false;
$scope.notifications = n; $scope.notifications = n;
$timeout(function() {
$scope.$apply();
}, 1);
});
}
$scope.openTxModal = function(n) { profileService.getTxps({}, function(err, txps, n) {
if (err) $log.error(err);
$scope.txps = txps;
$timeout(function() {
$scope.$apply();
});
});
});
};
$scope.openNotificationModal = function(n) {
if (!n.txpId && n.txid) {
openTxModal(n);
} else {
var txp = lodash.find($scope.txps, {
id: n.txpId
});
if (txp) txpModalService.open(txp);
}
};
var openTxModal = function(n) {
var wallet = profileService.getWallet(n.walletId); var wallet = profileService.getWallet(n.walletId);
ongoingProcess.set('loadingTxInfo', true); ongoingProcess.set('loadingTxInfo', true);

View file

@ -16,7 +16,18 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp; $scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
}); });
$scope.openTxModal = function(n) { $scope.openNotificationModal = function(n) {
if (!n.txpId && n.txid) {
openTxModal(n);
} else {
var txp = lodash.find($scope.txps, {
id: n.txpId
});
if (txp) txpModalService.open(txp);
}
};
var openTxModal = function(n) {
var wallet = profileService.getWallet(n.walletId); var wallet = profileService.getWallet(n.walletId);
ongoingProcess.set('loadingTxInfo', true); ongoingProcess.set('loadingTxInfo', true);