Fix fee levels when there is no wallet and hide Glidera if wallet is not complete (#4068)
* fix cordova is not define * Remove focused client from fee level service * remove wallet should be complete in route.js for global preferences routes * get network of the focused client in getCurrentFeeValue function * refactor * do not show testnet fee levels in preference global and refactors * bump new version bwc v2.2.1
This commit is contained in:
parent
975bd99834
commit
b720821d4e
8 changed files with 34 additions and 37 deletions
|
|
@ -41,7 +41,7 @@
|
||||||
"url": "https://github.com/bitpay/copay/issues"
|
"url": "https://github.com/bitpay/copay/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bitcore-wallet-client": "2.1.1",
|
"bitcore-wallet-client": "2.2.1",
|
||||||
"express": "^4.11.2",
|
"express": "^4.11.2",
|
||||||
"fs": "0.0.2",
|
"fs": "0.0.2",
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
<div translate>Create, join or import</div>
|
<div translate>Create, join or import</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-show="index.glideraEnabled">
|
<li ng-show="index.glideraEnabled && index.isComplete">
|
||||||
<a ng-click="sidebar.closeMenu(); $root.go('glidera')" class="oh">
|
<a ng-click="sidebar.closeMenu(); $root.go('glidera')" class="oh">
|
||||||
<i class="icon-arrow-right3 size-18 right m10t vm"></i>
|
<i class="icon-arrow-right3 size-18 right m10t vm"></i>
|
||||||
<i class="icon-bank size-24 icon vm"></i>
|
<i class="icon-bank size-24 icon vm"></i>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="no-bullet m0">
|
<ul class="no-bullet m0">
|
||||||
<li ng-repeat="fee in (index.network == 'livenet' ? prefFee.feeLevels.livenet : prefFee.feeLevels.testnet)"
|
<li ng-repeat="fee in prefFee.feeLevels.livenet"
|
||||||
ng-click="prefFee.save(fee.level)">
|
ng-click="prefFee.save(fee.level)">
|
||||||
{{prefFee.feeOpts[fee.level]|translate}}
|
{{prefFee.feeOpts[fee.level]|translate}}
|
||||||
<i class="fi-check size-16 right" ng-show="prefFee.currentFeeLevel == fee.level"></i>
|
<i class="fi-check size-16 right" ng-show="prefFee.currentFeeLevel == fee.level"></i>
|
||||||
|
|
@ -30,8 +30,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="row m20t">
|
<div class="row m20t">
|
||||||
<div class="text-gray size-12 text-center" ng-repeat="fee in (index.network == 'livenet' ? prefFee.feeLevels.livenet :
|
<div class="text-gray size-12 text-center" ng-repeat="fee in prefFee.feeLevels.livenet" ng-if="fee.level == prefFee.currentFeeLevel">
|
||||||
prefFee.feeLevels.testnet)" ng-if="fee.level == prefFee.currentFeeLevel">
|
|
||||||
<div ng-show="fee.nbBlocks">
|
<div ng-show="fee.nbBlocks">
|
||||||
<span translate>Average confirmation time: {{fee.nbBlocks * 10}} minutes</span>.
|
<span translate>Average confirmation time: {{fee.nbBlocks * 10}} minutes</span>.
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
<div translate>About Copay</div>
|
<div translate>About Copay</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div ng-show="prefGlobal.usePushNotifications && !PNEnabledByUser && isIOS">
|
<div ng-show="prefGlobal.usePushNotifications && !PNEnabledByUser && isIOSApp">
|
||||||
<div class="text-centered text-gray size-12 m10" translate>Push notifications for Copay are currently disabled. Enable them in the Settings app.</div>
|
<div class="text-centered text-gray size-12 m10" translate>Push notifications for Copay are currently disabled. Enable them in the Settings app.</div>
|
||||||
<ul class="no-bullet m0" ng-click="prefGlobal.openSettings()">
|
<ul class="no-bullet m0" ng-click="prefGlobal.openSettings()">
|
||||||
<li ng-style="{'color':index.backgroundColor}" translate>Open Settings app</li>
|
<li ng-style="{'color':index.backgroundColor}" translate>Open Settings app</li>
|
||||||
|
|
|
||||||
|
|
@ -295,8 +295,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.updateAll = function(opts, initStatusHash, tries) {
|
self.updateAll = function(opts, initStatusHash, tries) {
|
||||||
tries = tries || 0;
|
tries = tries || 0;
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
var fc = profileService.focusedClient;
|
||||||
|
if (!fc) return;
|
||||||
|
|
||||||
var walletId = profileService.focusedClient.credentials.walletId
|
var walletId = fc.credentials.walletId
|
||||||
|
|
||||||
if (opts.untilItChanges && lodash.isUndefined(initStatusHash)) {
|
if (opts.untilItChanges && lodash.isUndefined(initStatusHash)) {
|
||||||
initStatusHash = _walletStatusHash();
|
initStatusHash = _walletStatusHash();
|
||||||
|
|
@ -321,10 +323,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var fc = profileService.focusedClient;
|
|
||||||
if (!fc) return;
|
|
||||||
|
|
||||||
|
|
||||||
// If not untilItChanges...trigger history update now
|
// If not untilItChanges...trigger history update now
|
||||||
if (opts.triggerTxUpdate && !opts.untilItChanges) {
|
if (opts.triggerTxUpdate && !opts.untilItChanges) {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
|
||||||
this.currentFeeLevel = feeService.getCurrentFeeLevel();
|
this.currentFeeLevel = feeService.getCurrentFeeLevel();
|
||||||
this.usePushNotifications = isCordova && !isMobile.Windows();
|
this.usePushNotifications = isCordova && !isMobile.Windows();
|
||||||
$scope.PNEnabledByUser = true;
|
$scope.PNEnabledByUser = true;
|
||||||
$scope.isIOS = isMobile.iOS();
|
$scope.isIOSApp = isMobile.iOS() && isCordova;
|
||||||
if (!typeof cordova.plugins.diagnostic != undefined && $scope.isIOS) {
|
if ($scope.isIOSApp) {
|
||||||
cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) {
|
cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) {
|
||||||
$scope.PNEnabledByUser = isEnabled;
|
$scope.PNEnabledByUser = isEnabled;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@ angular
|
||||||
$stateProvider
|
$stateProvider
|
||||||
.state('translators', {
|
.state('translators', {
|
||||||
url: '/translators',
|
url: '/translators',
|
||||||
walletShouldBeComplete: true,
|
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -194,7 +193,6 @@ angular
|
||||||
})
|
})
|
||||||
.state('preferencesLanguage', {
|
.state('preferencesLanguage', {
|
||||||
url: '/preferencesLanguage',
|
url: '/preferencesLanguage',
|
||||||
walletShouldBeComplete: true,
|
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -205,7 +203,6 @@ angular
|
||||||
.state('preferencesUnit', {
|
.state('preferencesUnit', {
|
||||||
url: '/preferencesUnit',
|
url: '/preferencesUnit',
|
||||||
templateUrl: 'views/preferencesUnit.html',
|
templateUrl: 'views/preferencesUnit.html',
|
||||||
walletShouldBeComplete: true,
|
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -216,7 +213,6 @@ angular
|
||||||
.state('preferencesFee', {
|
.state('preferencesFee', {
|
||||||
url: '/preferencesFee',
|
url: '/preferencesFee',
|
||||||
templateUrl: 'views/preferencesFee.html',
|
templateUrl: 'views/preferencesFee.html',
|
||||||
walletShouldBeComplete: true,
|
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -298,7 +294,6 @@ angular
|
||||||
.state('preferencesAltCurrency', {
|
.state('preferencesAltCurrency', {
|
||||||
url: '/preferencesAltCurrency',
|
url: '/preferencesAltCurrency',
|
||||||
templateUrl: 'views/preferencesAltCurrency.html',
|
templateUrl: 'views/preferencesAltCurrency.html',
|
||||||
walletShouldBeComplete: true,
|
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -389,7 +384,6 @@ angular
|
||||||
.state('about', {
|
.state('about', {
|
||||||
url: '/about',
|
url: '/about',
|
||||||
templateUrl: 'views/preferencesAbout.html',
|
templateUrl: 'views/preferencesAbout.html',
|
||||||
walletShouldBeComplete: true,
|
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -400,7 +394,6 @@ angular
|
||||||
.state('logs', {
|
.state('logs', {
|
||||||
url: '/logs',
|
url: '/logs',
|
||||||
templateUrl: 'views/preferencesLogs.html',
|
templateUrl: 'views/preferencesLogs.html',
|
||||||
walletShouldBeComplete: true,
|
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('feeService', function($log, profileService, configService, gettextCatalog, lodash) {
|
angular.module('copayApp.services').factory('feeService', function($log, bwcService, profileService, configService, gettextCatalog, lodash) {
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
// Constant fee options to translate
|
// Constant fee options to translate
|
||||||
|
|
@ -20,11 +20,17 @@ angular.module('copayApp.services').factory('feeService', function($log, profile
|
||||||
|
|
||||||
fc.getFeeLevels(fc.credentials.network, function(err, levels) {
|
fc.getFeeLevels(fc.credentials.network, function(err, levels) {
|
||||||
if (err)
|
if (err)
|
||||||
return cb({message: 'Could not get dynamic fee'});
|
return cb({
|
||||||
|
message: 'Could not get dynamic fee'
|
||||||
|
});
|
||||||
|
|
||||||
var feeLevelValue = lodash.find(levels, { level: feeLevel });
|
var feeLevelValue = lodash.find(levels, {
|
||||||
|
level: feeLevel
|
||||||
|
});
|
||||||
if (!feeLevelValue || !feeLevelValue.feePerKB)
|
if (!feeLevelValue || !feeLevelValue.feePerKB)
|
||||||
return cb({message: 'Could not get dynamic fee for level: ' + feeLevel});
|
return cb({
|
||||||
|
message: 'Could not get dynamic fee for level: ' + feeLevel
|
||||||
|
});
|
||||||
|
|
||||||
var fee = feeLevelValue.feePerKB;
|
var fee = feeLevelValue.feePerKB;
|
||||||
$log.debug('Dynamic fee: ' + feeLevel + ' ' + fee + ' SAT');
|
$log.debug('Dynamic fee: ' + feeLevel + ' ' + fee + ' SAT');
|
||||||
|
|
@ -33,11 +39,12 @@ angular.module('copayApp.services').factory('feeService', function($log, profile
|
||||||
};
|
};
|
||||||
|
|
||||||
root.getFeeLevels = function(cb) {
|
root.getFeeLevels = function(cb) {
|
||||||
var fc = profileService.focusedClient;
|
var walletClient = bwcService.getClient();
|
||||||
|
|
||||||
var unitName = configService.getSync().wallet.settings.unitName;
|
var unitName = configService.getSync().wallet.settings.unitName;
|
||||||
|
|
||||||
fc.getFeeLevels('livenet', function(errLivenet, levelsLivenet) {
|
walletClient.getFeeLevels('livenet', function(errLivenet, levelsLivenet) {
|
||||||
fc.getFeeLevels('testnet', function(errTestnet, levelsTestnet) {
|
walletClient.getFeeLevels('testnet', function(errTestnet, levelsTestnet) {
|
||||||
if (errLivenet || errTestnet) $log.debug('Could not get dynamic fee');
|
if (errLivenet || errTestnet) $log.debug('Could not get dynamic fee');
|
||||||
else {
|
else {
|
||||||
for (var i = 0; i < 3; i++) {
|
for (var i = 0; i < 3; i++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue