refactor settings tab

This commit is contained in:
Gabriel Bazán 2016-08-15 17:42:04 -03:00
commit 41cc509d47
21 changed files with 462 additions and 252 deletions

View file

@ -20,7 +20,6 @@
<!-- <ion&#45;nav&#45;back&#45;button class="button&#45;icon ion&#45;arrow&#45;left&#45;c"> -->
<!-- </ion&#45;nav&#45;back&#45;button> -->
<!-- </ion&#45;nav&#45;bar> -->
<ion-nav-bar class="bar-stable"></ion-nav-bar>
<ion-nav-view name="main"></ion-nav-view>
<script src="lib/ionic.bundle.min.js"></script>

View file

@ -0,0 +1,12 @@
<ion-view cache-view="false">
<ion-nav-bar class="bar-stable">
<ion-nav-title>feedback</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="tabs.settings">
     <i class="ion-arrow-left-c"></i> Back
   </button>
 </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
</ion-content>
</ion-view>

View file

@ -1,42 +1,43 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='About Copay'; goBackToState = 'preferencesGlobal'; noColor = true">
</div>
<div class="content preferences" ng-controller="preferencesAbout as about">
<h4 translate>Release Information</h4>
<div ng-controller="versionController as v">
<ul class="no-bullet m0">
<li ng-conf>
<span translate>Version</span>
<span class="right text-gray">
v{{v.version}}
</span>
</li>
<li ng-conf ng-click="$root.openExternalLink('https://github.com/bitpay/copay/tree/'+v.commitHash)">
<span translate>Commit hash</span>
<span class="right text-gray">
#{{v.commitHash}}
</span>
</li>
</ul>
<ion-view ng-controller="preferencesAbout" cache-view="false">
<ion-nav-bar class="bar-stable">
<ion-nav-title>About Copay</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="tabs.settings">
     <i class="ion-arrow-left-c"></i> Back
   </button>
  </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<div class="item item-divider">
Release information
</div>
<h4></h4>
<ul class="no-bullet m0">
<li href ui-sref="termOfUse">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Terms of Use</span>
</li>
<li href ui-sref="translators">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Translators</span>
</li>
<li ng-conf href ui-sref="logs">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Session log</span>
</li>
</ul>
</div>
<div class="item item-icon-left">
<i class="icon ion-ios-film-outline"></i>
<span translate>Version</span>
<span class="item-note">
v{{v.version}}
</span>
</div>
<div class="item item-icon-left" ng-click="$root.openExternalLink('https://github.com/bitpay/copay/tree/'+v.commitHash)">
<i class="icon ion-ios-film-outline"></i>
<span translate>Commit hash</span>
<span class="item-note">
#{{v.commitHash}}
</span>
</div>
<div class="item item-divider">
</div>
<div class="item item-icon-left" href ui-sref="termOfUse">
<i class="icon ion-ios-bell-outline"></i>
<span translate>Terms of Use</span>
</div>
<div class="item item-icon-left" href ui-sref="translators">
<i class="icon ion-ios-bell-outline"></i>
<span translate>Translators</span>
</div>
<div class="item item-icon-left" href ui-sref="logs">
<i class="icon ion-ios-bell-outline"></i>
<span translate>Session log</span>
</div>
</ion-content>
</ion-view>

View file

@ -1,12 +1,14 @@
<div class="topbar-container" ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Alternative Currency'; goBackToState = 'preferencesGlobal'; noColor = true">
</div>
<div class="content preferences" ng-controller="preferencesAltCurrencyController" ng-init="init()">
<h4></h4>
<ion-view ng-controller="preferencesAltCurrencyController" cache-view="false" ng-init="init()">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Alternative Currency</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="tabs.settings">
     <i class="ion-arrow-left-c"></i> Back
   </button>
 </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<ion-radio class="line-b size-12 radio-label" ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"
<ion-radio ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"
ng-click="save(altCurrency)">{{altCurrency.name}}
</ion-radio>
<ion-infinite-scroll
@ -15,5 +17,4 @@
distance="1%">
</ion-infinite-scroll>
</ion-content>
</div>
</ion-view>

View file

