fix(devUtils): make dev utils toggle more reliable

This commit is contained in:
Jason Dreyzehner 2016-11-17 17:53:21 -05:00
parent 147c7faa8f
commit 57919f63a7
2 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $timeout) {
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) {
var updateConfig = function() {
@ -27,14 +27,19 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
$scope.frequentlyUsedEnabled = {
value: config.frequentlyUsed.enabled
};
$scope.developmentUtilitiesEnabled = {
value: false
};
};
$scope.global = $rootScope;
if(!$scope.global.developmentUtilitiesEnabled){
$scope.global.developmentUtilitiesEnabled = {
value: false
};
}
$scope.toggledDevelopmentUtils = function (){
if($scope.developmentUtilitiesEnabled.value){
if($scope.global.developmentUtilitiesEnabled.value){
$log.debug('User enabled development utilities.');
$ionicScrollDelegate.resize();
} else {
$log.debug('User disabled development utilities.');
}
@ -54,6 +59,9 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
$timeout(function(){
$scope.feedbackCardActivating = false;
$scope.feedbackCardActivated = true;
$timeout(function(){
$scope.feedbackCardActivated = false;
}, 10000);
}, 500);
});
});

View File

@ -51,7 +51,7 @@
If enabled, the Recent Transactions card - a list of transactions occuring across all wallets - will appear in the Home tab.
</div>
<ion-toggle class="has-comment" ng-model="developmentUtilitiesEnabled.value" toggle-class="toggle-balanced" ng-change="toggledDevelopmentUtils()">
<ion-toggle class="has-comment" ng-model="global.developmentUtilitiesEnabled.value" toggle-class="toggle-balanced" ng-change="toggledDevelopmentUtils()">
<span class="toggle-label" translate>Development Utilities</span>
</ion-toggle>
<div class="comment" translate>
@ -67,7 +67,7 @@
<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 ng-show="developmentUtilitiesEnabled.value">
<div ng-show="global.developmentUtilitiesEnabled.value">
<div class="item item-divider" translate>Development Utilities</div>
<div class="settings-explanation">
<div class="settings-description" translate>
@ -77,13 +77,13 @@
<div class="item has-comment item-button-right">
Feedback Card
<button class="button" ng-click="activateFeedbackCard()" ng-show="!feedbackCardActivating && !feedbackCardActivated">
<button class="button button-secondary" ng-click="activateFeedbackCard()" ng-show="!feedbackCardActivating && !feedbackCardActivated">
Activate
</button>
<button class="button button-clear" disabled ng-show="feedbackCardActivating">
<button class="button button-secondary button-clear" disabled ng-show="feedbackCardActivating">
<ion-spinner></ion-spinner>
</button>
<button class="button" ng-show="feedbackCardActivated" ng-click="resetActivateFeedbackCard()">
<button class="button button-secondary button-clear" ng-show="feedbackCardActivated" ng-click="resetActivateFeedbackCard()">
Activated
</button>
</div>