Merge pull request #204 from gabrielbazan7/feat/advancedSettings

advanced settings and recent transactions
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-27 16:28:15 -03:00 committed by GitHub
commit 83a2860ae3
11 changed files with 293 additions and 86 deletions

View File

@ -0,0 +1,63 @@
<ion-view id="advanced-settings" class="settings">
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Advanced Settings' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content>
<div class="list">
<div class="item item-divider" translate>Enabled Integrations</div>
<ion-toggle ng-show="!isWP" ng-model="bitpayCardEnabled.value" toggle-class="toggle-balanced" ng-change="bitpayCardChange()">
<span class="toggle-label" translate>Enable Bitpay Card Integration</span>
</ion-toggle>
<ion-toggle ng-show="!isWP" ng-model="amazonEnabled.value" toggle-class="toggle-balanced" ng-change="amazonChange()">
<span class="toggle-label" translate>Enable Amazon Integration</span>
</ion-toggle>
<ion-toggle ng-show="!isWP" ng-model="glideraEnabled.value" toggle-class="toggle-balanced" ng-change="glideraChange()">
<span class="toggle-label" translate>Enable Glidera Service</span>
</ion-toggle>
<!-- disable coinbase for this release -->
<!-- <ion-toggle ng-show="!isWP" ng-model="coinbaseEnabled" toggle-class="toggle-balanced" ng-change="coinbaseChange()">
<span class="toggle-label" translate>Enable Coinbase Service</span>
</ion-toggle> -->
<div class="item item-divider" translate>Wallet Operation</div>
<ion-toggle ng-model="spendUnconfirmed.value" toggle-class="toggle-balanced" ng-change="spendUnconfirmedChange()">
<span class="toggle-label" translate>Use Unconfirmed Funds</span>
</ion-toggle>
<div class="comment">
<span translate>If enabled, wallets will also try to spend unconfirmed funds. This option may cause transaction delays.</span>
</div>
<div class="item item-divider" translate>Experimental Features</div>
<div class="divider-comment">
<span translate>These features aren't quite ready for primetime. They may change, stop working, or disappear at any time.</span>
</div>
<ion-toggle ng-show="!isWP" ng-model="recentTransactionsEnabled.value" toggle-class="toggle-balanced" ng-change="recentTransactionsChange()">
<span class="toggle-label" translate>Recent Transaction Card</span>
</ion-toggle>
<div class="comment">
<span transaction>If enabled, the Recent Transactions card - a list of transactions occuring across all wallets - will appear in the Home tab.</span>
</div>
<!-- disable frequently used for this release -->
<!-- <ion-toggle ng-show="!isWP" ng-model="frequentlyUsedEnabled.value" toggle-class="toggle-balanced" ng-change="frequentlyUsedChange()">
<span class="toggle-label" translate>Frequently Used Card</span>
</ion-toggle>
<div ng-style="{'padding':'15px', 'background-color': '#fff', 'color': 'rgba(74, 74, 74, 0.8)'}">
<span transaction>If enabled, the Frequently Used card - a list of the most commonly chosen recipients - will appear in the Send tab.</span>
</div> -->
</div>
</ion-content>
</ion-view>

View File

@ -33,9 +33,9 @@
</a>
</div>
<div class="list card" ng-if="notifications[0]">
<div class="list card" ng-if="notifications[0] && recentTransactions">
<a class="item item-icon-right item-heading" ui-sref="tabs.activity">
<span translate>Recent Activity</span>
<span translate>Recent Transactions</span>
<i class="icon nav-item-arrow-right"></i>
</a>
<span ng-if="fetchingNotifications" class="item text-center">
@ -114,7 +114,7 @@
</div>
<div class="list card"
ng-if="!externalServices.AmazonGiftCards || !externalServices.BitpayCard || !externalServices.BuyAndSell || !wallets[0]">
ng-if="(!externalServices.AmazonGiftCards || !externalServices.BitpayCard || !externalServices.BuyAndSell || !wallets[0]) && nextStepEnabled">
<div class="item item-icon-right item-heading" ng-click="shouldHideNextSteps()" translate>
Next steps
<i class="icon nav-item-arrow-down" ng-if="!hideNextSteps"></i>
@ -128,21 +128,21 @@
<span translate>Create a bitcoin wallet</span>
<i class="icon nav-item-arrow-right"></i>
</a>
<a ui-sref="bitpayCard.main" ng-if="!externalServices.BitpayCard" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<a ui-sref="bitpayCard.main" ng-if="!externalServices.BitpayCard && bitpayCardEnabled" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<i class="icon big-icon-svg">
<div class="bg icon-bitpay-card"></div>
</i>
<span translate>Add BitPay Card</span>
<i class="icon nav-item-arrow-right"></i>
</a>
<a ng-if="!externalServices.BuyAndSell" ui-sref="tabs.buyandsell" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<a ng-if="!externalServices.BuyAndSell && (coinbaseEnabled || glideraEnabled)" ui-sref="tabs.buyandsell" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<i class="icon big-icon-svg">
<div class="bg icon-buy-bitcoin"></div>
</i>
<span translate>Buy or Sell Bitcoin</span>
<i class="icon nav-item-arrow-right"></i>
</a>
<a ui-sref="tabs.giftcards.amazon" ng-if="!externalServices.AmazonGiftCards" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<a ui-sref="tabs.giftcards.amazon" ng-if="!externalServices.AmazonGiftCards && amazonEnabled" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<i class="icon big-icon-svg">
<div class="bg icon-gift"></div>
</i>

