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

View file

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