fix(devUtils): make dev utils toggle more reliable

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

View file

@ -1,6 +1,6 @@
'use strict'; '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() { var updateConfig = function() {
@ -27,14 +27,19 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
$scope.frequentlyUsedEnabled = { $scope.frequentlyUsedEnabled = {
value: config.frequentlyUsed.enabled value: config.frequentlyUsed.enabled
}; };
$scope.developmentUtilitiesEnabled = {
value: false
};
}; };
$scope.global = $rootScope;
if(!$scope.global.developmentUtilitiesEnabled){
$scope.global.developmentUtilitiesEnabled = {
value: false
};
}
$scope.toggledDevelopmentUtils = function (){ $scope.toggledDevelopmentUtils = function (){
if($scope.developmentUtilitiesEnabled.value){ if($scope.global.developmentUtilitiesEnabled.value){
$log.debug('User enabled development utilities.'); $log.debug('User enabled development utilities.');
$ionicScrollDelegate.resize();
} else { } else {
$log.debug('User disabled development utilities.'); $log.debug('User disabled development utilities.');
} }
@ -54,6 +59,9 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
$timeout(function(){ $timeout(function(){
$scope.feedbackCardActivating = false; $scope.feedbackCardActivating = false;
$scope.feedbackCardActivated = true; $scope.feedbackCardActivated = true;
$timeout(function(){
$scope.feedbackCardActivated = false;
}, 10000);
}, 500); }, 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. If enabled, the Recent Transactions card - a list of transactions occuring across all wallets - will appear in the Home tab.
</div> </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> <span class="toggle-label" translate>Development Utilities</span>
</ion-toggle> </ion-toggle>
<div class="comment" translate> <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> <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> -->
<div ng-show="developmentUtilitiesEnabled.value"> <div ng-show="global.developmentUtilitiesEnabled.value">
<div class="item item-divider" translate>Development Utilities</div> <div class="item item-divider" translate>Development Utilities</div>
<div class="settings-explanation"> <div class="settings-explanation">
<div class="settings-description" translate> <div class="settings-description" translate>
@ -77,13 +77,13 @@
<div class="item has-comment item-button-right"> <div class="item has-comment item-button-right">
Feedback Card 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 Activate
</button> </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> <ion-spinner></ion-spinner>
</button> </button>
<button class="button" ng-show="feedbackCardActivated" ng-click="resetActivateFeedbackCard()"> <button class="button button-secondary button-clear" ng-show="feedbackCardActivated" ng-click="resetActivateFeedbackCard()">
Activated Activated
</button> </button>
</div> </div>