View File

@ -50,25 +50,6 @@
<i class="icon nav-item-arrow-right"></i>
</a>
<div class="item item-divider" translate>Exchanges</div>
<ion-toggle ng-show="!isWP" ng-model="glideraEnabled.value" toggle-class="toggle-balanced" ng-change="glideraChange()">
<span class="toggle-label" translate>Enable Glidera Service</span>
</ion-toggle>
<!-- disable coinbase for this release -->
<!--
<ion-toggle ng-show="!isWP" ng-model="coinbaseEnabled" toggle-class="toggle-balanced" ng-change="coinbaseChange()">
<span class="toggle-label" translate>Enable Coinbase Service</span>
</ion-toggle>
-->
<div class="item item-divider" translate>Others</div>
<ion-toggle ng-model="spendUnconfirmed.value" toggle-class="toggle-balanced" ng-change="spendUnconfirmedChange()">
<span class="toggle-label" translate>Use Unconfirmed Funds</span>
</ion-toggle>
<div ng-show="usePushNotifications && PNEnabledByUser">
<div class="item item-divider" translate>Notifications</div>
@ -108,6 +89,14 @@
<span translate>About</span> {{appName}}
<i class="icon nav-item-arrow-right"></i>
</a>
<div class="item item-divider"></div>
<a class="item item-icon-right" href ui-sref="tabs.advanced">
<span translate>Advanced</span>
<i class="icon nav-item-arrow-right"></i>
</a>
<div class="item item-divider"></div>
</div>
</ion-content>
</ion-view>

View File

