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>
<strong>{{addressbookEntry.name}}</strong>
</div>
<div class="item item-text-wrap">
<div class="item item-text-wrap" ng-show="addressbookEntry.email">
<h3 translate>Email</h3>
<strong>{{addressbookEntry.email}}</strong>
</div>

View file

@ -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() {

View file

@ -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);
});
};

View file

@ -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();
});