@ -1,39 +1,27 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Bitcoin Network Fee Policy'; goBackToState = 'preferencesGlobal'; noColor = true">
</div>
<div class="content preferences" ng-controller="preferencesFeeController">
<h4></h4>
<div class="preferences-fee" ng-show="loading">
<div class="row p20 text-center">
<div class="columns large-12 medium-12 small-12 m10b">
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
</div>
<div class="size-12 text-gray m20t" translate>
Loading...
</div>
<ion-view ng-controller="preferencesFeeController" cache-view="false" ng-init="init()">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Preferences fee</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="tabs.settings">
     <i class="ion-arrow-left-c"></i> Back
   </button>
 </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<div ng-show="loading">
<ion-spinner class="spinner-dark" icon="lines">Loading...</ion-spinner>
</div>
</div>
<ion-radio class="libe-b size-12 radio-label" ng-repeat="fee in feeLevels.livenet" ng-value="fee.level" ng-model="currentFeeLevel"
ng-click="save(fee)">{{feeOpts[fee.level]|translate}}
</ion-radio>
<div class="row m20t">
<div class="text-gray size-12 text-center" ng-repeat="fee in feeLevels.livenet" ng-if="fee.level == currentFeeLevel">
<div ng-show="fee.nbBlocks">
<span class="text-bold" translate>Average confirmation time: {{fee.nbBlocks * 10}} minutes</span>.
<ion-radio ng-repeat="fee in feeLevels.livenet" ng-value="fee.level" ng-model="currentFeeLevel" ng-click="save(fee)">{{feeOpts[fee.level]|translate}}
</ion-radio>
<div ng-repeat="fee in feeLevels.livenet" ng-if="fee.level == currentFeeLevel">
<div ng-show="fee.nbBlocks">
<span translate>Average confirmation time: {{fee.nbBlocks * 10}} minutes</span>.
</div>
<span translate>Current fee rate for this policy: {{fee.feePerKBUnit}}/kiB</span>
</div>
<span class="text-bold" translate>Current fee rate for this policy: {{fee.feePerKBUnit}}/kiB</span>
</div>
</div>
<div class="m15">
<div class="text-gray size-12 text-center" translate>
Bitcoin transactions may include a fee collected by miners on the network. The higher the fee, the greater the incentive a miner has to include that transaction in a block. Current fees are determined based on network load and the selected policy.
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>
<div translate>
Bitcoin transactions may include a fee collected by miners on the network. The higher the fee, the greater the incentive a miner has to include that transaction in a block. Current fees are determined based on network load and the selected policy.
</div>
</ion-content>
</ion-view>

View file

@ -1,24 +1,20 @@
<div class="topbar-container" ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Language'; goBackToState = 'preferencesGlobal'; noColor = true">
</div>
<div class="content preferences" ng-controller="preferencesLanguageController">
<h4></h4>
<ion-radio class="line-b size-12 radio-label" ng-repeat="lang in availableLanguages" ng-value="lang.isoCode" ng-model="currentLanguage"
ng-click="save(lang.isoCode)">{{lang.name}}
</ion-radio>
<div class="row m20v">
<div class="columns text-center">
<p class="size-12 text-black">
<span translate>All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at</span>
<a ng-click="$root.openExternalLink('https://crowdin.com/project/copay', '_system')">https://crowdin.com/project/copay</a>.
</p>
<span class="size-12 text-gray" translate>
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.
</span>
</div>
</div>
</div>
<ion-view ng-controller="preferencesLanguageController" ng-init="init()" cache-view="false">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Languages</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="tabs.settings">
     <i class="ion-arrow-left-c"></i> Back
   </button>
  </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<ion-radio ng-repeat="lang in availableLanguages" ng-value="lang.isoCode" ng-model="currentLanguage"
ng-click="save(lang.isoCode)">{{lang.name}}
</ion-radio>
<span translate>All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at</span>
<a ng-click="$root.openExternalLink('https://crowdin.com/project/copay', '_system')">https://crowdin.com/project/copay</a>.
<span translate>
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.
</span>
</ion-content>
</ion-view>

View file

