From 6ee9fbe77c3bc29d61b7d576f71aa350752b2e74 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Thu, 20 Oct 2016 09:51:01 -0400 Subject: [PATCH 1/3] redefined logic to use wallet name only if not present alias available --- src/js/controllers/preferencesAlias.js | 8 +------- www/views/preferencesAlias.html | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/js/controllers/preferencesAlias.js b/src/js/controllers/preferencesAlias.js index e5967199c..ae79fde72 100644 --- a/src/js/controllers/preferencesAlias.js +++ b/src/js/controllers/preferencesAlias.js @@ -7,6 +7,7 @@ angular.module('copayApp.controllers').controller('preferencesAliasController', var config = configService.getSync(); $scope.walletName = wallet.credentials.walletName; + $scope.walletAlias = config.aliasFor[walletId] || wallet.credentials.walletName; $scope.alias = { value: (config.aliasFor && config.aliasFor[walletId]) || wallet.credentials.walletName }; @@ -23,11 +24,4 @@ angular.module('copayApp.controllers').controller('preferencesAliasController', $ionicHistory.goBack(); }); }; - $scope.valueCheck = function() { - if ($scope.alias.value == wallet.credentials.walletName || $scope.alias.value == '') $scope.disableSave = true; - else $scope.disableSave = false; - }; - $scope.$watch('alias.value', function(newvalue, oldvalue) { - $scope.valueCheck(); - }); }); diff --git a/www/views/preferencesAlias.html b/www/views/preferencesAlias.html index 292842c33..c34f241c6 100644 --- a/www/views/preferencesAlias.html +++ b/www/views/preferencesAlias.html @@ -20,7 +20,7 @@ From d2ca85a03670c042fe9e7f328c516ae9180019ec Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Thu, 20 Oct 2016 10:15:27 -0400 Subject: [PATCH 2/3] minor update to how value is set --- src/js/controllers/preferencesAlias.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/controllers/preferencesAlias.js b/src/js/controllers/preferencesAlias.js index ae79fde72..1d95d27d0 100644 --- a/src/js/controllers/preferencesAlias.js +++ b/src/js/controllers/preferencesAlias.js @@ -9,7 +9,7 @@ angular.module('copayApp.controllers').controller('preferencesAliasController', $scope.walletName = wallet.credentials.walletName; $scope.walletAlias = config.aliasFor[walletId] || wallet.credentials.walletName; $scope.alias = { - value: (config.aliasFor && config.aliasFor[walletId]) || wallet.credentials.walletName + value: $scope.walletAlias }; $scope.save = function() { From d9f8501b8fc7f14f630a949cd2254bab631b02b6 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Thu, 20 Oct 2016 10:35:18 -0400 Subject: [PATCH 3/3] changed or operator to ternary operator --- src/js/controllers/preferencesAlias.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/controllers/preferencesAlias.js b/src/js/controllers/preferencesAlias.js index 1d95d27d0..5060335c1 100644 --- a/src/js/controllers/preferencesAlias.js +++ b/src/js/controllers/preferencesAlias.js @@ -7,7 +7,7 @@ angular.module('copayApp.controllers').controller('preferencesAliasController', var config = configService.getSync(); $scope.walletName = wallet.credentials.walletName; - $scope.walletAlias = config.aliasFor[walletId] || wallet.credentials.walletName; + $scope.walletAlias = config.aliasFor && config.aliasFor[walletId] ? config.aliasFor[walletId] : wallet.credentials.walletName; $scope.alias = { value: $scope.walletAlias };