diff --git a/src/js/controllers/addressbookView.js b/src/js/controllers/addressbookView.js
index 3ff3f0f81..a87d23bec 100644
--- a/src/js/controllers/addressbookView.js
+++ b/src/js/controllers/addressbookView.js
@@ -2,27 +2,32 @@
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory) {
- var address = $stateParams.address;
+ $scope.$on("$ionicView.beforeEnter", function(event, data){
+ var address = data.stateParams.address;
- if (!address) {
- $state.go('tabs.addressbook');
- return;
- }
-
- addressbookService.get(address, function(err, obj) {
- if (err) {
- popupService.showAlert(err);
+ if (!address) {
+ $ionicHistory.back();
return;
}
- if (!lodash.isObject(obj)) {
- var name = obj;
- obj = {
- 'name': name,
- 'address': address,
- 'email': ''
- };
- }
- $scope.addressbookEntry = obj;
+
+ addressbookService.get(address, function(err, obj) {
+ if (err) {
+ popupService.showAlert(err);
+ return;
+ }
+ if (!lodash.isObject(obj)) {
+ var name = obj;
+ obj = {
+ 'name': name,
+ 'address': address,
+ 'email': ''
+ };
+ }
+ $scope.addressbookEntry = obj;
+ $timeout(function() {
+ $scope.$apply();
+ });
+ });
});
$scope.sendTo = function() {
diff --git a/src/js/controllers/preferencesHistory.js b/src/js/controllers/preferencesHistory.js
index b1d06c098..9fb6f3c7e 100644
--- a/src/js/controllers/preferencesHistory.js
+++ b/src/js/controllers/preferencesHistory.js
@@ -122,11 +122,13 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
$log.error(err);
return;
}
- $scope.$emit('Local/ClearHistory');
+ $ionicHistory.removeBackView();
+ $state.go('tabs.home');
$timeout(function() {
- $ionicHistory.removeBackView();
- $state.go('tabs.home');
+ $state.transitionTo('tabs.wallet', {
+ walletId: $scope.wallet.id
+ });
}, 100);
});
};
diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js
index 5fd146fa5..7cc36c532 100644
--- a/src/js/controllers/tab-home.js
+++ b/src/js/controllers/tab-home.js
@@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService) {
var wallet;
var listeners = [];
+ var notifications = [];
$scope.externalServices = {};
$scope.bitpayCardEnabled = true; // TODO
$scope.openTxpModal = txpModalService.open;
@@ -102,7 +103,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
var i = $scope.wallets.length;
var j = 0;
var timeSpan = 60 * 60 * 24 * 7;
- var notifications = [];
lodash.each($scope.wallets, function(wallet) {
walletService.getStatus(wallet, {}, function(err, status) {
diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js
index a5571fed8..bd4641d40 100644
--- a/src/js/controllers/tab-receive.js
+++ b/src/js/controllers/tab-receive.js
@@ -38,6 +38,9 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
$scope.addr = addr;
if ($scope.wallet.showBackupNeededModal) $scope.openBackupNeededModal();
+ $timeout(function() {
+ $scope.$apply();
+ }, 100);
});
};
diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js
index c3583249a..6e2aa8d37 100644
--- a/src/js/controllers/tab-send.js
+++ b/src/js/controllers/tab-send.js
@@ -3,10 +3,12 @@
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) {
var originalList;
- var CONTACTS_SHOW_LIMIT = 10;
- var currentContactsPage = 0;
+ var CONTACTS_SHOW_LIMIT;
+ var currentContactsPage;
var updateList = function() {
+ CONTACTS_SHOW_LIMIT = 10;
+ currentContactsPage = 0;
originalList = [];
var wallets = profileService.getWallets({
@@ -15,16 +17,18 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$scope.hasWallets = lodash.isEmpty(wallets) ? false : true;
$scope.oneWallet = wallets.length == 1;
- lodash.each(wallets, function(v) {
- originalList.push({
- color: v.color,
- name: v.name,
- isWallet: true,
- getAddress: function(cb) {
- walletService.getAddress(v, false, cb);
- },
+ if (!$scope.oneWallet) {
+ lodash.each(wallets, function(v) {
+ originalList.push({
+ color: v.color,
+ name: v.name,
+ isWallet: true,
+ getAddress: function(cb) {
+ walletService.getAddress(v, false, cb);
+ },
+ });
});
- });
+ }
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
@@ -50,7 +54,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
- }, 10);
+ }, 100);
});
};
diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js
index ec1492ef9..52dd02e5a 100644
--- a/src/js/controllers/tab-settings.js
+++ b/src/js/controllers/tab-settings.js
@@ -1,13 +1,12 @@
'use strict';
-angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
+angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, uxLanguage, platformInfo, profileService, feeService, configService) {
var updateConfig = function() {
var config = configService.getSync();
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
- var isIOS = platformInfo.isIOS;
$scope.usePushNotifications = isCordova && !isWP;
@@ -22,13 +21,10 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
- $scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) {
- return w.id != self.walletId;
- });
$scope.wallets = profileService.getWallets();
};
- $scope.$on("$ionicView.enter", function(event, data) {
+ $scope.$on("$ionicView.beforeEnter", function(event, data) {
updateConfig();
});
diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js
index 4bcdbebbd..83cf90735 100644
--- a/src/js/controllers/walletDetails.js
+++ b/src/js/controllers/walletDetails.js
@@ -122,9 +122,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.updatingTxHistoryProgress = txs ? txs.length : 0;
$scope.completeTxHistory = txs;
$scope.showHistory();
- $timeout(function() {
- $scope.$apply();
- });
};
$timeout(function() {
@@ -139,9 +136,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
}
$scope.completeTxHistory = txHistory;
$scope.showHistory();
- $timeout(function() {
- $scope.$apply();
- });
+ $scope.$apply();
return cb();
});
});
diff --git a/src/js/directives/directives.js b/src/js/directives/directives.js
index e20643e9f..6eedb407e 100644
--- a/src/js/directives/directives.js
+++ b/src/js/directives/directives.js
@@ -154,6 +154,8 @@ angular.module('copayApp.directives')
link: function(scope, element, attrs) {
scope.$on("$ionicSlides.sliderInitialized", function(event, data) {
scope.slider = data.slider;
+ if(scope.slider.slides.length == 1)
+ scope.slider.lockSwipes();
scope.$emit('Wallet/Changed', scope.wallets ? scope.wallets[0] : null);
});
diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js
index 506af8f12..ee40f741b 100644
--- a/src/js/services/profileService.js
+++ b/src/js/services/profileService.js
@@ -129,26 +129,13 @@ angular.module('copayApp.services')
});
wallet.on('notification', function(n) {
+
$log.debug('BWC Notification:', n);
- // notification?
-
- // TODO (put this in wallet ViewModel)
- if (wallet.cachedStatus)
- wallet.cachedStatus.isValid = false;
-
- if (wallet.completeHistory)
- wallet.completeHistory.isValid = false;
-
- if (wallet.cachedActivity)
- wallet.cachedActivity.isValid = false;
-
- if (wallet.cachedTxps)
- wallet.cachedTxps.isValid = false;
-
-
-
- $rootScope.$emit('bwsEvent', wallet.id, n.type, n);
+ if (n.type == "NewBlock" && n.data.network == "testnet") {
+ throttledBwsEvent(n, wallet);
+ }
+ else newBwsEvent(n, wallet);
});
wallet.on('walletCompleted', function() {
@@ -183,6 +170,26 @@ angular.module('copayApp.services')
return true;
};
+ var throttledBwsEvent = lodash.throttle(function(n, wallet) {
+ newBwsEvent(n, wallet);
+ }, 10000);
+
+ var newBwsEvent = function(n, wallet) {
+ if (wallet.cachedStatus)
+ wallet.cachedStatus.isValid = false;
+
+ if (wallet.completeHistory)
+ wallet.completeHistory.isValid = false;
+
+ if (wallet.cachedActivity)
+ wallet.cachedActivity.isValid = false;
+
+ if (wallet.cachedTxps)
+ wallet.cachedTxps.isValid = false;
+
+ $rootScope.$emit('bwsEvent', wallet.id, n.type, n);
+ };
+
var validationLock = false;
root.runValidation = function(client, delay, retryDelay) {
diff --git a/src/sass/views/address-book.scss b/src/sass/views/address-book.scss
index 24019b52e..4b0f49c58 100644
--- a/src/sass/views/address-book.scss
+++ b/src/sass/views/address-book.scss
@@ -8,6 +8,7 @@
height:100%;
}
#add-contact{
+ min-width: 300px;
img{
width: 10rem;
display: inline-block;
diff --git a/src/sass/views/tab-receive.scss b/src/sass/views/tab-receive.scss
index e24ba8739..0bdbdbb88 100644
--- a/src/sass/views/tab-receive.scss
+++ b/src/sass/views/tab-receive.scss
@@ -11,6 +11,7 @@
background: #fff;
.incomplete {
padding: 50px;
+ height: 350px;
.title {
padding: 20px;
font-size: 25px;
@@ -44,11 +45,13 @@
&-gen-address {}
}
.qr {
- padding: 30px;
+ padding: 50px 0 20px 0;
}
.backup {
background-color: orange;
color: #fff;
+ position: absolute;
+ top: 5px;
i {
padding: 10px;
}