@ -1,27 +1,22 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Session log'; goBackToState = 'about'; noColor = true">
</div>
<div class="content preferences" ng-controller="preferencesLogs as logs">
<h4></h4>
<div class="row columns large-centered medium-centered">
<button class="black round small expand" ng-show="index.isCordova" ng-style="{'background-color':index.backgroundColor}" ng-click="logs.sendLogs()"><i class="fi-mail"></i>
<span translate>Send by email</span>
</button>
<ul class="no-bullet size-14 oh" style="word-wrap: break-word;">
<li class="line-b enable_text_select" ng-repeat="l in logs.logs">
<span ng-class="{'text-warning': l.level=='warn', 'text-secondary': l.level=='debug', 'text-primary': l.level=='info', 'text-alert': l.level=='error' }">
{{l.msg}}
</span>
</li>
</ul>
</div>
</div>
<ion-view ng-controller="preferencesLogs" ng-init="init()" cache-view="false">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Session log</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="about">
     <i class="ion-arrow-left-c"></i> Back
   </button>
  </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<button ng-show="isCordova" ng-click="logs.sendLogs()"><i class="fi-mail"></i>
<span translate>Send by email</span>
</button>
<ul>
<li ng-repeat="l in logs">
<span ng-class="{'text-warning': l.level=='warn', 'text-secondary': l.level=='debug', 'text-primary': l.level=='info', 'text-alert': l.level=='error' }">
{{l.msg}}
</span>
</li>
</ul>
</ion-content>
</ion-view>

View file

@ -1,11 +1,15 @@
<div class="topbar-container" ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Unit'; goBackToState = 'preferencesGlobal'; noColor = true">
</div>
<div class="content preferences" ng-controller="preferencesUnitController">
<h4></h4>
<ion-radio class="line-b size-12 radio-label" ng-repeat="unit in unitList" ng-value="unit.code" ng-model="currentUnit"
ng-click="save(unit)">{{unit.shortName}}
</ion-radio>
</div>
<ion-view ng-controller="preferencesUnitController" ng-init="init()" cache-view="false">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Unit</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="tabs.settings">
     <i class="ion-arrow-left-c"></i> Back
   </button>
  </ion-nav-buttons>
</ion-nav-bar class="bar-stable">
<ion-content>
<ion-radio ng-repeat="unit in unitList" ng-value="unit.code" ng-model="currentUnit"
ng-click="save(unit)">{{unit.shortName}}
</ion-radio>
</ion-content>
</ion-view>

View file

@ -1,6 +1,89 @@
<ion-view ng-controller="tabSettingsController" cache-view="false" ng-init="init()">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Global Settings</ion-nav-title>
</ion-nav-bar>
<ion-content class="has-header">
<div class="item item-divider">
</div>
<div class="list">
<div class="item item-icon-left" ng-click="openAddressbookModal()">
<i class="icon ion-ios-book-outline"></i>
<span translate>Address Book</span>
</div>
<div class="item item-icon-left" href ui-sref="feedback">
<i class="icon ion-ios-heart-outline"></i>
<span translate>Feedback</span>
</div>
</div>
<div class="item item-divider">
Preferences
</div>
<div class="list">
<div class="item item-icon-left" href ui-sref="preferencesLanguage">
<i class="icon ion-ios-chatbubble-outline"></i>
<span translate>Language</span>
<span class="item-note">
{{currentLanguageName|translate}}
</span>
</div>
<div class="item item-icon-left" href ui-sref="preferencesUnit">
<i class="icon ion-ios-calculator-outline"></i>
<span translate>Unit</span>
<span class="item-note">
{{unitName}}
</span>
</div>
<div class="item item-icon-left" href ui-sref="preferencesAltCurrency">
<i class="icon ion-social-usd-outline"></i>
<span translate>Alternative Currency</span>
<span class="item-note">
{{selectedAlternative.name}}
</span>
</div>
<div class="item item-icon-left" href ui-sref="preferencesFee">
<i class="icon ion-ios-film-outline"></i>
<span translate>Bitcoin Network Fee Policy</span>
<span class="item-note">
{{feeOpts[currentFeeLevel]|translate}}
</span>
</div>
</div>
<div class="list" ng-show="usePushNotifications && PNEnabledByUser">
<div class="item item-divider">
Notifications
</div>
<ion-toggle ng-model="pushNotifications" toggle-class="toggle-balanced" ng-change="pushNotificationsChange()">
<span class="toggle-label" translate>Enable push notifications</span>
</ion-toggle>
<div ng-show="usePushNotifications && !PNEnabledByUser && isIOSApp">
<div translate>Push notifications for Copay are currently disabled. Enable them in the Settings app.</div>
<ul ng-click="openSettings()">
<li ng-style="{'color':index.backgroundColor}" translate>Open Settings app</li>
</ul>
</div>
</div>
<div class="item item-divider">
Exchanges
</div>
<ion-toggle ng-show="!isWP" ng-model="glideraEnabled" toggle-class="toggle-balanced" ng-change="glideraChange()">
<span class="toggle-label" translate>Enable Glidera Service</span>
</ion-toggle>
<ion-view view-title="Home">
<ion-content class="Settings">
<h2>Welcome to Settings</h2>
<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>
<div class="item item-divider">
Others
</div>
<div class="list">
<ion-toggle ng-model="spendUnconfirmed" toggle-class="toggle-balanced" ng-change="spendUnconfirmedChange()">
<span class="toggle-label" translate>Use Unconfirmed Funds</span>
</ion-toggle>
<div class="item item-icon-left" href ui-sref="about">
<i class="icon ion-ios-film-outline"></i>
<span translate>About Copay</span>
</div>
</div>
</ion-content>
</ion-view>
</ion-view>

