use scope only - preferences global

This commit is contained in:
Javier 2016-06-13 14:49:43 -03:00
commit fb56ad7505
2 changed files with 17 additions and 16 deletions

View file

@ -3,12 +3,12 @@
ng-init="titleSection='Global preferences'; closeToHome = true; noColor = true">
</div>
<div class="content preferences" ng-controller="preferencesGlobalController as prefGlobal" ng-init="prefGlobal.init()">
<div class="content preferences" ng-controller="preferencesGlobalController" ng-init="init()">
<h4></h4>
<ul class="no-bullet m0">
<li href ui-sref="preferencesLanguage">
<div class="right text-gray">
{{prefGlobal.currentLanguageName|translate}}
{{currentLanguageName|translate}}
<i class="icon-arrow-right3 size-24"></i>
</div>
<div translate>Language</div>
@ -19,7 +19,7 @@
<ul class="no-bullet m0">
<li href ui-sref="preferencesUnit">
<div class="right text-gray">
{{prefGlobal.unitName}}
{{unitName}}
<i class="icon-arrow-right3 size-24"></i>
</div>
<div translate>Unit</div>
@ -27,7 +27,7 @@
<li href ui-sref="preferencesAltCurrency">
<div class="right text-gray">
{{prefGlobal.selectedAlternative.name}}
{{selectedAlternative.name}}
<i class="icon-arrow-right3 size-24"></i>
</div>
<div translate>Alternative Currency</div>
@ -38,7 +38,7 @@
<ul class="no-bullet m0">
<li href ui-sref="preferencesFee">
<div class="right text-gray">
{{prefGlobal.feeOpts[prefGlobal.currentFeeLevel]|translate}}
{{feeOpts[currentFeeLevel]|translate}}
<i class="icon-arrow-right3 size-24"></i>
</div>
<div translate>Bitcoin Network Fee Policy</div>
@ -49,7 +49,7 @@
<span class="toggle-label" translate>Use Unconfirmed Funds</span>
</ion-toggle>
<div ng-show="prefGlobal.usePushNotifications && PNEnabledByUser">
<div ng-show="usePushNotifications && PNEnabledByUser">
<h4></h4>
<ion-toggle ng-model="pushNotifications" toggle-class="toggle-balanced" ng-change="pushNotificationsChange()">
<span class="toggle-label" translate>Enable push notifications</span>
@ -74,9 +74,9 @@
</li>
</ul>
<div ng-show="prefGlobal.usePushNotifications && !PNEnabledByUser && isIOSApp">
<div ng-show="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>
<ul class="no-bullet m0" ng-click="prefGlobal.openSettings()">
<ul class="no-bullet m0" ng-click="openSettings()">
<li ng-style="{'color':index.backgroundColor}" translate>Open Settings app</li>
</ul>
</div>

View file

@ -4,17 +4,18 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
function($scope, $rootScope, $log, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
var isCordova = platformInfo.isCordova;
this.init = function() {
$scope.init = function() {
var config = configService.getSync();
this.unitName = config.wallet.settings.unitName;
this.currentLanguageName = uxLanguage.getCurrentLanguageName();
this.selectedAlternative = {
$scope.unitName = config.wallet.settings.unitName;
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
$scope.selectedAlternative = {
name: config.wallet.settings.alternativeName,
isoCode: config.wallet.settings.alternativeIsoCode
};
this.feeOpts = feeService.feeOpts;
this.currentFeeLevel = feeService.getCurrentFeeLevel();
this.usePushNotifications = isCordova && !platformInfo.isWP;
$scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
$scope.usePushNotifications = isCordova && !platformInfo.isWP;
$scope.PNEnabledByUser = true;
$scope.isIOSApp = platformInfo.isIOS && isCordova;
if ($scope.isIOSApp) {
@ -28,7 +29,7 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
$scope.pushNotifications = config.pushNotifications.enabled;
};
this.openSettings = function() {
$scope.openSettings = function() {
cordova.plugins.diagnostic.switchToSettings(function() {
$log.debug('switched to settings');
}, function(err) {