Fix send, settings and addressbook views

This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-30 13:19:29 -03:00
commit aac067e216
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
4 changed files with 42 additions and 37 deletions

View file

@ -18,7 +18,7 @@
<h3 translate>Name</h3> <h3 translate>Name</h3>
<strong>{{addressbookEntry.name}}</strong> <strong>{{addressbookEntry.name}}</strong>
</div> </div>
<div class="item item-text-wrap"> <div class="item item-text-wrap" ng-show="addressbookEntry.email">
<h3 translate>Email</h3> <h3 translate>Email</h3>
<strong>{{addressbookEntry.email}}</strong> <strong>{{addressbookEntry.email}}</strong>
</div> </div>

View file

@ -2,27 +2,32 @@
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory) { 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) { if (!address) {
$state.go('tabs.addressbook'); $ionicHistory.back();
return;
}
addressbookService.get(address, function(err, obj) {
if (err) {
popupService.showAlert(err);
return; return;
} }
if (!lodash.isObject(obj)) {
var name = obj; addressbookService.get(address, function(err, obj) {
obj = { if (err) {
'name': name, popupService.showAlert(err);
'address': address, return;
'email': '' }
}; if (!lodash.isObject(obj)) {
} var name = obj;
$scope.addressbookEntry = obj; obj = {
'name': name,
'address': address,
'email': ''
};
}
$scope.addressbookEntry = obj;
$timeout(function() {
$scope.$apply();
});
});
}); });
$scope.sendTo = function() { $scope.sendTo = function() {

View file

@ -3,10 +3,12 @@
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) { angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) {
var originalList; var originalList;
var CONTACTS_SHOW_LIMIT = 10; var CONTACTS_SHOW_LIMIT;
var currentContactsPage = 0; var currentContactsPage;
var updateList = function() { var updateList = function() {
CONTACTS_SHOW_LIMIT = 10;
currentContactsPage = 0;
originalList = []; originalList = [];
var wallets = profileService.getWallets({ var wallets = profileService.getWallets({
@ -15,16 +17,18 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$scope.hasWallets = lodash.isEmpty(wallets) ? false : true; $scope.hasWallets = lodash.isEmpty(wallets) ? false : true;
$scope.oneWallet = wallets.length == 1; $scope.oneWallet = wallets.length == 1;
lodash.each(wallets, function(v) { if (!$scope.oneWallet) {
originalList.push({ lodash.each(wallets, function(v) {
color: v.color, originalList.push({
name: v.name, color: v.color,
isWallet: true, name: v.name,
getAddress: function(cb) { isWallet: true,
walletService.getAddress(v, false, cb); getAddress: function(cb) {
}, walletService.getAddress(v, false, cb);
},
});
}); });
}); }
addressbookService.list(function(err, ab) { addressbookService.list(function(err, ab) {
if (err) $log.error(err); if (err) $log.error(err);
@ -50,7 +54,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
$scope.$apply(); $scope.$apply();
}, 10); }, 100);
}); });
}; };

View file

@ -1,13 +1,12 @@
'use strict'; '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 updateConfig = function() {
var config = configService.getSync(); var config = configService.getSync();
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
var isIOS = platformInfo.isIOS;
$scope.usePushNotifications = isCordova && !isWP; $scope.usePushNotifications = isCordova && !isWP;
@ -22,13 +21,10 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$scope.feeOpts = feeService.feeOpts; $scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel(); $scope.currentFeeLevel = feeService.getCurrentFeeLevel();
$scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) {
return w.id != self.walletId;
});
$scope.wallets = profileService.getWallets(); $scope.wallets = profileService.getWallets();
}; };
$scope.$on("$ionicView.enter", function(event, data) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
updateConfig(); updateConfig();
}); });