Adds setting for bitcoin cash support

This commit is contained in:
Gustavo Maximiliano Cortez 2017-08-30 16:38:42 -03:00
commit 7d64827616
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
12 changed files with 34 additions and 51 deletions

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $log, configService, platformInfo) { angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $log, configService, platformInfo, externalLinkService) {
var updateConfig = function() { var updateConfig = function() {
var config = configService.getSync(); var config = configService.getSync();
@ -66,6 +66,10 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
}); });
}; };
$scope.openExternalLink = function(url) {
externalLinkService.open(url);
};
$scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.isWindowsPhoneApp = platformInfo.isCordova && platformInfo.isWP; $scope.isWindowsPhoneApp = platformInfo.isCordova && platformInfo.isWP;
updateConfig(); updateConfig();

View file

@ -22,12 +22,16 @@ angular.module('copayApp.controllers').controller('createController',
$scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.formData = {}; $scope.formData = {};
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
var config = configService.getSync();
var tc = $state.current.name == 'tabs.add.create-personal' ? 1 : defaults.wallet.totalCopayers; var tc = $state.current.name == 'tabs.add.create-personal' ? 1 : defaults.wallet.totalCopayers;
$scope.formData.account = 1; $scope.formData.account = 1;
$scope.formData.bwsurl = defaults.bws.url; $scope.formData.bwsurl = defaults.bws.url;
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1); $scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.formData.derivationPath = derivationPathHelper.default; $scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.coin = 'btc'; $scope.formData.coin = 'btc';
if (config.cashSupport.enabled) $scope.enableCash = true;
$scope.setTotalCopayers(tc); $scope.setTotalCopayers(tc);
updateRCSelect(tc); updateRCSelect(tc);
resetPasswordFields(); resetPasswordFields();

View file

@ -5,6 +5,7 @@ angular.module('copayApp.controllers').controller('importController',
var reader = new FileReader(); var reader = new FileReader();
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
var config = configService.getSync();
var errors = bwcService.getErrors(); var errors = bwcService.getErrors();
$scope.init = function() { $scope.init = function() {
@ -20,6 +21,8 @@ angular.module('copayApp.controllers').controller('importController',
$scope.isCopay = appConfigService.name == 'copay'; $scope.isCopay = appConfigService.name == 'copay';
$scope.fromHardwareWallet = { value: false }; $scope.fromHardwareWallet = { value: false };
if (config.cashSupport.enabled) $scope.enableCash = true;
if ($stateParams.code) if ($stateParams.code)
$scope.processWalletInfo($stateParams.code); $scope.processWalletInfo($stateParams.code);

View file

@ -5,12 +5,14 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
var config = configService.getSync();
$scope.formData = {}; $scope.formData = {};
$scope.formData.bwsurl = defaults.bws.url; $scope.formData.bwsurl = defaults.bws.url;
$scope.formData.derivationPath = derivationPathHelper.default; $scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.account = 1; $scope.formData.account = 1;
$scope.formData.secret = null; $scope.formData.secret = null;
$scope.formData.coin = 'btc'; $scope.formData.coin = 'btc';
if (config.cashSupport.enabled) $scope.enableCash = true;
resetPasswordFields(); resetPasswordFields();
updateSeedSourceSelect(); updateSeedSourceSelect();
}); });

View file

@ -62,7 +62,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
}, },
cashSupport: { cashSupport: {
enabled: true, enabled: false,
}, },
recentTransactions: { recentTransactions: {

View file

@ -12,7 +12,8 @@
<span class="toggle-label" translate>Support Bitcoin Cash</span> <span class="toggle-label" translate>Support Bitcoin Cash</span>
</ion-toggle> </ion-toggle>
<div class="comment" translate> <div class="comment" translate>
Enable Bitcoin Cash wallet creation and operation within the App. Learn more about Bitcoin Cash at <a href="https://www.bitcoincash.org/">its main website</a> Enable Bitcoin Cash wallet creation and operation within the App. Learn more about Bitcoin Cash at
<a ng-click="openExternalLink('https://www.bitcoincash.org/')">its main website</a>
</div> </div>

View file

@ -0,0 +1,9 @@
<label class="item item-input item-select">
<div class="input-label" translate>
Coin
</div>
<select ng-model="formData.coin">
<option value="btc">BTC</option>
<option value="bch">BCH</option>
</select>
</label>

View file

@ -40,15 +40,7 @@
</div> </div>
</div> </div>
<label class="item item-input item-select"> <div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="input-label" translate>
Coin
</div>
<select ng-model="formData.coin">
<option value="btc">BTC</option>
<option value="bch">BCH</option>
</select>
</label>
<div class="item item-divider"></div> <div class="item item-divider"></div>

View file

@ -19,15 +19,7 @@
required> required>
</label> </label>
<label class="item item-input item-select"> <div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="input-label" translate>
Coin
</div>
<select ng-model="formData.coin">
<option value="btc">BTC</option>
<option value="bch">BCH</option>
</select>
</label>
<div class="item item-divider"></div> <div class="item item-divider"></div>

View file

@ -29,15 +29,7 @@
ng-blur="formFocus(false)"> ng-blur="formFocus(false)">
</label> </label>
<label class="item item-input item-select"> <div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="input-label" translate>
Coin
</div>
<select ng-model="formData.coin">
<option value="btc">BTC</option>
<option value="bch">BCH</option>
</select>
</label>
<label class="item item-input item-select"> <label class="item item-input item-select">
<div class="input-label" translate> <div class="input-label" translate>

View file

@ -21,15 +21,7 @@
ng-model="formData.password"> ng-model="formData.password">
</label> </label>
<label class="item item-input item-select"> <div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="input-label" translate>
Coin
</div>
<select ng-model="formData.coin">
<option value="btc">BTC</option>
<option value="bch">BCH</option>
</select>
</label>
<div class="item item-divider"></div> <div class="item item-divider"></div>

View file

@ -27,15 +27,7 @@
</div> </div>
</div> </div>
<label class="item item-input item-select"> <div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="input-label" translate>
Coin
</div>
<select ng-model="formData.coin">
<option value="btc">BTC</option>
<option value="bch">BCH</option>
</select>
</label>
<div class="item item-divider"></div> <div class="item item-divider"></div>