@ -0,0 +1,113 @@
'use strict';
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
var updateConfig = function() {
var config = configService.getSync();
$scope.spendUnconfirmed = {
value: config.wallet.spendUnconfirmed
};
$scope.bitpayCardEnabled = {
value: config.bitpayCard.enabled
};
$scope.amazonEnabled = {
value: config.amazon.enabled
};
$scope.glideraEnabled = {
value: config.glidera.enabled
};
$scope.coinbaseEnabled = {
value: config.coinbase.enabled
};
$scope.recentTransactionsEnabled = {
value: config.recentTransactions.enabled
};
$scope.frequentlyUsedEnabled = {
value: config.frequentlyUsed.enabled
};
};
$scope.spendUnconfirmedChange = function() {
var opts = {
wallet: {
spendUnconfirmed: $scope.spendUnconfirmed.value
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.bitpayCardChange = function() {
var opts = {
bitpayCard: {
enabled: $scope.bitpayCardEnabled.value
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.amazonChange = function() {
var opts = {
amazon: {
enabled: $scope.amazonEnabled.value
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.glideraChange = function() {
var opts = {
glidera: {
enabled: $scope.glideraEnabled.value
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.coinbaseChange = function() {
var opts = {
coinbase: {
enabled: $scope.coinbaseEnabled
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.recentTransactionsChange = function() {
var opts = {
recentTransactions: {
enabled: $scope.recentTransactionsEnabled
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.frequentlyUsedChange = function() {
var opts = {
frequentlyUsed: {
enabled: $scope.frequentlyUsedEnabled
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.$on("$ionicView.enter", function(event, data) {
updateConfig();
});
});

View File

@ -209,6 +209,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
var isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
$scope.amazonEnabled = config.amazon.enabled;
$scope.bitpayCardEnabled = config.bitpayCard.enabled;
$scope.nextStepEnabled = $scope.glideraEnabled || $scope.coinbaseEnabled || $scope.amazonEnabled || $scope.bitpayCardEnabled;
$scope.recentTransactionsEnabled = config.recentTransactions.enabled;
});
$scope.nextStep();
$scope.updateAllWallets();

View File

@ -28,13 +28,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$scope.$digest();
});
}
$scope.spendUnconfirmed = {
value: config.wallet.spendUnconfirmed
};
$scope.glideraEnabled = {
value: config.glidera.enabled
};
$scope.coinbaseEnabled = config.coinbase.enabled;
$scope.pushNotifications = {
value: config.pushNotifications.enabled
};
@ -52,17 +46,6 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
});
};
$scope.spendUnconfirmedChange = function() {
var opts = {
wallet: {
spendUnconfirmed: $scope.spendUnconfirmed.value
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.pushNotificationsChange = function() {
var opts = {
pushNotifications: {
@ -78,28 +61,6 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
});
};
$scope.glideraChange = function() {
var opts = {
glidera: {
enabled: $scope.glideraEnabled.value
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.coinbaseChange = function() {
var opts = {
coinbase: {
enabled: $scope.coinbaseEnabled
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.$on("$ionicView.enter", function(event, data) {
updateConfig();
});

View File

@ -390,6 +390,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
}
})
.state('tabs.advanced', {
url: '/advanced',
views: {
'tab-settings@tabs': {
controller: 'advancedSettingsController',
templateUrl: 'views/advancedSettings.html'
}
}
})
/*
*

View File

@ -39,10 +39,28 @@ angular.module('copayApp.services').factory('configService', function(storageSer
},
coinbase: {
enabled: true,
enabled: false, //disable coinbase for this release
testnet: false
},
bitpayCard: {
enabled: true
},
amazon: {
enabled: true
},
//Experimental Features
recentTransactions: {
enabled: true
},
frequentlyUsed: {
enabled: true
},
rates: {
url: 'https://insight.bitpay.com:443/api/rates',
},
@ -111,6 +129,18 @@ angular.module('copayApp.services').factory('configService', function(storageSer
if (!configCache.coinbase) {
configCache.coinbase = defaultConfig.coinbase;
}
if (!configCache.amazon) {
configCache.amazon = defaultConfig.amazon;
}
if (!configCache.bitpayCard) {
configCache.bitpayCard = defaultConfig.bitpayCard;
}
if (!configCache.recentTransactions) {
configCache.recentTransactions = defaultConfig.recentTransactions;
}
if (!configCache.frequentlyUsed) {
configCache.frequentlyUsed = defaultConfig.frequentlyUsed;
}
if (!configCache.pushNotifications) {
configCache.pushNotifications = defaultConfig.pushNotifications;
}

View File

@ -780,21 +780,11 @@ angular.module('copayApp.services')
var TIME_STAMP = 60 * 60 * 24 * 7;
var MAX = 100;
var typeFilter1 = {
'NewBlock': 1,
'BalanceUpdated': 1,
'NewOutgoingTxByThirdParty': 1,
'NewAddress': 1,
'TxProposalFinallyAccepted': 1,
'TxProposalFinallyRejected': 1,
var typeFilter = {
'NewOutgoingTx': 1,
'NewIncomingTx': 1
};
var typeFilter2 = {
'TxProposalAcceptedBy': 1,
'TxProposalRejectedBy': 1,
'NewTxProposal': 1,
}
var w = root.getWallets();
if (lodash.isEmpty(w)) return cb();
@ -895,15 +885,9 @@ angular.module('copayApp.services')
var n;
n = lodash.filter(wallet.cachedActivity.n, function(x) {
return !typeFilter1[x.type];
return typeFilter[x.type];
});
if (wallet.m == 1) {
n = lodash.filter(n, function(x) {
return !typeFilter2[x.type];
});
}
var idToName = {};
if (wallet.cachedStatus) {
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {

View File

@ -996,6 +996,7 @@ input[type=number] {
@import "views/tab-send";
@import "views/tab-settings";
@import "views/walletDetails";
@import "views/advancedSettings";
@import "views/bitpayCard";
@import "views/address-book";
@import "views/wallet-backup-phrase";

View File

@ -0,0 +1,53 @@
.settings {
.item {
color: #444;
border-color: rgba(221, 221, 221, 0.3);
}
}
#advanced-settings {
.list {
.item {
color: #444;
border-top: none;
padding-top: 1.5rem;
padding-bottom: 1.5rem;
&:before {
display: block;
position: absolute;
width: 100%;
height: 1px;
background: rgba(221, 221, 221, 0.3);
top: 0;
right: 0;
content: '';
}
&.item-divider {
color: rgba(74, 74, 74, .8);
}
&.item-heading {
&:before {
top: 99%
}
}
&:nth-child(2) {
&:before {
width: 0;
}
}
.item-note {
color: rgb(58, 58, 58);
}
}
.comment {
padding: 15px;
background-color: #fff;
color: rgba(74, 74, 74, 0.8);
}
.divider-comment {
padding: 15px;
color: rgba(74, 74, 74, 0.8);
font-size: 15px;
}
}
}