View file

@ -1,16 +1,20 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Terms of Use'; goBackToState = 'about'; noColor = true">
</div>
<div ng-controller="termOfUseController" class="content">
<p class="enable_text_select m0">
<div class="terms" ng-include="'views/includes/terms.html'"></div>
<ion-view ng-controller="termOfUseController" cache-view="false">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Terms of Use</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="about">
     <i class="ion-arrow-left-c"></i> Back
   </button>
  </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<p>
<div ng-include="'views/includes/terms.html'"></div>
</p>
<div class="row text-center">
<div class="row">
<p ng-show="lang != 'en'">
<a class="center" ng-click="$root.openExternalLink('https://copay.io/disclaimer')" translate>Official English Disclaimer</a>
<a ng-click="$root.openExternalLink('https://copay.io/disclaimer')" translate>Official English Disclaimer</a>
</p>
</div>
</div>
<div class="extra-margin-bottom"></div>
</ion-content>
</ion-view>

View file

@ -1,32 +1,35 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Translators'; goBackToState = 'about'; noColor = true">
</div>
<div class="content preferences">
<h4 class="title m0" translate>Translation Credits</h4>
<ul class="no-bullet m0 size-14">
<li class="line-b p10">kinoshitajona<span class="right text-gray size-12" translate>Japanese</span></li>
<li class="line-b p10">Kirvx<span class="right text-gray size-12" translate>French</span></li>
<li class="line-b p10">saschad<span class="right text-gray size-12" translate>German</span></li>
<li class="line-b p10">cmgustavo83<span class="right text-gray size-12" translate>Spanish</span></li>
<li class="line-b p10">RussianNeuroMancer<span class="right text-gray size-12" translate>Russian</span></li>
<li class="line-b p10">HostFat<span class="right text-gray size-12" translate>Italian</span></li>
<li class="line-b p10">xm2hi<span class="right text-gray size-12" translate>Chinese</span></li>
<li class="line-b p10">Pirx1618<span class="right text-gray size-12" translate>Polish</span></li>
<li class="line-b p10">mareksip<span class="right text-gray size-12" translate>Czech</span></li>
</ul>
<div class="row m20t">
<div class="columns text-center">
<p class="size-12 text-black">
<span translate>All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at</span>
<a ng-click="$root.openExternalLink('https://crowdin.com/project/copay', '_system')">https://crowdin.com/project/copay</a>.
</p>
<span class="size-12 text-gray" translate>
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.
</span>
</div>
</div>
<div class="extra-margin-bottom"></div>
</div>
<ion-view cache-view="false">
<ion-nav-bar class="bar-stable">
<ion-nav-title>Translators</ion-nav-title>
<ion-nav-buttons side="primary">
 <button class="button" href ui-sref="about">
     <i class="ion-arrow-left-c"></i> Back
   </button>
  </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<h4 translate>Translation Credits</h4>
