From b146d405391a23deff57821cf0f5346ba67811d4 Mon Sep 17 00:00:00 2001 From: Javier Date: Wed, 21 Sep 2016 11:38:38 -0300 Subject: [PATCH] open txp modal from recent activity --- public/views/activity.html | 2 +- public/views/tab-home.html | 2 +- src/js/controllers/activity.js | 32 +++++++++++++++++++++++++------- src/js/controllers/tab-home.js | 13 ++++++++++++- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/public/views/activity.html b/public/views/activity.html index c020fa25f..ea976412a 100644 --- a/public/views/activity.html +++ b/public/views/activity.html @@ -19,7 +19,7 @@
-
+
diff --git a/public/views/tab-home.html b/public/views/tab-home.html index c870f2088..a60921131 100644 --- a/public/views/tab-home.html +++ b/public/views/tab-home.html @@ -44,7 +44,7 @@
Updating activity. Please stand by
- +
diff --git a/src/js/controllers/activity.js b/src/js/controllers/activity.js index a55eb40f0..c1b7a8a2c 100644 --- a/src/js/controllers/activity.js +++ b/src/js/controllers/activity.js @@ -1,7 +1,9 @@ 'use strict'; 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.fetchingNotifications = true; profileService.getNotifications(50, function(err, n) { @@ -11,13 +13,29 @@ angular.module('copayApp.controllers').controller('activityController', } $scope.fetchingNotifications = false; $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); ongoingProcess.set('loadingTxInfo', true); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 2acf9428c..4a6965e31 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -16,7 +16,18 @@ angular.module('copayApp.controllers').controller('tabHomeController', $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); ongoingProcess.set('loadingTxInfo', true);