wip add modal config

This commit is contained in:
JDonadio 2017-02-28 10:32:10 -03:00
commit 82e556b026
7 changed files with 57 additions and 8 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) {
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) {
var updateConfig = function() {
var config = configService.getSync();
@ -11,10 +11,12 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
$scope.recentTransactionsEnabled = {
value: config.recentTransactions.enabled
};
$scope.hideNextSteps = {
value: config.hideNextSteps.enabled
};
$scope.usePincode = {
value: config.pincode ? config.pincode.enabled : false
};
};
$scope.spendUnconfirmedChange = function() {
@ -31,7 +33,24 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
$scope.nextStepsChange = function() {
var opts = {
hideNextSteps: {
enabled: $scope.hideNextSteps.value
enabled: $scope.hideNextSteps.value
},
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
};
$scope.savePincodeChanges = function(val) {
if (!val || val.length < 4) {
$scope.usePincode = {
value: false
}
return;
}
var opts = {
usePincode: {
enabled: $scope.usePincode.enabled
},
};
configService.set(opts, function(err) {
@ -50,6 +69,18 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
});
};
$scope.showPincodeModal = function() {
$scope.fromSettings = true;
$ionicModal.fromTemplateUrl('views/modals/pincode.html', {
scope: $scope,
backdropClickToClose: false,
hardwareBackButtonClose: false
}).then(function(modal) {
$scope.pincodeModal = modal;
$scope.pincodeModal.show();
});
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
updateConfig();
});

View file

@ -41,10 +41,16 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
};
function checkPasscode() {
console.log('Checking');
configService.whenAvailable(function(config) {
var value = '1234';
if (value != $scope.pincode) return;
console.log('MATCH');
});
};
$scope.cancel = function() {
$scope.savePincodeChanges(false);
$scope.pincodeModal.hide();
};
});

View file

@ -25,7 +25,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.pincodeModal.show();
});
};
openPincodeModal();
// openPincodeModal();
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
});