-
Total Locked Balance:
{{lockedBalanceStr}}
diff --git a/src/js/controllers/proposals.js b/src/js/controllers/proposals.js
new file mode 100644
index 000000000..3747cd706
--- /dev/null
+++ b/src/js/controllers/proposals.js
@@ -0,0 +1,23 @@
+
+'use strict';
+
+angular.module('copayApp.controllers').controller('proposalsController',
+ function($timeout, $scope, profileService, $log, txpModalService) {
+ var self = this;
+
+
+ $scope.init = function() {
+ profileService.getTxps(50, function(err, txps) {
+ if (err) {
+ console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
+ return;
+ }
+ $scope.txps = txps;
+ $timeout(function() {
+ $scope.$apply();
+ }, 1);
+ });
+ }
+
+ $scope.openTxpModal = txpModalService.open;
+ });
diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js
index 7b410784e..20d85c7d6 100644
--- a/src/js/controllers/tab-home.js
+++ b/src/js/controllers/tab-home.js
@@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
- function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService) {
+ function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService, txpModalService) {
$scope.externalServices = {};
$scope.bitpayCardEnabled = true; // TODO
@@ -31,44 +31,44 @@ angular.module('copayApp.controllers').controller('tabHomeController',
walletService.getStatus(wallet, {}, function(err, status) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
- return;
+ } else {
+ 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);
+ });
}
- wallet.status = status;
});
});
$scope.fetchingNotifications = true;
-
- profileService.getTxps({
+ profileService.getNotifications({
limit: 3
- }, function(err, txps) {
-console.log('[tab-home.js.44:txps:]',txps); //TODO
+ }, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
+ return;
}
- $scope.txps = txps;
+ $scope.fetchingNotifications = false;
+ $scope.notifications = n;
$ionicScrollDelegate.resize();
$timeout(function() {
$scope.$apply();
}, 1);
-
- profileService.getNotifications({
- limit: 3
- }, function(err, n) {
- if (err) {
- console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
- return;
- }
- $scope.fetchingNotifications = false;
- $scope.notifications = n;
- $ionicScrollDelegate.resize();
-
- $timeout(function() {
- $scope.$apply();
- }, 1);
- })
})
};
@@ -83,17 +83,27 @@ console.log('[tab-home.js.44:txps:]',txps); //TODO
profileService.getNotifications({
limit: 3
- }, function(err, n) {
+ }, function(err, notifications) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
- $scope.notifications = n;
- $ionicScrollDelegate.resize();
+ $scope.notifications = notifications;
- $timeout(function() {
- $scope.$apply();
- }, 1);
+ 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);
+ })
})
});
};
@@ -131,4 +141,7 @@ console.log('[tab-home.js.44:txps:]',txps); //TODO
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
});
+ $scope.openTxpModal = txpModalService.open;
+
+
});
diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js
index 9994be0dd..7d1748b7c 100644
--- a/src/js/controllers/walletDetails.js
+++ b/src/js/controllers/walletDetails.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup) {
+angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@@ -47,26 +47,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
};
- var glideraActive = true; // TODO TODO TODO
- // isGlidera flag is a security measure so glidera status is not
- // only determined by the tx.message
- $scope.openTxpModal = function(tx) {
- var config = configService.getSync().wallet;
- var scope = $rootScope.$new(true);
- scope.tx = tx;
- scope.wallet = tx.wallet;
- scope.copayers = tx.wallet.copayers;
- scope.isGlidera = glideraActive;
- scope.currentSpendUnconfirmed = config.spendUnconfirmed;
-
- $ionicModal.fromTemplateUrl('views/modals/txp-details.html', {
- scope: scope
- }).then(function(modal) {
- scope.txpDetailsModal = modal;
- scope.txpDetailsModal.show();
- });
- };
-
+ $scope.openTxpModal = txpModalService.open;
var listeners = [
$rootScope.$on('bwsEvent', function(e, walletId) {
diff --git a/src/js/routes.js b/src/js/routes.js
index d580f3f4d..05c7096ff 100644
--- a/src/js/routes.js
+++ b/src/js/routes.js
@@ -147,7 +147,10 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/activity',
templateUrl: 'views/activity.html'
})
-
+ .state('proposals', {
+ url: '/proposals',
+ templateUrl: 'views/proposals.html'
+ })
/*
*
diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js
index 0cbb179a5..05495fcc4 100644
--- a/src/js/services/profileService.js
+++ b/src/js/services/profileService.js
@@ -900,6 +900,7 @@ angular.module('copayApp.services')
root.getTxps = function(opts, cb) {
+ var MAX = 100;
opts = opts || {};
var w = root.getWallets();
@@ -920,8 +921,9 @@ angular.module('copayApp.services')
txps = txps.concat(x.pendingTxps);
});
txps = lodash.sortBy(txps, 'createdOn');
- txps = lodash.compact(lodash.flatten(notifications)).slice(0,MAX);
- return cb(null, process(txps));
+ txps = lodash.compact(lodash.flatten(txps)).slice(0,MAX);
+ var n = txps.length;
+ return cb(null, process(txps), n);
};
return root;
diff --git a/src/js/services/txpModalService.js b/src/js/services/txpModalService.js
new file mode 100644
index 000000000..a0cfce6e2
--- /dev/null
+++ b/src/js/services/txpModalService.js
@@ -0,0 +1,31 @@
+'use strict';
+
+angular.module('copayApp.services').factory('txpModalService', function(configService, $rootScope, $ionicModal) {
+
+ var root = {};
+
+
+ var glideraActive = true; // TODO TODO TODO
+ // isGlidera flag is a security measure so glidera status is not
+ // only determined by the tx.message
+
+
+ root.open = function(tx) {
+ var config = configService.getSync().wallet;
+ var scope = $rootScope.$new(true);
+ scope.tx = tx;
+ scope.wallet = tx.wallet;
+ scope.copayers = tx.wallet.copayers;
+ scope.isGlidera = glideraActive;
+ scope.currentSpendUnconfirmed = config.spendUnconfirmed;
+
+ $ionicModal.fromTemplateUrl('views/modals/txp-details.html', {
+ scope: scope
+ }).then(function(modal) {
+ scope.txpDetailsModal = modal;
+ scope.txpDetailsModal.show();
+ });
+ };
+
+ return root;
+});