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';
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 config = configService.getSync();
@ -15,9 +15,9 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
value: config.hideNextSteps.enabled
};
$scope.cashSupport = {
value: config.cashSupport.enabled
value: config.cashSupport.enabled
};
};
$scope.spendUnconfirmedChange = function() {
@ -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.isWindowsPhoneApp = platformInfo.isCordova && platformInfo.isWP;
updateConfig();

View file

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

View file

@ -5,6 +5,7 @@ angular.module('copayApp.controllers').controller('importController',
var reader = new FileReader();
var defaults = configService.getDefaults();
var config = configService.getSync();
var errors = bwcService.getErrors();
$scope.init = function() {
@ -20,6 +21,8 @@ angular.module('copayApp.controllers').controller('importController',
$scope.isCopay = appConfigService.name == 'copay';
$scope.fromHardwareWallet = { value: false };
if (config.cashSupport.enabled) $scope.enableCash = true;
if ($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) {
var defaults = configService.getDefaults();
var config = configService.getSync();
$scope.formData = {};
$scope.formData.bwsurl = defaults.bws.url;
$scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.account = 1;
$scope.formData.secret = null;
$scope.formData.coin = 'btc';
if (config.cashSupport.enabled) $scope.enableCash = true;
resetPasswordFields();
updateSeedSourceSelect();
});

View file

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

View file

@ -12,10 +12,11 @@
<span class="toggle-label" translate>Support Bitcoin Cash</span>
</ion-toggle>
<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>
<ion-toggle class="has-comment" ng-model="spendUnconfirmed.value" toggle-class="toggle-balanced" ng-change="spendUnconfirmedChange()">
<span class="toggle-label" translate>Use Unconfirmed Funds</span>

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>
<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>
<div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="item item-divider"></div>

View file

@ -19,15 +19,7 @@
required>
</label>
<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>
<div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="item item-divider"></div>

View file

@ -29,15 +29,7 @@
ng-blur="formFocus(false)">
</label>
<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>
<div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<label class="item item-input item-select">
<div class="input-label" translate>

View file

@ -21,15 +21,7 @@
ng-model="formData.password">
</label>
<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>
<div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="item item-divider"></div>

View file

@ -27,15 +27,7 @@
</div>
</div>
<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>
<div ng-include="'views/includes/cash.html'" ng-if="enableCash"></div>
<div class="item item-divider"></div>