Merge pull request #115 from Bitcoin-com/wallet/task/324

Improvement - 324 - Remove "Bitcoin Core Wallet" toggle entirely.
This commit is contained in:
Sam Cheng Hung 2018-05-16 13:57:05 +08:00 committed by GitHub
commit 12f021979f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 7 additions and 106 deletions

View file

@ -13,10 +13,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
$scope.hideNextSteps = {
value: config.hideNextSteps.enabled
};
$scope.displayBitcoinCoreEnabled = {
value: config.displayBitcoinCore.enabled
};
};
$scope.spendUnconfirmedChange = function() {
@ -52,17 +48,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
});
};
$scope.displayBitcoinCoreChange = function() {
var opts = {
displayBitcoinCore: {
enabled: $scope.displayBitcoinCoreEnabled.value
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.isWindowsPhoneApp = platformInfo.isCordova && platformInfo.isWP;
updateConfig();

View file

@ -83,9 +83,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.$on("$ionicView.enter", function(event, data) {
$ionicNavBarDelegate.showBar(true);
updateAllWallets(function() {
profileService.initBitcoinCoreDisplay();
});
updateAllWallets();
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
@ -126,8 +124,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.nextStepsItems = nextStepsService.get();
}
$scope.displayBitcoinCore = config.displayBitcoinCore.enabled;
$scope.showServices = true;
pushNotificationsService.init();
firebaseEventsService.init();
@ -316,9 +312,4 @@ angular.module('copayApp.controllers').controller('tabHomeController',
updateAllWallets();
};
$rootScope.$on('Local/SettingsUpdated', function(e, walletId) {
configService.whenAvailable(function(config) {
$scope.displayBitcoinCore = config.displayBitcoinCore.enabled;
});
});
});

View file

@ -81,7 +81,6 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
coin: v.coin,
network: v.network,
balanceString: v.cachedBalance,
displayWallet: v.coin == 'btc' ? config.displayBitcoinCore.enabled : true,
getAddress: function(cb) {
walletService.getAddress(v, false, cb);
},

View file

@ -11,11 +11,9 @@ angular.module('copayApp.directives')
show: '=walletSelectorShow',
wallets: '=walletSelectorWallets',
selectedWallet: '=walletSelectorSelectedWallet',
onSelect: '=walletSelectorOnSelect',
alwaysDisplayBitcoinCore: '=walletSelectorAlwaysDisplayBitcoinCore'
onSelect: '=walletSelectorOnSelect'
},
link: function(scope, element, attrs) {
scope.displayWallet = true;
scope.hide = function() {
scope.show = false;
};
@ -28,19 +26,6 @@ angular.module('copayApp.directives')
scope.$watch('wallets', function(newValue, oldValue) {
scope.wallets = newValue;
});
scope.initDisplayBitcoinCoreConfig = function() {
configService.whenAvailable(function(config) {
scope.displayBitcoinCore = config.displayBitcoinCore.enabled;
scope.initWalletDisplay();
});
};
scope.initWalletDisplay = function() {
scope.displayWallet = scope.alwaysDisplayBitcoinCore ? true : scope.displayBitcoinCore;
};
scope.initDisplayBitcoinCoreConfig();
$rootScope.$on('Local/SettingsUpdated', function(e, walletId) {
scope.initDisplayBitcoinCoreConfig();
});
}
};
});

View file

@ -85,10 +85,6 @@ angular.module('copayApp.services').factory('configService', function(storageSer
enabled: true,
},
displayBitcoinCore: {
enabled: false,
},
hideNextSteps: {
enabled: isWindowsPhoneApp ? true : false,
},

View file

@ -1037,39 +1037,6 @@ angular.module('copayApp.services')
return cb(null, txps, n);
};
// Displays Bitcoin Core Wallets if BTC balance is more than 0
root.initBitcoinCoreDisplay = function() {
storageService.checkIfFlagIsSet('displayBitcoinCoreFlag')
.then(function(result) {
// Perform checks for flags which are even set to true once more, set the new flag value to 1
if (result === false || result === true) {
root.checkBtcBalanceAndInitDisplay(1);
}
});
};
root.checkBtcBalanceAndInitDisplay = function(flagValue) {
var walletsBtc = root.getWallets({coin: 'btc'});
if (walletsBtc.length > 0) {
// Do not trust cachedBalance as it is added asynchronously. Using a new promise-based function.
root.getWalletsBalance(walletsBtc)
.then(function(totalBalance) {
var enableDisplayBitcoinCore = totalBalance > 0 ? true : false;
var opts = {
displayBitcoinCore: {
enabled: enableDisplayBitcoinCore
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
storageService.activateDisplayBitcoinCoreFlag(flagValue);
});
}
}
// Calculate wallets total balance (Promise). Attempts to fix asynchronous issue with cachedBalance not being available when it's needed
root.getWalletsBalance = function(wallets) {
return new Promise(function(resolve, reject) {

View file

@ -645,13 +645,6 @@ angular.module('copayApp.services')
});
});
}
root.activateDisplayBitcoinCoreFlag = function(value) {
var flag = {
initialized: value
};
storage.set('displayBitcoinCoreFlag', flag, function() { });
}
return root;
});