<ul>
<li >kinoshitajona<span translate>Japanese</span></li>
<li >Kirvx<span translate>French</span></li>
<li >saschad<span translate>German</span></li>
<li >cmgustavo83<span translate>Spanish</span></li>
<li >RussianNeuroMancer<span translate>Russian</span></li>
<li >HostFat<span translate>Italian</span></li>
<li >xm2hi<span translate>Chinese</span></li>
<li >Pirx1618<span translate>Polish</span></li>
<li >mareksip<span translate>Czech</span></li>
</ul>
<div class="row">
<div class="columns">
<p>
<span translate>All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at</span>
<a ng-click="$root.openExternalLink('https://crowdin.com/project/copay', '_system')">https://crowdin.com/project/copay</a>.
</p>
<spantranslate>
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.
</span>
</div>
</div>
</ion-content>
</ion-view>

View file

@ -3,13 +3,15 @@
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
function($scope, $log, $timeout, configService, rateService, lodash, go, profileService, walletService) {
var config = configService.getSync();
var next = 10;
var completeAlternativeList;
$scope.currentCurrency = config.wallet.settings.alternativeIsoCode;
$scope.listComplete = false;
$scope.init = function() {
var config = configService.getSync();
$scope.currentCurrency = config.wallet.settings.alternativeIsoCode;
$scope.listComplete = false;
rateService.whenAvailable(function() {
completeAlternativeList = rateService.listAlternatives();
lodash.remove(completeAlternativeList, function(c) {

View file

@ -2,14 +2,16 @@
angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, configService, feeService) {
$scope.loading = true;
feeService.getFeeLevels(function(levels) {
$scope.loading = false;
$scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
$scope.feeLevels = levels;
$scope.$apply();
});
$scope.init = function() {
$scope.loading = true;
feeService.getFeeLevels(function(levels) {
$scope.loading = false;
$scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
$scope.feeLevels = levels;
$scope.$apply();
});
}
$scope.save = function(newFee) {
var opts = {

View file

@ -3,14 +3,14 @@
angular.module('copayApp.controllers').controller('preferencesGlobalController',
function($scope, $rootScope, $log, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
var isCordova = platformInfo.isCordova;
if (isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
$scope.init = function() {
var config = configService.getSync();
var isCordova = platformInfo.isCordova;
if (isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
$scope.unitName = config.wallet.settings.unitName;
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
$scope.selectedAlternative = {

View file

@ -1,10 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $log, configService, profileService, uxLanguage, walletService, go) {
function($scope, $log, $state, configService, profileService, uxLanguage, walletService, go) {
$scope.availableLanguages = uxLanguage.getLanguages();
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
$scope.init = function() {
$scope.availableLanguages = uxLanguage.getLanguages();
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
}
$scope.save = function(newLang) {
var opts = {

View file

@ -1,25 +1,28 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesLogs',
function(historicLog) {
this.logs = historicLog.get();
function($scope, historicLog) {
this.sendLogs = function() {
var body = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n';
body += '\n\n';
body += this.logs.map(function(v) {
return v.msg;
}).join('\n');
$scope.init = function() {
$scope.logs = historicLog.get();
}
window.plugins.socialsharing.shareViaEmail(
body,
'Copay Logs',
null, // TO: must be null or an array
null, // CC: must be null or an array
null, // BCC: must be null or an array
null, // FILES: can be null, a string, or an array
function() {},
function() {}
);
};
});
$scope.sendLogs = function() {
var body = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n';
body += '\n\n';
body += $scope.logs.map(function(v) {
return v.msg;
}).join('\n');
window.plugins.socialsharing.shareViaEmail(
body,
'Copay Logs',
null, // TO: must be null or an array
null, // CC: must be null or an array
null, // BCC: must be null or an array
null, // FILES: can be null, a string, or an array
function() {},
function() {}
);
};
});

View file

@ -2,9 +2,10 @@
angular.module('copayApp.controllers').controller('preferencesUnitController', function($scope, $log, configService, go, walletService, profileService) {
var config = configService.getSync();
$scope.currentUnit = config.wallet.settings.unitCode;
$scope.init = function() {
var config = configService.getSync();
$scope.currentUnit = config.wallet.settings.unitCode;
}
$scope.unitList = [
{

View file

@ -0,0 +1,109 @@
'use strict';
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
$scope.init = function() {
var config = configService.getSync();
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
var isIOS = platformInfo.isIOS;
$scope.unitName = config.wallet.settings.unitName;
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
$scope.selectedAlternative = {
name: config.wallet.settings.alternativeName,
isoCode: config.wallet.settings.alternativeIsoCode
};
$scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
$scope.usePushNotifications = isCordova && !isWP;
$scope.PNEnabledByUser = true;
$scope.isIOSApp = isIOS && isCordova;
if ($scope.isIOSApp) {
cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) {
$scope.PNEnabledByUser = isEnabled;
$scope.$digest();
});
}
$scope.spendUnconfirmed = config.wallet.spendUnconfirmed;
$scope.glideraEnabled = config.glidera.enabled;
$scope.coinbaseEnabled = config.coinbase.enabled;
$scope.pushNotifications = config.pushNotifications.enabled;
if (isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
$scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) {
return w.id != self.walletId;
});
};
$scope.openAddressbookModal = function() {
$ionicModal.fromTemplateUrl('views/modals/addressbook.html', {
scope: $scope
}).then(function(modal) {
$scope.addressbookModal = modal;
$scope.addressbookModal.show();
});
};
$scope.openSettings = function() {
cordova.plugins.diagnostic.switchToSettings(function() {
$log.debug('switched to settings');
}, function(err) {
$log.debug(err);
});
}
$scope.spendUnconfirmedChange = function() {
var opts = {
wallet: {
spendUnconfirmed: $scope.spendUnconfirmed
}
};
configService.set(opts, function(err) {
$rootScope.$emit('Local/SpendUnconfirmedUpdated', $scope.spendUnconfirmed);
if (err) $log.debug(err);
});
};
$scope.pushNotificationsChange = function() {
var opts = {
pushNotifications: {
enabled: $scope.pushNotifications
}
};
configService.set(opts, function(err) {
if (opts.pushNotifications.enabled)
pushNotificationsService.enableNotifications(profileService.walletClients);
else
pushNotificationsService.disableNotifications(profileService.walletClients);
if (err) $log.debug(err);
});
};
$scope.glideraChange = function() {
var opts = {
glidera: {
enabled: $scope.glideraEnabled
}
};
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);
});
};
});

View file

@ -160,11 +160,16 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
},
}
})
.state('unsupported', {
.state('feedback', {
url: '/feedback',
needProfile: true,
views: {
'main': {
templateUrl: 'views/feedback.html',
},
}
})
.state('unsupported', {
url: '/unsupported',
needProfile: false,
views: {

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('feeService', function($log, bwcService, profileService, configService, gettext, lodash) {
angular.module('copayApp.services').factory('feeService', function($log, bwcService, walletService, configService, gettext, lodash) {
var root = {};
// Constant fee options to translate
@ -16,7 +16,7 @@ angular.module('copayApp.services').factory('feeService', function($log, bwcServ
};
root.getCurrentFeeValue = function(cb) {
var fc = profileService.focusedClient;
var fc = walletService.focusedClient;
var feeLevel = root.getCurrentFeeLevel();
fc.getFeeLevels(fc.credentials.network, function(err, levels) {
@ -49,8 +49,8 @@ angular.module('copayApp.services').factory('feeService', function($log, bwcServ
if (errLivenet || errTestnet) $log.debug('Could not get dynamic fee');
else {
for (var i = 0; i < 4; i++) {
levelsLivenet[i]['feePerKBUnit'] = profileService.formatAmount(levelsLivenet[i].feePerKB) + ' ' + unitName;
levelsTestnet[i]['feePerKBUnit'] = profileService.formatAmount(levelsTestnet[i].feePerKB) + ' ' + unitName;
levelsLivenet[i]['feePerKBUnit'] = walletService.formatAmount(levelsLivenet[i].feePerKB) + ' ' + unitName;
levelsTestnet[i]['feePerKBUnit'] = walletService.formatAmount(levelsTestnet[i].feePerKB) + ' ' + unitName;
}
}

View file

@ -56,7 +56,7 @@ angular.module('copayApp.services').factory('go', function($window, $ionicSideMe
};
root.preferencesGlobal = function() {
$state.transitionTo('preferencesGlobal');
$state.transitionTo('tabs.settings');
};
root.reload = function() {