can switch between addresses on address screen

This commit is contained in:
Kadir Sekha 2018-01-11 12:59:26 +09:00
commit 353214f50f
3 changed files with 42 additions and 7 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService, txFormatService, feeService) {
angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService, txFormatService, feeService, bitcoinCashJsService) {
var UNUSED_ADDRESS_LIMIT = 5;
var BALANCE_ADDRESS_LIMIT = 5;
var withBalance, cachedWallet;
@ -58,6 +58,19 @@ angular.module('copayApp.controllers').controller('addressesController', functio
};
$scope.allAddresses = $scope.noBalance.concat(withBalance);
if ($scope.wallet.coin == 'bch') {
lodash.each($scope.allAddresses, function(a) {
a.translatedAddresses = bitcoinCashJsService.translateAddresses(a.address);
});
var cashaddrDate = new Date(2018, 0, 15);
var currentDate = new Date();
$scope.addressType = {
type: currentDate >= cashaddrDate ? 'cashaddr' : 'legacy'
};
}
cachedWallet = $scope.wallet.id;
$scope.loading = false;
$log.debug('Addresses cached for Wallet:', cachedWallet);